{-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} module Main where import Control.Monad.Logger (runStderrLoggingT) import Control.Monad.Trans.Resource (runResourceT) import Data.ByteString.Lazy as BS import Data.List as List import Database.Persist.Postgresql (ConnectionPool, ConnectionString, SqlBackend, runMigration, runSqlPool, withPostgresqlPool) import Debug.Trace (traceShow) import Store (fetch, migrateAll, save) import Track (parseBS) import Yesod.Core import Yesod.Form.Fields import Yesod.Form.Functions import Yesod.Form.Types import Yesod.Persist -- https://github.com/yesodweb/yesod-cookbook/blob/master/cookbook/Static-file-subsite-Hello-World.md import Yesod.Static staticFiles "frontend" -- this param appears to be a pathname data Souplesse = Souplesse ConnectionPool Static -- ref https://www.yesodweb.com/book/routing-and-handlers -- for adding params (start/end) to the timeline route mkYesod "Souplesse" [parseRoutes| / CalendarR GET /timeline TimelineR GET /upload UploadR POST /static StaticR Static getStatic /points PointsR GET |] getStatic :: Souplesse -> Static getStatic y = let Souplesse _ s = y in s instance Yesod Souplesse instance YesodPersist Souplesse where type YesodPersistBackend Souplesse = SqlBackend runDB action = do Souplesse pool _ <- getYesod runSqlPool action pool getCalendarR :: Handler Html getCalendarR = do (formWidget, _) <- generateFormPost uploadForm defaultLayout [whamlet|
A calendar view goes here