Skip to content

Commit

Permalink
chore: tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian committed Jan 25, 2024
1 parent 2207ddc commit 39f2207
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,9 @@ export class PartTransformer {

private readonly corePartPieces = observable.map<Core.PartId, Core.Piece[]>()

private readonly editedScripts = observable.map<Core.PartId, ScriptContents>()

constructor(private transformers: Transformers) {
makeObservable(this, {
partIds: computed,
updateEditedScript: action,
updateCorePart: action,
updateCorePiece: action,
updateCoreShowStyleBase: action,
Expand Down Expand Up @@ -162,8 +159,6 @@ export class PartTransformer {
}
}

const editedScript = this.editedScripts.get(this.convertId(partId))

return literal<Part>({
_id: partId,
playlistId,
Expand All @@ -185,18 +180,10 @@ export class PartTransformer {
label: derived.displayLabel,
},
scriptContents: derived.scriptContents,
editedScriptContents: editedScript,
editedScriptContents: undefined,
})
})

updateEditedScript(partId: Core.PartId, editedScript: ScriptContents | undefined) {
if (editedScript !== undefined) {
this.editedScripts.set(partId, editedScript)
} else {
this.editedScripts.delete(partId)
}
}

updateCorePart(partId: Core.PartId, part: Core.DBPart | undefined) {
if (part) {
if (!isEqual(this.coreParts.get(partId), part)) {
Expand Down
10 changes: 5 additions & 5 deletions packages/apps/client/src/components/ScriptEditor/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,13 @@ function makeNewEditorState(doc: Node): EditorState {
updateModel((lineId, lineNodes) => {
console.log(lineId, lineNodes)

const compiledMarkdown = toMarkdown(lineNodes)
console.log('markdown', compiledMarkdown)

// Future: debounce? locking? require manual triggering of the save?
const openRundown = RootAppStore.rundownStore.openRundown
if (openRundown) {
const compiledMarkdown = toMarkdown(lineNodes)

// TODO - debounce? require manual execution?
if (openRundown) openRundown.updatePartScript(lineId, compiledMarkdown)
openRundown.updatePartScript(lineId, compiledMarkdown)
}
}),
],
doc,
Expand Down
2 changes: 0 additions & 2 deletions packages/apps/client/src/model/UIRundown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,5 @@ export class UIRundown {
partId,
script,
})

// TODO - should this have any side effects?
}
}

0 comments on commit 39f2207

Please sign in to comment.