diff --git a/src/app/dashboard/[subdomain]/layout.tsx b/src/app/dashboard/[subdomain]/layout.tsx
index aa1f9b13..8b7d5f64 100644
--- a/src/app/dashboard/[subdomain]/layout.tsx
+++ b/src/app/dashboard/[subdomain]/layout.tsx
@@ -12,14 +12,13 @@ import {
import { ConnectButton } from "~/components/common/ConnectButton"
import { Logo } from "~/components/common/Logo"
-import { SEOHead } from "~/components/common/SEOHead"
import { DashboardSidebar } from "~/components/dashboard/DashboardSidebar"
import { DashboardTopbar } from "~/components/dashboard/DashboardTopbar"
import { Avatar } from "~/components/ui/Avatar"
import { UniLink } from "~/components/ui/UniLink"
import { useIsMobileLayout } from "~/hooks/useMobileLayout"
import { useUserRole } from "~/hooks/useUserRole"
-import { APP_NAME, DISCORD_LINK } from "~/lib/env"
+import { DISCORD_LINK } from "~/lib/env"
import { getSiteLink } from "~/lib/helpers"
import { toGateway } from "~/lib/ipfs-parser"
import { getStorage } from "~/lib/storage"
@@ -169,7 +168,8 @@ export default function DashboardLayout({
return ready ? (
hasPermission ? (
<>
-
+ {/* TODO */}
+ {/* */}
{site?.data?.metadata?.content?.css && (
= ({ siteName, title, description, image, icon, site }) => {
- return (
-
- {title ? `${title} - ${siteName}` : `${siteName}`}
-
-
-
-
-
-
-
- {image && (
- <>
-
-
- >
- )}
-
- {site ? (
- <>
-
-
-
-
-
- >
- ) : (
- <>
-
-
-
-
-
-
-
-
-
-
- >
- )}
-
- )
-}
diff --git a/src/components/dashboard/DashboardLayout.tsx b/src/components/dashboard/DashboardLayout.tsx
deleted file mode 100644
index 35cdd577..00000000
--- a/src/components/dashboard/DashboardLayout.tsx
+++ /dev/null
@@ -1,388 +0,0 @@
-import { useParams } from "next/navigation"
-import React, { useEffect } from "react"
-import { useTranslation } from "react-i18next"
-
-import { useAccountState, useConnectModal } from "@crossbell/connect-kit"
-import {
- useNotifications,
- useShowNotificationModal,
-} from "@crossbell/notification"
-
-import { ConnectButton } from "~/components/common/ConnectButton"
-import { Logo } from "~/components/common/Logo"
-import { Avatar } from "~/components/ui/Avatar"
-import { useIsMobileLayout } from "~/hooks/useMobileLayout"
-import { useUserRole } from "~/hooks/useUserRole"
-import { APP_NAME, DISCORD_LINK } from "~/lib/env"
-import { getSiteLink } from "~/lib/helpers"
-import { toGateway } from "~/lib/ipfs-parser"
-import { getStorage } from "~/lib/storage"
-import { cn } from "~/lib/utils"
-import { useGetPagesBySite } from "~/queries/page"
-import { useGetSite } from "~/queries/site"
-
-import { SEOHead } from "../common/SEOHead"
-import { UniLink } from "../ui/UniLink"
-import { DashboardSidebar } from "./DashboardSidebar"
-import { DashboardTopbar } from "./DashboardTopbar"
-
-export function DashboardLayout({
- children,
- title,
-}: {
- children: React.ReactNode
- title: string
-}) {
- const params = useParams()
- const subdomain = params?.subdomain as string
- const site = useGetSite(subdomain)
-
- const userRole = useUserRole(subdomain)
- const [ssrReady, account] = useAccountState(({ ssrReady, computed }) => [
- ssrReady,
- computed.account,
- ])
- const connectModal = useConnectModal()
- const [ready, setReady] = React.useState(false)
- const [hasPermission, setHasPermission] = React.useState(false)
- const { t } = useTranslation("dashboard")
-
- const isMobileLayout = useIsMobileLayout()
-
- useEffect(() => {
- if (ssrReady) {
- if (!account) {
- setReady(false)
- setHasPermission(false)
- connectModal.show()
- } else if (userRole.isSuccess) {
- setReady(true)
- if (userRole.data) {
- setHasPermission(true)
- } else {
- setHasPermission(false)
- }
- }
- }
- }, [ssrReady, userRole.isSuccess, userRole.data, account, connectModal])
-
- const showNotificationModal = useShowNotificationModal()
- const { isAllRead } = useNotifications()
-
- const pages = useGetPagesBySite({
- type: "post",
- characterId: 50153,
- limit: 1,
- })
- const [isEventsAllRead, setIsEventsAllRead] = React.useState(true)
- const latestEventRead = getStorage("latestEventRead")?.value || 0
- useEffect(() => {
- if (pages.isSuccess) {
- if (
- new Date(pages.data.pages[0].list?.[0].createdAt) >
- new Date(latestEventRead)
- ) {
- setIsEventsAllRead(false)
- } else {
- setIsEventsAllRead(true)
- }
- }
- }, [pages.isSuccess, pages.data?.pages, latestEventRead])
-
- const links: {
- href?: string
- onClick?: () => void
- isActive: (ctx: { href: string; pathname: string }) => boolean
- icon: React.ReactNode
- text: string
- }[] = [
- {
- href: `/dashboard/${subdomain}`,
- isActive: ({ href, pathname }) => href === pathname,
- icon: "icon-[mingcute--grid-line]",
- text: "Dashboard",
- },
- {
- href: `/dashboard/${subdomain}/posts`,
- isActive: ({ href, pathname }) => href === pathname,
- icon: "icon-[mingcute--news-line]",
- text: "Posts",
- },
- {
- href: `/dashboard/${subdomain}/pages`,
- isActive: ({ href, pathname }) => href === pathname,
- icon: "icon-[mingcute--file-line]",
- text: "Pages",
- },
- {
- href: `/dashboard/${subdomain}/comments`,
- isActive: ({ href, pathname }) => href === pathname,
- icon: "icon-[mingcute--comment-line]",
- text: "Comments",
- },
- {
- onClick: showNotificationModal,
- isActive: ({ href, pathname }) => href === pathname,
- icon: isAllRead
- ? "icon-[mingcute--notification-line]"
- : "icon-[mingcute--notification-fill]",
- text: isAllRead ? "Notifications" : "Unread notifications",
- },
- {
- href: `/dashboard/${subdomain}/import`,
- isActive: ({ pathname }) =>
- pathname.startsWith(`/dashboard/${subdomain}/import`),
- icon: "icon-[mingcute--file-import-line]",
- text: "Import",
- },
- {
- href: `/dashboard/${subdomain}/events`,
- isActive: ({ href, pathname }) => href === pathname,
- icon: isEventsAllRead
- ? "icon-[mingcute--flag-4-line]"
- : "icon-[mingcute--flag-4-fill]",
- text: isEventsAllRead ? "Events" : "New Events",
- },
- {
- href: `/dashboard/${subdomain}/achievements`,
- isActive: ({ href, pathname }) => href === pathname,
- icon: "icon-[mingcute--trophy-line]",
- text: "Achievements",
- },
- {
- href: `/dashboard/${subdomain}/tokens`,
- isActive: ({ href, pathname }) => href === pathname,
- icon: "icon-[mingcute--pig-money-line]",
- text: "Tokens",
- },
- {
- href: `/dashboard/${subdomain}/settings/general`,
- isActive: ({ pathname }) =>
- pathname.startsWith(`/dashboard/${subdomain}/settings`),
- icon: "icon-[mingcute--settings-3-line]",
- text: "Settings",
- },
- ]
-
- return ready ? (
- hasPermission ? (
- <>
-
- {site?.data?.metadata?.content?.css && (
-
- )}
-
- {isMobileLayout ? (
-
-
-
- }
- drawerWidget={(close: any) => (
- <>
-
-
-
- {links.map((link) => {
- const active =
- link.href &&
- link.isActive({
- pathname: router.asPath,
- href: link.href,
- })
- return (
-
close()}>
-
-
- {t(link.text)}
-
-
- )
- })}
-
-
-
-
- {{t("Need help?")}}
-
-
-
- {{t("View Site")}}
-
-
-
- >
- )}
- >
- {(isOpen) => 233
}
-
- ) : (
-
- {(isOpen) => (
- <>
-
-
-
-
-
- {isOpen && "xLog"}
-
- {account?.character?.handle &&
- subdomain &&
- account?.character?.handle !== subdomain && (
-
-
- {isOpen && "You are operating"}
-
-
- {isOpen && (
-
-
- {site.data?.metadata?.content?.name}
-
-
- @{site.data?.handle}
-
-
- )}
-
- )}
-
-
-
-
-
- {links.map((link) => {
- const active =
- link.href &&
- link.isActive({
- pathname: router.asPath,
- href: link.href,
- })
- return (
-
-
- {isOpen && {t(link.text)}}
-
- )
- })}
-
-
-
-
-
- {isOpen && {t("Need help?")}}
-
-
-
- {isOpen && {t("View Site")}}
-
-
- >
- )}
-
- )}
-
-
- {children}
-
-
- >
- ) : (
-
-
-
- Sorry, you do not have permission to access the current page.
-
-
- Please switch account or request the owner to set you as the operator.
-
-
- Take me to my own dashboard
-
-
- )
- ) : (
-
- Loading...
-
- )
-}
diff --git a/src/components/main/MainLayout.tsx b/src/components/main/MainLayout.tsx
deleted file mode 100644
index 75420e7a..00000000
--- a/src/components/main/MainLayout.tsx
+++ /dev/null
@@ -1,127 +0,0 @@
-import { useRouter } from "next/navigation"
-
-import { Logo } from "~/components/common/Logo"
-import {
- APP_DESCRIPTION,
- APP_NAME,
- DISCORD_LINK,
- GITHUB_LINK,
- TWITTER_LINK,
-} from "~/lib/env"
-import { getSiteLink } from "~/lib/helpers"
-import { useTranslation } from "~/lib/i18n/client"
-import { cn } from "~/lib/utils"
-
-import { ConnectButton } from "../common/ConnectButton"
-import { DarkModeSwitch } from "../common/DarkModeSwitch"
-import { SEOHead } from "../common/SEOHead"
-import { Image } from "../ui/Image"
-import { UniLink } from "../ui/UniLink"
-
-const tabs = [
- {
- name: "Home",
- link: "/",
- },
- {
- name: "Activities",
- link: "/activities",
- },
- {
- name: (
-
- ),
- link: GITHUB_LINK,
- },
-]
-
-export function MainLayout({
- children,
- title,
-}: {
- children?: React.ReactNode
- title?: string
-}) {
- const { t } = useTranslation("index")
- const router = useRouter()
-
- return (
- <>
-
-
- {children}
-
- >
- )
-}
diff --git a/src/components/site/SiteLayout.tsx b/src/components/site/SiteLayout.tsx
deleted file mode 100644
index a4b5dd0a..00000000
--- a/src/components/site/SiteLayout.tsx
+++ /dev/null
@@ -1,130 +0,0 @@
-import { useRouter } from "next/navigation"
-import React, { useEffect } from "react"
-
-import { useAccountState } from "@crossbell/connect-kit"
-
-import { BlockchainInfo } from "~/components/common/BlockchainInfo"
-import { Style } from "~/components/common/Style"
-import { useUserRole } from "~/hooks/useUserRole"
-import { IS_PROD, IS_VERCEL_PREVIEW } from "~/lib/constants"
-import { OUR_DOMAIN, SITE_URL } from "~/lib/env"
-import { getUserContentsUrl } from "~/lib/user-contents"
-import { cn } from "~/lib/utils"
-import { useCheckLike, useCheckMint, useGetPage } from "~/queries/page"
-import { useGetSite, useGetSubscription } from "~/queries/site"
-
-import { SEOHead } from "../common/SEOHead"
-import { FABContainer } from "../ui/FAB"
-import { BackToTopFAB } from "./BackToTopFAB"
-import { SiteFooter } from "./SiteFooter"
-import { SiteHeader } from "./SiteHeader"
-
-export type SiteLayoutProps = {
- children: React.ReactNode
- title?: string | null
- siteId?: string
- useStat?: boolean
- type: "index" | "post" | "tag" | "nft" | "404" | "archive"
-}
-
-export const SiteLayout: React.FC = ({
- children,
- title,
- siteId,
- useStat,
- type,
-}) => {
- const router = useRouter()
- const domainOrSubdomain = (router.query.site || siteId) as string
- const pageSlug = router.query.page as string
- const tag = router.query.tag as string
-
- const site = useGetSite(domainOrSubdomain)
-
- const page = useGetPage({
- characterId: site.data?.characterId,
- slug: pageSlug,
- ...(useStat && {
- useStat: true,
- }),
- })
-
- const isConnected = useAccountState((s) => !!s.computed.account)
- const userRole = useUserRole(domainOrSubdomain)
- const subscription = useGetSubscription(site.data?.characterId)
- const [{ isLiked }] = useCheckLike({
- characterId: page.data?.characterId,
- noteId: page.data?.noteId,
- })
- const isMint = useCheckMint({
- characterId: page.data?.characterId,
- noteId: page.data?.noteId,
- })
-
- useEffect(() => {
- if (site.data) {
- if (
- window.location.host.split(".").slice(-2).join(".") !== OUR_DOMAIN &&
- window.location.host !== site.data?.metadata?.content?.custom_domain &&
- IS_PROD &&
- !IS_VERCEL_PREVIEW
- ) {
- window.location.href = SITE_URL
- }
- }
- }, [site.isSuccess, site.data])
-
- return (
-
-
]*>/g, "")
- }
- image={
- page.data?.metadata?.content?.cover ||
- getUserContentsUrl(site.data?.metadata?.content?.avatars?.[0])
- }
- icon={getUserContentsUrl(site.data?.metadata?.content?.avatars?.[0])}
- site={domainOrSubdomain}
- />
-
- {site.data && }
- `xlog-post-tag-${tag}`,
- ),
- )}
- >
- {children}
-
- {site.data && (
-
-
-
- )}
-
-
-
-
-
-
- )
-}