Browse Source

feat: show version in footer

Co-authored-by: thejjw <72130076+thejjw@users.noreply.github.com>
C4illin 2 months ago
parent
commit
9a49dedaca
2 changed files with 70 additions and 60 deletions
  1. 58 40
      src/components/base.tsx
  2. 12 20
      src/index.tsx

+ 58 - 40
src/components/base.tsx

@@ -1,40 +1,58 @@
-import { Html } from "@elysiajs/html";
-
-export const BaseHtml = ({
-  children,
-  title = "ConvertX",
-  webroot = "",
-}: {
-  children: JSX.Element;
-  title?: string;
-  webroot?: string;
-}) => (
-  <html lang="en">
-    <head>
-      <meta charset="UTF-8" />
-      <meta name="viewport" content="width=device-width, initial-scale=1.0" />
-      <meta name="webroot" content={webroot} />
-      <title safe>{title}</title>
-      <link rel="stylesheet" href={`${webroot}/generated.css`} />
-      <link
-        rel="apple-touch-icon"
-        sizes="180x180"
-        href={`${webroot}/apple-touch-icon.png`}
-      />
-      <link
-        rel="icon"
-        type="image/png"
-        sizes="32x32"
-        href={`${webroot}/favicon-32x32.png`}
-      />
-      <link
-        rel="icon"
-        type="image/png"
-        sizes="16x16"
-        href={`${webroot}/favicon-16x16.png`}
-      />
-      <link rel="manifest" href={`${webroot}/site.webmanifest`} />
-    </head>
-    <body class="w-full bg-neutral-900 text-neutral-200">{children}</body>
-  </html>
-);
+import { Html } from "@elysiajs/html";
+import { version } from "../../package.json";
+
+export const BaseHtml = ({
+  children,
+  title = "ConvertX",
+  webroot = "",
+}: {
+  children: JSX.Element;
+  title?: string;
+  webroot?: string;
+}) => (
+  <html lang="en">
+    <head>
+      <meta charset="UTF-8" />
+      <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+      <meta name="webroot" content={webroot} />
+      <title safe>{title}</title>
+      <link rel="stylesheet" href={`${webroot}/generated.css`} />
+      <link
+        rel="apple-touch-icon"
+        sizes="180x180"
+        href={`${webroot}/apple-touch-icon.png`}
+      />
+      <link
+        rel="icon"
+        type="image/png"
+        sizes="32x32"
+        href={`${webroot}/favicon-32x32.png`}
+      />
+      <link
+        rel="icon"
+        type="image/png"
+        sizes="16x16"
+        href={`${webroot}/favicon-16x16.png`}
+      />
+      <link rel="manifest" href={`${webroot}/site.webmanifest`} />
+    </head>
+    <body class="flex min-h-screen w-full flex-col bg-neutral-900 text-neutral-200">
+      {children}
+      <footer class="w-full">
+        <div class="p-4 text-center text-sm text-neutral-500">
+          <span>Powered by </span>
+          <a
+            href="https://github.com/C4illin/ConvertX"
+            class={`
+              hover:text-accent-500
+              text-neutral-400
+            `}
+          >
+            ConvertX{" "}
+          </a>
+          <span safe>v{version || ""}</span>
+        </div>
+      </footer>
+    </body>
+  </html>
+);

+ 12 - 20
src/index.tsx

@@ -135,18 +135,6 @@ const app = new Elysia({
       prefix: "",
     }),
   )
-  .get("/test", () => {
-    return (
-      <html lang="en">
-        <head>
-          <title>Hello World</title>
-        </head>
-        <body>
-          <h1>Hello</h1>
-        </body>
-      </html>
-    );
-  })
   .get("/setup", ({ redirect }) => {
     if (!FIRST_RUN) {
       return redirect(`${WEBROOT}/login`, 302);
@@ -156,7 +144,7 @@ const app = new Elysia({
       <BaseHtml title="ConvertX | Setup" webroot={WEBROOT}>
         <main
           class={`
-            mx-auto w-full max-w-4xl px-2
+            mx-auto w-full max-w-4xl flex-1 px-2
             sm:px-4
           `}
         >
@@ -222,10 +210,11 @@ const app = new Elysia({
             webroot={WEBROOT}
             accountRegistration={ACCOUNT_REGISTRATION}
             allowUnauthenticated={ALLOW_UNAUTHENTICATED}
+            hideHistory={HIDE_HISTORY}
           />
           <main
             class={`
-              w-full px-2
+              w-full flex-1 px-2
               sm:px-4
             `}
           >
@@ -357,7 +346,7 @@ const app = new Elysia({
           />
           <main
             class={`
-              w-full px-2
+              w-full flex-1 px-2
               sm:px-4
             `}
           >
@@ -502,10 +491,11 @@ const app = new Elysia({
             accountRegistration={ACCOUNT_REGISTRATION}
             allowUnauthenticated={ALLOW_UNAUTHENTICATED}
             hideHistory={HIDE_HISTORY}
+            loggedIn
           />
           <main
             class={`
-              w-full px-2
+              w-full flex-1 px-2
               sm:px-4
             `}
           >
@@ -727,12 +717,14 @@ const app = new Elysia({
         <>
           <Header
             webroot={WEBROOT}
+            accountRegistration={ACCOUNT_REGISTRATION}
             allowUnauthenticated={ALLOW_UNAUTHENTICATED}
+            hideHistory={HIDE_HISTORY}
             loggedIn
           />
           <main
             class={`
-              w-full px-2
+              w-full flex-1 px-2
               sm:px-4
             `}
           >
@@ -1155,7 +1147,7 @@ const app = new Elysia({
           />
           <main
             class={`
-              w-full px-2
+              w-full flex-1 px-2
               sm:px-4
             `}
           >
@@ -1289,7 +1281,7 @@ const app = new Elysia({
             />
             <main
               class={`
-                w-full px-2
+                w-full flex-1 px-2
                 sm:px-4
               `}
             >
@@ -1604,7 +1596,7 @@ const app = new Elysia({
           />
           <main
             class={`
-              w-full px-2
+              w-full flex-1 px-2
               sm:px-4
             `}
           >