mirror of
https://github.com/NoRedInk/noredink-ui.git
synced 2025-01-05 05:07:06 +03:00
🎨 tidy up the summarization logic
This commit is contained in:
parent
df7f333b17
commit
f86e907317
@ -95,28 +95,16 @@ summarize (State state) panels =
|
||||
in
|
||||
case state of
|
||||
Just current ->
|
||||
case List.drop (current - 1) panels of
|
||||
first :: second :: rest ->
|
||||
if current > 0 then
|
||||
Just
|
||||
{ current = second
|
||||
, previousPanel = Just first
|
||||
, upcoming = List.drop (current + 1) indexedPanels
|
||||
, previous = List.take current indexedPanels
|
||||
}
|
||||
|
||||
else
|
||||
Just
|
||||
{ current = first
|
||||
, previousPanel = Nothing
|
||||
, upcoming = List.drop (current + 1) indexedPanels
|
||||
, previous = List.take current indexedPanels
|
||||
}
|
||||
|
||||
first :: [] ->
|
||||
case List.drop current panels of
|
||||
currentPanel :: rest ->
|
||||
Just
|
||||
{ current = first
|
||||
, previousPanel = Nothing
|
||||
{ current = currentPanel
|
||||
, previousPanel =
|
||||
if current > 0 then
|
||||
List.head (List.drop (current - 1) panels)
|
||||
|
||||
else
|
||||
Nothing
|
||||
, upcoming = List.drop (current + 1) indexedPanels
|
||||
, previous = List.take current indexedPanels
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user