Portfolio/app/Types.hs
tombdf cdaf2c4157
feat!: convert portfolio to Haskell web application
* Migrate from static HTML/JS to Haskell/Scotty web application
* Add server-side routing and API endpoints
* Implement language switching and command processing
* Set up project structure with stack
* Move static assets to dedicated directory
* Add type definitions and template rendering
2025-02-25 22:02:55 +01:00

28 lines
698 B
Haskell

{-# LANGUAGE OverloadedStrings #-}
module Types where
import Data.Text.Lazy (Text)
import Data.Map.Strict (Map)
import qualified Data.Map.Strict as Map
import Data.Aeson (ToJSON(..), object, (.=))
data Language = French | English
deriving (Show, Eq)
type TranslationKey = Text
type TranslationValue = Text
type Translation = Map TranslationKey TranslationValue
data CommandResponse = CommandResponse
{ responseText :: Text
, responseHtml :: Bool
} deriving (Show)
-- Instance ToJSON pour permettre la sérialisation JSON
instance ToJSON CommandResponse where
toJSON (CommandResponse text html) =
object [ "responseText" .= text
, "responseHtml" .= html
]