fix!: adjust external share page route

Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
Innei
2024-10-14 22:00:42 +08:00
parent d98c06e1c0
commit f09cd8107e
15 changed files with 342 additions and 279 deletions
@@ -1,7 +1,7 @@
import { WEB_URL } from "@follow/shared/constants"
import { env } from "@follow/shared/env"
import { FeedIcon } from "~/components/feed-icon"
import { UrlBuilder } from "~/lib/url-builder"
import { cn } from "~/lib/utils"
import type { FeedOrListRespModel } from "~/models"
@@ -24,9 +24,9 @@ export function FollowSummary({
switch (feed.type) {
case "list": {
siteLink = `${WEB_URL}/list/${feed.id}`
siteLink = UrlBuilder.shareList(feed.id)
feedLink = siteLink
feedText = `/list/${feed.id}`
feedText = UrlBuilder.shareList(feed.id)
break
}
case "inbox": {
@@ -1,4 +1,4 @@
import { IN_ELECTRON, WEB_URL } from "@follow/shared/constants"
import { IN_ELECTRON } from "@follow/shared/constants"
import { env } from "@follow/shared/env"
import { useMemo } from "react"
import { useTranslation } from "react-i18next"
@@ -7,6 +7,7 @@ import { whoami } from "~/atoms/user"
import { useModalStack } from "~/components/ui/modal"
import type { FeedViewType } from "~/lib/enum"
import type { NativeMenuItem, NullableNativeMenuItem } from "~/lib/native-menu"
import { UrlBuilder } from "~/lib/url-builder"
import { isBizId } from "~/lib/utils"
import { useFeedClaimModal } from "~/modules/claim"
import { FeedForm } from "~/modules/discover/feed-form"
@@ -175,7 +176,7 @@ export const useFeedActions = ({
}),
disabled: isEntryList,
shortcut: "O",
click: () => window.open(`${WEB_URL}/feed/${feedId}?view=${view}`, "_blank"),
click: () => window.open(UrlBuilder.shareFeed(feedId, view), "_blank"),
},
{
type: "text" as const,
@@ -298,7 +299,7 @@ export const useListActions = ({ listId, view }: { listId: string; view: FeedVie
}),
disabled: false,
shortcut: "O",
click: () => window.open(`${WEB_URL}/list/${listId}?view=${view}`, "_blank"),
click: () => window.open(UrlBuilder.shareList(listId, view), "_blank"),
},
{
@@ -311,8 +312,7 @@ export const useListActions = ({ listId, view }: { listId: string; view: FeedVie
disabled: false,
shortcut: "Meta+C",
click: () => {
const url = `${WEB_URL}/list/${listId}?view=${view}`
navigator.clipboard.writeText(url)
navigator.clipboard.writeText(UrlBuilder.shareList(listId, view))
},
},
{
+26
View File
@@ -0,0 +1,26 @@
import { WEB_URL } from "@follow/shared/constants"
class UrlBuilderStatic {
private join(path: string, query?: Record<string, string>) {
const nextUrl = new URL(WEB_URL)
nextUrl.pathname = path
if (query) {
for (const [key, value] of Object.entries(query)) {
nextUrl.searchParams.set(key, value)
}
}
return nextUrl.toString()
}
shareFeed(id: string, view?: number) {
return this.join(`share/feeds/${id}`, view ? { view: view.toString() } : undefined)
}
shareList(id: string, view?: number) {
return this.join(`share/lists/${id}`, view ? { view: view.toString() } : undefined)
}
profile(id: string) {
return this.join(`profile/${id}`)
}
}
export const UrlBuilder = new UrlBuilderStatic()
@@ -1,4 +1,3 @@
import { env } from "@follow/shared/env"
import { useDebounceCallback } from "usehooks-ts"
import { AudioPlayer, useAudioPlayerAtomSelector } from "~/atoms/player"
@@ -13,6 +12,7 @@ import { EllipsisHorizontalTextWithTooltip } from "~/components/ui/typography"
import { FEED_COLLECTION_LIST } from "~/constants"
import { useAsRead } from "~/hooks/biz/useAsRead"
import { useRouteParamsSelector } from "~/hooks/biz/useRouteParams"
import { UrlBuilder } from "~/lib/url-builder"
import { cn, isSafari } from "~/lib/utils"
import { FeedForm } from "~/modules/discover/feed-form"
import { EntryTranslation } from "~/modules/entry-column/translation"
@@ -55,9 +55,10 @@ export function ListItem({
{ leading: false },
)
const isSubscription = withFollow && entry?.entries.url?.startsWith(`${env.VITE_WEB_URL}/feed/`)
const isSubscription =
withFollow && entry?.entries.url?.startsWith(UrlBuilder.shareFeed(entry.feedId))
const feedId = isSubscription
? entry?.entries.url?.replace(`${env.VITE_WEB_URL}/feed/`, "")
? entry?.entries.url?.replace(UrlBuilder.shareFeed(entry.feedId), "")
: undefined
const isFollowed = !!useSubscriptionStore((state) => feedId && state.data[feedId])
const { present } = useModalStack()
@@ -1,4 +1,3 @@
import { WEB_URL } from "@follow/shared/constants"
import dayjs from "dayjs"
import { memo, useCallback, useState } from "react"
import { useTranslation } from "react-i18next"
@@ -17,6 +16,7 @@ import { nextFrame } from "~/lib/dom"
import type { FeedViewType } from "~/lib/enum"
import { getNewIssueUrl } from "~/lib/issues"
import { showNativeMenu } from "~/lib/native-menu"
import { UrlBuilder } from "~/lib/url-builder"
import { cn } from "~/lib/utils"
import { getPreferredTitle, useFeedById } from "~/store/feed"
import { useInboxById } from "~/store/inbox"
@@ -82,7 +82,7 @@ const FeedItemImpl = ({ view, feedId, className }: FeedItemProps) => {
)}
onClick={handleNavigate}
onDoubleClick={() => {
window.open(`${WEB_URL}/feed/${feedId}?view=${view}`, "_blank")
window.open(UrlBuilder.shareFeed(feedId, view), "_blank")
}}
onContextMenu={(e) => {
setIsContextMenuOpen(true)
@@ -215,7 +215,7 @@ const ListItemImpl: Component<{
)}
onClick={handleNavigate}
onDoubleClick={() => {
window.open(`${WEB_URL}/list/${listId}?view=${view}`, "_blank")
window.open(UrlBuilder.shareList(listId, view), "_blank")
}}
onContextMenu={(e) => {
setIsContextMenuOpen(true)
@@ -1,4 +1,3 @@
import { WEB_URL } from "@follow/shared/constants"
import { useTranslation } from "react-i18next"
import { FeedIcon } from "~/components/feed-icon"
@@ -15,6 +14,7 @@ import {
} from "~/components/ui/table"
import { EllipsisHorizontalTextWithTooltip } from "~/components/ui/typography"
import { useAuthQuery } from "~/hooks/common"
import { UrlBuilder } from "~/lib/url-builder"
import { Balance } from "~/modules/wallet/balance"
import { Queries } from "~/queries"
@@ -54,7 +54,7 @@ export const SettingFeeds = () => {
<TableCell size="sm">
<a
target="_blank"
href={`${WEB_URL}/feed/${row.feed.id}`}
href={UrlBuilder.shareFeed(row.feed.id)}
className="flex items-center"
>
<FeedIcon fallback feed={row.feed} size={16} />
@@ -1,4 +1,3 @@
import { WEB_URL } from "@follow/shared/constants"
import { useMutation } from "@tanstack/react-query"
import { toast } from "sonner"
@@ -20,6 +19,7 @@ import { Tooltip, TooltipContent, TooltipPortal, TooltipTrigger } from "~/compon
import { views } from "~/constants"
import { useAuthQuery, useI18n } from "~/hooks/common"
import { apiClient } from "~/lib/api-fetch"
import { UrlBuilder } from "~/lib/url-builder"
import { cn } from "~/lib/utils"
import { Balance } from "~/modules/wallet/balance"
import { Queries } from "~/queries"
@@ -90,7 +90,7 @@ export const SettingLists = () => {
<TableCell size="sm">
<a
target="_blank"
href={`${WEB_URL}/list/${row.id}`}
href={UrlBuilder.shareList(row.id)}
className="inline-flex items-center gap-2 font-semibold"
>
{row.image && (
@@ -1,4 +1,3 @@
import { WEB_URL } from "@follow/shared/constants"
import { zodResolver } from "@hookform/resolvers/zod"
import { useMutation } from "@tanstack/react-query"
import { useMemo, useRef, useState } from "react"
@@ -37,6 +36,7 @@ import {
import { views } from "~/constants"
import { apiClient } from "~/lib/api-fetch"
import { createErrorToaster } from "~/lib/error-parser"
import { UrlBuilder } from "~/lib/url-builder"
import { isBizId } from "~/lib/utils"
import type { FeedModel } from "~/models"
import { ViewSelectorRadioGroup } from "~/modules/shared/ViewSelectorRadioGroup"
@@ -317,7 +317,7 @@ const RowRender = ({ feedId, listId }: { feedId: string; listId: string }) => {
<TableCell size="sm">
<a
target="_blank"
href={`${WEB_URL}/list/${feed.id}`}
href={UrlBuilder.shareList(feed.id)}
className="flex items-center gap-2 font-semibold"
>
{feed.siteUrl && <FeedIcon className="mr-0" siteUrl={feed.siteUrl} />}
+2 -1
View File
@@ -16,6 +16,7 @@ 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 { UrlBuilder } from "~/lib/url-builder"
import { cn } from "~/lib/utils"
import type { FeedModel, Models } from "~/models"
@@ -248,7 +249,7 @@ const TrendingFeeds = ({ data }: { data: FeedModel[] }) => {
>
<a
target="_blank"
href={`/feed/${feed.id}`}
href={UrlBuilder.shareFeed(feed.id)}
className="flex grow items-center gap-2 py-1"
>
<div>
@@ -1,140 +1,11 @@
import type { FC } from "react"
import { useTranslation } from "react-i18next"
import { useParams, useSearchParams } from "react-router-dom"
import { toast } from "sonner"
import { redirect } from "react-router-dom"
import { PoweredByFooter } from "~/components/common/PoweredByFooter"
import { FeedCertification } from "~/components/feed-certification"
import { FeedIcon } from "~/components/feed-icon"
import { FollowIcon } from "~/components/icons/follow"
import { Button } from "~/components/ui/button"
import { ListItemHoverOverlay } from "~/components/ui/list-item-hover-overlay"
import { LoadingCircle } from "~/components/ui/loading"
import { views } from "~/constants"
import { usePresentFeedFormModal } from "~/hooks/biz/useFeedFormModal"
import { useTitle } from "~/hooks/common"
import type { FeedViewType } from "~/lib/enum"
import { cn } from "~/lib/utils"
import type { FeedModel } from "~/models"
import { getItemComponentByView } from "~/modules/entry-column/Items"
import type { UniversalItemProps } from "~/modules/entry-column/types"
import { useEntriesPreview } from "~/queries/entries"
import { useFeed } from "~/queries/feed"
export function Component() {
const { id } = useParams()
const [search] = useSearchParams()
const view = Number.parseInt(search.get("view") || "0")
const feed = useFeed({
id,
})
const feedData = feed.data?.feed as FeedModel
const isSubscribed = !!feed.data?.subscription
const entries = useEntriesPreview({
id,
})
const Item: FC<UniversalItemProps> = getItemComponentByView(view as FeedViewType)
const { t } = useTranslation("external")
useTitle(feed.data?.feed.title)
const presentFeedFormModal = usePresentFeedFormModal()
return (
<>
{feed.isLoading ? (
<LoadingCircle size="large" className="center fixed inset-0" />
) : (
feed.data?.feed && (
<div className="mx-auto mt-12 flex max-w-5xl flex-col items-center justify-center p-4 lg:p-0">
<FeedIcon
fallback
feed={feed.data.feed}
className="mask-squircle mask shrink-0"
size={64}
/>
<div className="flex flex-col items-center">
<div className="mb-2 mt-4 flex items-center text-2xl font-bold">
<h1>{feed.data.feed.title}</h1>
<FeedCertification feed={feed.data.feed} />
</div>
<div className="mb-8 text-sm text-zinc-500">{feed.data.feed.description}</div>
</div>
<div className="mb-4 text-sm">
{t("feed.followsAndReads", {
subscriptionCount: feed.data.subscriptionCount,
subscriptionNoun: t("feed.follower", { count: feed.data.subscriptionCount }),
readCount: feed.data.readCount,
readNoun: t("feed.read", { count: feed.data.readCount }),
appName: APP_NAME,
})}
</div>
<span className="center mb-8 flex gap-4">
{feedData.url.startsWith("https://") ? (
<Button
variant={"outline"}
onClick={() => {
window.open(feedData.url, "_blank")
}}
>
{t("feed.view_feed_url")}
</Button>
) : (
<Button
variant={"outline"}
onClick={() => {
toast.success(t("copied_link"))
navigator.clipboard.writeText(feedData.url)
}}
>
{t("feed.copy_feed_url")}
</Button>
)}
<Button
variant={isSubscribed ? "outline" : undefined}
onClick={() => {
presentFeedFormModal({
feedId: id!,
})
}}
>
<FollowIcon className="mr-1 size-3" />
{isSubscribed ? t("feed.actions.followed") : <>{APP_NAME}</>}
</Button>
</span>
<div
className={cn(
"w-full pb-12 pt-8",
views[view].gridMode
? "grid grid-cols-2 gap-4 md:grid-cols-3 lg:grid-cols-4"
: "flex max-w-3xl flex-col gap-6",
)}
>
{entries.data?.map((entry) => (
<a
className="relative cursor-pointer"
href={entry.url || void 0}
target="_blank"
key={entry.id}
>
<ListItemHoverOverlay className="rounded">
<Item
entryPreview={{
entries: entry,
feeds: feedData,
read: true,
feedId: feedData.id!,
}}
entryId={entry.id}
/>
</ListItemHoverOverlay>
</a>
))}
</div>
<PoweredByFooter className="pb-12" />
</div>
)
)}
</>
)
/**
* @deprecated remove after split application
*/
export const loader = async ({ params }: { params: { id: string } }) => {
return redirect(`/share/feeds/${params.id}`)
}
export function Component() {
return null
}
@@ -1,122 +1,11 @@
import { useTranslation } from "react-i18next"
import { useParams } from "react-router-dom"
import { toast } from "sonner"
import { PoweredByFooter } from "~/components/common/PoweredByFooter"
import { FeedCertification } from "~/components/feed-certification"
import { FeedIcon } from "~/components/feed-icon"
import { FollowIcon } from "~/components/icons/follow"
import { Button } from "~/components/ui/button"
import { LoadingCircle } from "~/components/ui/loading"
import { usePresentFeedFormModal } from "~/hooks/biz/useFeedFormModal"
import { useTitle } from "~/hooks/common"
import type { ListModel } from "~/models"
import { useList } from "~/queries/lists"
import { useFeedById } from "~/store/feed/hooks"
import { redirect } from "react-router-dom"
export const loader = async ({ params }: { params: { id: string } }) => {
return redirect(`/share/lists/${params.id}`)
}
/**
* @deprecated remove after split application
*/
export function Component() {
const { id } = useParams()
const list = useList({
id: id!,
})
const listData = list.data?.list as ListModel
const isSubscribed = !!list.data?.subscription
const { t } = useTranslation("external")
useTitle(list.data?.list.title)
const presentFeedFormModal = usePresentFeedFormModal()
return (
<>
{list.isLoading ? (
<LoadingCircle size="large" className="center fixed inset-0" />
) : (
list.data?.list && (
<div className="mx-auto mt-12 flex max-w-5xl flex-col items-center justify-center p-4 lg:p-0">
<FeedIcon
fallback
feed={list.data.list}
className="mask-squircle mask shrink-0"
size={64}
/>
<div className="flex flex-col items-center">
<div className="mb-2 mt-4 flex items-center text-2xl font-bold">
<h1>{list.data.list.title}</h1>
<FeedCertification feed={list.data.list} />
</div>
<div className="mb-8 text-sm text-zinc-500">{list.data.list.description}</div>
</div>
<div className="mb-4 text-sm">
{t("feed.followsAndFeeds", {
subscriptionCount: list.data?.subscriptionCount,
subscriptionNoun: t("feed.follower", { count: list.data?.subscriptionCount }),
feedsCount: list.data?.feedCount || 0,
feedsNoun: t("feed.feeds", { count: listData?.feedIds?.length }),
appName: APP_NAME,
})}
</div>
<span className="center mb-8 flex gap-4">
<Button
variant={"outline"}
onClick={() => {
toast.success(t("copied_link"))
navigator.clipboard.writeText(id!)
}}
>
Copy List ID
</Button>
<Button
variant={isSubscribed ? "outline" : undefined}
onClick={() => {
presentFeedFormModal({
listId: id!,
})
}}
>
<FollowIcon className="mr-2 size-3" />
{isSubscribed ? "Followed" : <>{APP_NAME}</>}
</Button>
</span>
<div className="flex w-full max-w-3xl flex-col gap-4 pb-12 pt-8">
{listData.feedIds
?.slice(0, 5)
.map((feedId) => <FeedRow feedId={feedId} key={feedId} />)}
{"feedCount" in list.data && (
<div
onClick={() => {
presentFeedFormModal({
listId: id!,
})
}}
className="text-sm text-zinc-500"
>
{t("feed.follow_to_view_all", {
count: list.data.feedCount || 0,
})}
</div>
)}
</div>
<PoweredByFooter className="mt-20 pb-12" />
</div>
)
)}
</>
)
}
const FeedRow = ({ feedId }: { feedId: string }) => {
const feed = useFeedById(feedId)
if (!feed) return null
return (
<a
className="relative flex cursor-pointer items-center text-base"
href={`/feed/${feed.id}`}
target="_blank"
key={feed.id}
>
<FeedIcon fallback feed={feed} className="mask-squircle mask mr-2 shrink-0" size={20} />
{feed.title}
<FeedCertification feed={feed} />
</a>
)
return null
}
@@ -13,6 +13,7 @@ import { useAuthQuery, useI18n, useTitle } from "~/hooks/common"
import { apiClient } from "~/lib/api-fetch"
import { defineQuery } from "~/lib/defineQuery"
import { replaceImgUrlIfNeed } from "~/lib/img-proxy"
import { UrlBuilder } from "~/lib/url-builder"
import { cn, isBizId } from "~/lib/utils"
import { useUserSubscriptionsQuery } from "~/modules/profile/hooks"
@@ -80,7 +81,7 @@ export function Component() {
<div key={subscription.feedId} className="group relative border-b py-5">
<a
className="flex flex-1 cursor-button"
href={`/feed/${subscription.feedId}`}
href={UrlBuilder.shareFeed(subscription.feedId)}
target="_blank"
>
<FeedIcon
@@ -0,0 +1,140 @@
import type { FC } from "react"
import { useTranslation } from "react-i18next"
import { useParams, useSearchParams } from "react-router-dom"
import { toast } from "sonner"
import { PoweredByFooter } from "~/components/common/PoweredByFooter"
import { FeedCertification } from "~/components/feed-certification"
import { FeedIcon } from "~/components/feed-icon"
import { FollowIcon } from "~/components/icons/follow"
import { Button } from "~/components/ui/button"
import { ListItemHoverOverlay } from "~/components/ui/list-item-hover-overlay"
import { LoadingCircle } from "~/components/ui/loading"
import { views } from "~/constants"
import { usePresentFeedFormModal } from "~/hooks/biz/useFeedFormModal"
import { useTitle } from "~/hooks/common"
import type { FeedViewType } from "~/lib/enum"
import { cn } from "~/lib/utils"
import type { FeedModel } from "~/models"
import { getItemComponentByView } from "~/modules/entry-column/Items"
import type { UniversalItemProps } from "~/modules/entry-column/types"
import { useEntriesPreview } from "~/queries/entries"
import { useFeed } from "~/queries/feed"
export function Component() {
const { id } = useParams()
const [search] = useSearchParams()
const view = Number.parseInt(search.get("view") || "0")
const feed = useFeed({
id,
})
const feedData = feed.data?.feed as FeedModel
const isSubscribed = !!feed.data?.subscription
const entries = useEntriesPreview({
id,
})
const Item: FC<UniversalItemProps> = getItemComponentByView(view as FeedViewType)
const { t } = useTranslation("external")
useTitle(feed.data?.feed.title)
const presentFeedFormModal = usePresentFeedFormModal()
return (
<>
{feed.isLoading ? (
<LoadingCircle size="large" className="center fixed inset-0" />
) : (
feed.data?.feed && (
<div className="mx-auto mt-12 flex max-w-5xl flex-col items-center justify-center p-4 lg:p-0">
<FeedIcon
fallback
feed={feed.data.feed}
className="mask-squircle mask shrink-0"
size={64}
/>
<div className="flex flex-col items-center">
<div className="mb-2 mt-4 flex items-center text-2xl font-bold">
<h1>{feed.data.feed.title}</h1>
<FeedCertification feed={feed.data.feed} />
</div>
<div className="mb-8 text-sm text-zinc-500">{feed.data.feed.description}</div>
</div>
<div className="mb-4 text-sm">
{t("feed.followsAndReads", {
subscriptionCount: feed.data.subscriptionCount,
subscriptionNoun: t("feed.follower", { count: feed.data.subscriptionCount }),
readCount: feed.data.readCount,
readNoun: t("feed.read", { count: feed.data.readCount }),
appName: APP_NAME,
})}
</div>
<span className="center mb-8 flex gap-4">
{feedData.url.startsWith("https://") ? (
<Button
variant={"outline"}
onClick={() => {
window.open(feedData.url, "_blank")
}}
>
{t("feed.view_feed_url")}
</Button>
) : (
<Button
variant={"outline"}
onClick={() => {
toast.success(t("copied_link"))
navigator.clipboard.writeText(feedData.url)
}}
>
{t("feed.copy_feed_url")}
</Button>
)}
<Button
variant={isSubscribed ? "outline" : undefined}
onClick={() => {
presentFeedFormModal({
feedId: id!,
})
}}
>
<FollowIcon className="mr-1 size-3" />
{isSubscribed ? t("feed.actions.followed") : <>{APP_NAME}</>}
</Button>
</span>
<div
className={cn(
"w-full pb-12 pt-8",
views[view].gridMode
? "grid grid-cols-2 gap-4 md:grid-cols-3 lg:grid-cols-4"
: "flex max-w-3xl flex-col gap-6",
)}
>
{entries.data?.map((entry) => (
<a
className="relative cursor-pointer"
href={entry.url || void 0}
target="_blank"
key={entry.id}
>
<ListItemHoverOverlay className="rounded">
<Item
entryPreview={{
entries: entry,
feeds: feedData,
read: true,
feedId: feedData.id!,
}}
entryId={entry.id}
/>
</ListItemHoverOverlay>
</a>
))}
</div>
<PoweredByFooter className="pb-12" />
</div>
)
)}
</>
)
}
@@ -0,0 +1,122 @@
import { useTranslation } from "react-i18next"
import { useParams } from "react-router-dom"
import { toast } from "sonner"
import { PoweredByFooter } from "~/components/common/PoweredByFooter"
import { FeedCertification } from "~/components/feed-certification"
import { FeedIcon } from "~/components/feed-icon"
import { FollowIcon } from "~/components/icons/follow"
import { Button } from "~/components/ui/button"
import { LoadingCircle } from "~/components/ui/loading"
import { usePresentFeedFormModal } from "~/hooks/biz/useFeedFormModal"
import { useTitle } from "~/hooks/common"
import type { ListModel } from "~/models"
import { useList } from "~/queries/lists"
import { useFeedById } from "~/store/feed/hooks"
export function Component() {
const { id } = useParams()
const list = useList({
id: id!,
})
const listData = list.data?.list as ListModel
const isSubscribed = !!list.data?.subscription
const { t } = useTranslation("external")
useTitle(list.data?.list.title)
const presentFeedFormModal = usePresentFeedFormModal()
return (
<>
{list.isLoading ? (
<LoadingCircle size="large" className="center fixed inset-0" />
) : (
list.data?.list && (
<div className="mx-auto mt-12 flex max-w-5xl flex-col items-center justify-center p-4 lg:p-0">
<FeedIcon
fallback
feed={list.data.list}
className="mask-squircle mask shrink-0"
size={64}
/>
<div className="flex flex-col items-center">
<div className="mb-2 mt-4 flex items-center text-2xl font-bold">
<h1>{list.data.list.title}</h1>
<FeedCertification feed={list.data.list} />
</div>
<div className="mb-8 text-sm text-zinc-500">{list.data.list.description}</div>
</div>
<div className="mb-4 text-sm">
{t("feed.followsAndFeeds", {
subscriptionCount: list.data?.subscriptionCount,
subscriptionNoun: t("feed.follower", { count: list.data?.subscriptionCount }),
feedsCount: list.data?.feedCount || 0,
feedsNoun: t("feed.feeds", { count: listData?.feedIds?.length }),
appName: APP_NAME,
})}
</div>
<span className="center mb-8 flex gap-4">
<Button
variant={"outline"}
onClick={() => {
toast.success(t("copied_link"))
navigator.clipboard.writeText(id!)
}}
>
Copy List ID
</Button>
<Button
variant={isSubscribed ? "outline" : undefined}
onClick={() => {
presentFeedFormModal({
listId: id!,
})
}}
>
<FollowIcon className="mr-2 size-3" />
{isSubscribed ? "Followed" : <>{APP_NAME}</>}
</Button>
</span>
<div className="flex w-full max-w-3xl flex-col gap-4 pb-12 pt-8">
{listData.feedIds
?.slice(0, 5)
.map((feedId) => <FeedRow feedId={feedId} key={feedId} />)}
{"feedCount" in list.data && (
<div
onClick={() => {
presentFeedFormModal({
listId: id!,
})
}}
className="text-sm text-zinc-500"
>
{t("feed.follow_to_view_all", {
count: list.data.feedCount || 0,
})}
</div>
)}
</div>
<PoweredByFooter className="mt-20 pb-12" />
</div>
)
)}
</>
)
}
const FeedRow = ({ feedId }: { feedId: string }) => {
const feed = useFeedById(feedId)
if (!feed) return null
return (
<a
className="relative flex cursor-pointer items-center text-base"
href={`/share/feeds/${feed.id}`}
target="_blank"
key={feed.id}
>
<FeedIcon fallback feed={feed} className="mask-squircle mask mr-2 shrink-0" size={20} />
{feed.title}
<FeedCertification feed={feed} />
</a>
)
}
+12
View File
@@ -13,6 +13,18 @@
"destination": "/index.html"
}
],
"redirects": [
{
"source": "/feed/:id",
"destination": "/share/feeds/:id",
"permanent": true
},
{
"source": "/list/:id",
"destination": "/share/lists/:id",
"permanent": true
}
],
"headers": [
{
"source": "/vendor/(.*)",