diff --git a/TODO b/TODO index bdfaea1..36d737e 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,3 @@ -COMMENT YOUR CODE!!!!!!! - make it look nicer :) fix import/exports to be conservative diff --git a/src/Request.hs b/src/Request.hs index 5c6cc72..ad20ce2 100644 --- a/src/Request.hs +++ b/src/Request.hs @@ -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) diff --git a/src/UI.hs b/src/UI.hs index 36d5b0b..f0d193e 100644 --- a/src/UI.hs +++ b/src/UI.hs @@ -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!") diff --git a/src/UI/Widgets.hs b/src/UI/Widgets.hs index 39100df..8ae8f56 100644 --- a/src/UI/Widgets.hs +++ b/src/UI/Widgets.hs @@ -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")