@@ -0,0 +1,7 @@
|
||||
import type { SVGProps } from "react"
|
||||
|
||||
export function PhCrown(props: SVGProps<SVGSVGElement>) {
|
||||
return (
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 256 256" {...props}><path fill="currentColor" d="M248 80a28 28 0 1 0-51.12 15.77l-26.79 33L146 73.4a28 28 0 1 0-36.06 0l-24.03 55.34l-26.79-33a28 28 0 1 0-26.6 12L47 194.63A16 16 0 0 0 62.78 208h130.44A16 16 0 0 0 209 194.63l14.47-86.85A28 28 0 0 0 248 80M128 40a12 12 0 1 1-12 12a12 12 0 0 1 12-12M24 80a12 12 0 1 1 12 12a12 12 0 0 1-12-12m169.22 112H62.78l-13.92-83.48L81.79 149a8 8 0 0 0 6.21 3a8 8 0 0 0 1.08-.07a8 8 0 0 0 6.26-4.74l29.3-67.4a27 27 0 0 0 6.72 0l29.3 67.4a8 8 0 0 0 6.26 4.74a8 8 0 0 0 1.08.07a8 8 0 0 0 6.21-3l32.93-40.52ZM220 92a12 12 0 1 1 12-12a12 12 0 0 1-12 12" /></svg>
|
||||
)
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
import { getMainContainerElement } from "@renderer/atoms/dom"
|
||||
import { useMe } from "@renderer/atoms/user"
|
||||
import { FeedIcon } from "@renderer/components/feed-icon"
|
||||
import { PhCrown } from "@renderer/components/icons/crown"
|
||||
import {
|
||||
Tooltip,
|
||||
TooltipContent,
|
||||
@@ -61,71 +63,81 @@ const FeedItemImpl = ({
|
||||
const feed = useFeedById(feedId)
|
||||
|
||||
const { items } = useFeedActions({ feedId, view })
|
||||
const me = useMe()
|
||||
const isOwned = feed && feed.ownerUserId === me?.id
|
||||
|
||||
if (!feed) return null
|
||||
|
||||
return (
|
||||
<div
|
||||
data-feed-id={feedId}
|
||||
className={cn(
|
||||
"flex w-full items-center justify-between rounded-md py-[2px] pr-2.5 text-sm font-medium leading-loose",
|
||||
isActive && "bg-native-active",
|
||||
className,
|
||||
)}
|
||||
onClick={handleNavigate}
|
||||
onDoubleClick={() => {
|
||||
window.open(`${WEB_URL}/feed/${feedId}?view=${view}`, "_blank")
|
||||
}}
|
||||
onContextMenu={(e) => {
|
||||
const nextItems = items.concat()
|
||||
if (feed.errorAt && feed.errorMessage) {
|
||||
nextItems.push(
|
||||
{
|
||||
type: "separator",
|
||||
disabled: false,
|
||||
},
|
||||
{
|
||||
label: "Feedback",
|
||||
type: "text",
|
||||
click: () => {
|
||||
window.open(
|
||||
getNewIssueUrl({
|
||||
body:
|
||||
`### Error\n\nError Message: ${feed.errorMessage}\n\n### Info\n\n` +
|
||||
`\`\`\`json\n${
|
||||
JSON.stringify(feed, null, 2)
|
||||
}\n\`\`\``,
|
||||
label: "bug",
|
||||
title: `Feed Error: ${feed.title}, ${feed.errorMessage}`,
|
||||
}),
|
||||
)
|
||||
},
|
||||
},
|
||||
)
|
||||
}
|
||||
showNativeMenu(
|
||||
nextItems,
|
||||
e,
|
||||
)
|
||||
}}
|
||||
>
|
||||
<TooltipProvider delayDuration={300}>
|
||||
<div
|
||||
data-feed-id={feedId}
|
||||
className={cn(
|
||||
"flex min-w-0 items-center",
|
||||
feed.errorAt && "text-red-900 dark:text-red-500",
|
||||
"flex w-full items-center justify-between rounded-md py-[2px] pr-2.5 text-sm font-medium leading-loose",
|
||||
isActive && "bg-native-active",
|
||||
className,
|
||||
)}
|
||||
onClick={handleNavigate}
|
||||
onDoubleClick={() => {
|
||||
window.open(`${WEB_URL}/feed/${feedId}?view=${view}`, "_blank")
|
||||
}}
|
||||
onContextMenu={(e) => {
|
||||
const nextItems = items.concat()
|
||||
if (feed.errorAt && feed.errorMessage) {
|
||||
nextItems.push(
|
||||
{
|
||||
type: "separator",
|
||||
disabled: false,
|
||||
},
|
||||
{
|
||||
label: "Feedback",
|
||||
type: "text",
|
||||
click: () => {
|
||||
window.open(
|
||||
getNewIssueUrl({
|
||||
body:
|
||||
`### Error\n\nError Message: ${feed.errorMessage}\n\n### Info\n\n` +
|
||||
`\`\`\`json\n${JSON.stringify(feed, null, 2)}\n\`\`\``,
|
||||
label: "bug",
|
||||
title: `Feed Error: ${feed.title}, ${feed.errorMessage}`,
|
||||
}),
|
||||
)
|
||||
},
|
||||
},
|
||||
)
|
||||
}
|
||||
showNativeMenu(nextItems, e)
|
||||
}}
|
||||
>
|
||||
<FeedIcon fallback feed={feed} size={16} />
|
||||
<div
|
||||
className={cn(
|
||||
"truncate",
|
||||
!showUnreadCount &&
|
||||
(feedUnread ? "font-bold" : "font-medium opacity-70"),
|
||||
"flex min-w-0 items-center",
|
||||
feed.errorAt && "text-red-900 dark:text-red-500",
|
||||
)}
|
||||
>
|
||||
{feed.title}
|
||||
</div>
|
||||
{feed.errorAt && (
|
||||
<TooltipProvider delayDuration={300}>
|
||||
<FeedIcon fallback feed={feed} size={16} />
|
||||
<div
|
||||
className={cn(
|
||||
"truncate",
|
||||
!showUnreadCount &&
|
||||
(feedUnread ? "font-bold" : "font-medium opacity-70"),
|
||||
)}
|
||||
>
|
||||
{feed.title}
|
||||
</div>
|
||||
{isOwned && (
|
||||
<Tooltip>
|
||||
<TooltipTrigger>
|
||||
<PhCrown className="ml-1 shrink-0 text-base" />
|
||||
</TooltipTrigger>
|
||||
|
||||
<TooltipPortal>
|
||||
<TooltipContent>This feed is owned by you</TooltipContent>
|
||||
</TooltipPortal>
|
||||
</Tooltip>
|
||||
)}
|
||||
{feed.errorAt && (
|
||||
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<i className="i-mgc-wifi-off-cute-re ml-1 shrink-0 text-base" />
|
||||
@@ -152,10 +164,10 @@ const FeedItemImpl = ({
|
||||
</TooltipContent>
|
||||
</TooltipPortal>
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
)}
|
||||
{subscription.isPrivate && (
|
||||
<TooltipProvider delayDuration={300}>
|
||||
|
||||
)}
|
||||
{subscription.isPrivate && (
|
||||
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<i className="i-mgc-eye-close-cute-re ml-1 shrink-0 text-base" />
|
||||
@@ -166,15 +178,17 @@ const FeedItemImpl = ({
|
||||
</TooltipContent>
|
||||
</TooltipPortal>
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
|
||||
)}
|
||||
</div>
|
||||
|
||||
{showUnreadCount && !!feedUnread && (
|
||||
<div className="ml-2 text-xs text-zinc-500 dark:text-neutral-400">
|
||||
{feedUnread}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
{showUnreadCount && !!feedUnread && (
|
||||
<div className="ml-2 text-xs text-zinc-500 dark:text-neutral-400">
|
||||
{feedUnread}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</TooltipProvider>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user