feat: not refreshed DashboardLayout
This commit is contained in:
@@ -38,6 +38,7 @@ import { Button } from "~/components/ui/Button"
|
||||
import { Modal } from "~/components/ui/Modal"
|
||||
import { CSB_SCAN } from "~/lib/env"
|
||||
import { showConfetti } from "~/lib/confetti"
|
||||
import type { ReactElement } from "react"
|
||||
|
||||
const getInputDatetimeValue = (date: Date | string) => {
|
||||
const str = dayjs(date).format()
|
||||
@@ -374,199 +375,194 @@ export default function SubdomainEditor() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<DashboardLayout title="Editor">
|
||||
<DashboardMain fullWidth>
|
||||
{page.isLoading ? (
|
||||
<div className="flex justify-center items-center min-h-[300px]">
|
||||
Loading...
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
<header className="flex justify-between absolute top-0 left-0 right-0 z-10 px-5 h-14 border-b items-center text-sm">
|
||||
<div className="flex items-center">
|
||||
<EditorToolbar
|
||||
view={view}
|
||||
toolbars={toolbars}
|
||||
></EditorToolbar>
|
||||
<UniLink
|
||||
className="ml-7 align-middle"
|
||||
href={`${getSiteLink({
|
||||
subdomain: "xlog",
|
||||
})}/xfm`}
|
||||
>
|
||||
Tip: xLog Flavored Markdown
|
||||
</UniLink>
|
||||
</div>
|
||||
<div className="flex items-center space-x-3">
|
||||
<span
|
||||
className={clsx(
|
||||
`text-sm capitalize`,
|
||||
visibility === PageVisibilityEnum.Draft
|
||||
? `text-zinc-300`
|
||||
: visibility === PageVisibilityEnum.Modified
|
||||
? "text-orange-600"
|
||||
: "text-green-600",
|
||||
)}
|
||||
>
|
||||
{visibility?.toLowerCase()}
|
||||
</span>
|
||||
<Button
|
||||
isAutoWidth
|
||||
onClick={() => {
|
||||
window.open(
|
||||
`/_site/${subdomain}/preview/${draftKey.replace(
|
||||
`draft-${subdomain}-`,
|
||||
"",
|
||||
)}`,
|
||||
)
|
||||
}}
|
||||
>
|
||||
Preview
|
||||
</Button>
|
||||
<PublishButton
|
||||
save={savePage}
|
||||
published={visibility !== PageVisibilityEnum.Draft}
|
||||
isSaving={createOrUpdatePage.isLoading}
|
||||
isDisabled={
|
||||
visibility !== PageVisibilityEnum.Modified &&
|
||||
visibility !== PageVisibilityEnum.Draft
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</header>
|
||||
<div className="h-screen pt-14 flex w-full">
|
||||
<div className="h-full overflow-auto w-full">
|
||||
<div className="h-full mx-auto pt-5 flex flex-col">
|
||||
<div className="px-5 h-12">
|
||||
<input
|
||||
type="text"
|
||||
name="title"
|
||||
value={values.title}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter") {
|
||||
view?.focus()
|
||||
}
|
||||
}}
|
||||
onChange={(e) => updateValue("title", e.target.value)}
|
||||
className="h-12 ml-1 inline-flex items-center border-none text-3xl font-bold w-full focus:outline-none"
|
||||
placeholder="Title goes here.."
|
||||
/>
|
||||
</div>
|
||||
<div className="mt-5 flex-1 flex overflow-hidden">
|
||||
<Editor
|
||||
value={values.content}
|
||||
onChange={onChange}
|
||||
handleDropFile={handleDropFile}
|
||||
onScroll={onEditorScroll}
|
||||
// onUpdate={onUpdate}
|
||||
onCreateEditor={onCreateEditor}
|
||||
onMouseEnter={() => {
|
||||
setCurrentScrollArea("editor")
|
||||
}}
|
||||
/>
|
||||
<PageContent
|
||||
className="px-5 w-1/2 overflow-scroll pb-[200px]"
|
||||
parsedContent={parsedContent}
|
||||
inputRef={previewRef}
|
||||
onScroll={onPreviewScroll}
|
||||
onMouseEnter={() => {
|
||||
setCurrentScrollArea("preview")
|
||||
}}
|
||||
></PageContent>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="h-full overflow-auto flex-shrink-0 w-[280px] border-l bg-zinc-50 p-5 space-y-5">
|
||||
<div>
|
||||
<Input
|
||||
type="datetime-local"
|
||||
label="Publish at"
|
||||
isBlock
|
||||
name="publishAt"
|
||||
id="publishAt"
|
||||
value={getInputDatetimeValue(values.publishedAt)}
|
||||
onChange={(e: ChangeEvent<HTMLInputElement>) => {
|
||||
const value = inLocalTimezone(
|
||||
e.target.value,
|
||||
).toISOString()
|
||||
updateValue("publishedAt", value)
|
||||
<DashboardMain fullWidth>
|
||||
{page.isLoading ? (
|
||||
<div className="flex justify-center items-center min-h-[300px]">
|
||||
Loading...
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
<header className="flex justify-between absolute top-0 left-0 right-0 z-10 px-5 h-14 border-b items-center text-sm">
|
||||
<div className="flex items-center">
|
||||
<EditorToolbar view={view} toolbars={toolbars}></EditorToolbar>
|
||||
<UniLink
|
||||
className="ml-7 align-middle"
|
||||
href={`${getSiteLink({
|
||||
subdomain: "xlog",
|
||||
})}/xfm`}
|
||||
>
|
||||
Tip: xLog Flavored Markdown
|
||||
</UniLink>
|
||||
</div>
|
||||
<div className="flex items-center space-x-3">
|
||||
<span
|
||||
className={clsx(
|
||||
`text-sm capitalize`,
|
||||
visibility === PageVisibilityEnum.Draft
|
||||
? `text-zinc-300`
|
||||
: visibility === PageVisibilityEnum.Modified
|
||||
? "text-orange-600"
|
||||
: "text-green-600",
|
||||
)}
|
||||
>
|
||||
{visibility?.toLowerCase()}
|
||||
</span>
|
||||
<Button
|
||||
isAutoWidth
|
||||
onClick={() => {
|
||||
window.open(
|
||||
`/_site/${subdomain}/preview/${draftKey.replace(
|
||||
`draft-${subdomain}-`,
|
||||
"",
|
||||
)}`,
|
||||
)
|
||||
}}
|
||||
>
|
||||
Preview
|
||||
</Button>
|
||||
<PublishButton
|
||||
save={savePage}
|
||||
published={visibility !== PageVisibilityEnum.Draft}
|
||||
isSaving={createOrUpdatePage.isLoading}
|
||||
isDisabled={
|
||||
visibility !== PageVisibilityEnum.Modified &&
|
||||
visibility !== PageVisibilityEnum.Draft
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</header>
|
||||
<div className="h-screen pt-14 flex w-full">
|
||||
<div className="h-full overflow-auto w-full">
|
||||
<div className="h-full mx-auto pt-5 flex flex-col">
|
||||
<div className="px-5 h-12">
|
||||
<input
|
||||
type="text"
|
||||
name="title"
|
||||
value={values.title}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter") {
|
||||
view?.focus()
|
||||
}
|
||||
}}
|
||||
help={`This ${
|
||||
isPost ? "post" : "page"
|
||||
} will be accessible from this time`}
|
||||
onChange={(e) => updateValue("title", e.target.value)}
|
||||
className="h-12 ml-1 inline-flex items-center border-none text-3xl font-bold w-full focus:outline-none"
|
||||
placeholder="Title goes here.."
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<Input
|
||||
name="slug"
|
||||
value={values.slug}
|
||||
placeholder={defaultSlug}
|
||||
label={`${isPost ? "Post" : "Page"} slug`}
|
||||
id="slug"
|
||||
isBlock
|
||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||
updateValue("slug", e.target.value)
|
||||
}
|
||||
help={
|
||||
<>
|
||||
{(values.slug || defaultSlug) && (
|
||||
<>
|
||||
This {isPost ? "post" : "page"} will be accessible
|
||||
at{" "}
|
||||
<UniLink
|
||||
href={`${getSiteLink({
|
||||
subdomain,
|
||||
domain: site.data?.custom_domain,
|
||||
})}/${values.slug || defaultSlug}`}
|
||||
className="hover:underline"
|
||||
>
|
||||
{getSiteLink({
|
||||
subdomain,
|
||||
domain: site.data?.custom_domain,
|
||||
noProtocol: true,
|
||||
})}
|
||||
/{values.slug || defaultSlug}
|
||||
</UniLink>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<Input
|
||||
name="tags"
|
||||
value={values.tags}
|
||||
label="Tags"
|
||||
id="tags"
|
||||
isBlock
|
||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||
updateValue("tags", e.target.value)
|
||||
}
|
||||
help='Separate multiple tags with English commas ","'
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<Input
|
||||
label="Excerpt"
|
||||
isBlock
|
||||
name="excerpt"
|
||||
id="excerpt"
|
||||
value={values.excerpt}
|
||||
multiline
|
||||
rows={5}
|
||||
onChange={(e: ChangeEvent<HTMLTextAreaElement>) => {
|
||||
updateValue("excerpt", e.target.value)
|
||||
<div className="mt-5 flex-1 flex overflow-hidden">
|
||||
<Editor
|
||||
value={values.content}
|
||||
onChange={onChange}
|
||||
handleDropFile={handleDropFile}
|
||||
onScroll={onEditorScroll}
|
||||
// onUpdate={onUpdate}
|
||||
onCreateEditor={onCreateEditor}
|
||||
onMouseEnter={() => {
|
||||
setCurrentScrollArea("editor")
|
||||
}}
|
||||
help="Leave it blank to use auto-generated excerpt"
|
||||
/>
|
||||
<PageContent
|
||||
className="px-5 w-1/2 overflow-scroll pb-[200px]"
|
||||
parsedContent={parsedContent}
|
||||
inputRef={previewRef}
|
||||
onScroll={onPreviewScroll}
|
||||
onMouseEnter={() => {
|
||||
setCurrentScrollArea("preview")
|
||||
}}
|
||||
></PageContent>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</DashboardMain>
|
||||
</DashboardLayout>
|
||||
<div className="h-full overflow-auto flex-shrink-0 w-[280px] border-l bg-zinc-50 p-5 space-y-5">
|
||||
<div>
|
||||
<Input
|
||||
type="datetime-local"
|
||||
label="Publish at"
|
||||
isBlock
|
||||
name="publishAt"
|
||||
id="publishAt"
|
||||
value={getInputDatetimeValue(values.publishedAt)}
|
||||
onChange={(e: ChangeEvent<HTMLInputElement>) => {
|
||||
const value = inLocalTimezone(
|
||||
e.target.value,
|
||||
).toISOString()
|
||||
updateValue("publishedAt", value)
|
||||
}}
|
||||
help={`This ${
|
||||
isPost ? "post" : "page"
|
||||
} will be accessible from this time`}
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<Input
|
||||
name="slug"
|
||||
value={values.slug}
|
||||
placeholder={defaultSlug}
|
||||
label={`${isPost ? "Post" : "Page"} slug`}
|
||||
id="slug"
|
||||
isBlock
|
||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||
updateValue("slug", e.target.value)
|
||||
}
|
||||
help={
|
||||
<>
|
||||
{(values.slug || defaultSlug) && (
|
||||
<>
|
||||
This {isPost ? "post" : "page"} will be accessible
|
||||
at{" "}
|
||||
<UniLink
|
||||
href={`${getSiteLink({
|
||||
subdomain,
|
||||
domain: site.data?.custom_domain,
|
||||
})}/${values.slug || defaultSlug}`}
|
||||
className="hover:underline"
|
||||
>
|
||||
{getSiteLink({
|
||||
subdomain,
|
||||
domain: site.data?.custom_domain,
|
||||
noProtocol: true,
|
||||
})}
|
||||
/{values.slug || defaultSlug}
|
||||
</UniLink>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<Input
|
||||
name="tags"
|
||||
value={values.tags}
|
||||
label="Tags"
|
||||
id="tags"
|
||||
isBlock
|
||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||
updateValue("tags", e.target.value)
|
||||
}
|
||||
help='Separate multiple tags with English commas ","'
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<Input
|
||||
label="Excerpt"
|
||||
isBlock
|
||||
name="excerpt"
|
||||
id="excerpt"
|
||||
value={values.excerpt}
|
||||
multiline
|
||||
rows={5}
|
||||
onChange={(e: ChangeEvent<HTMLTextAreaElement>) => {
|
||||
updateValue("excerpt", e.target.value)
|
||||
}}
|
||||
help="Leave it blank to use auto-generated excerpt"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</DashboardMain>
|
||||
<Modal
|
||||
open={isCheersOpen}
|
||||
setOpen={setIsCheersOpen}
|
||||
@@ -627,3 +623,7 @@ export default function SubdomainEditor() {
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
SubdomainEditor.getLayout = (page: ReactElement) => {
|
||||
return <DashboardLayout title="Editor">{page}</DashboardLayout>
|
||||
}
|
||||
|
||||
@@ -5,90 +5,93 @@ import { UniLink } from "~/components/ui/UniLink"
|
||||
import Image from "next/image"
|
||||
import { DISCORD_LINK, TWITTER_LINK, GITHUB_LINK, APP_NAME } from "~/lib/env"
|
||||
import { getSiteLink } from "~/lib/helpers"
|
||||
import type { ReactElement } from "react"
|
||||
|
||||
export default function SubdomainIndex() {
|
||||
const router = useRouter()
|
||||
const subdomain = router.query.subdomain as string
|
||||
return (
|
||||
<DashboardLayout title="Dashboard">
|
||||
<DashboardMain>
|
||||
<div className="prose max-w-screen-md">
|
||||
<div className="w-14 h-14 mb-8">
|
||||
<Image alt="logo" src="/logo.svg" width={100} height={100} />
|
||||
</div>
|
||||
<p>Hello there,</p>
|
||||
<p>
|
||||
This page is quite empty for now, but we will polish it very soon!
|
||||
Maybe some useful analytics!
|
||||
</p>
|
||||
<p>Here{`'`}re some useful links to get started:</p>
|
||||
<ul>
|
||||
<li>
|
||||
<UniLink href={`/dashboard/${subdomain}/editor?type=post`}>
|
||||
Create a Post
|
||||
</UniLink>
|
||||
</li>
|
||||
<li>
|
||||
<UniLink href={`/dashboard/${subdomain}/settings/general`}>
|
||||
Change Site Name or Icon
|
||||
</UniLink>
|
||||
</li>
|
||||
<li>
|
||||
Subscribe the{" "}
|
||||
<UniLink
|
||||
href={`${getSiteLink({
|
||||
subdomain: subdomain,
|
||||
})}/feed`}
|
||||
>
|
||||
posts feed
|
||||
</UniLink>{" "}
|
||||
and{" "}
|
||||
<UniLink
|
||||
href={`${getSiteLink({
|
||||
subdomain: subdomain,
|
||||
})}/feed/notifications`}
|
||||
>
|
||||
notifications feed
|
||||
</UniLink>{" "}
|
||||
via RSS Reader
|
||||
</li>
|
||||
</ul>
|
||||
<p>
|
||||
You are not alone, join the community to meet friends or give xLog
|
||||
some advice:
|
||||
</p>
|
||||
<ul>
|
||||
<li>
|
||||
<UniLink href={DISCORD_LINK}>
|
||||
Join {APP_NAME}
|
||||
{`'`}s Discord channel
|
||||
</UniLink>
|
||||
</li>
|
||||
<li>
|
||||
<UniLink
|
||||
href={getSiteLink({
|
||||
subdomain: "xlog",
|
||||
})}
|
||||
>
|
||||
Follow {APP_NAME}
|
||||
{`'`}s xLog
|
||||
</UniLink>
|
||||
</li>
|
||||
<li>
|
||||
<UniLink href={GITHUB_LINK}>
|
||||
View {APP_NAME}
|
||||
{`'`}s source code or participate in its development
|
||||
</UniLink>
|
||||
</li>
|
||||
<li>
|
||||
<UniLink href={TWITTER_LINK}>
|
||||
Follow {APP_NAME}
|
||||
{`'`}s Twitter
|
||||
</UniLink>
|
||||
</li>
|
||||
</ul>
|
||||
<DashboardMain>
|
||||
<div className="prose max-w-screen-md">
|
||||
<div className="w-14 h-14 mb-8">
|
||||
<Image alt="logo" src="/logo.svg" width={100} height={100} />
|
||||
</div>
|
||||
</DashboardMain>
|
||||
</DashboardLayout>
|
||||
<p>Hello there,</p>
|
||||
<p>
|
||||
This page is quite empty for now, but we will polish it very soon!
|
||||
Maybe some useful analytics!
|
||||
</p>
|
||||
<p>Here{`'`}re some useful links to get started:</p>
|
||||
<ul>
|
||||
<li>
|
||||
<UniLink href={`/dashboard/${subdomain}/editor?type=post`}>
|
||||
Create a Post
|
||||
</UniLink>
|
||||
</li>
|
||||
<li>
|
||||
<UniLink href={`/dashboard/${subdomain}/settings/general`}>
|
||||
Change Site Name or Icon
|
||||
</UniLink>
|
||||
</li>
|
||||
<li>
|
||||
Subscribe the{" "}
|
||||
<UniLink
|
||||
href={`${getSiteLink({
|
||||
subdomain: subdomain,
|
||||
})}/feed`}
|
||||
>
|
||||
posts feed
|
||||
</UniLink>{" "}
|
||||
and{" "}
|
||||
<UniLink
|
||||
href={`${getSiteLink({
|
||||
subdomain: subdomain,
|
||||
})}/feed/notifications`}
|
||||
>
|
||||
notifications feed
|
||||
</UniLink>{" "}
|
||||
via RSS Reader
|
||||
</li>
|
||||
</ul>
|
||||
<p>
|
||||
You are not alone, join the community to meet friends or give xLog
|
||||
some advice:
|
||||
</p>
|
||||
<ul>
|
||||
<li>
|
||||
<UniLink href={DISCORD_LINK}>
|
||||
Join {APP_NAME}
|
||||
{`'`}s Discord channel
|
||||
</UniLink>
|
||||
</li>
|
||||
<li>
|
||||
<UniLink
|
||||
href={getSiteLink({
|
||||
subdomain: "xlog",
|
||||
})}
|
||||
>
|
||||
Follow {APP_NAME}
|
||||
{`'`}s xLog
|
||||
</UniLink>
|
||||
</li>
|
||||
<li>
|
||||
<UniLink href={GITHUB_LINK}>
|
||||
View {APP_NAME}
|
||||
{`'`}s source code or participate in its development
|
||||
</UniLink>
|
||||
</li>
|
||||
<li>
|
||||
<UniLink href={TWITTER_LINK}>
|
||||
Follow {APP_NAME}
|
||||
{`'`}s Twitter
|
||||
</UniLink>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</DashboardMain>
|
||||
)
|
||||
}
|
||||
|
||||
SubdomainIndex.getLayout = (page: ReactElement) => {
|
||||
return <DashboardLayout title="Dashboard">{page}</DashboardLayout>
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { DashboardLayout } from "~/components/dashboard/DashboardLayout"
|
||||
import { PagesManager } from "~/components/dashboard/PagesManager"
|
||||
import type { ReactElement } from "react"
|
||||
|
||||
export default function SubdomainPages() {
|
||||
return (
|
||||
<DashboardLayout title="Pages">
|
||||
<PagesManager isPost={false} />
|
||||
</DashboardLayout>
|
||||
)
|
||||
return <PagesManager isPost={false} />
|
||||
}
|
||||
|
||||
SubdomainPages.getLayout = (page: ReactElement) => {
|
||||
return <DashboardLayout title="Pages">{page}</DashboardLayout>
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { DashboardLayout } from "~/components/dashboard/DashboardLayout"
|
||||
import { PagesManager } from "~/components/dashboard/PagesManager"
|
||||
import type { ReactElement } from "react"
|
||||
|
||||
export default function SubdomainPosts() {
|
||||
return (
|
||||
<DashboardLayout title="Posts">
|
||||
<PagesManager isPost={true} />
|
||||
</DashboardLayout>
|
||||
)
|
||||
return <PagesManager isPost={true} />
|
||||
}
|
||||
|
||||
SubdomainPosts.getLayout = (page: ReactElement) => {
|
||||
return <DashboardLayout title="Posts">{page}</DashboardLayout>
|
||||
}
|
||||
|
||||
@@ -7,8 +7,9 @@ import { Button } from "~/components/ui/Button"
|
||||
import { useGetSite, useUpdateSite } from "~/queries/site"
|
||||
import Editor from "@monaco-editor/react"
|
||||
import { FieldLabel } from "~/components/ui/FieldLabel"
|
||||
import type { ReactElement } from "react"
|
||||
|
||||
export default function SettingsDomainsPage() {
|
||||
export default function SettingsCSSPage() {
|
||||
const router = useRouter()
|
||||
const subdomain = router.query.subdomain as string
|
||||
|
||||
@@ -45,71 +46,73 @@ export default function SettingsDomainsPage() {
|
||||
}, [site.data, site.isSuccess, css, hasSet])
|
||||
|
||||
return (
|
||||
<DashboardLayout title={"Domains"}>
|
||||
<SettingsLayout title={"Site Settings"} type="site">
|
||||
<form onSubmit={handleSubmit}>
|
||||
<div className="">
|
||||
<div className="p-5 text-zinc-500 bg-zinc-50 mb-5 rounded-lg text-xs space-y-2">
|
||||
<p className="text-zinc-800 text-sm font-bold">Scope</p>
|
||||
<p>
|
||||
These styles will be applied to your entire blog, including this
|
||||
dashboard.
|
||||
</p>
|
||||
<p>
|
||||
Support <code>ipfs://</code>
|
||||
</p>
|
||||
<p className="text-zinc-800 text-sm font-bold">
|
||||
Tips: you can override the built-in CSS variables
|
||||
</p>
|
||||
<p>
|
||||
<span className="bg-zinc-200 rounded-lg px-2">
|
||||
--theme-color: #4f46e5;
|
||||
</span>
|
||||
</p>
|
||||
<p>
|
||||
<span className="bg-zinc-200 rounded-lg px-2">
|
||||
--theme-color-emphasis: #4338ca;
|
||||
</span>
|
||||
</p>
|
||||
<p>
|
||||
<span className="bg-zinc-200 rounded-lg px-2">
|
||||
--header-height: auto;
|
||||
</span>
|
||||
</p>
|
||||
<p>
|
||||
<span className="bg-zinc-200 rounded-lg px-2">
|
||||
--banner-bg-color: #fff;
|
||||
</span>
|
||||
</p>
|
||||
<p>
|
||||
<span className="bg-zinc-200 rounded-lg px-2">
|
||||
--font-fans: ui-sans-serif, system-ui, -apple-system,
|
||||
BlinkMacSystemFont, "Segoe UI", Roboto,
|
||||
"Helvetica Neue", Arial, "Noto Sans",
|
||||
sans-serif, "Apple Color Emoji", "Segoe UI
|
||||
Emoji", "Segoe UI Symbol", "Noto Color
|
||||
Emoji";
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<FieldLabel label="Custom CSS" />
|
||||
<Editor
|
||||
className="w-full h-96 border outline-none py-3 rounded-lg inline-flex items-center overflow-hidden"
|
||||
defaultLanguage="css"
|
||||
defaultValue={css}
|
||||
onChange={(value) => setCss(value || "")}
|
||||
options={{
|
||||
fontSize: 14,
|
||||
}}
|
||||
/>
|
||||
<SettingsLayout title={"Site Settings"} type="site">
|
||||
<form onSubmit={handleSubmit}>
|
||||
<div className="">
|
||||
<div className="p-5 text-zinc-500 bg-zinc-50 mb-5 rounded-lg text-xs space-y-2">
|
||||
<p className="text-zinc-800 text-sm font-bold">Scope</p>
|
||||
<p>
|
||||
These styles will be applied to your entire blog, including this
|
||||
dashboard.
|
||||
</p>
|
||||
<p>
|
||||
Support <code>ipfs://</code>
|
||||
</p>
|
||||
<p className="text-zinc-800 text-sm font-bold">
|
||||
Tips: you can override the built-in CSS variables
|
||||
</p>
|
||||
<p>
|
||||
<span className="bg-zinc-200 rounded-lg px-2">
|
||||
--theme-color: #4f46e5;
|
||||
</span>
|
||||
</p>
|
||||
<p>
|
||||
<span className="bg-zinc-200 rounded-lg px-2">
|
||||
--theme-color-emphasis: #4338ca;
|
||||
</span>
|
||||
</p>
|
||||
<p>
|
||||
<span className="bg-zinc-200 rounded-lg px-2">
|
||||
--header-height: auto;
|
||||
</span>
|
||||
</p>
|
||||
<p>
|
||||
<span className="bg-zinc-200 rounded-lg px-2">
|
||||
--banner-bg-color: #fff;
|
||||
</span>
|
||||
</p>
|
||||
<p>
|
||||
<span className="bg-zinc-200 rounded-lg px-2">
|
||||
--font-fans: ui-sans-serif, system-ui, -apple-system,
|
||||
BlinkMacSystemFont, "Segoe UI", Roboto,
|
||||
"Helvetica Neue", Arial, "Noto Sans",
|
||||
sans-serif, "Apple Color Emoji", "Segoe UI
|
||||
Emoji", "Segoe UI Symbol", "Noto Color
|
||||
Emoji";
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div className="mt-5">
|
||||
<Button type="submit" isLoading={updateSite.isLoading}>
|
||||
Save
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
</SettingsLayout>
|
||||
</DashboardLayout>
|
||||
<FieldLabel label="Custom CSS" />
|
||||
<Editor
|
||||
className="w-full h-96 border outline-none py-3 rounded-lg inline-flex items-center overflow-hidden"
|
||||
defaultLanguage="css"
|
||||
defaultValue={css}
|
||||
onChange={(value) => setCss(value || "")}
|
||||
options={{
|
||||
fontSize: 14,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<div className="mt-5">
|
||||
<Button type="submit" isLoading={updateSite.isLoading}>
|
||||
Save
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
</SettingsLayout>
|
||||
)
|
||||
}
|
||||
|
||||
SettingsCSSPage.getLayout = (page: ReactElement) => {
|
||||
return <DashboardLayout title="Site Settings">{page}</DashboardLayout>
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import { useGetSite, useUpdateSite } from "~/queries/site"
|
||||
import { useAccountState, useUpgradeAccountModal } from "@crossbell/connect-kit"
|
||||
import { UniLink } from "~/components/ui/UniLink"
|
||||
import { getSiteLink } from "~/lib/helpers"
|
||||
import type { ReactElement } from "react"
|
||||
|
||||
export default function SettingsDomainsPage() {
|
||||
const router = useRouter()
|
||||
@@ -74,90 +75,90 @@ export default function SettingsDomainsPage() {
|
||||
}, [form, site.data, site.isSuccess, customDomain, hasSet])
|
||||
|
||||
return (
|
||||
<DashboardLayout title={"Domains"}>
|
||||
<SettingsLayout title={"Site Settings"} type="site">
|
||||
<form onSubmit={handleSubmit}>
|
||||
<div>
|
||||
<Input
|
||||
id="subdomain"
|
||||
label={`${APP_NAME} subdomain`}
|
||||
addon={`.${OUR_DOMAIN}`}
|
||||
className="w-28"
|
||||
{...form.register("subdomain")}
|
||||
disabled={isEmailAccount}
|
||||
/>
|
||||
{isEmailAccount && (
|
||||
<div className="text-sm text-orange-400 mt-1">
|
||||
Email users cannot change subdomain/handle.{" "}
|
||||
<UniLink
|
||||
className="underline"
|
||||
href={
|
||||
getSiteLink({
|
||||
subdomain: "crossbell-blog",
|
||||
}) + "/newbie-villa"
|
||||
}
|
||||
>
|
||||
Learn more
|
||||
</UniLink>{" "}
|
||||
or{" "}
|
||||
<span
|
||||
className="underline cursor-pointer"
|
||||
onClick={upgradeAccountModal.show}
|
||||
>
|
||||
upgrade account
|
||||
</span>
|
||||
.
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="mt-5">
|
||||
<Input
|
||||
id="custom_domain"
|
||||
label="Custom Domain"
|
||||
className="w-64"
|
||||
{...form.register("custom_domain")}
|
||||
/>
|
||||
{customDomain && (
|
||||
<div className="mt-2 text-xs">
|
||||
<p className="mb-2">
|
||||
Set the following record on your DNS provider to active your
|
||||
custom domain:
|
||||
</p>
|
||||
<table className="">
|
||||
<tbody>
|
||||
<tr className="border-b">
|
||||
<th className="text-center p-3">Type</th>
|
||||
<th className="text-center p-3">Name</th>
|
||||
<th className="text-center p-3">Value</th>
|
||||
</tr>
|
||||
<tr className="border-b">
|
||||
<td className="text-center p-3">CNAME</td>
|
||||
<td className="text-center p-3">
|
||||
{customSubdomain || "@"}
|
||||
</td>
|
||||
<td className="text-center p-3">cname.{OUR_DOMAIN}</td>
|
||||
</tr>
|
||||
<tr className="border-b">
|
||||
<td className="text-center p-3">TXT</td>
|
||||
<td className="text-center p-3">{`_xlog-challenge${
|
||||
customSubdomain
|
||||
? `.${customSubdomain}`
|
||||
: customSubdomain
|
||||
}`}</td>
|
||||
<td className="text-center p-3">{subdomain}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="mt-5">
|
||||
<Button type="submit" isLoading={updateSite.isLoading}>
|
||||
Save
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
</SettingsLayout>
|
||||
</DashboardLayout>
|
||||
<SettingsLayout title={"Site Settings"} type="site">
|
||||
<form onSubmit={handleSubmit}>
|
||||
<div>
|
||||
<Input
|
||||
id="subdomain"
|
||||
label={`${APP_NAME} subdomain`}
|
||||
addon={`.${OUR_DOMAIN}`}
|
||||
className="w-28"
|
||||
{...form.register("subdomain")}
|
||||
disabled={isEmailAccount}
|
||||
/>
|
||||
{isEmailAccount && (
|
||||
<div className="text-sm text-orange-400 mt-1">
|
||||
Email users cannot change subdomain/handle.{" "}
|
||||
<UniLink
|
||||
className="underline"
|
||||
href={
|
||||
getSiteLink({
|
||||
subdomain: "crossbell-blog",
|
||||
}) + "/newbie-villa"
|
||||
}
|
||||
>
|
||||
Learn more
|
||||
</UniLink>{" "}
|
||||
or{" "}
|
||||
<span
|
||||
className="underline cursor-pointer"
|
||||
onClick={upgradeAccountModal.show}
|
||||
>
|
||||
upgrade account
|
||||
</span>
|
||||
.
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="mt-5">
|
||||
<Input
|
||||
id="custom_domain"
|
||||
label="Custom Domain"
|
||||
className="w-64"
|
||||
{...form.register("custom_domain")}
|
||||
/>
|
||||
{customDomain && (
|
||||
<div className="mt-2 text-xs">
|
||||
<p className="mb-2">
|
||||
Set the following record on your DNS provider to active your
|
||||
custom domain:
|
||||
</p>
|
||||
<table className="">
|
||||
<tbody>
|
||||
<tr className="border-b">
|
||||
<th className="text-center p-3">Type</th>
|
||||
<th className="text-center p-3">Name</th>
|
||||
<th className="text-center p-3">Value</th>
|
||||
</tr>
|
||||
<tr className="border-b">
|
||||
<td className="text-center p-3">CNAME</td>
|
||||
<td className="text-center p-3">
|
||||
{customSubdomain || "@"}
|
||||
</td>
|
||||
<td className="text-center p-3">cname.{OUR_DOMAIN}</td>
|
||||
</tr>
|
||||
<tr className="border-b">
|
||||
<td className="text-center p-3">TXT</td>
|
||||
<td className="text-center p-3">{`_xlog-challenge${
|
||||
customSubdomain ? `.${customSubdomain}` : customSubdomain
|
||||
}`}</td>
|
||||
<td className="text-center p-3">{subdomain}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="mt-5">
|
||||
<Button type="submit" isLoading={updateSite.isLoading}>
|
||||
Save
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
</SettingsLayout>
|
||||
)
|
||||
}
|
||||
|
||||
SettingsDomainsPage.getLayout = (page: ReactElement) => {
|
||||
return <DashboardLayout title="Site Settings">{page}</DashboardLayout>
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import { useGetSite, useUpdateSite } from "~/queries/site"
|
||||
import { UniLink } from "~/components/ui/UniLink"
|
||||
import { ImageUploader } from "~/components/ui/ImageUploader"
|
||||
import { toIPFS } from "~/lib/ipfs-parser"
|
||||
import type { ReactElement } from "react"
|
||||
|
||||
export default function SiteSettingsGeneralPage() {
|
||||
const router = useRouter()
|
||||
@@ -86,118 +87,120 @@ export default function SiteSettingsGeneralPage() {
|
||||
const [bannerUploading, setBannerUploading] = useState(false)
|
||||
|
||||
return (
|
||||
<DashboardLayout title="Site Settings">
|
||||
<SettingsLayout title="Site Settings" type="site">
|
||||
<form onSubmit={handleSubmit}>
|
||||
<div className="mt-5">
|
||||
<label htmlFor="icon" className="form-label">
|
||||
Icon
|
||||
</label>
|
||||
<Controller
|
||||
name="icon"
|
||||
control={form.control}
|
||||
render={({ field }) => (
|
||||
<ImageUploader
|
||||
id="icon"
|
||||
className="w-24 h-24 rounded-full"
|
||||
uploadStart={() => {
|
||||
setIconUploading(true)
|
||||
}}
|
||||
uploadEnd={(key) => {
|
||||
form.setValue("icon", key as string)
|
||||
setIconUploading(false)
|
||||
}}
|
||||
{...field}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
<SettingsLayout title="Site Settings" type="site">
|
||||
<form onSubmit={handleSubmit}>
|
||||
<div className="mt-5">
|
||||
<label htmlFor="icon" className="form-label">
|
||||
Icon
|
||||
</label>
|
||||
<Controller
|
||||
name="icon"
|
||||
control={form.control}
|
||||
render={({ field }) => (
|
||||
<ImageUploader
|
||||
id="icon"
|
||||
className="w-24 h-24 rounded-full"
|
||||
uploadStart={() => {
|
||||
setIconUploading(true)
|
||||
}}
|
||||
uploadEnd={(key) => {
|
||||
form.setValue("icon", key as string)
|
||||
setIconUploading(false)
|
||||
}}
|
||||
{...field}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="mt-5">
|
||||
<label htmlFor="icon" className="form-label">
|
||||
Banner
|
||||
</label>
|
||||
<Controller
|
||||
name="banner"
|
||||
control={form.control}
|
||||
render={({ field }) => (
|
||||
<ImageUploader
|
||||
id="banner"
|
||||
className="max-w-screen-md h-[220px]"
|
||||
uploadStart={() => {
|
||||
setBannerUploading(true)
|
||||
}}
|
||||
uploadEnd={(key) => {
|
||||
form.setValue(
|
||||
"banner",
|
||||
key as { address: string; mime_type: string },
|
||||
)
|
||||
setBannerUploading(false)
|
||||
}}
|
||||
withMimeType={true}
|
||||
hasClose={true}
|
||||
{...(field as any)}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
<div className="text-xs text-gray-400 mt-1">
|
||||
Supports both pictures and videos.
|
||||
</div>
|
||||
<div className="mt-5">
|
||||
<label htmlFor="icon" className="form-label">
|
||||
Banner
|
||||
</label>
|
||||
<Controller
|
||||
name="banner"
|
||||
control={form.control}
|
||||
render={({ field }) => (
|
||||
<ImageUploader
|
||||
id="banner"
|
||||
className="max-w-screen-md h-[220px]"
|
||||
uploadStart={() => {
|
||||
setBannerUploading(true)
|
||||
}}
|
||||
uploadEnd={(key) => {
|
||||
form.setValue(
|
||||
"banner",
|
||||
key as { address: string; mime_type: string },
|
||||
)
|
||||
setBannerUploading(false)
|
||||
}}
|
||||
withMimeType={true}
|
||||
hasClose={true}
|
||||
{...(field as any)}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
<div className="text-xs text-gray-400 mt-1">
|
||||
Supports both pictures and videos.
|
||||
</div>
|
||||
</div>
|
||||
<div className="mt-5">
|
||||
<Input required label="Name" id="name" {...form.register("name")} />
|
||||
</div>
|
||||
<div className="mt-5">
|
||||
<label htmlFor="description" className="form-label">
|
||||
Description
|
||||
</label>
|
||||
<Input
|
||||
multiline
|
||||
id="description"
|
||||
className="input is-block"
|
||||
rows={2}
|
||||
{...form.register("description")}
|
||||
/>
|
||||
</div>
|
||||
<div className="mt-5">
|
||||
<Input
|
||||
id="ga"
|
||||
{...form.register("ga")}
|
||||
prefix="G-"
|
||||
label="Google Analytics"
|
||||
help={
|
||||
<p>
|
||||
Integrate Google Analytics into your site. You can follow the
|
||||
instructions{" "}
|
||||
<UniLink
|
||||
className="underline"
|
||||
href="https://support.google.com/analytics/answer/9539598"
|
||||
>
|
||||
here
|
||||
</UniLink>{" "}
|
||||
to find your Measurement ID.
|
||||
</p>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<div className="mt-5">
|
||||
<Button
|
||||
type="submit"
|
||||
isLoading={updateSite.isLoading}
|
||||
isDisabled={iconUploading || bannerUploading}
|
||||
>
|
||||
Save
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
{/* <div className="mt-14 border-t pt-8">
|
||||
<h3 className="text-red-500 text-lg mb-5">Danger Zone</h3>
|
||||
<form>
|
||||
<Button variantColor="red" type="submit">
|
||||
Delete Site
|
||||
</div>
|
||||
<div className="mt-5">
|
||||
<Input required label="Name" id="name" {...form.register("name")} />
|
||||
</div>
|
||||
<div className="mt-5">
|
||||
<label htmlFor="description" className="form-label">
|
||||
Description
|
||||
</label>
|
||||
<Input
|
||||
multiline
|
||||
id="description"
|
||||
className="input is-block"
|
||||
rows={2}
|
||||
{...form.register("description")}
|
||||
/>
|
||||
</div>
|
||||
<div className="mt-5">
|
||||
<Input
|
||||
id="ga"
|
||||
{...form.register("ga")}
|
||||
prefix="G-"
|
||||
label="Google Analytics"
|
||||
help={
|
||||
<p>
|
||||
Integrate Google Analytics into your site. You can follow the
|
||||
instructions{" "}
|
||||
<UniLink
|
||||
className="underline"
|
||||
href="https://support.google.com/analytics/answer/9539598"
|
||||
>
|
||||
here
|
||||
</UniLink>{" "}
|
||||
to find your Measurement ID.
|
||||
</p>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<div className="mt-5">
|
||||
<Button
|
||||
type="submit"
|
||||
isLoading={updateSite.isLoading}
|
||||
isDisabled={iconUploading || bannerUploading}
|
||||
>
|
||||
Save
|
||||
</Button>
|
||||
</form>
|
||||
</div> */}
|
||||
</SettingsLayout>
|
||||
</DashboardLayout>
|
||||
</div>
|
||||
</form>
|
||||
{/* <div className="mt-14 border-t pt-8">
|
||||
<h3 className="text-red-500 text-lg mb-5">Danger Zone</h3>
|
||||
<form>
|
||||
<Button variantColor="red" type="submit">
|
||||
Delete Site
|
||||
</Button>
|
||||
</form>
|
||||
</div> */}
|
||||
</SettingsLayout>
|
||||
)
|
||||
}
|
||||
|
||||
SiteSettingsGeneralPage.getLayout = (page: ReactElement) => {
|
||||
return <DashboardLayout title="Site Settings">{page}</DashboardLayout>
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import { nanoid } from "nanoid"
|
||||
import { ReactSortable } from "react-sortablejs"
|
||||
import equal from "fast-deep-equal"
|
||||
import { useGetSite, useUpdateSite } from "~/queries/site"
|
||||
import type { ReactElement } from "react"
|
||||
|
||||
type UpdateItem = (id: string, newItem: Partial<SiteNavigationItem>) => void
|
||||
|
||||
@@ -128,74 +129,70 @@ export default function SiteSettingsNavigationPage() {
|
||||
}, [site.data?.navigation, hasSet])
|
||||
|
||||
return (
|
||||
<DashboardLayout title="Navigation">
|
||||
<SettingsLayout title="Site Settings" type="site">
|
||||
<div className="p-5 text-zinc-500 bg-zinc-50 mb-5 rounded-lg text-xs space-y-2">
|
||||
<p className="text-zinc-800 text-sm font-bold">
|
||||
Tips: built-in pages
|
||||
</p>
|
||||
<p>
|
||||
<span className="text-zinc-800">
|
||||
Home page (use your own Label to replace the default Label):
|
||||
</span>{" "}
|
||||
<span className="bg-zinc-200 rounded-lg px-2">/</span>
|
||||
</p>
|
||||
<p>
|
||||
<span className="text-zinc-800">Archives page:</span>{" "}
|
||||
<span className="bg-zinc-200 rounded-lg px-2">/archives</span>
|
||||
</p>
|
||||
<p>
|
||||
<span className="text-zinc-900">Tag page:</span>{" "}
|
||||
<span className="bg-zinc-200 rounded-lg px-2">/tag/[tag]</span>
|
||||
</p>
|
||||
<p>
|
||||
<span className="text-zinc-900">NFT Showcase page:</span>{" "}
|
||||
<span className="bg-zinc-200 rounded-lg px-2">/nft</span>
|
||||
</p>
|
||||
<SettingsLayout title="Site Settings" type="site">
|
||||
<div className="p-5 text-zinc-500 bg-zinc-50 mb-5 rounded-lg text-xs space-y-2">
|
||||
<p className="text-zinc-800 text-sm font-bold">Tips: built-in pages</p>
|
||||
<p>
|
||||
<span className="text-zinc-800">
|
||||
Home page (use your own Label to replace the default Label):
|
||||
</span>{" "}
|
||||
<span className="bg-zinc-200 rounded-lg px-2">/</span>
|
||||
</p>
|
||||
<p>
|
||||
<span className="text-zinc-800">Archives page:</span>{" "}
|
||||
<span className="bg-zinc-200 rounded-lg px-2">/archives</span>
|
||||
</p>
|
||||
<p>
|
||||
<span className="text-zinc-900">Tag page:</span>{" "}
|
||||
<span className="bg-zinc-200 rounded-lg px-2">/tag/[tag]</span>
|
||||
</p>
|
||||
<p>
|
||||
<span className="text-zinc-900">NFT Showcase page:</span>{" "}
|
||||
<span className="bg-zinc-200 rounded-lg px-2">/nft</span>
|
||||
</p>
|
||||
</div>
|
||||
<form onSubmit={handleSubmit}>
|
||||
<div className="bg-zinc-50 rounded-lg overflow-hidden">
|
||||
{items.length === 0 && (
|
||||
<div className="text-center text-zinc-500 p-5">
|
||||
No navigation items yet
|
||||
</div>
|
||||
)}
|
||||
<ReactSortable list={items} setList={setItems} handle=".drag-handle">
|
||||
{items.map((item) => {
|
||||
return (
|
||||
<SortableNavigationItem
|
||||
key={item.id}
|
||||
item={item}
|
||||
updateItem={updateItem}
|
||||
removeItem={removeItem}
|
||||
/>
|
||||
)
|
||||
})}
|
||||
<style jsx global>{`
|
||||
.sortable-ghost {
|
||||
opacity: 0.4;
|
||||
}
|
||||
`}</style>
|
||||
</ReactSortable>
|
||||
</div>
|
||||
<form onSubmit={handleSubmit}>
|
||||
<div className="bg-zinc-50 rounded-lg overflow-hidden">
|
||||
{items.length === 0 && (
|
||||
<div className="text-center text-zinc-500 p-5">
|
||||
No navigation items yet
|
||||
</div>
|
||||
)}
|
||||
<ReactSortable
|
||||
list={items}
|
||||
setList={setItems}
|
||||
handle=".drag-handle"
|
||||
>
|
||||
{items.map((item) => {
|
||||
return (
|
||||
<SortableNavigationItem
|
||||
key={item.id}
|
||||
item={item}
|
||||
updateItem={updateItem}
|
||||
removeItem={removeItem}
|
||||
/>
|
||||
)
|
||||
})}
|
||||
<style jsx global>{`
|
||||
.sortable-ghost {
|
||||
opacity: 0.4;
|
||||
}
|
||||
`}</style>
|
||||
</ReactSortable>
|
||||
</div>
|
||||
<div className="border-t pt-5 mt-10 space-x-3 flex items-center">
|
||||
<Button
|
||||
type="submit"
|
||||
isLoading={updateSite.isLoading}
|
||||
isDisabled={!itemsModified}
|
||||
>
|
||||
Save
|
||||
</Button>
|
||||
<Button variant="secondary" onClick={newEmptyItem}>
|
||||
New Item
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
</SettingsLayout>
|
||||
</DashboardLayout>
|
||||
<div className="border-t pt-5 mt-10 space-x-3 flex items-center">
|
||||
<Button
|
||||
type="submit"
|
||||
isLoading={updateSite.isLoading}
|
||||
isDisabled={!itemsModified}
|
||||
>
|
||||
Save
|
||||
</Button>
|
||||
<Button variant="secondary" onClick={newEmptyItem}>
|
||||
New Item
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
</SettingsLayout>
|
||||
)
|
||||
}
|
||||
|
||||
SiteSettingsNavigationPage.getLayout = (page: ReactElement) => {
|
||||
return <DashboardLayout title="Site Settings">{page}</DashboardLayout>
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import { CharacterCard } from "~/components/common/CharacterCard"
|
||||
import { useAccountState, useUpgradeAccountModal } from "@crossbell/connect-kit"
|
||||
import { UniLink } from "~/components/ui/UniLink"
|
||||
import { getSiteLink } from "~/lib/helpers"
|
||||
import type { ReactElement } from "react"
|
||||
|
||||
type RemoveItem = (operator: string) => void
|
||||
|
||||
@@ -51,7 +52,7 @@ const SortableNavigationItem: React.FC<{
|
||||
)
|
||||
}
|
||||
|
||||
export default function SiteSettingsNavigationPage() {
|
||||
export default function SettingsOperatorPage() {
|
||||
const router = useRouter()
|
||||
|
||||
const subdomain = router.query.subdomain as string
|
||||
@@ -114,120 +115,122 @@ export default function SiteSettingsNavigationPage() {
|
||||
const [address, setAddress] = useState("")
|
||||
|
||||
return (
|
||||
<DashboardLayout title="Navigation">
|
||||
<SettingsLayout title="Site Settings" type="site">
|
||||
<Dialog
|
||||
open={isOpen}
|
||||
onClose={() => setIsOpen(false)}
|
||||
className="fixed z-10 inset-0 overflow-y-auto"
|
||||
>
|
||||
<div className="flex items-center justify-center min-h-screen">
|
||||
<Dialog.Overlay className="fixed inset-0 bg-black opacity-30" />
|
||||
<SettingsLayout title="Site Settings" type="site">
|
||||
<Dialog
|
||||
open={isOpen}
|
||||
onClose={() => setIsOpen(false)}
|
||||
className="fixed z-10 inset-0 overflow-y-auto"
|
||||
>
|
||||
<div className="flex items-center justify-center min-h-screen">
|
||||
<Dialog.Overlay className="fixed inset-0 bg-black opacity-30" />
|
||||
|
||||
<div className="relative bg-white rounded-lg max-w-md w-full mx-auto">
|
||||
<Dialog.Title className="px-5 h-12 flex items-center border-b">
|
||||
New operator
|
||||
</Dialog.Title>
|
||||
<div className="relative bg-white rounded-lg max-w-md w-full mx-auto">
|
||||
<Dialog.Title className="px-5 h-12 flex items-center border-b">
|
||||
New operator
|
||||
</Dialog.Title>
|
||||
|
||||
<div className="p-5">
|
||||
<Input
|
||||
className="w-full"
|
||||
label="Operator Address"
|
||||
required
|
||||
onChange={(e) => {
|
||||
setAddress(e.target.value)
|
||||
}}
|
||||
<div className="p-5">
|
||||
<Input
|
||||
className="w-full"
|
||||
label="Operator Address"
|
||||
required
|
||||
onChange={(e) => {
|
||||
setAddress(e.target.value)
|
||||
}}
|
||||
/>
|
||||
<div className="form-label mt-5">Operator Character Check</div>
|
||||
<div>
|
||||
<CharacterCard
|
||||
address={address}
|
||||
open={true}
|
||||
hideFollowButton={true}
|
||||
style="flat"
|
||||
/>
|
||||
<div className="form-label mt-5">Operator Character Check</div>
|
||||
<div>
|
||||
<CharacterCard
|
||||
address={address}
|
||||
open={true}
|
||||
hideFollowButton={true}
|
||||
style="flat"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="h-16 border-t flex items-center px-5">
|
||||
<Button
|
||||
isLoading={addOperator.isLoading}
|
||||
isDisabled={!address}
|
||||
onClick={addItem}
|
||||
>
|
||||
Save
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="h-16 border-t flex items-center px-5">
|
||||
<Button
|
||||
isLoading={addOperator.isLoading}
|
||||
isDisabled={!address}
|
||||
onClick={addItem}
|
||||
>
|
||||
Save
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Dialog>
|
||||
<div className="p-5 text-zinc-500 bg-orange-50 mb-5 rounded-lg text-sm space-y-2">
|
||||
<p className="text-zinc-800 text-sm font-bold">⚠️ Warning:</p>
|
||||
<p>
|
||||
<span className="text-zinc-800">
|
||||
{isEmailAccount ? (
|
||||
<span>
|
||||
Email users cannot set operators.{" "}
|
||||
<UniLink
|
||||
className="underline"
|
||||
href={
|
||||
getSiteLink({
|
||||
subdomain: "crossbell-blog",
|
||||
}) + "/newbie-villa"
|
||||
}
|
||||
>
|
||||
Learn more
|
||||
</UniLink>{" "}
|
||||
or{" "}
|
||||
<span
|
||||
className="underline cursor-pointer"
|
||||
onClick={upgradeAccountModal.show}
|
||||
>
|
||||
upgrade account
|
||||
</span>
|
||||
.
|
||||
</span>
|
||||
) : (
|
||||
<span>
|
||||
Operators have permissions to enter your dashboard, change
|
||||
your settings(excluding xLog subdomain) and post contents on
|
||||
your site.
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div className={isEmailAccount ? `grayscale cursor-not-allowed` : ""}>
|
||||
<div className="bg-zinc-50 rounded-lg overflow-hidden">
|
||||
{items.length === 0 && (
|
||||
<div className="text-center text-zinc-500 p-5">
|
||||
No operators yet
|
||||
</div>
|
||||
</Dialog>
|
||||
<div className="p-5 text-zinc-500 bg-orange-50 mb-5 rounded-lg text-sm space-y-2">
|
||||
<p className="text-zinc-800 text-sm font-bold">⚠️ Warning:</p>
|
||||
<p>
|
||||
<span className="text-zinc-800">
|
||||
{isEmailAccount ? (
|
||||
<span>
|
||||
Email users cannot set operators.{" "}
|
||||
<UniLink
|
||||
className="underline"
|
||||
href={
|
||||
getSiteLink({
|
||||
subdomain: "crossbell-blog",
|
||||
}) + "/newbie-villa"
|
||||
}
|
||||
>
|
||||
Learn more
|
||||
</UniLink>{" "}
|
||||
or{" "}
|
||||
<span
|
||||
className="underline cursor-pointer"
|
||||
onClick={upgradeAccountModal.show}
|
||||
>
|
||||
upgrade account
|
||||
</span>
|
||||
.
|
||||
</span>
|
||||
) : (
|
||||
<span>
|
||||
Operators have permissions to enter your dashboard, change your
|
||||
settings(excluding xLog subdomain) and post contents on your
|
||||
site.
|
||||
</span>
|
||||
)}
|
||||
{items.map((item, index) => {
|
||||
return (
|
||||
<SortableNavigationItem
|
||||
key={index}
|
||||
item={item}
|
||||
removeItem={removeItem}
|
||||
isLoading={removeOperator.isLoading}
|
||||
disabled={isEmailAccount}
|
||||
/>
|
||||
)
|
||||
})}
|
||||
<style jsx global>{`
|
||||
.sortable-ghost {
|
||||
opacity: 0.4;
|
||||
}
|
||||
`}</style>
|
||||
</div>
|
||||
<div className="border-t pt-5 mt-10 space-x-3 flex items-center">
|
||||
<Button onClick={newEmptyItem} isDisabled={isEmailAccount}>
|
||||
Add
|
||||
</Button>
|
||||
</div>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div className={isEmailAccount ? `grayscale cursor-not-allowed` : ""}>
|
||||
<div className="bg-zinc-50 rounded-lg overflow-hidden">
|
||||
{items.length === 0 && (
|
||||
<div className="text-center text-zinc-500 p-5">
|
||||
No operators yet
|
||||
</div>
|
||||
)}
|
||||
{items.map((item, index) => {
|
||||
return (
|
||||
<SortableNavigationItem
|
||||
key={index}
|
||||
item={item}
|
||||
removeItem={removeItem}
|
||||
isLoading={removeOperator.isLoading}
|
||||
disabled={isEmailAccount}
|
||||
/>
|
||||
)
|
||||
})}
|
||||
<style jsx global>{`
|
||||
.sortable-ghost {
|
||||
opacity: 0.4;
|
||||
}
|
||||
`}</style>
|
||||
</div>
|
||||
</SettingsLayout>
|
||||
</DashboardLayout>
|
||||
<div className="border-t pt-5 mt-10 space-x-3 flex items-center">
|
||||
<Button onClick={newEmptyItem} isDisabled={isEmailAccount}>
|
||||
Add
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</SettingsLayout>
|
||||
)
|
||||
}
|
||||
|
||||
SettingsOperatorPage.getLayout = (page: ReactElement) => {
|
||||
return <DashboardLayout title="Site Settings">{page}</DashboardLayout>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user