Clean up, working links

This commit is contained in:
Daniel Kauss Serna 2026-02-04 23:56:21 +01:00
parent e382150986
commit 6ee5998e82
3 changed files with 39 additions and 39 deletions

View file

@ -36,7 +36,7 @@ import Options.Applicative
)
import Render
import Text.Printf (printf)
import Translation (Lang (EN, ES))
import Translation (Lang (EN, ES), getLangAsString)
import Web.Scotty
import Web.Scotty.Cookie (defaultSetCookie, getCookie, setCookie, setCookieExpires, setCookieName, setCookieValue)
@ -62,7 +62,6 @@ data Config = Config
configPort :: Int
}
-- Build the parser
configParser :: Parser Config
configParser =
Config
@ -115,6 +114,11 @@ main = do
liftIO $ print errors
html $ renderText $ renderFrontpage lang validEvents
get "/wiki" $ do
langHeader <- header "Accept-Language"
let lang = getLanguageHeader langHeader
langString = getLangAsString lang
redirect $ TL.pack $ printf "/%s/" langString
get "/monthView/" $ do
timeNow <- liftIO $ getCurrentTime
tmz <- liftIO $ getCurrentTimeZone

View file

@ -37,7 +37,7 @@ renderHeader lang active =
li_ $ a_ [href_ "/", getActive 0] (toHtml $ tr lang NavChip)
li_ $ a_ [href_ "/monthView", getActive 1] (toHtml $ tr lang NavEvents)
li_ $ a_ [href_ "/wiki", getActive 2] (toHtml $ tr lang NavWiki)
li_ $ a_ [href_ "/wiki/contact", getActive 3] (toHtml $ tr lang NavContact)
li_ $ a_ [href_ $ tr lang NavContactLink, getActive 3] (toHtml $ tr lang NavContact)
where
getActive cur = if cur == active then class_ "active" else class_ "inactive"
renderImage :: T.Text -> T.Text -> T.Text -> Html ()
@ -80,6 +80,9 @@ renderEventList lang events = mapM_ (renderDayGroup lang) (groupEvents events)
trh :: Lang -> Msg -> Html ()
trh lang m = toHtml $ tr lang m
trhr :: Lang -> Msg -> Html ()
trhr lang m = toHtmlRaw $ tr lang m
renderFrontpage :: Lang -> [Event] -> Html ()
renderFrontpage lang events = do
renderHead lang
@ -93,18 +96,10 @@ renderFrontpage lang events = do
p_ [class_ "lead"] $
trh lang Lead
p_ $ do
trh lang HomeGreeting
br_ []
trh lang HomeP1
br_ []
trh lang HomeP2
br_ []
trh lang HomePContact
a_ [href_ "/contact"] $ trh lang HomeContactHere
"!"
trhr lang HomeIntroText
section_ [class_ "image-gallery"] $ do
renderImage "example.com" "Imagen sobre algo" "Imagen interesante"
-- section_ [class_ "image-gallery"] $ do
-- renderImage "example.com" "Imagen sobre algo" "Imagen interesante"
aside_ [class_ "sidebar"] $ do
section_ [class_ "events-panel"] $ do
@ -176,12 +171,12 @@ renderMonthview lang (year, month) today groupedEvents = do
renderHeader lang 1
div_ [class_ "calendar-wrapper"] $ do
header_ [class_ "calendar-header"] $ do
h1_ [class_ "view-title"] "Vista mensual"
h1_ [class_ "view-title"] $ trh lang NavMonthView
nav_ [class_ "calendar-nav"] $ do
mkLink py pm "« Mes pasado"
mkLink cy cm "Este mes"
mkLink ny nm "Mes siguiente »"
mkLink py pm $ trh lang NavPrevMonth
mkLink cy cm $ trh lang NavThisMonth
mkLink ny nm $ trh lang NavNextMonth
h2_ [class_ "month-name"] $
toHtml $

View file

@ -12,20 +12,16 @@ data Msg
| NavChip
| NavEvents
| NavWiki
-- Calendar
| NavContact
| -- Calendar
NavContact
| NavContactLink
| NavMonthView
| NavPrevMonth
| NavThisMonth
| NavNextMonth
-- Home page text
| Lead
| HomeGreeting
| HomeP1
| HomeP2
| HomePContact
| HomeContactHere
| -- Home page text
Lead
| HomeIntroText
| SignalLink
| ImgCaption
| ImgAlt
@ -39,16 +35,16 @@ tr ES msg = case msg of
NavEvents -> "Eventos"
NavWiki -> "Wiki"
NavContact -> "Contacto"
NavContactLink -> "/es/Contacto"
NavMonthView -> "Vista mensual"
NavPrevMonth -> "« Mes pasado"
NavThisMonth -> "Este mes"
NavNextMonth -> "Mes siguiente »"
Lead -> "Los chips estan burning"
HomeGreeting -> "Buenos dias,"
HomeP1 -> "Somos un grupo de personas y entidades interesados en infromatica y las technologias relacionadas. Este hackerspace ha sido creado como manera d juntar gente con intereses similares y compartir conocimientos. Mas que nada intentamos hacer una variedad de charlas y talleres sobre temas mas profundos, organizar espacios de trabajo colaborativo, ayudar con projectos personales y lo mas importnate:"
HomeP2 -> "Creer una comunidad amigable y respetuosa de gente interesante"
HomePContact -> "Contactanos "
HomeContactHere -> "aqui!"
HomeIntroText ->
"Somos un <a href=https://es.wikipedia.org/wiki/Hacklab>hackerspace</a> en formación para personas y entidades interesados en la informática y tecnologías relacionadas.<br><br>\
\Nuestro objetivo es juntar gente con intereses similares y compartir conocimientos. Mas informacion sobre los temas y objectivos puedes encontrar en <a href=/es/>nuestra wiki.</a><br><br>\
\Puedes acudir a cualquiera de los eventos programados o contactarnos en <a href=/es/Contacto>estos sitios!</a>"
SidebarEvents -> "Eventos"
ImgCaption -> "Imagen sobre algo"
ImgAlt -> "Imagen interesante"
@ -62,21 +58,21 @@ tr ES msg = case msg of
DayName 7 -> "Domingo"
DayName _ -> ""
tr EN msg = case msg of
PageDesc -> "Chipbuerns home page"
PageDesc -> "Chipburners home page"
NavChip -> "Chip"
NavEvents -> "Events"
NavWiki -> "Wiki"
NavContact -> "Contact"
NavContactLink -> "/en/Contact"
NavMonthView -> "Monthly View"
NavPrevMonth -> "« Last Month"
NavThisMonth -> "This Month"
NavNextMonth -> "Next Month »"
Lead -> "The chips are burning"
HomeGreeting -> "Good morning,"
HomeP1 -> "We are a group of people and entities interested in computer science and related technologies. This hacerpsace was created as a way to meet individuals with similar interests and share knowledge. We host a variety of workshops and talks about, goind in-depth into more obscure topics. Apart from that we facilitate community work spaces to share and help with personal projects. Hoever, most importantly we want to:"
HomeP2 -> "Create a friendly and respectful community of interesting people"
HomePContact -> "You can contact us "
HomeContactHere -> "here!"
HomeIntroText ->
"We are a <a href=https://en.wikipedia.org/wiki/Hackerspace>hackerspace</a> in the making for individuals and organizations interested in computing and related technologies.<br><br>\
\Our goal is to bring together people with similar interests and share knowledge. You can find more information on <a href=/en/> our wiki.</a><br><br>\
\You can attend any of the scheduled events or contact us at <a href=/en/contact>these places!</a>"
SidebarEvents -> "Events"
ImgCaption -> "Image about something"
ImgAlt -> "Interesting image"
@ -90,6 +86,11 @@ tr EN msg = case msg of
DayName 7 -> "Sunday"
DayName _ -> ""
getLangAsString :: Lang -> String
getLangAsString l = case l of
EN -> "en"
ES -> "es"
esLocale :: TimeLocale
esLocale =
defaultTimeLocale