diff --git a/app/lish/[did]/[publication]/PublicationHomeLayout.tsx b/app/lish/[did]/[publication]/PublicationHomeLayout.tsx index 0f1d9136..2a2e9787 100644 --- a/app/lish/[did]/[publication]/PublicationHomeLayout.tsx +++ b/app/lish/[did]/[publication]/PublicationHomeLayout.tsx @@ -15,7 +15,7 @@ export function PublicationHomeLayout(props: { >
{props.children}
diff --git a/app/lish/[did]/[publication]/theme-settings/ThemeSettingsContent.tsx b/app/lish/[did]/[publication]/theme-settings/ThemeSettingsContent.tsx index fe4e4581..89fed05d 100644 --- a/app/lish/[did]/[publication]/theme-settings/ThemeSettingsContent.tsx +++ b/app/lish/[did]/[publication]/theme-settings/ThemeSettingsContent.tsx @@ -24,6 +24,7 @@ import { } from "../dashboard/PublicationSWRProvider"; import { Separator } from "components/Layout"; import { GoToArrow } from "components/Icons/GoToArrow"; +import Link from "next/link"; export function ThemeSettingsContent() { let toolbarRef = useRef(null); @@ -44,8 +45,7 @@ export function ThemeSettingsContent() { showPageBackground, changes, } = state; - let router = useRouter(); - let [showLeaveWarning, setShowLeaveWarning] = useState(false); + let settingsHref = `/lish/${params.did}/${params.publication}/dashboard?tab=Settings`; let hasUnsavedChanges = @@ -72,48 +72,15 @@ export function ThemeSettingsContent() { className=" bg-accent-1 items-center -mb-2 pb-[10px] pt-2 " >
- { - if (hasUnsavedChanges) { - setShowLeaveWarning(true); - } else { - router.push(settingsHref); - } - }} - > - - - } - > -

Discard unsaved changes?

-

- You have unsaved changes to your theme. Leaving the page will - lose your edits! -

-
- router.push(settingsHref)} - > - Discard and Leave - - -
-
+
["localPubTheme"]; + headingFont: ReturnType["headingFont"]; + bodyFont: ReturnType["bodyFont"]; + image: ReturnType["image"]; + pageWidth: ReturnType["pageWidth"]; +}) => { + let router = useRouter(); + let [open, setOpen] = useState(false); + if (props.hasUnsavedChanges) + return ( + + + Back To Settings +
+ } + > + +
+

Discard unsaved changes?

+

+ You have unsaved changes to your theme. Leaving the page will lose + your edits! +

+
+ router.push(props.settingsHref)} + > + Discard and Leave + + + +
+
+
+ + ); + else + return ( + +
+ + Back To Settings +
+ + ); +}; + const PubThemePopover = ({ state, toolbarRef, @@ -183,15 +215,6 @@ const PubThemePopover = ({ side="bottom" arrowFill="white" border="#CCCCCC" - onInteractOutside={(e) => { - if ( - toolbarRef.current && - e.target instanceof Node && - toolbarRef.current.contains(e.target) - ) { - e.preventDefault(); - } - }} className="sm:w-sm w-[1000px] rounded-lg! !p-0 bg-white! border-[#CCCCCC]!" trigger={