-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Johan Nyman <[email protected]>
- Loading branch information
Showing
16 changed files
with
615 additions
and
51 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
packages/apps/client/src/CurrentRundown/CurrentRundown.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React from 'react' | ||
import { observer } from 'mobx-react-lite' | ||
import { AppStore } from '../stores/AppStore' | ||
import { Segment } from './Segment' | ||
|
||
const CurrentRundown = observer((): React.JSX.Element => { | ||
const openRundown = AppStore.rundownStore.openRundown | ||
|
||
if (!openRundown) { | ||
return <p>No open rundown</p> | ||
} | ||
|
||
function onClose() { | ||
openRundown?.close() | ||
} | ||
|
||
return ( | ||
<> | ||
<h1>{openRundown.name}</h1> | ||
<p> | ||
<button onClick={onClose}>Close</button> | ||
</p> | ||
<ul> | ||
{openRundown.segmentsInOrder.map((segment) => ( | ||
<li key={segment.id}> | ||
<Segment segment={segment} /> | ||
</li> | ||
))} | ||
</ul> | ||
</> | ||
) | ||
}) | ||
CurrentRundown.displayName = 'CurrentRundown' | ||
|
||
export { CurrentRundown } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import React from 'react' | ||
import { observer } from 'mobx-react-lite' | ||
import { UILine } from '../model/UILine' | ||
|
||
const Line = observer(({ line }: { line: UILine | undefined }): React.JSX.Element | null => { | ||
if (!line) return null | ||
return <p>{line.slug}</p> | ||
}) | ||
Line.displayName = 'Line' | ||
|
||
export { Line } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React from 'react' | ||
import { observer } from 'mobx-react-lite' | ||
import { UISegment } from '../model/UISegment' | ||
import { Line } from './Line' | ||
|
||
const Segment = observer(({ segment }: { segment: UISegment | undefined }): React.JSX.Element | null => { | ||
if (!segment) return null | ||
|
||
return ( | ||
<> | ||
<p>{segment.name}</p> | ||
<ul> | ||
{segment.linesInOrder.map((line) => ( | ||
<li key={line.id}> | ||
<Line line={line} /> | ||
</li> | ||
))} | ||
</ul> | ||
</> | ||
) | ||
}) | ||
Segment.displayName = 'Segment' | ||
|
||
export { Segment } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React from 'react' | ||
import { observer } from 'mobx-react-lite' | ||
import { AppStore } from '../stores/AppStore' | ||
import { UIRundownId } from '../model/UIRundown' | ||
|
||
const RundownEntry = observer(({ rundownId }: { rundownId: UIRundownId }): React.JSX.Element => { | ||
const rundownEntry = AppStore.rundownStore.allRundowns.get(rundownId) | ||
|
||
function onOpen() { | ||
if (!rundownEntry) return | ||
AppStore.rundownStore.loadRundown(rundownEntry.playlistId) | ||
} | ||
|
||
return ( | ||
<p> | ||
{rundownEntry?.name} <button onClick={onOpen}>Open</button> | ||
</p> | ||
) | ||
}) | ||
RundownEntry.displayName = 'RundownEntry' | ||
|
||
export { RundownEntry } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React from 'react' | ||
import { keys } from 'mobx' | ||
import { observer } from 'mobx-react-lite' | ||
import { AppStore } from '../stores/AppStore' | ||
import { UIRundownId } from '../model/UIRundown' | ||
import { RundownEntry } from './RundownEntry' | ||
|
||
const RundownList = observer((): React.JSX.Element => { | ||
const allRundownIds = keys<UIRundownId>(AppStore.rundownStore.allRundowns) | ||
|
||
return ( | ||
<> | ||
<ul> | ||
{allRundownIds.map((rundownId) => ( | ||
<li key={rundownId}> | ||
<RundownEntry rundownId={rundownId} /> | ||
</li> | ||
))} | ||
</ul> | ||
</> | ||
) | ||
}) | ||
RundownList.displayName = 'RundownList' | ||
|
||
export { RundownList } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import uuid from 'uuid'; | ||
import { v4 } from 'uuid' | ||
|
||
export function randomId() { | ||
return uuid.v4() | ||
return v4() | ||
} |
Oops, something went wrong.