fix indents for nonConceal and update TODO

master
Rachel Lambda Samuelsson 2021-09-19 19:43:19 +02:00
parent 56e1a7ce0b
commit 5843a137f8
4 changed files with 7 additions and 10 deletions

2
TODO
View File

@ -1,5 +1,3 @@
COMMENT YOUR CODE!!!!!!!
make it look nicer :)
fix import/exports to be conservative

View File

@ -21,7 +21,7 @@ makeRequest url opts = do
r <- asJSON =<< getWith opts url
pure $ case (r ^. responseBody) of
(JSONResponse "ok" _ (Just d)) -> Right d
(JSONResponse _ m _) -> Left m
(JSONResponse _ m _) -> Left m
-- | Requests a list of all movies
getMovies :: IO (Either T.Text JSONListMovies)

View File

@ -57,9 +57,9 @@ startEvent s = do
response <- liftIO getMovies
pure $ case response of
(Left msg) -> s & appMessage .~ Just (T.unpack msg)
& appContinue .~ False
& appContinue .~ False
(Right listing) -> s & appListing .~ Just listing
& appDetails .~ (movies listing !? s ^. appCursor)
& appDetails .~ (movies listing !? s ^. appCursor)
-- | The drawing function which defers to the proper function
-- from UI.Widgets
@ -81,9 +81,8 @@ scroll d s = s & appCursor .~ newCursor
& appDetails .~ (s ^. appListing >>= ((!? newCursor) . movies))
where
upperLimit = fromMaybe 0 (subtract 1 . length . movies <$> s ^. appListing)
new = case d of { Up -> (subtract 1); Down -> (+1) }
oldCursor = s ^. appCursor
newCursor = max 0 (min upperLimit (new oldCursor))
new = case d of { Up -> (subtract 1); Down -> (+1) }
newCursor = max 0 (min upperLimit (new (s ^. appCursor)))
-- | Given a String, modify our state so that string
@ -99,7 +98,7 @@ copyMagnet s i = case (do
m <- s ^. appDetails
_ <- movieTorrents m !? i - 1
toMagnets m !? i - 1) of
Nothing -> continue s
Nothing -> continue s
(Just magnet) -> do
liftIO (setClipboardString magnet)
continue (displayMessage s "Copied magnet link to clipboard!")

View File

@ -70,7 +70,7 @@ searchWidget = undefined
browseWidget :: AppS -> Widget Ident
browseWidget s =
headings <=> case (s ^. appListing) of
Nothing -> center $ str "No movies found matching query."
Nothing -> center $ str "No movies found matching query."
(Just m) -> (viewport Listing Vertical (movieWidgets s m))
where
headings = str "Title" <+> padLeft Max (str "Year")