diff --git a/Format.hs b/Format.hs index c7d191e..a1f442a 100644 --- a/Format.hs +++ b/Format.hs @@ -4,6 +4,7 @@ import System.Random import State import Timestamp import Config +import Utils currentFormat :: Timestamp -> State currentFormat t = strictApplyN n nextFormat initialRotation @@ -45,14 +46,5 @@ addNewPack ((i, o), r) = ((ni, no), nr) ni = i ++ [(setLegal np)] no = filter (\x -> x /= np) o -rotate :: Integer -> [a] -> [a] -rotate n xs = take lxs . drop ((fromIntegral n) `mod` lxs) . cycle $ xs - where - lxs = length xs - rotateBox :: BoxQueue -> BoxQueue rotateBox (Bq x) = Bq $ rotate 1 x - -strictApplyN :: Integer -> (a -> a) -> a -> a -strictApplyN 0 _ x = x -strictApplyN n f x = strictApplyN (n - 1) f $! (f x) diff --git a/Main.hs b/Main.hs index 50db60a..beb8fcd 100644 --- a/Main.hs +++ b/Main.hs @@ -14,6 +14,8 @@ import Preview import Yesod import Config import Nrdb +import Text.Lucius +import Utils data ProtocolSeven = ProtocolSeven @@ -29,23 +31,6 @@ mkYesod "ProtocolSeven" [parseRoutes| instance Yesod ProtocolSeven -inBoth :: (Eq a) => [a] -> [a] -> [a] -inBoth x y = filter (\n -> n `elem` y) x - -showMonth :: Int -> String -showMonth 1 = "January" -showMonth 2 = "February" -showMonth 3 = "March" -showMonth 4 = "April" -showMonth 5 = "May" -showMonth 6 = "June" -showMonth 7 = "July" -showMonth 8 = "August" -showMonth 9 = "September" -showMonth 10 = "October" -showMonth 11 = "November" -showMonth 12 = "December" - getHomeR :: Handler Html getHomeR = defaultLayout $ do (year, month, day) <- io $ getCurrentTime >>= return . toGregorian . utctDay @@ -62,162 +47,13 @@ getHomeR = defaultLayout $ do let nrdbIn = nrdbSearch (pdi,catMaybes [bbi]) let nrdbOut = nrdbSearch (pdo,catMaybes [bbo]) setTitle "Protocol Seven" - toWidget [lucius| - html { - color: #FFFFFF; - background-color: #222222; - font-family: 'Inconsolata', monospace; - margin: 0px; - padding: 0px; - text-size-adjust: none; - } - - body { - min-width: 400px; - max-width: 600px; - margin: auto; - padding: 20px; - text-align: left; - border-left: 4px solid white; - border-right: 4px solid white; - } - - section { - border-top: 4px solid white; - padding: 5px; - } - - header, footer { - margin: 0px; - padding: 5px; - border-top: 4px solid white; - } - - .subheading { - text-align: center; - padding: 5px; - } - - h1 { - text-align: center; - margin: 0px; - padding: 5px; - } - - p,h2,h3 { - margin: 0px; - padding: 5px; - } - - .flexboxcontainer { - display: flex; - flex-direction: row; - flex-wrap: wrap; - padding: 10px; - } - - ul { - text-align: initial; - margin: 10px; - } - - .upcomingIn { - color: #00DD00; - background-color: inherit; - } - - .upcomingOut { - color: #DD0000; - background-color: inherit; - } - |] addScriptRemote "https://fonts.googleapis.com/css?family=Inconsolata" - toWidgetBody [hamlet| -
-

Protocol Seven -

Always Be Running

- |] - toWidgetBody [hamlet| -
-

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

Evergreen: -