feat: followed status for external follow button
This commit is contained in:
@@ -311,36 +311,31 @@ const SearchCard: FC<{
|
||||
)}
|
||||
</CardContent>
|
||||
<CardFooter>
|
||||
{item.isSubscribed ? (
|
||||
<Button variant="outline" disabled>
|
||||
Followed
|
||||
</Button>
|
||||
) : (
|
||||
<Button
|
||||
onClick={() => {
|
||||
present({
|
||||
title: "Add Feed",
|
||||
content: ({ dismiss }) => (
|
||||
<FeedForm
|
||||
asWidget
|
||||
url={item.feed?.url}
|
||||
id={item.feed?.id || item.list?.id}
|
||||
isList={!!item.list?.id}
|
||||
defaultValues={{
|
||||
view: getSidebarActiveView().toString(),
|
||||
}}
|
||||
onSuccess={() => {
|
||||
onSuccess(item)
|
||||
dismiss()
|
||||
}}
|
||||
/>
|
||||
),
|
||||
})
|
||||
}}
|
||||
>
|
||||
Follow
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
variant={item.isSubscribed ? "outline" : undefined}
|
||||
onClick={() => {
|
||||
present({
|
||||
title: "Add Feed",
|
||||
content: ({ dismiss }) => (
|
||||
<FeedForm
|
||||
asWidget
|
||||
url={item.feed?.url}
|
||||
id={item.feed?.id || item.list?.id}
|
||||
isList={!!item.list?.id}
|
||||
defaultValues={{
|
||||
view: getSidebarActiveView().toString(),
|
||||
}}
|
||||
onSuccess={() => {
|
||||
onSuccess(item)
|
||||
dismiss()
|
||||
}}
|
||||
/>
|
||||
),
|
||||
})
|
||||
}}
|
||||
>
|
||||
{item.isSubscribed ? "Followed" : "Follow"}
|
||||
</Button>
|
||||
<div className="ml-6 text-zinc-500">
|
||||
<span className="font-medium text-zinc-800 dark:text-zinc-200">
|
||||
{item.subscriptionCount}
|
||||
|
||||
@@ -34,6 +34,7 @@ export function Component() {
|
||||
id,
|
||||
})
|
||||
const feedData = feed.data?.feed as FeedModel
|
||||
const isSubscribed = !!feed.data?.subscription
|
||||
const entries = useEntriesPreview({
|
||||
id,
|
||||
})
|
||||
@@ -118,6 +119,7 @@ export function Component() {
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
variant={isSubscribed ? "outline" : undefined}
|
||||
onClick={() => {
|
||||
presentFeedFormModal({
|
||||
feedId: id!,
|
||||
@@ -125,7 +127,7 @@ export function Component() {
|
||||
}}
|
||||
>
|
||||
<FollowIcon className="mr-1 size-3" />
|
||||
{APP_NAME}
|
||||
{isSubscribed ? "Followed" : <>{APP_NAME}</>}
|
||||
</Button>
|
||||
</span>
|
||||
<div
|
||||
|
||||
@@ -21,6 +21,7 @@ export function Component() {
|
||||
isList: true,
|
||||
})
|
||||
const listData = feed.data?.feed as ListModel
|
||||
const isSubscribed = !!feed.data?.subscription
|
||||
|
||||
const { t } = useTranslation("external")
|
||||
useTitle(feed.data?.feed.title)
|
||||
@@ -65,14 +66,15 @@ export function Component() {
|
||||
Copy List ID
|
||||
</Button>
|
||||
<Button
|
||||
variant={isSubscribed ? "outline" : undefined}
|
||||
onClick={() => {
|
||||
presentFeedFormModal({
|
||||
listId: id!,
|
||||
})
|
||||
}}
|
||||
>
|
||||
<FollowIcon className="mr-1 size-3" />
|
||||
{APP_NAME}
|
||||
<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">
|
||||
|
||||
Reference in New Issue
Block a user