diff --git a/src/app/(home)/(activities)/tag/[tag]/page.tsx b/src/app/(home)/(activities)/tag/[tag]/page.tsx index 60da187a..bc7c3db9 100644 --- a/src/app/(home)/(activities)/tag/[tag]/page.tsx +++ b/src/app/(home)/(activities)/tag/[tag]/page.tsx @@ -3,6 +3,7 @@ import { Metadata } from "next" import { Hydrate, dehydrate } from "@tanstack/react-query" import { HomeFeed } from "~/components/home/HomeFeed" +import ParticipateButton from "~/components/home/ParticipateButton" import { APP_NAME } from "~/lib/env" import getQueryClient from "~/lib/query-client" import { prefetchGetFeed } from "~/queries/home.server" @@ -41,7 +42,13 @@ export default async function Tag({ return ( - Tag: {params.tag} + + + + {params.tag} + + + ) diff --git a/src/app/(home)/(activities)/topic/[topic]/page.tsx b/src/app/(home)/(activities)/topic/[topic]/page.tsx index 31f11f62..9063b88d 100644 --- a/src/app/(home)/(activities)/topic/[topic]/page.tsx +++ b/src/app/(home)/(activities)/topic/[topic]/page.tsx @@ -3,6 +3,7 @@ import { Metadata } from "next" import { Hydrate, dehydrate } from "@tanstack/react-query" import { HomeFeed } from "~/components/home/HomeFeed" +import ParticipateButton from "~/components/home/ParticipateButton" import { APP_NAME } from "~/lib/env" import { getTranslation } from "~/lib/i18n" import getQueryClient from "~/lib/query-client" @@ -49,7 +50,7 @@ export default async function Topic({ - + {info?.includeTags[0]} {t(info?.description || "")} @@ -58,9 +59,7 @@ export default async function Topic({ {t("Topic Keywords")}: {info?.includeKeywords?.join(", ")} ) : null} - {/* - {t("Participate in Topic")} - */} + diff --git a/src/app/dashboard/[subdomain]/editor/page-component.tsx b/src/app/dashboard/[subdomain]/editor/page-component.tsx index 5337bc68..07c68fe2 100644 --- a/src/app/dashboard/[subdomain]/editor/page-component.tsx +++ b/src/app/dashboard/[subdomain]/editor/page-component.tsx @@ -99,6 +99,7 @@ export default function SubdomainEditor() { let pageId = searchParams?.get("id") as string | undefined const isPost = searchParams?.get("type") === "post" + const defaultTag = searchParams?.get("tag") const site = useGetSite(subdomain) @@ -117,7 +118,9 @@ export default function SubdomainEditor() { router.replace( `/dashboard/${subdomain}/editor?id=!local-${randomId}&type=${searchParams?.get( "type", - )}`, + )}${ + searchParams?.get("tag") ? "&tag=" + searchParams?.get("tag") : "" + }`, ) } else { key = `draft-${site.data?.characterId}-${pageId}` @@ -159,7 +162,10 @@ export default function SubdomainEditor() { // reset editor state when page changes useBeforeMounted(() => { - useEditorState.setState(initialEditorState) + useEditorState.setState({ + ...initialEditorState, + tags: defaultTag || "", + }) }) const values = useEditorState() diff --git a/src/components/home/HomeActivitiesTabs.tsx b/src/components/home/HomeActivitiesTabs.tsx index 4b7fce3c..1df17bcc 100644 --- a/src/components/home/HomeActivitiesTabs.tsx +++ b/src/components/home/HomeActivitiesTabs.tsx @@ -2,7 +2,11 @@ import { usePathname, useRouter } from "next/navigation" -import { useAccountState, useConnectModal } from "@crossbell/connect-kit" +import { + useAccountState, + useConnectModal, + useConnectedAction, +} from "@crossbell/connect-kit" import { Tabs } from "~/components/ui/Tabs" import { useTranslation } from "~/lib/i18n/client" @@ -32,13 +36,7 @@ export const HomeActivitiesTabs = () => { }, { text: "Following", - onClick: () => { - if (!currentCharacterId) { - connectModal.show() - } else { - router.push(`/following`) - } - }, + onClick: useConnectedAction(() => router.push(`/following`)), active: pathname === "/following", }, { diff --git a/src/components/home/ParticipateButton.tsx b/src/components/home/ParticipateButton.tsx new file mode 100644 index 00000000..3982d6f4 --- /dev/null +++ b/src/components/home/ParticipateButton.tsx @@ -0,0 +1,22 @@ +"use client" + +import { useAccountState, useConnectedAction } from "@crossbell/connect-kit" + +import { Button } from "~/components/ui/Button" +import { useTranslation } from "~/lib/i18n/client" + +export default function ParticipateButton({ tag }: { tag: string }) { + const { t } = useTranslation("index") + + const handleClick = useConnectedAction(() => { + const handle = + useAccountState.getState().computed.account?.character?.handle + window.open(`/dashboard/${handle}/editor?type=post&tag=${tag}`) + }) + + return ( + + {t("Participate in Topic")} + + ) +}
{t(info?.description || "")}