Skip to content

An open-source, self-hosted system for apps built with web technologies.

Move client layout into appearance

zohayrslilehb35b93fd1220
diff --git a/source/client/view2/appearance/appearance.tsx b/source/client/view2/appearance/appearance.tsx
index 880cf2d..8a3751b 100644
--- a/source/client/view2/appearance/appearance.tsx
+++ b/source/client/view2/appearance/appearance.tsx
@@ -1,12 +1,25 @@
-import { type PropsWithChildren } from "react"
+import { type ComponentProps, Fragment, useLayoutEffect } from "react"
import { ThemeProvider } from "next-themes"
+import useStorage from "@libs/storage-hook"
import "./appearance.css"
-export default function ({ children }: PropsWithChildren) {
+export default function ({ children }: ComponentProps<typeof Fragment>) {
+
+ const direction = useStorage("direction")
+
+ useLayoutEffect(function () {
+
+ document.documentElement.dir = direction.value === "rtl" ? "rtl" : "ltr"
+
+ }, [direction.value])
return <ThemeProvider attribute="class" defaultTheme="system">
- {children}
+ <div className="grid min-h-dvh grid-rows-[auto_minmax(0,1fr)] bg-background font-roboto text-foreground">
+
+ {children}
+
+ </div>
</ThemeProvider>
}
diff --git a/source/client/view2/structure/structure.tsx b/source/client/view2/structure/structure.tsx
index aba6782..a6ec629 100644
--- a/source/client/view2/structure/structure.tsx
+++ b/source/client/view2/structure/structure.tsx
@@ -8,7 +8,7 @@ import Authentication from "./authentication/authentication"
import usePromise from "@libs/react-promise"
import useStorage from "@libs/storage-hook"
import { useTheme } from "next-themes"
-import { useCallback, useLayoutEffect, useState } from "react"
+import { useCallback, useState } from "react"
export default function () {
@@ -18,13 +18,7 @@ export default function () {
const reversed = direction.value === "rtl"
- useLayoutEffect(function () {
-
- document.documentElement.dir = reversed ? "rtl" : "ltr"
-
- }, [reversed])
-
- return <main className="grid min-h-dvh grid-rows-[auto_minmax(0,1fr)] bg-background font-roboto text-foreground">
+ return <>
<SwitchGroup orientation="horizontal" className="justify-self-end p-4">
@@ -56,7 +50,7 @@ export default function () {
<Connection />
- </main>
+ </>
}
function Connection() {