fix indents for nonConceal and update TODO
This commit is contained in:
parent
56e1a7ce0b
commit
5843a137f8
2
TODO
2
TODO
|
@ -1,5 +1,3 @@
|
||||||
COMMENT YOUR CODE!!!!!!!
|
|
||||||
|
|
||||||
make it look nicer :)
|
make it look nicer :)
|
||||||
|
|
||||||
fix import/exports to be conservative
|
fix import/exports to be conservative
|
||||||
|
|
|
@ -21,7 +21,7 @@ makeRequest url opts = do
|
||||||
r <- asJSON =<< getWith opts url
|
r <- asJSON =<< getWith opts url
|
||||||
pure $ case (r ^. responseBody) of
|
pure $ case (r ^. responseBody) of
|
||||||
(JSONResponse "ok" _ (Just d)) -> Right d
|
(JSONResponse "ok" _ (Just d)) -> Right d
|
||||||
(JSONResponse _ m _) -> Left m
|
(JSONResponse _ m _) -> Left m
|
||||||
|
|
||||||
-- | Requests a list of all movies
|
-- | Requests a list of all movies
|
||||||
getMovies :: IO (Either T.Text JSONListMovies)
|
getMovies :: IO (Either T.Text JSONListMovies)
|
||||||
|
|
11
src/UI.hs
11
src/UI.hs
|
@ -57,9 +57,9 @@ startEvent s = do
|
||||||
response <- liftIO getMovies
|
response <- liftIO getMovies
|
||||||
pure $ case response of
|
pure $ case response of
|
||||||
(Left msg) -> s & appMessage .~ Just (T.unpack msg)
|
(Left msg) -> s & appMessage .~ Just (T.unpack msg)
|
||||||
& appContinue .~ False
|
& appContinue .~ False
|
||||||
(Right listing) -> s & appListing .~ Just listing
|
(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
|
-- | The drawing function which defers to the proper function
|
||||||
-- from UI.Widgets
|
-- from UI.Widgets
|
||||||
|
@ -81,9 +81,8 @@ scroll d s = s & appCursor .~ newCursor
|
||||||
& appDetails .~ (s ^. appListing >>= ((!? newCursor) . movies))
|
& appDetails .~ (s ^. appListing >>= ((!? newCursor) . movies))
|
||||||
where
|
where
|
||||||
upperLimit = fromMaybe 0 (subtract 1 . length . movies <$> s ^. appListing)
|
upperLimit = fromMaybe 0 (subtract 1 . length . movies <$> s ^. appListing)
|
||||||
new = case d of { Up -> (subtract 1); Down -> (+1) }
|
new = case d of { Up -> (subtract 1); Down -> (+1) }
|
||||||
oldCursor = s ^. appCursor
|
newCursor = max 0 (min upperLimit (new (s ^. appCursor)))
|
||||||
newCursor = max 0 (min upperLimit (new oldCursor))
|
|
||||||
|
|
||||||
|
|
||||||
-- | Given a String, modify our state so that string
|
-- | Given a String, modify our state so that string
|
||||||
|
@ -99,7 +98,7 @@ copyMagnet s i = case (do
|
||||||
m <- s ^. appDetails
|
m <- s ^. appDetails
|
||||||
_ <- movieTorrents m !? i - 1
|
_ <- movieTorrents m !? i - 1
|
||||||
toMagnets m !? i - 1) of
|
toMagnets m !? i - 1) of
|
||||||
Nothing -> continue s
|
Nothing -> continue s
|
||||||
(Just magnet) -> do
|
(Just magnet) -> do
|
||||||
liftIO (setClipboardString magnet)
|
liftIO (setClipboardString magnet)
|
||||||
continue (displayMessage s "Copied magnet link to clipboard!")
|
continue (displayMessage s "Copied magnet link to clipboard!")
|
||||||
|
|
|
@ -70,7 +70,7 @@ searchWidget = undefined
|
||||||
browseWidget :: AppS -> Widget Ident
|
browseWidget :: AppS -> Widget Ident
|
||||||
browseWidget s =
|
browseWidget s =
|
||||||
headings <=> case (s ^. appListing) of
|
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))
|
(Just m) -> (viewport Listing Vertical (movieWidgets s m))
|
||||||
where
|
where
|
||||||
headings = str "Title" <+> padLeft Max (str "Year")
|
headings = str "Title" <+> padLeft Max (str "Year")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user