feat(trending): implement trending feature and components (#820)
* init Signed-off-by: Innei <i@innei.in> * update Signed-off-by: Innei <i@innei.in> * fix: update styles Signed-off-by: Innei <i@innei.in> * fix: hover Signed-off-by: Innei <i@innei.in> * update scroll Signed-off-by: Innei <i@innei.in> * update i18n Signed-off-by: Innei <i@innei.in> * chore: auto-fix linting and formatting issues --------- Signed-off-by: Innei <i@innei.in> Co-authored-by: Innei <Innei@users.noreply.github.com>
This commit is contained in:
@@ -46,6 +46,7 @@
|
||||
"@tanstack/react-query-persist-client": "5.56.2",
|
||||
"@use-gesture/react": "10.3.1",
|
||||
"@yornaath/batshit": "0.10.1",
|
||||
"camelcase-keys": "9.1.3",
|
||||
"class-variance-authority": "0.7.0",
|
||||
"click-to-react-component": "1.1.0",
|
||||
"clsx": "2.1.1",
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import camelcaseKeys from "camelcase-keys"
|
||||
|
||||
import { apiFetch } from "~/lib/api-fetch"
|
||||
import type { Models } from "~/models"
|
||||
|
||||
const v1ApiPrefix = "/v1"
|
||||
export const getTrendingAggregates = () => {
|
||||
return apiFetch<Models.TrendingAggregates>(`${v1ApiPrefix}/trendings`).then((data) =>
|
||||
camelcaseKeys(data as any, { deep: true }),
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import type { SVGProps } from "react"
|
||||
import React from "react"
|
||||
|
||||
export function IconoirBrightCrown(props: SVGProps<SVGSVGElement>) {
|
||||
return (
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" {...props}>
|
||||
<path
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth="1.5"
|
||||
d="M22 12h1M12 2V1m0 22v-1m8-2l-1-1m1-15l-1 1M4 20l1-1M4 4l1 1m-4 7h1m14.8 3.5l1.2-7l-4.2 2.1L12 8.5l-1.8 2.1L6 8.5l1.2 7z"
|
||||
/>
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import type { SVGProps } from "react"
|
||||
import React from "react"
|
||||
|
||||
export function PhUsersBold(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="M125.18 156.94a64 64 0 1 0-82.36 0a100.23 100.23 0 0 0-39.49 32a12 12 0 0 0 19.35 14.2a76 76 0 0 1 122.64 0a12 12 0 0 0 19.36-14.2a100.33 100.33 0 0 0-39.5-32M44 108a40 40 0 1 1 40 40a40 40 0 0 1-40-40m206.1 97.67a12 12 0 0 1-16.78-2.57A76.31 76.31 0 0 0 172 172a12 12 0 0 1 0-24a40 40 0 1 0-10.3-78.67a12 12 0 1 1-6.16-23.19a64 64 0 0 1 57.64 110.8a100.23 100.23 0 0 1 39.49 32a12 12 0 0 1-2.57 16.73"
|
||||
/>
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { PropsWithChildren } from "react"
|
||||
import { useState } from "react"
|
||||
import { m, useAnimationControls } from "framer-motion"
|
||||
import type { FC, PropsWithChildren } from "react"
|
||||
import { useEffect, useState } from "react"
|
||||
|
||||
import { m } from "~/components/common/Motion"
|
||||
import { stopPropagation } from "~/lib/dom"
|
||||
import { nextFrame, stopPropagation } from "~/lib/dom"
|
||||
import { cn } from "~/lib/utils"
|
||||
|
||||
import { ModalClose } from "./components"
|
||||
@@ -61,3 +61,52 @@ SlideUpModal.class = (className: string) => {
|
||||
<SlideUpModal {...props} className={cn(props.className, className)} />
|
||||
)
|
||||
}
|
||||
|
||||
const modalVariant = {
|
||||
enter: {
|
||||
x: 0,
|
||||
opacity: 1,
|
||||
},
|
||||
initial: {
|
||||
x: 700,
|
||||
opacity: 0.9,
|
||||
},
|
||||
exit: {
|
||||
x: 750,
|
||||
opacity: 0,
|
||||
},
|
||||
}
|
||||
export const DrawerModalLayout: FC<PropsWithChildren> = ({ children }) => {
|
||||
const { dismiss } = useCurrentModal()
|
||||
const controller = useAnimationControls()
|
||||
useEffect(() => {
|
||||
nextFrame(() => controller.start("enter"))
|
||||
}, [controller])
|
||||
|
||||
return (
|
||||
<div className={"h-full"} onPointerDown={dismiss} onClick={stopPropagation}>
|
||||
<m.div
|
||||
onPointerDown={stopPropagation}
|
||||
tabIndex={-1}
|
||||
initial="initial"
|
||||
animate={controller}
|
||||
variants={modalVariant}
|
||||
transition={{
|
||||
type: "spring",
|
||||
mass: 0.4,
|
||||
tension: 100,
|
||||
friction: 1,
|
||||
}}
|
||||
exit="exit"
|
||||
layout="size"
|
||||
className={cn(
|
||||
"flex flex-col items-center overflow-hidden rounded-xl border bg-theme-background p-8 pb-0",
|
||||
"shadow-drawer-to-left w-[60ch] max-w-full",
|
||||
"fixed inset-y-2 right-2",
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
</m.div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import { t } from "i18next"
|
||||
import { useCallback } from "react"
|
||||
|
||||
import { useModalStack } from "~/components/ui/modal/stacked"
|
||||
import { FeedForm } from "~/modules/discover/feed-form"
|
||||
import { ListForm } from "~/modules/discover/list-form"
|
||||
|
||||
export const useFollow = () => {
|
||||
const { present } = useModalStack()
|
||||
|
||||
return useCallback(
|
||||
(options?: { isList: boolean; id?: string; url?: string }) => {
|
||||
present({
|
||||
title: options?.isList
|
||||
? t("sidebar.feed_actions.edit_list")
|
||||
: t("sidebar.feed_actions.edit_feed"),
|
||||
content: ({ dismiss }) =>
|
||||
options?.isList ? (
|
||||
<ListForm asWidget id={options?.id} onSuccess={dismiss} />
|
||||
) : (
|
||||
<FeedForm asWidget id={options?.id} url={options?.url} onSuccess={dismiss} />
|
||||
),
|
||||
})
|
||||
},
|
||||
[present],
|
||||
)
|
||||
}
|
||||
@@ -1 +1,41 @@
|
||||
import type { User } from "@auth/core/types"
|
||||
|
||||
import type { FeedModel, ListModelPoplutedFeeds } from "./types"
|
||||
|
||||
export * from "./types"
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-namespace */
|
||||
export namespace Models {
|
||||
export interface TrendingList {
|
||||
id: string
|
||||
title: string
|
||||
description: string
|
||||
image: string
|
||||
view: number
|
||||
fee: number
|
||||
timelineUpdatedAt: string
|
||||
ownerUserId: string
|
||||
subscriberCount: number
|
||||
}
|
||||
|
||||
export interface TrendingAggregates {
|
||||
trendingFeeds: FeedModel[]
|
||||
trendingLists: ListModelPoplutedFeeds[]
|
||||
trendingEntries: TrendingEntry[]
|
||||
trendingUsers: User[]
|
||||
}
|
||||
|
||||
export interface TrendingEntry {
|
||||
id: string
|
||||
feedId: string
|
||||
title: string
|
||||
url: string
|
||||
content: string
|
||||
description: string
|
||||
guid: string
|
||||
author: string
|
||||
insertedAt: string
|
||||
publishedAt: string
|
||||
readCount: number
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ export const RecommendationCard: FC<RecommendationCardProps> = memo(({ data, rou
|
||||
{Object.keys(data.routes).map((route) => (
|
||||
<li
|
||||
key={route}
|
||||
className="hover:text-theme-foreground-hover"
|
||||
className="group hover:text-theme-foreground-hover"
|
||||
onClick={(e) => {
|
||||
;(e.target as HTMLElement).querySelector("button")?.click()
|
||||
}}
|
||||
@@ -35,7 +35,7 @@ export const RecommendationCard: FC<RecommendationCardProps> = memo(({ data, rou
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
className="-translate-x-1.5 rounded p-0.5 px-1.5 duration-200 hover:translate-x-0 hover:bg-muted"
|
||||
className="-translate-x-1.5 rounded p-0.5 px-1.5 duration-200 group-hover:translate-x-0 group-hover:bg-muted"
|
||||
onClick={() => {
|
||||
present({
|
||||
id: `recommendation-content-${route}`,
|
||||
|
||||
@@ -0,0 +1,312 @@
|
||||
import type { User } from "@auth/core/types"
|
||||
import { useQuery } from "@tanstack/react-query"
|
||||
import type { FC } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
|
||||
import { getTrendingAggregates } from "~/api/trending"
|
||||
import { FeedIcon } from "~/components/feed-icon"
|
||||
import { IconoirBrightCrown } from "~/components/icons/crown"
|
||||
import { PhUsersBold } from "~/components/icons/users"
|
||||
import { Avatar, AvatarFallback, AvatarImage } from "~/components/ui/avatar"
|
||||
import { ActionButton, Button } from "~/components/ui/button"
|
||||
import { LoadingWithIcon } from "~/components/ui/loading"
|
||||
import { useCurrentModal, useModalStack } from "~/components/ui/modal"
|
||||
import { DrawerModalLayout } from "~/components/ui/modal/stacked/custom-modal"
|
||||
import { ScrollArea } from "~/components/ui/scroll-area"
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from "~/components/ui/tooltip"
|
||||
import { EllipsisHorizontalTextWithTooltip } from "~/components/ui/typography"
|
||||
import { useFollow } from "~/hooks/biz/useFollow"
|
||||
import { stopPropagation } from "~/lib/dom"
|
||||
import { cn } from "~/lib/utils"
|
||||
import type { FeedModel, Models } from "~/models"
|
||||
|
||||
import { usePresentUserProfileModal } from "../profile/hooks"
|
||||
|
||||
export const Trend = () => {
|
||||
const { present } = useModalStack()
|
||||
const { t } = useTranslation()
|
||||
return (
|
||||
<Tooltip>
|
||||
<TooltipContent>{t("words.trending")}</TooltipContent>
|
||||
<TooltipTrigger asChild>
|
||||
<ActionButton
|
||||
onClick={() => {
|
||||
present({
|
||||
title: "Trending",
|
||||
content: TrendContent,
|
||||
CustomModalComponent: DrawerModalLayout,
|
||||
})
|
||||
}}
|
||||
className={cn(
|
||||
"size-6 text-accent duration-200 hover:shadow-none",
|
||||
"absolute bottom-1 right-3",
|
||||
)}
|
||||
>
|
||||
<i className="i-mgc-trending-up-cute-re" />
|
||||
</ActionButton>
|
||||
</TooltipTrigger>
|
||||
</Tooltip>
|
||||
)
|
||||
}
|
||||
const TrendContent = () => {
|
||||
const { data } = useQuery({
|
||||
queryKey: ["trending"],
|
||||
queryFn: () => {
|
||||
return getTrendingAggregates()
|
||||
},
|
||||
})
|
||||
|
||||
const { t } = useTranslation()
|
||||
const { dismiss } = useCurrentModal()
|
||||
if (!data)
|
||||
return (
|
||||
<div className="center absolute inset-0">
|
||||
<LoadingWithIcon
|
||||
icon={<i className="i-mingcute-trending-up-line text-3xl" />}
|
||||
size="large"
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
return (
|
||||
<div className="flex size-full grow flex-col gap-4">
|
||||
<div className="-mt-4 flex w-full items-center justify-center gap-2 text-2xl">
|
||||
<i className="i-mingcute-trending-up-line text-3xl" />
|
||||
<span className="font-bold">{t("words.trending")}</span>
|
||||
</div>
|
||||
<ActionButton
|
||||
className="absolute right-4 top-4"
|
||||
onClick={dismiss}
|
||||
tooltip={t("close", { ns: "common" })}
|
||||
>
|
||||
<i className="i-mgc-close-cute-re" />
|
||||
</ActionButton>
|
||||
<ScrollArea.ScrollArea
|
||||
rootClassName="flex h-0 w-[calc(100%+8px)] grow flex-col overflow-visible"
|
||||
viewportClassName="pb-4"
|
||||
scrollbarClassName="-mr-6"
|
||||
>
|
||||
<TrendingUsers data={data.trendingUsers} />
|
||||
<TrendingLists data={data.trendingLists} />
|
||||
<TrendingFeeds data={data.trendingFeeds} />
|
||||
|
||||
<TrendingEntries data={data.trendingEntries} />
|
||||
</ScrollArea.ScrollArea>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
const TrendingLists: FC<{
|
||||
data: Models.TrendingList[]
|
||||
}> = ({ data }) => {
|
||||
const follow = useFollow()
|
||||
const { t } = useTranslation()
|
||||
return (
|
||||
<section className="mt-8 w-full text-left">
|
||||
<h2 className="my-2 text-xl font-bold">{t("trending.list")}</h2>
|
||||
|
||||
<ul className="mt-4 flex flex-col gap-3 pb-4">
|
||||
{data.map((item) => (
|
||||
<li key={item.id}>
|
||||
<button
|
||||
type="button"
|
||||
className={"group relative flex w-full min-w-0 items-center pl-2"}
|
||||
onClick={() => {
|
||||
follow({ isList: true, id: item.id })
|
||||
}}
|
||||
>
|
||||
<div className="absolute -inset-y-1 inset-x-0 rounded-lg duration-200 group-hover:bg-theme-item-hover" />
|
||||
<FeedIcon feed={item as any} size={40} />
|
||||
|
||||
<div className={cn("ml-1 flex w-full flex-col text-left")}>
|
||||
<div className="flex items-end gap-2">
|
||||
<div className={cn("truncate text-base font-medium")}>{item.title}</div>
|
||||
|
||||
<UserCount count={item.subscriberCount} />
|
||||
</div>
|
||||
{!!item.description && (
|
||||
<div className={"-mt-0.5 line-clamp-2 text-xs"}>{item.description}</div>
|
||||
)}
|
||||
</div>
|
||||
</button>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
const UserCount = ({ count }: { count: number }) => {
|
||||
return (
|
||||
<span className="flex -translate-y-0.5 items-center gap-0.5 text-xs tabular-nums text-gray-500">
|
||||
<PhUsersBold className="size-3" />
|
||||
{count}
|
||||
</span>
|
||||
)
|
||||
}
|
||||
|
||||
interface TopUserAvatarProps {
|
||||
user: User
|
||||
position: string
|
||||
}
|
||||
|
||||
const TopUserAvatar: React.FC<TopUserAvatarProps> = ({ user, position }) => (
|
||||
<div className={`absolute ${position} group flex w-[50px] flex-col`}>
|
||||
<div className="absolute -inset-x-4 -inset-y-2 rounded-lg duration-200 group-hover:bg-theme-item-hover" />
|
||||
<Avatar className="block aspect-square size-[50px] overflow-hidden rounded-full border border-border ring-1 ring-background">
|
||||
<AvatarImage src={user?.image || undefined} />
|
||||
<AvatarFallback>{user.name?.slice(0, 2)}</AvatarFallback>
|
||||
</Avatar>
|
||||
|
||||
{user.name && (
|
||||
<EllipsisHorizontalTextWithTooltip className="mt-2 text-xs font-medium">
|
||||
<span>{user.name}</span>
|
||||
</EllipsisHorizontalTextWithTooltip>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
|
||||
const TrendingUsers: FC<{ data: User[] }> = ({ data }) => {
|
||||
const profile = usePresentUserProfileModal("dialog")
|
||||
const { t } = useTranslation()
|
||||
return (
|
||||
<section className="w-full text-left">
|
||||
<h2 className="my-2 text-xl font-bold">{t("trending.user")}</h2>
|
||||
<div className="relative h-[100px]">
|
||||
<div className="absolute left-[calc(50%+12px)] top-[12px] rotate-45 text-[20px] text-accent">
|
||||
<IconoirBrightCrown />
|
||||
</div>
|
||||
|
||||
{data.slice(0, 3).map((user, index: number) => (
|
||||
<button
|
||||
onFocusCapture={stopPropagation}
|
||||
type="button"
|
||||
onClick={() => {
|
||||
profile(user.id)
|
||||
}}
|
||||
key={user.id}
|
||||
>
|
||||
<TopUserAvatar
|
||||
user={user}
|
||||
position={
|
||||
index === 0
|
||||
? "left-1/2 -translate-x-1/2"
|
||||
: index === 1
|
||||
? "left-1/3 top-6 -translate-x-1/2"
|
||||
: "left-2/3 top-6 -translate-x-1/2"
|
||||
}
|
||||
/>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{data.length > 3 && (
|
||||
<ul className="mt-8 flex flex-col gap-4 pl-2">
|
||||
{data.slice(3).map((user) => (
|
||||
<li key={user.id}>
|
||||
<button
|
||||
onFocusCapture={stopPropagation}
|
||||
className="group relative flex w-full items-center gap-3"
|
||||
type="button"
|
||||
onClick={() => {
|
||||
profile(user.id)
|
||||
}}
|
||||
>
|
||||
<div className="absolute -inset-2 right-0 rounded-lg duration-200 group-hover:bg-theme-item-hover" />
|
||||
<Avatar className="block aspect-square size-[40px] overflow-hidden rounded-full border border-border ring-1 ring-background">
|
||||
<AvatarImage src={user?.image || undefined} />
|
||||
<AvatarFallback>{user.name?.slice(0, 2)}</AvatarFallback>
|
||||
</Avatar>
|
||||
<span className="font-medium">{user.name}</span>
|
||||
</button>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
const TrendingFeeds = ({ data }: { data: FeedModel[] }) => {
|
||||
const follow = useFollow()
|
||||
const { t } = useTranslation()
|
||||
return (
|
||||
<section className="mt-8 w-full text-left">
|
||||
<h2 className="my-2 text-xl font-bold">{t("trending.feed")}</h2>
|
||||
|
||||
<ul className="mt-2 flex flex-col">
|
||||
{data.map((feed) => {
|
||||
return (
|
||||
<li
|
||||
className={cn(
|
||||
"group flex w-full items-center gap-1 rounded-md pl-2 duration-200 hover:bg-theme-item-hover",
|
||||
"relative",
|
||||
)}
|
||||
key={feed.id}
|
||||
>
|
||||
<a
|
||||
target="_blank"
|
||||
href={`/feed/${feed.id}`}
|
||||
className="flex grow items-center gap-2 py-1"
|
||||
>
|
||||
<div>
|
||||
<FeedIcon feed={feed} size={24} className="rounded" />
|
||||
</div>
|
||||
<div className="flex w-full min-w-0 grow items-center">
|
||||
<div className={"truncate"}>{feed.title}</div>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<div className="pr-2">
|
||||
<UserCount count={(feed as any).subscriberCount} />
|
||||
|
||||
<Button
|
||||
type="button"
|
||||
buttonClassName={
|
||||
"absolute inset-y-0.5 right-0 font-medium opacity-0 duration-200 group-hover:opacity-100"
|
||||
}
|
||||
onClick={() => {
|
||||
follow({ isList: false, id: feed.id })
|
||||
}}
|
||||
>
|
||||
{t("feed_form.follow")}
|
||||
</Button>
|
||||
</div>
|
||||
</li>
|
||||
)
|
||||
})}
|
||||
</ul>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
const TrendingEntries = ({ data }: { data: Models.TrendingEntry[] }) => {
|
||||
const filteredData = data.filter((entry) => !entry.url.startsWith("https://x.com"))
|
||||
return (
|
||||
<section className="mt-8 w-full text-left">
|
||||
<h2 className="my-2 text-xl font-bold">Trending Entries</h2>
|
||||
|
||||
<ul className="mt-2 list-inside list-disc space-y-1">
|
||||
{filteredData.map((entry) => {
|
||||
return (
|
||||
<li
|
||||
key={entry.id}
|
||||
className="relative truncate whitespace-nowrap pr-10 marker:text-accent"
|
||||
>
|
||||
<a
|
||||
href={entry.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="follow-link--underline truncate text-sm"
|
||||
>
|
||||
{entry.title}
|
||||
</a>
|
||||
<span className="absolute right-0 top-0 flex items-center gap-0.5 text-xs opacity-60">
|
||||
<i className="i-mingcute-book-2-line" />
|
||||
<span>{entry.readCount}</span>
|
||||
</span>
|
||||
</li>
|
||||
)
|
||||
})}
|
||||
</ul>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import { DiscoverInboxList } from "~/modules/discover/inbox-list-form"
|
||||
import { Recommendations } from "~/modules/discover/recommendations"
|
||||
import { DiscoverRSS3 } from "~/modules/discover/rss3-form"
|
||||
import { DiscoverUser } from "~/modules/discover/user-form"
|
||||
import { Trend } from "~/modules/trending"
|
||||
|
||||
import { useSubViewTitle } from "../hooks"
|
||||
|
||||
@@ -64,12 +65,14 @@ export function Component() {
|
||||
})
|
||||
}}
|
||||
>
|
||||
<TabsList className="w-full">
|
||||
<TabsList className="relative w-full">
|
||||
{tabs.map((tab) => (
|
||||
<TabsTrigger key={tab.name} value={tab.value} disabled={tab.disabled}>
|
||||
{t(tab.name)}
|
||||
</TabsTrigger>
|
||||
))}
|
||||
|
||||
<Trend />
|
||||
</TabsList>
|
||||
{tabs.map((tab) => (
|
||||
<TabsContent key={tab.name} value={tab.value} className="mt-8">
|
||||
|
||||
@@ -7,8 +7,7 @@ import { toast } from "sonner"
|
||||
import { getGeneralSettings } from "~/atoms/settings/general"
|
||||
import { getUISettings } from "~/atoms/settings/ui"
|
||||
import { useModalStack } from "~/components/ui/modal"
|
||||
import { FeedForm } from "~/modules/discover/feed-form"
|
||||
import { ListForm } from "~/modules/discover/list-form"
|
||||
import { useFollow } from "~/hooks/biz/useFollow"
|
||||
import { usePresentUserProfileModal } from "~/modules/profile/hooks"
|
||||
import { useSettingModal } from "~/modules/settings/modal/hooks"
|
||||
|
||||
@@ -39,27 +38,16 @@ export const ExtensionExposeProvider = () => {
|
||||
|
||||
const { t } = useTranslation()
|
||||
|
||||
const follow = useFollow()
|
||||
const presentUserProfile = usePresentUserProfileModal("dialog")
|
||||
useEffect(() => {
|
||||
registerGlobalContext({
|
||||
follow(options) {
|
||||
present({
|
||||
title: options?.isList
|
||||
? t("sidebar.feed_actions.edit_list")
|
||||
: t("sidebar.feed_actions.edit_feed"),
|
||||
content: ({ dismiss }) =>
|
||||
options?.isList ? (
|
||||
<ListForm asWidget id={options?.id} onSuccess={dismiss} />
|
||||
) : (
|
||||
<FeedForm asWidget id={options?.id} url={options?.url} onSuccess={dismiss} />
|
||||
),
|
||||
})
|
||||
},
|
||||
follow,
|
||||
|
||||
profile(id, variant) {
|
||||
presentUserProfile(id, variant)
|
||||
},
|
||||
})
|
||||
}, [present, presentUserProfile, t])
|
||||
}, [follow, present, presentUserProfile, t])
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M24 0V24H0V0H24Z" fill="white" fill-opacity="0.01"/>
|
||||
<path d="M3 16L7.25 11.75C8.03001 10.97 8.42002 10.58 8.86852 10.4307C9.27846 10.2943 9.72154 10.2943 10.1315 10.4307C10.58 10.58 10.97 10.97 11.75 11.75V11.75C12.53 12.53 12.92 12.92 13.3685 13.0693C13.7785 13.2057 14.2215 13.2057 14.6315 13.0693C15.08 12.92 15.47 12.53 16.25 11.75L20.5 7.49999M17 6.99999C18.2574 6.47386 19.3841 6.42494 20.6172 6.85324C20.7989 6.91636 20.8898 6.94793 20.9709 7.02905C21.0521 7.11017 21.0836 7.20105 21.1468 7.38279C21.575 8.61587 21.5261 9.74262 21 11" stroke="#10161F" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 738 B |
+5
-1
@@ -247,6 +247,10 @@
|
||||
"tip_modal.tip_support": "⭐ Tip to show your support!",
|
||||
"tip_modal.tip_title": "Tip Power",
|
||||
"tip_modal.unclaimed_feed": "No one has claimed this feed yet. The received Power will be securely held in the blockchain contract until it is claimed.",
|
||||
"trending.entry": "Trending Entries",
|
||||
"trending.feed": "Trending Feeds",
|
||||
"trending.list": "Trending Lists",
|
||||
"trending.user": "Trending Users",
|
||||
"user_button.account": "Account",
|
||||
"user_button.achievement": "Achievements",
|
||||
"user_button.download_desktop_app": "Download Desktop app",
|
||||
@@ -259,7 +263,6 @@
|
||||
"user_profile.loading": "Loading",
|
||||
"user_profile.share": "Share",
|
||||
"user_profile.toggle_item_style": "Toggle Item Style",
|
||||
"uu": "Mark <which /> as readdddd?",
|
||||
"words.achievement": "Achievements",
|
||||
"words.add": "Add",
|
||||
"words.browser": "Browser",
|
||||
@@ -281,6 +284,7 @@
|
||||
"words.rsshub": "RSSHub",
|
||||
"words.search": "Search",
|
||||
"words.starred": "Starred",
|
||||
"words.trending": "Trending",
|
||||
"words.undo": "Undo",
|
||||
"words.unread": "Unread",
|
||||
"words.user": "User",
|
||||
|
||||
Generated
+32
@@ -426,6 +426,9 @@ importers:
|
||||
'@yornaath/batshit':
|
||||
specifier: 0.10.1
|
||||
version: 0.10.1
|
||||
camelcase-keys:
|
||||
specifier: 9.1.3
|
||||
version: 9.1.3
|
||||
class-variance-authority:
|
||||
specifier: 0.7.0
|
||||
version: 0.7.0
|
||||
@@ -4133,6 +4136,14 @@ packages:
|
||||
resolution: {integrity: sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==}
|
||||
engines: {node: '>= 6'}
|
||||
|
||||
camelcase-keys@9.1.3:
|
||||
resolution: {integrity: sha512-Rircqi9ch8AnZscQcsA1C47NFdaO3wukpmIRzYcDOrmvgt78hM/sj5pZhZNec2NM12uk5vTwRHZ4anGcrC4ZTg==}
|
||||
engines: {node: '>=16'}
|
||||
|
||||
camelcase@8.0.0:
|
||||
resolution: {integrity: sha512-8WB3Jcas3swSvjIeA2yvCJ+Miyz5l1ZmB6HFb9R1317dt9LCQoswg/BGrmAmkWVEszSrrg4RwmO46qIm2OEnSA==}
|
||||
engines: {node: '>=16'}
|
||||
|
||||
caniuse-api@3.0.0:
|
||||
resolution: {integrity: sha512-bsTwuIg/BZZK/vreVTYYbSWoe2F+71P7K5QGEX+pT250DZbfU1MQ5prOKpPR+LL6uWKK3KMwMCAS74QB3Um1uw==}
|
||||
|
||||
@@ -6303,6 +6314,10 @@ packages:
|
||||
resolution: {integrity: sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==}
|
||||
engines: {node: '>=6'}
|
||||
|
||||
map-obj@5.0.0:
|
||||
resolution: {integrity: sha512-2L3MIgJynYrZ3TYMriLDLWocz15okFakV6J12HXvMXDHui2x/zgChzg1u9mFFGbbGWE+GsLpQByt4POb9Or+uA==}
|
||||
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
|
||||
|
||||
markdown-table@3.0.3:
|
||||
resolution: {integrity: sha512-Z1NL3Tb1M9wH4XESsCDEksWoKTdlUafKc4pt0GRwjUyXaCFZ+dc3g2erqB6zm3szA2IUSi7VnPI+o/9jnxh9hw==}
|
||||
|
||||
@@ -7393,6 +7408,10 @@ packages:
|
||||
resolution: {integrity: sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==}
|
||||
engines: {node: '>=10'}
|
||||
|
||||
quick-lru@6.1.2:
|
||||
resolution: {integrity: sha512-AAFUA5O1d83pIHEhJwWCq/RQcRukCkn/NSm2QsTEMle5f2hP0ChI2+3Xb051PZCkLryI/Ir1MVKviT2FIloaTQ==}
|
||||
engines: {node: '>=12'}
|
||||
|
||||
raf-schd@4.0.3:
|
||||
resolution: {integrity: sha512-tQkJl2GRWh83ui2DiPTJz9wEiMN20syf+5oKfB03yYP7ioZcJwsIK8FjrtLwH1m7C7e+Tt2yYBlrOpdT+dyeIQ==}
|
||||
|
||||
@@ -13153,6 +13172,15 @@ snapshots:
|
||||
|
||||
camelcase-css@2.0.1: {}
|
||||
|
||||
camelcase-keys@9.1.3:
|
||||
dependencies:
|
||||
camelcase: 8.0.0
|
||||
map-obj: 5.0.0
|
||||
quick-lru: 6.1.2
|
||||
type-fest: 4.26.1
|
||||
|
||||
camelcase@8.0.0: {}
|
||||
|
||||
caniuse-api@3.0.0:
|
||||
dependencies:
|
||||
browserslist: 4.23.3
|
||||
@@ -15736,6 +15764,8 @@ snapshots:
|
||||
dependencies:
|
||||
p-defer: 1.0.0
|
||||
|
||||
map-obj@5.0.0: {}
|
||||
|
||||
markdown-table@3.0.3: {}
|
||||
|
||||
masonic@4.0.1(react@18.3.1):
|
||||
@@ -17019,6 +17049,8 @@ snapshots:
|
||||
|
||||
quick-lru@5.1.1: {}
|
||||
|
||||
quick-lru@6.1.2: {}
|
||||
|
||||
raf-schd@4.0.3: {}
|
||||
|
||||
random-path@0.1.2:
|
||||
|
||||
Reference in New Issue
Block a user