diff --git a/Main.hs b/Main.hs index beb8fcd..83d0460 100644 --- a/Main.hs +++ b/Main.hs @@ -2,8 +2,7 @@ module Main where -import Data.Time.Clock -import Data.Time.Calendar +import Data.Time import Data.List import Data.Maybe import Packs @@ -33,19 +32,29 @@ instance Yesod ProtocolSeven getHomeR :: Handler Html getHomeR = defaultLayout $ do - (year, month, day) <- io $ getCurrentTime >>= return . toGregorian . utctDay + -- Date / Time stuff + sTimeDate <- io $ getZonedTime >>= return . (formatTime defaultTimeLocale "%y %m %d") + let (year, month, day) = (\[a,b,c] -> (a,b,c)) $ map (\x -> read x :: Integer) $ words sTimeDate let nextMonth = (month + 1) `mod` 12 let ts = toTS (year, month, day) + + -- Release Order Big Boxes + let (_,ib,_) = initialRotation + + -- Current Format let ((i,o),b,r) = currentFormat ts let bx = (\(Bq x) -> x) - let (_,ib,_) = initialRotation let bbout = map show $ catMaybes $ inBoth (bx ib) (tail $ bx b) - let dpout = sort $ map show $ map (\(Ir n) -> n) i + let dpout = sort $ map show $ map (\(Ir n) -> n) i + + -- Preview let pr = getPreview ts let (pdi,pdo,bbi,bbo) = extractPreview pr let nrdbFormat = nrdbSearch (((map (\(Ir n) -> n) i) ++ (map (\(Or n _) -> n) o)),(catMaybes (bx b))) let nrdbIn = nrdbSearch (pdi,catMaybes [bbi]) let nrdbOut = nrdbSearch (pdo,catMaybes [bbo]) + + -- Build Site setTitle "Protocol Seven" addScriptRemote "https://fonts.googleapis.com/css?family=Inconsolata" toWidget $(whamletFile "header.hamlet") diff --git a/Nrdb.hs b/Nrdb.hs index 9e69805..93f7ced 100644 --- a/Nrdb.hs +++ b/Nrdb.hs @@ -7,8 +7,8 @@ nrdbSearch :: ([DataPack], [BigBox]) -> String nrdbSearch (d, b) = "https://netrunnerdb.com/find/?q=e%3A" ++ intercalate "%7C" ( - (map nrdbPackCodes d) ++ - (map nrdbBoxCodes b) + sort ((map nrdbPackCodes d) ++ + (map nrdbBoxCodes b)) ) nrdbPackCodes :: DataPack -> String diff --git a/Timestamp.hs b/Timestamp.hs index 77456f0..f44aa54 100644 --- a/Timestamp.hs +++ b/Timestamp.hs @@ -20,5 +20,5 @@ monthsSince (Ts d1 m1 y1) (Ts d2 m2 y2) t1 = Ts d1 m1 y1 t2 = Ts d2 m2 y2 -toTS :: (Integer, Int, Int) -> Timestamp -toTS (y,m,d) = Ts (fromIntegral d) (fromIntegral m) y +toTS :: (Integer, Integer, Integer) -> Timestamp +toTS (y,m,d) = Ts d m y diff --git a/Utils.hs b/Utils.hs index 2b26efa..5bdffb0 100644 --- a/Utils.hs +++ b/Utils.hs @@ -3,7 +3,7 @@ module Utils where inBoth :: (Eq a) => [a] -> [a] -> [a] inBoth x y = filter (\n -> n `elem` y) x -showMonth :: Int -> String +showMonth :: Integer -> String showMonth 1 = "January" showMonth 2 = "February" showMonth 3 = "March" diff --git a/format.hamlet b/format.hamlet index e55c665..63d69ae 100644 --- a/format.hamlet +++ b/format.hamlet @@ -1,6 +1,5 @@
-

Format for #{showMonth month} #{year}: - Click Here for NetrunnerDB +

Format for #{showMonth month} #{year}: NRDB

Evergreen: @@ -19,16 +18,14 @@
$maybe (pin, pout, pbin, pbout) <- pr
-

In: - Click Here for NetrunnerDB +

In: NRDB
    $maybe pbbin <- pbin
  • + #{show pbbin} $forall indp <- pin
  • + #{show indp}
    -

    Out: - Click Here for NetrunnerDB +

    Out: NRDB
      $maybe pbbout <- pbout
    • - #{show pbbout} diff --git a/style.lucius b/style.lucius index e2f786f..6bb1ba6 100644 --- a/style.lucius +++ b/style.lucius @@ -51,6 +51,14 @@ p,h2,h3 { padding: 10px; } +a:link { + color: cornflowerblue +} + +a:visited { + color: mediumpurple +} + ul { text-align: initial; margin: 10px;