Skip to content

Commit

Permalink
Use fake data for the display in the editor
Browse files Browse the repository at this point in the history
  • Loading branch information
ryelle committed Oct 11, 2019
1 parent ac2fbdc commit 3ec58c6
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/**
* WordPress dependencies
*/
import { _x } from '@wordpress/i18n';

const makeTrack = ( name ) => ( {
slug: name.toLowerCase(),
name: name,
} );

const makeSession = ( name, time ) => ( {
terms: {},
link: '#',
title: { rendered: name },
meta: {
_wcpt_session_type: 'session',
},
session_date_time: { time },
_embedded: {
speakers: [
{
id: 1,
title: { rendered: _x( 'Speaker Name', 'A fake speaker name', 'wordcamporg' ) },
link: '#',
}, {
id: 2,
title: { rendered: _x( 'Speaker Name', 'A fake speaker name', 'wordcamporg' ) },
link: '#',
},
],
},
} );

export default [
{
track: makeTrack( _x( 'Location', 'A fake track name', 'wordcamporg' ) ),
now: makeSession( _x( 'Session Title', 'A fake session name', 'wordcamporg' ), '10:00 AM' ),
next: makeSession( _x( 'Session Title', 'A fake session name', 'wordcamporg' ), '11:00 AM' ),
},
{
track: makeTrack( _x( 'Location', 'A fake track name', 'wordcamporg' ) ),
now: makeSession( _x( 'Workshop Title', 'A fake session name', 'wordcamporg' ), '10:00 AM' ),
next: makeSession( _x( 'Session Title', 'A fake session name', 'wordcamporg' ), '1:00 PM' ),
},
{
track: makeTrack( _x( 'Location', 'A fake track name', 'wordcamporg' ) ),
now: makeSession( _x( 'Flash Talk Title', 'A fake session name', 'wordcamporg' ), '10:15 AM' ),
next: makeSession( _x( 'Flash Talk Title', 'A fake session name', 'wordcamporg' ), '10:30 AM' ),
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
import { __ } from '@wordpress/i18n';
import { Fragment } from '@wordpress/element';
import { InspectorControls } from '@wordpress/block-editor';
import { PanelBody, Placeholder, TextControl } from '@wordpress/components';
import { PanelBody, TextControl } from '@wordpress/components';

/**
* Internal dependencies
*/
import './style.scss';
import { HeadingToolbar } from '../../components';
import LiveSchedule from './components/schedule';
import mockSessions from './data/mock';

const title = __( 'Live Schedule', 'wordcamporg' );
const icon = 'excerpt-view';
Expand Down Expand Up @@ -41,7 +43,12 @@ export const SETTINGS = {
},
edit: ( { attributes, setAttributes } ) => (
<Fragment>
<Placeholder icon={ icon } label={ title } />
<LiveSchedule
config={ window.WordCampBlocks[ 'live-schedule' ] }
sessions={ mockSessions }
isFetching={ false }
attributes={ attributes }
/>
<InspectorControls>
<PanelBody title={ __( 'Headings', 'wordcamporg' ) }>
<TextControl
Expand Down

0 comments on commit 3ec58c6

Please sign in to comment.