diff --git a/.fallowrc.json b/.fallowrc.json index 0568a68..63959e1 100644 --- a/.fallowrc.json +++ b/.fallowrc.json @@ -1,6 +1,8 @@ { "$schema": "https://raw.githubusercontent.com/fallow-rs/fallow/main/schema.json", "entry": ["test/features/*.test.js", "test/unit/*.test.js"], + "ignorePatterns": ["static/**"], + "ignoreUnresolvedImports": ["/**/static/**"], "ignoreDependencies": ["pino"], "ignoreExports": [{ "file": "static/auth-client.js", "exports": ["*"] }] } diff --git a/.gitignore b/.gitignore index 48121cb..77730be 100644 --- a/.gitignore +++ b/.gitignore @@ -36,5 +36,8 @@ coverage/ .tap/ test-results/ +# build artifacts +.version + # worktrees .worktrees/ diff --git a/eslint.config.js b/eslint.config.js index 7cb2650..42c485b 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -3,6 +3,9 @@ import globals from "globals"; import { defineConfig } from "eslint/config"; export default defineConfig([ + { + ignores: ["static/**"], + }, { files: ["**/*.{js,mjs,cjs}"], plugins: { js }, diff --git a/package.json b/package.json index 4ae3ce9..4d1966b 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "db:generate": "npx @better-auth/cli generate --yes", "db:migrate": "npx @better-auth/cli migrate --yes", "fallow": "fallow", + "heroku-postbuild": "node -e \"require('fs').writeFileSync('.version', (process.env.SOURCE_VERSION || 'dev').slice(0, 7))\"", "prettier:check": "prettier --check '**/*.{js,css,md,yml}'", "prettier:write": "prettier --write '**/*.{js,css,md,yml}'", "lint": "eslint .", diff --git a/src/app/components/admin.js b/src/app/components/admin.js index 97dac5a..aa5c5e2 100644 --- a/src/app/components/admin.js +++ b/src/app/components/admin.js @@ -1,65 +1,74 @@ import { html } from "hono/html"; import { formatISO } from "date-fns"; -// Admin users list component export const UsersList = ({ users, total }) => html` -
-

Users (${total} total)

+
+
+

Users (${total} total)

+
${ users && users.length > 0 ? html` - - - - - - - - - - - - ${users.map( - (user) => html` - - - - - + + + `, + )} + +
NameEmailVerifiedRoleCreated
${user.name}${user.email}${user.emailVerified ? "✅" : "❌"} -
- - + + + + + + + + + + + ${users.map( + (user) => html` + + + + + - - - `, - )} - -
NameEmailVerifiedRoleDate
${user.name}${user.email}${user.emailVerified ? "✅" : "❌"} + + + - - - ${formatISO(new Date(user.createdAt), { - representation: "date", - })} -
+ + + + +
+ ${formatISO(new Date(user.createdAt), { + representation: "date", + })} +
+
` - : html`

No users found.

` + : html`
+

No users found.

+
` }
`; diff --git a/src/app/components/common.js b/src/app/components/common.js index 4e6a076..69f0bd6 100644 --- a/src/app/components/common.js +++ b/src/app/components/common.js @@ -1,22 +1,26 @@ import { html } from "hono/html"; -// Form section wrapper -export const FormSection = ({ children }) => html`
${children}
`; - // Message display component -export const Message = ({ error, success }) => html` +export const Message = ({ error, success, info } = {}) => html` ${ error - ? html`
+ ? html`
${decodeURIComponent(error)}
` : "" } ${ success - ? html`
+ ? html`
${decodeURIComponent(success)}
` : "" } + ${ + info + ? html`
+ ${decodeURIComponent(info)} +
` + : "" + } `; diff --git a/src/app/components/home.js b/src/app/components/home.js index f8de595..0022ccf 100644 --- a/src/app/components/home.js +++ b/src/app/components/home.js @@ -1,21 +1,44 @@ import { html } from "hono/html"; +import { STATIC_VERSION } from "../version.js"; // Login status display export const LoginStatus = ({ user }) => html` - ${ - user - ? html` -
- ✅ Logged in as: ${user.name} (${user.email}) -
- View Profile | -
- -
- ` - : html` -
❌ Not logged in
- Sign In - ` - } +
+ ${ + user + ? html` +
+ Logged in as ${user.name} (${user.email}) +
+
+ View Profile +
+ +
+
+ ` + : html` +
+ codebar mark +

Welcome to codebar

+

+ Sign in to manage your profile and access workshops. +

+ Sign In +
+ ` + } +
`; diff --git a/src/app/components/layout.js b/src/app/components/layout.js index 63a9769..b922bae 100644 --- a/src/app/components/layout.js +++ b/src/app/components/layout.js @@ -1,44 +1,70 @@ import { html } from "hono/html"; - -// Derive a version stamp for cache-busting static assets. -// HEROKU_SLUG_COMMIT is the deployed git SHA, set automatically by Heroku. -// Falls back to SOURCE_VERSION (build-time env), then 'dev' for local. -const STATIC_VERSION = - (process.env.HEROKU_SLUG_COMMIT || process.env.SOURCE_VERSION || "").slice( - 0, - 7, - ) || "dev"; +import { STATIC_VERSION } from "../version.js"; // Base layout component -export const Layout = ({ title, children }) => html` +export const Layout = ({ title, children, hideNav }) => html` - + - ${title} + codebar Auth — ${title} - - + -
-
${children}
-
+ ${ + !hideNav + ? html` + + ` + : "" + } +
${children}
+ `; + // Navigation component export const Navigation = ({ back, extra }) => html` - ← ${back.text} - ${extra ? html` | ${extra.text}` : ""} + ← ${back.text} + ${ + extra + ? html`${extra.text}` + : "" + } `; diff --git a/src/app/components/login.js b/src/app/components/login.js index c840514..e66b09a 100644 --- a/src/app/components/login.js +++ b/src/app/components/login.js @@ -1,17 +1,19 @@ import { html } from "hono/html"; export const GitHubButton = ({ callbackURL } = {}) => html` -

Using GitHub

- +
`; export const MagicLinkButton = ({ callbackURL } = {}) => html` -

Using magic link

- +
`; diff --git a/src/app/components/profile.js b/src/app/components/profile.js index 0497a26..3f504b2 100644 --- a/src/app/components/profile.js +++ b/src/app/components/profile.js @@ -1,17 +1,24 @@ import { html } from "hono/html"; import { format } from "date-fns"; -// User info display export const UserInfo = ({ user }) => html` -

User Information

-

Name: ${user.name}

-

Email: ${user.email}

-

ID: ${user.id}

-

Email Verified: ${user.emailVerified ? "Yes" : "No"}

-

- Created: ${format( - new Date(user.createdAt), - "yyyy-MM-dd HH:mm:ss", - )} -

+
+
+

User Information

+
+
+
+
Name
+
${user.name}
+
Email
+
${user.email}
+
Email verified
+
${user.emailVerified ? "Yes" : "No"}
+
Member since
+
+ ${format(new Date(user.createdAt), "dd MMM yyyy")} +
+
+
+
`; diff --git a/src/app/demo/templates/home.html b/src/app/demo/templates/home.html index c8c994d..dbb7de4 100644 --- a/src/app/demo/templates/home.html +++ b/src/app/demo/templates/home.html @@ -15,7 +15,7 @@

Demo Time

-
+