feat(SettingsLayout): hide `Operators` page if is email account
This commit is contained in:
parent
6622f1c117
commit
255fb693a9
|
|
@ -1,5 +1,7 @@
|
|||
import { useRouter } from "next/router"
|
||||
import React from "react"
|
||||
import { useAccountState } from "@crossbell/connect-kit"
|
||||
|
||||
import { type TabItem, Tabs } from "../ui/Tabs"
|
||||
import { DashboardMain } from "./DashboardMain"
|
||||
|
||||
|
|
@ -9,6 +11,9 @@ export const SettingsLayout: React.FC<{
|
|||
type: "site" | "account"
|
||||
}> = ({ title, children, type }) => {
|
||||
const router = useRouter()
|
||||
const isEmailAccount = useAccountState(
|
||||
(s) => s.computed.account?.type === "email",
|
||||
)
|
||||
|
||||
const subdomain = router.query.subdomain as string
|
||||
const tabItems: TabItem[] = (
|
||||
|
|
@ -23,6 +28,7 @@ export const SettingsLayout: React.FC<{
|
|||
{ text: "Custom CSS", href: `/dashboard/${subdomain}/settings/css` },
|
||||
{
|
||||
text: "Operators",
|
||||
hidden: isEmailAccount,
|
||||
href: `/dashboard/${subdomain}/settings/operator`,
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import { UniLink } from "./UniLink"
|
|||
export type TabItem = {
|
||||
text: string
|
||||
href?: string
|
||||
hidden?: boolean
|
||||
onClick?: () => void
|
||||
active?: boolean
|
||||
}
|
||||
|
|
@ -13,6 +14,8 @@ export const Tabs: React.FC<{ items: TabItem[] }> = ({ items }) => {
|
|||
return (
|
||||
<div className="flex border-b space-x-5 mb-8">
|
||||
{items.map((item) => {
|
||||
if (item.hidden) return null
|
||||
|
||||
return (
|
||||
<UniLink
|
||||
href={item.href}
|
||||
|
|
|
|||
Loading…
Reference in New Issue