add context menu to navigate to feed if a category is displayed

This commit is contained in:
Athou
2023-02-27 14:18:25 +01:00
parent 69fb11eee0
commit 9f421ec3b0
29 changed files with 140 additions and 12 deletions

View File

@@ -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
@@ -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 (
@@ -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>
)
}

View File

@@ -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 "الأشياء الجيدة"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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 "خوبی ها"

View File

@@ -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ää"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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 "グッディーズ"

View File

@@ -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 "굿즈"

View File

@@ -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 ""

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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 "Сладости"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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 "好东西"