Skip to content

Commit

Permalink
add context menu to navigate to feed if a category is displayed
Browse files Browse the repository at this point in the history
  • Loading branch information
Athou committed Feb 27, 2023
1 parent 69fb11e commit 9f421ec
Show file tree
Hide file tree
Showing 29 changed files with 140 additions and 12 deletions.
40 changes: 28 additions & 12 deletions commafeed-client/src/components/content/FeedEntryContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ import { t, Trans } from "@lingui/macro"
import { createStyles, Group } from "@mantine/core"
import { Constants } from "app/constants"
import { markEntriesUpToEntry, markEntry, starEntry } from "app/slices/entries"
import { useAppDispatch } from "app/store"
import { redirectToFeed } from "app/slices/redirect"
import { useAppDispatch, useAppSelector } from "app/store"
import { Entry } from "app/types"
import { openLinkInBackgroundTab } from "app/utils"
import { throttle } from "lodash"
import { throttle, truncate } from "lodash"
import { useEffect } from "react"
import { Item, Menu, Separator, useContextMenu } from "react-contexify"
import { TbArrowBarToDown, TbExternalLink, TbEyeCheck, TbEyeOff, TbStar, TbStarOff } from "react-icons/tb"
import { TbArrowBarToDown, TbExternalLink, TbEyeCheck, TbEyeOff, TbRss, TbStar, TbStarOff } from "react-icons/tb"

interface FeedEntryContextMenuProps {
entry: Entry
Expand All @@ -30,6 +31,7 @@ const useStyles = createStyles(theme => ({
const menuId = (entry: Entry) => entry.id
export function FeedEntryContextMenu(props: FeedEntryContextMenuProps) {
const { classes, theme } = useStyles()
const sourceType = useAppSelector(state => state.entries.source.type)
const dispatch = useAppDispatch()

return (
Expand Down Expand Up @@ -59,27 +61,41 @@ export function FeedEntryContextMenu(props: FeedEntryContextMenuProps) {

<Separator />

<Item onClick={() => dispatch(markEntry({ entry: props.entry, read: !props.entry.read }))}>
<Group>
{props.entry.read ? <TbEyeOff size={iconSize} /> : <TbEyeCheck size={iconSize} />}
{props.entry.read ? t`Keep unread` : t`Mark as read`}
</Group>
</Item>
<Item onClick={() => dispatch(starEntry({ entry: props.entry, starred: !props.entry.starred }))}>
<Group>
{props.entry.starred ? <TbStarOff size={iconSize} /> : <TbStar size={iconSize} />}
{props.entry.starred ? t`Unstar` : t`Star`}
</Group>
</Item>

<Separator />

<Item onClick={() => dispatch(markEntry({ entry: props.entry, read: !props.entry.read }))}>
<Group>
{props.entry.read ? <TbEyeOff size={iconSize} /> : <TbEyeCheck size={iconSize} />}
{props.entry.read ? t`Keep unread` : t`Mark as read`}
</Group>
</Item>
<Item onClick={() => dispatch(markEntriesUpToEntry(props.entry))}>
<Group>
<TbArrowBarToDown size={iconSize} />
<Trans>Mark as read up to here</Trans>
</Group>
</Item>

{sourceType === "category" && (
<>
<Separator />

<Item
onClick={() => {
dispatch(redirectToFeed(props.entry.feedId))
}}
>
<Group>
<TbRss size={iconSize} />
<Trans>Go to {truncate(props.entry.feedName)}</Trans>
</Group>
</Item>
</>
)}
</Menu>
)
}
Expand Down
4 changes: 4 additions & 0 deletions commafeed-client/src/locales/ar/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ msgstr "انتقل إلى وثائق API."
msgid "Go to the All view"
msgstr "اذهب إلى طريقة العرض \"الكل\""

#: src/components/content/FeedEntryContextMenu.tsx
msgid "Go to {0}"
msgstr ""

#: src/pages/app/AboutPage.tsx
msgid "Goodies"
msgstr "الأشياء الجيدة"
Expand Down
4 changes: 4 additions & 0 deletions commafeed-client/src/locales/ca/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ msgstr "Vés a la documentació de l'API."
msgid "Go to the All view"
msgstr "Vés a la vista Tot"

#: src/components/content/FeedEntryContextMenu.tsx
msgid "Go to {0}"
msgstr ""

#: src/pages/app/AboutPage.tsx
msgid "Goodies"
msgstr "Bones"
Expand Down
4 changes: 4 additions & 0 deletions commafeed-client/src/locales/cs/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ msgstr "Přejděte na dokumentaci API."
msgid "Go to the All view"
msgstr "Přejděte do zobrazení Vše"

#: src/components/content/FeedEntryContextMenu.tsx
msgid "Go to {0}"
msgstr ""

#: src/pages/app/AboutPage.tsx
msgid "Goodies"
msgstr "Dobroty"
Expand Down
4 changes: 4 additions & 0 deletions commafeed-client/src/locales/cy/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ msgstr "Ewch i'r ddogfennaeth API."
msgid "Go to the All view"
msgstr "Ewch i'r golwg Pawb"

#: src/components/content/FeedEntryContextMenu.tsx
msgid "Go to {0}"
msgstr ""

#: src/pages/app/AboutPage.tsx
msgid "Goodies"
msgstr "nwyddau"
Expand Down
4 changes: 4 additions & 0 deletions commafeed-client/src/locales/da/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ msgstr "Gå til API-dokumentationen."
msgid "Go to the All view"
msgstr "Gå til visningen Alle"

#: src/components/content/FeedEntryContextMenu.tsx
msgid "Go to {0}"
msgstr ""

#: src/pages/app/AboutPage.tsx
msgid "Goodies"
msgstr "Godbidder"
Expand Down
4 changes: 4 additions & 0 deletions commafeed-client/src/locales/de/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ msgstr "Gehen Sie zur API-Dokumentation."
msgid "Go to the All view"
msgstr "Zur Ansicht Alle wechseln"

#: src/components/content/FeedEntryContextMenu.tsx
msgid "Go to {0}"
msgstr ""

#: src/pages/app/AboutPage.tsx
msgid "Goodies"
msgstr "Gutes"
Expand Down
4 changes: 4 additions & 0 deletions commafeed-client/src/locales/en/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ msgstr "Go to the API documentation."
msgid "Go to the All view"
msgstr "Go to the All view"

#: src/components/content/FeedEntryContextMenu.tsx
msgid "Go to {0}"
msgstr "Go to {0}"

#: src/pages/app/AboutPage.tsx
msgid "Goodies"
msgstr "Goodies"
Expand Down
4 changes: 4 additions & 0 deletions commafeed-client/src/locales/es/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ msgstr "Ir a la documentación de la API."
msgid "Go to the All view"
msgstr "Ir a la vista Todo"

#: src/components/content/FeedEntryContextMenu.tsx
msgid "Go to {0}"
msgstr ""

#: src/pages/app/AboutPage.tsx
msgid "Goodies"
msgstr "golosinas"
Expand Down
4 changes: 4 additions & 0 deletions commafeed-client/src/locales/fa/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ msgstr "به مستندات API بروید."
msgid "Go to the All view"
msgstr "به نمای All بروید"

#: src/components/content/FeedEntryContextMenu.tsx
msgid "Go to {0}"
msgstr ""

#: src/pages/app/AboutPage.tsx
msgid "Goodies"
msgstr "خوبی ها"
Expand Down
4 changes: 4 additions & 0 deletions commafeed-client/src/locales/fi/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ msgstr "Siirry API-dokumentaatioon."
msgid "Go to the All view"
msgstr "Siirry Kaikki-näkymään"

#: src/components/content/FeedEntryContextMenu.tsx
msgid "Go to {0}"
msgstr ""

#: src/pages/app/AboutPage.tsx
msgid "Goodies"
msgstr "Hyvää"
Expand Down
4 changes: 4 additions & 0 deletions commafeed-client/src/locales/fr/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ msgstr "Aller à la documentation de l'API."
msgid "Go to the All view"
msgstr "Aller à la catégorie Tout"

#: src/components/content/FeedEntryContextMenu.tsx
msgid "Go to {0}"
msgstr ""

#: src/pages/app/AboutPage.tsx
msgid "Goodies"
msgstr "Extensions"
Expand Down
4 changes: 4 additions & 0 deletions commafeed-client/src/locales/gl/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ msgstr "Ir á documentación da API."
msgid "Go to the All view"
msgstr "Ir á vista Todos"

#: src/components/content/FeedEntryContextMenu.tsx
msgid "Go to {0}"
msgstr ""

#: src/pages/app/AboutPage.tsx
msgid "Goodies"
msgstr "agasallos"
Expand Down
4 changes: 4 additions & 0 deletions commafeed-client/src/locales/hu/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ msgstr "Nyissa meg az API dokumentációját."
msgid "Go to the All view"
msgstr "Lépjen az Összes nézetre"

#: src/components/content/FeedEntryContextMenu.tsx
msgid "Go to {0}"
msgstr ""

#: src/pages/app/AboutPage.tsx
msgid "Goodies"
msgstr "Jók"
Expand Down
4 changes: 4 additions & 0 deletions commafeed-client/src/locales/id/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ msgstr "Buka dokumentasi API."
msgid "Go to the All view"
msgstr "Pergi ke tampilan Semua"

#: src/components/content/FeedEntryContextMenu.tsx
msgid "Go to {0}"
msgstr ""

#: src/pages/app/AboutPage.tsx
msgid "Goodies"
msgstr "Pernak-pernik"
Expand Down
4 changes: 4 additions & 0 deletions commafeed-client/src/locales/it/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ msgstr "Vai alla documentazione dell'API."
msgid "Go to the All view"
msgstr "Vai alla vista Tutto"

#: src/components/content/FeedEntryContextMenu.tsx
msgid "Go to {0}"
msgstr ""

#: src/pages/app/AboutPage.tsx
msgid "Goodies"
msgstr "Chicche"
Expand Down
4 changes: 4 additions & 0 deletions commafeed-client/src/locales/ja/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ msgstr "API ドキュメントに移動します。"
msgid "Go to the All view"
msgstr "すべてのビューに移動"

#: src/components/content/FeedEntryContextMenu.tsx
msgid "Go to {0}"
msgstr ""

#: src/pages/app/AboutPage.tsx
msgid "Goodies"
msgstr "グッディーズ"
Expand Down
4 changes: 4 additions & 0 deletions commafeed-client/src/locales/ko/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ msgstr "API 문서로 이동합니다."
msgid "Go to the All view"
msgstr "전체 보기로 이동"

#: src/components/content/FeedEntryContextMenu.tsx
msgid "Go to {0}"
msgstr ""

#: src/pages/app/AboutPage.tsx
msgid "Goodies"
msgstr "굿즈"
Expand Down
4 changes: 4 additions & 0 deletions commafeed-client/src/locales/ms/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ msgstr "Pergi ke dokumentasi API."
msgid "Go to the All view"
msgstr "Pergi ke paparan Semua"

#: src/components/content/FeedEntryContextMenu.tsx
msgid "Go to {0}"
msgstr ""

#: src/pages/app/AboutPage.tsx
msgid "Goodies"
msgstr ""
Expand Down
4 changes: 4 additions & 0 deletions commafeed-client/src/locales/nb/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ msgstr "Gå til API-dokumentasjonen."
msgid "Go to the All view"
msgstr "Gå til visningen Alle"

#: src/components/content/FeedEntryContextMenu.tsx
msgid "Go to {0}"
msgstr ""

#: src/pages/app/AboutPage.tsx
msgid "Goodies"
msgstr "Godbiter"
Expand Down
4 changes: 4 additions & 0 deletions commafeed-client/src/locales/nl/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ msgstr "Ga naar de API-documentatie."
msgid "Go to the All view"
msgstr "Ga naar de weergave Alles"

#: src/components/content/FeedEntryContextMenu.tsx
msgid "Go to {0}"
msgstr ""

#: src/pages/app/AboutPage.tsx
msgid "Goodies"
msgstr "Goederen"
Expand Down
4 changes: 4 additions & 0 deletions commafeed-client/src/locales/nn/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ msgstr "Gå til API-dokumentasjonen."
msgid "Go to the All view"
msgstr "Gå til visningen Alle"

#: src/components/content/FeedEntryContextMenu.tsx
msgid "Go to {0}"
msgstr ""

#: src/pages/app/AboutPage.tsx
msgid "Goodies"
msgstr "Godbiter"
Expand Down
4 changes: 4 additions & 0 deletions commafeed-client/src/locales/pl/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ msgstr "Przejdź do dokumentacji API."
msgid "Go to the All view"
msgstr "Przejdź do widoku Wszystkie"

#: src/components/content/FeedEntryContextMenu.tsx
msgid "Go to {0}"
msgstr ""

#: src/pages/app/AboutPage.tsx
msgid "Goodies"
msgstr "Gadżety"
Expand Down
4 changes: 4 additions & 0 deletions commafeed-client/src/locales/pt/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ msgstr "Vá para a documentação da API."
msgid "Go to the All view"
msgstr "Ir para a visualização Tudo"

#: src/components/content/FeedEntryContextMenu.tsx
msgid "Go to {0}"
msgstr ""

#: src/pages/app/AboutPage.tsx
msgid "Goodies"
msgstr "Brindes"
Expand Down
4 changes: 4 additions & 0 deletions commafeed-client/src/locales/ru/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ msgstr "Перейдите к документации по API."
msgid "Go to the All view"
msgstr "Перейти к представлению «Все»"

#: src/components/content/FeedEntryContextMenu.tsx
msgid "Go to {0}"
msgstr ""

#: src/pages/app/AboutPage.tsx
msgid "Goodies"
msgstr "Сладости"
Expand Down
4 changes: 4 additions & 0 deletions commafeed-client/src/locales/sk/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ msgstr "Prejdite na dokumentáciu API."
msgid "Go to the All view"
msgstr "Prejdite na zobrazenie Všetky"

#: src/components/content/FeedEntryContextMenu.tsx
msgid "Go to {0}"
msgstr ""

#: src/pages/app/AboutPage.tsx
msgid "Goodies"
msgstr "Dobrôtky"
Expand Down
4 changes: 4 additions & 0 deletions commafeed-client/src/locales/sv/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ msgstr "Gå till API-dokumentationen."
msgid "Go to the All view"
msgstr "Gå till vyn Alla"

#: src/components/content/FeedEntryContextMenu.tsx
msgid "Go to {0}"
msgstr ""

#: src/pages/app/AboutPage.tsx
msgid "Goodies"
msgstr "Godsaker"
Expand Down
4 changes: 4 additions & 0 deletions commafeed-client/src/locales/tr/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ msgstr "API belgelerine gidin."
msgid "Go to the All view"
msgstr "Tümü görünümüne git"

#: src/components/content/FeedEntryContextMenu.tsx
msgid "Go to {0}"
msgstr ""

#: src/pages/app/AboutPage.tsx
msgid "Goodies"
msgstr "İyilikler"
Expand Down
4 changes: 4 additions & 0 deletions commafeed-client/src/locales/zh/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ msgstr "转到 API 文档。"
msgid "Go to the All view"
msgstr "转到全部视图"

#: src/components/content/FeedEntryContextMenu.tsx
msgid "Go to {0}"
msgstr ""

#: src/pages/app/AboutPage.tsx
msgid "Goodies"
msgstr "好东西"
Expand Down

0 comments on commit 9f421ec

Please sign in to comment.