| 8 | import { Atom, atom, PrimitiveAtom } from "jotai"; |
| 9 | |
| 10 | class QuickTipsViewModel implements ViewModel { |
| 11 | viewType: string; |
| 12 | blockId: string; |
| 13 | nodeModel: BlockNodeModel; |
| 14 | tabModel: TabModel; |
| 15 | showTocAtom: PrimitiveAtom<boolean>; |
| 16 | endIconButtons: Atom<IconButtonDecl[]>; |
| 17 | |
| 18 | constructor({ blockId, nodeModel, tabModel }: ViewModelInitType) { |
| 19 | this.blockId = blockId; |
| 20 | this.nodeModel = nodeModel; |
| 21 | this.tabModel = tabModel; |
| 22 | this.viewType = "tips"; |
| 23 | this.showTocAtom = atom(false); |
| 24 | } |
| 25 | |
| 26 | get viewComponent(): ViewComponent { |
| 27 | return QuickTipsView; |
| 28 | } |
| 29 | |
| 30 | showTocToggle() { |
| 31 | globalStore.set(this.showTocAtom, !globalStore.get(this.showTocAtom)); |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | function QuickTipsView({ model }: { model: QuickTipsViewModel }) { |
| 36 | return ( |
nothing calls this directly
no outgoing calls
no test coverage detected