Files
Folo/apps/mobile/src/modules/screen/TimelineViewSelectorContextMenu.tsx
T
Innei 63e6a30d83 refactor(mobile): Update TimelineViewSelector context menu handling
- 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>
2025-02-19 21:44:29 +08:00

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