- Modify TimelineViewSelector to pass view-specific context menu props - Adjust TimelineViewSelectorContextMenu to handle undefined viewId more precisely - Simplify context menu rendering logic for view-based timelines Signed-off-by: Innei <tukon479@gmail.com>
33 lines
1023 B
TypeScript
33 lines
1023 B
TypeScript
import type { FeedViewType } from "@follow/constants"
|
|
import type { FC, PropsWithChildren } from "react"
|
|
|
|
import { ContextMenu } from "@/src/components/ui/context-menu"
|
|
import { unreadSyncService } from "@/src/store/unread/store"
|
|
|
|
export const TimelineViewSelectorContextMenu: FC<
|
|
PropsWithChildren<{ type: string | undefined; viewId: FeedViewType | undefined }>
|
|
> = ({ children, type, viewId }) => {
|
|
if (type !== "view" || viewId === undefined) return children
|
|
|
|
return (
|
|
<ContextMenu.Root>
|
|
<ContextMenu.Trigger>{children}</ContextMenu.Trigger>
|
|
<ContextMenu.Content>
|
|
<ContextMenu.Item
|
|
key="MarkAsRead"
|
|
onSelect={() => {
|
|
unreadSyncService.markViewAsRead(viewId)
|
|
}}
|
|
>
|
|
<ContextMenu.ItemTitle>Mark as Read</ContextMenu.ItemTitle>
|
|
<ContextMenu.ItemIcon
|
|
ios={{
|
|
name: "checklist.checked",
|
|
}}
|
|
/>
|
|
</ContextMenu.Item>
|
|
</ContextMenu.Content>
|
|
</ContextMenu.Root>
|
|
)
|
|
}
|