* 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
41 lines
1.3 KiB
Haskell
41 lines
1.3 KiB
Haskell
{-# LANGUAGE OverloadedStrings #-}
|
|
|
|
module Templates where
|
|
|
|
import Data.Text.Lazy (Text)
|
|
import qualified Data.Text.Lazy as TL
|
|
import Types
|
|
|
|
renderIndex :: Language -> Text
|
|
renderIndex lang = TL.concat
|
|
[ "<!DOCTYPE html>\n"
|
|
, "<html lang=\"", languageCode lang, "\">\n"
|
|
, " <head>\n"
|
|
, " <meta charset=\"UTF-8\">\n"
|
|
, " <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n"
|
|
, " <meta name=\"robots\" content=\"noindex, nofollow\">\n"
|
|
, " <title>Portfolio</title>\n"
|
|
, " <link rel=\"stylesheet\" href=\"/css/style.css\">\n"
|
|
, " </head>\n"
|
|
, " <body>\n"
|
|
, " <div id=\"terminal\">\n"
|
|
, " <div id=\"welcome-text\"></div>\n"
|
|
, " <div id=\"input-line\" style=\"display: none;\">\n"
|
|
, " <span id=\"prompt\">$</span>\n"
|
|
, " <input type=\"text\" id=\"user-input\" autofocus>\n"
|
|
, " </div>\n"
|
|
, " </div>\n"
|
|
, " <script src=\"/js/terminal.js\"></script>\n"
|
|
, " <script>\n"
|
|
, " window.onload = function() {\n"
|
|
, " initTerminal('", languageCode lang, "');\n"
|
|
, " }\n"
|
|
, " </script>\n"
|
|
, " </body>\n"
|
|
, "</html>"
|
|
]
|
|
|
|
languageCode :: Language -> Text
|
|
languageCode French = "fr"
|
|
languageCode English = "en"
|