-
Notifications
You must be signed in to change notification settings - Fork 0
Home
see Firebase Console
The admin edits data. A service updates the database according to the edits. The visitors download the latest data from the database. We have some design considerations to inform the implementation:
- What if the admin uses two tabs or two devices simultaneously?
- (a) The latest save overrides everything
- (b) Edits are accumulated from all sources in the order they arrive at the database
- (c) Offline-first: Edits are intelligently merged when the admin goes online; otherwise local storage has a working draft.
- Does Elm need to inspect the edits?
- (1) If no, we just render a
sync-hypertextelement that handles database synchronisation at its leaf. - (2) If yes, we are collecting edits in the global
updateloop and push them via a singletonappend-logelement.
- (1) If no, we just render a
Preset articles are not synced. Custom articles are stored in plain Html, indexed by unique id. Every edit is immediately synced. The last overwrite 'wins' (a).
Segment.view =
...
Html.node "sync-hypertext"
See sync-hypertext in append-log.js
type alias Article =
{ id : String
, caption : { text : String, showsDate : Bool }
, info : Maybe InfoChoice
, body : BodyChoice
, shape : Shape
, fab : Maybe Fab
, additionalClasses : List String
}This record can be edited with controls. Each individual edit generates an Action:
type Article.Action
= WithCaption { text : String, showsDate : Bool }
| WithInfo (Maybe InfoChoice)
| WithBody BodyChoice
| WithShape Shape
| WithFab (Maybe Fab)
| WithClasses (List String)These Actions are encoded and stored in a history list. With Undo and Redo, you can reorder it.
The History is accumulated at the level of the Accordion.elm and interwoven with its Actions:
type Accordion.Action
= Name String
| Modify Article.Action
| Go Direction
| Insert Direction
| Delete
| Reset String
| Undo IntentIdOn loading the page, all actions are replayed to recreate the initial state before rendering the Accordion.
Articles and the Accordion are orthogonal to each other. One can imagine to load a different set of Articles or a different data-type than the Accordion loading Articles. They are connected by unique ids.
Perhaps a functionality rename would be useful: renaming an article hypertext HTML.
Need Workflow design.