Cleaned up Links, sorted parameters
This commit is contained in:
parent
9cf0f6ebbd
commit
2611f8a8e2
19
Main.hs
19
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")
|
||||
|
4
Nrdb.hs
4
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
|
||||
|
@ -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
|
||||
|
2
Utils.hs
2
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"
|
||||
|
@ -1,6 +1,5 @@
|
||||
<section class="rotation">
|
||||
<h2>Format for #{showMonth month} #{year}:
|
||||
<a href=#{nrdbFormat}>Click Here for NetrunnerDB
|
||||
<h2>Format for #{showMonth month} #{year}: <a href=#{nrdbFormat}>NRDB</a>
|
||||
<div class="flexboxcontainer">
|
||||
<div class="rotationLeft">
|
||||
<h3>Evergreen:
|
||||
@ -19,16 +18,14 @@
|
||||
<div class="flexboxcontainer">
|
||||
$maybe (pin, pout, pbin, pbout) <- pr
|
||||
<div class="upcomingIn">
|
||||
<h3>In:
|
||||
<a href=#{nrdbIn}>Click Here for NetrunnerDB
|
||||
<h3>In: <a href=#{nrdbIn}>NRDB</a>
|
||||
<ul>
|
||||
$maybe pbbin <- pbin
|
||||
<li>+ #{show pbbin}
|
||||
$forall indp <- pin
|
||||
<li>+ #{show indp}
|
||||
<div class="upcomingOut">
|
||||
<h3>Out:
|
||||
<a href=#{nrdbOut}>Click Here for NetrunnerDB
|
||||
<h3>Out: <a href=#{nrdbOut}>NRDB</a>
|
||||
<ul>
|
||||
$maybe pbbout <- pbout
|
||||
<li>- #{show pbbout}
|
||||
|
@ -51,6 +51,14 @@ p,h2,h3 {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
a:link {
|
||||
color: cornflowerblue
|
||||
}
|
||||
|
||||
a:visited {
|
||||
color: mediumpurple
|
||||
}
|
||||
|
||||
ul {
|
||||
text-align: initial;
|
||||
margin: 10px;
|
||||
|
Loading…
Reference in New Issue
Block a user