All files / app view.ts

100% Statements 3/3
100% Branches 6/6
100% Functions 2/2
100% Lines 2/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44                  128x                                                 2x                  
import type { Document, HtmlBuilder } from 'foldkit/html'
 
import * as CoordkitMap from '../map'
import * as Settings from '../submodels/settings'
import * as Readout from '../views/readout'
import * as Toolbar from '../views/toolbar'
import { Message } from './message'
import type { Model } from './model'
 
export const view = (model: Model, h: HtmlBuilder<Message>): Document => ({
  title: 'CoordKit',
  body: h.div(
    [h.Class('flex h-dvh w-screen flex-col bg-surface text-ink')],
    [
      Toolbar.view(model, h),
      h.div(
        [h.Class('flex min-h-0 flex-1')],
        [
          h.main(
            [h.Class('relative min-h-0 min-w-0 flex-1 overflow-hidden')],
            [
              CoordkitMap.view(model, h),
              CoordkitMap.errorView(model, h),
              model.layout === 'Compact'
                ? Readout.sheetView(model, h)
                : h.empty,
            ],
          ),
          model.layout === 'Wide'
            ? h.submodel({
                slotId: 'settings-panel',
                model: model.settings,
                view: Settings.sidePanelView,
                toParentMessage: message =>
                  Message.GotSettingsMessage({ message }),
              })
            : h.empty,
        ],
      ),
      model.layout === 'Wide' ? Readout.tableView(model, h) : h.empty,
    ],
  ),
})