Skip to content

Commit

Permalink
Cleanup split shortcut view. Add translations
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianoFerrari committed May 25, 2020
1 parent b7701de commit 4da766a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 35 deletions.
24 changes: 24 additions & 0 deletions src/elm/Translation.elm
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,13 @@ type TranslationId
| EditCardTitle
| ArrowsAction
| AddChildAction
| SplitChildAction
| InsertChildTitle
| AddBelowAction
| SplitBelowAction
| InsertBelowTitle
| AddAboveAction
| SplitUpwardAction
| InsertAboveTitle
| ArrowKeys
| MoveAction
Expand Down Expand Up @@ -231,6 +234,13 @@ tr lang trans =
, fr = ""
}

SplitChildAction ->
{ en = "to Split Card to the Right"
, zh = ""
, es = "para Dividir la Tarjeta hacia la Derecha"
, fr = ""
}

InsertChildTitle ->
{ en = "Insert Child (Ctrl+L)"
, zh = ""
Expand All @@ -245,6 +255,13 @@ tr lang trans =
, fr = ""
}

SplitBelowAction ->
{ en = "to Split Card Down"
, zh = ""
, es = "para Dividir la Tarjeta hacia la Abajo"
, fr = ""
}

InsertBelowTitle ->
{ en = "Insert Below (Ctrl+J)"
, zh = ""
Expand All @@ -259,6 +276,13 @@ tr lang trans =
, fr = ""
}

SplitUpwardAction ->
{ en = "to Split Card Upward"
, zh = ""
, es = "para Dividir la Tarjeta hacia la Arriba"
, fr = ""
}

InsertAboveTitle ->
{ en = "Insert Above (Ctrl+K)"
, zh = ""
Expand Down
44 changes: 9 additions & 35 deletions src/elm/UI.elm
Original file line number Diff line number Diff line change
Expand Up @@ -223,47 +223,21 @@ viewShortcutsToggle lang isOpen isMac isOnly textCursorInfo vs =
else
text ""

splitChild =
case textCursorInfo.position of
Start ->
shortcutSpan [ ctrlOrCmd, "L" ] "to Split Card to Right"

End ->
shortcutSpan [ ctrlOrCmd, "L" ] (tr lang AddChildAction)
spanSplit key descAdd descSplit =
if textCursorInfo.position == End || textCursorInfo.position == Empty then
shortcutSpan [ ctrlOrCmd, key ] descAdd

Empty ->
shortcutSpan [ ctrlOrCmd, "L" ] (tr lang AddChildAction)
else
shortcutSpan [ ctrlOrCmd, key ] descSplit

Other ->
shortcutSpan [ ctrlOrCmd, "L" ] "to Split Card to Right"
splitChild =
spanSplit "L" (tr lang AddChildAction) (tr lang SplitChildAction)

splitBelow =
case textCursorInfo.position of
Start ->
shortcutSpan [ ctrlOrCmd, "J" ] "to Split Card Down"

End ->
shortcutSpan [ ctrlOrCmd, "J" ] (tr lang AddBelowAction)

Empty ->
shortcutSpan [ ctrlOrCmd, "J" ] (tr lang AddBelowAction)

Other ->
shortcutSpan [ ctrlOrCmd, "J" ] "to Split Card Down"
spanSplit "J" (tr lang AddBelowAction) (tr lang SplitBelowAction)

splitAbove =
case textCursorInfo.position of
Start ->
shortcutSpan [ ctrlOrCmd, "K" ] "to Split Card Upward"

End ->
shortcutSpan [ ctrlOrCmd, "K" ] (tr lang AddAboveAction)

Empty ->
shortcutSpan [ ctrlOrCmd, "K" ] (tr lang AddAboveAction)

Other ->
shortcutSpan [ ctrlOrCmd, "K" ] "to Split Card Upward"
spanSplit "K" (tr lang AddAboveAction) (tr lang SplitUpwardAction)

shortcutSpanEnabled enabled keys desc =
let
Expand Down

0 comments on commit 4da766a

Please sign in to comment.