svitak/app/State.hs
2026-07-05 01:45:47 +01:00

25 lines
710 B
Haskell

{-# LANGUAGE OverloadedStrings #-}
-- | The mutable application state's initial value. Navigation logic lives in
-- the UI, which renders chapters lazily into 'stCache'.
module State (initialState) where
import qualified Data.Map.Strict as M
import qualified Data.Text as T
import Types (AppState (..), ChapterIndex (..))
-- | Empty state shown while the book's structure loads in the background.
initialState :: T.Text -> FilePath -> AppState
initialState title path =
AppState
{ stRefs = [],
stToc = [],
stCache = M.empty,
stIndex = ChapterIndex 0,
stZoom = 1.0,
stTitle = title,
stBookPath = path,
stGen = 0,
stUse = M.empty,
stTick = 0,
}