fix: hide some actions for inbox

close #912
This commit is contained in:
Stephen Zhou 2024-10-14 10:47:24 +08:00
parent d850a5c328
commit 29b893a23e
No known key found for this signature in database
2 changed files with 6 additions and 2 deletions

View File

@ -137,6 +137,7 @@ export const useEntryActions = ({
const { t } = useTranslation()
const feed = useFeedById(entry?.feedId)
const isInbox = feed?.type === "inbox"
const populatedEntry = useMemo(() => {
if (!entry) return null
@ -312,7 +313,7 @@ export const useEntryActions = ({
shortcut: shortcuts.entry.tip.key,
name: t("entry_actions.tip"),
className: "i-mgc-power-outline",
hide: feed?.ownerUserId === whoami()?.id,
hide: isInbox || feed?.ownerUserId === whoami()?.id,
onClick: () => {
nextFrame(openTipModal)
},

View File

@ -38,6 +38,7 @@ export const useFeedActions = ({
}) => {
const { t } = useTranslation()
const feed = useFeedById(feedId)
const isInbox = feed?.type === "inbox"
const subscription = useSubscriptionByFeedId(feedId)
const { present } = useModalStack()
const deleteSubscription = useDeleteSubscription({})
@ -91,6 +92,7 @@ export const useFeedActions = ({
{
type: "text" as const,
label: t("sidebar.feed_column.context_menu.add_feeds_to_list"),
disabled: isInbox,
submenu: [
...listByView.map((list) => {
const isIncluded = list.feedIds.includes(feedId)
@ -150,13 +152,14 @@ export const useFeedActions = ({
? t("sidebar.feed_actions.unfollow_feed")
: t("sidebar.feed_actions.unfollow"),
shortcut: "Meta+Backspace",
disabled: isInbox,
click: () => deleteSubscription.mutate(subscription),
},
{
type: "text" as const,
label: t("sidebar.feed_actions.navigate_to_feed"),
shortcut: "Meta+G",
disabled: !isEntryList || getRouteParams().feedId === feedId,
disabled: isInbox || !isEntryList || getRouteParams().feedId === feedId,
click: () => {
navigateEntry({ feedId })
},