From 99b249fa663558dbc6db31edeb51fd38f63e4265 Mon Sep 17 00:00:00 2001 From: Tim Wundenberg Date: Fri, 23 Aug 2024 19:16:30 +0200 Subject: [PATCH] #109 add home page again --- package-lock.json | 51 +++++++++++++++++- package.json | 5 +- service/static_ui.go | 2 +- tailwind.config.js | 15 ++++-- templates/footer.templ | 5 -- templates/header.templ | 9 +++- templates/index.templ | 16 ++++++ templates/layout.templ | 13 +++-- view/package.json | 40 -------------- view/src/lib/firebase.ts | 16 ------ view/src/lib/toast.ts | 27 ---------- view/src/routes/+layout.svelte | 82 ----------------------------- view/src/routes/+layout.ts | 4 -- view/src/routes/+page.svelte | 12 ----- view/src/routes/signin/+page.svelte | 66 ----------------------- view/src/routes/signup/+page.svelte | 67 ----------------------- view/tailwind.config.js | 14 ----- 17 files changed, 96 insertions(+), 348 deletions(-) delete mode 100644 templates/footer.templ create mode 100644 templates/index.templ delete mode 100644 view/package.json delete mode 100644 view/src/lib/firebase.ts delete mode 100644 view/src/lib/toast.ts delete mode 100644 view/src/routes/+layout.svelte delete mode 100644 view/src/routes/+layout.ts delete mode 100644 view/src/routes/signin/+page.svelte delete mode 100644 view/src/routes/signup/+page.svelte delete mode 100644 view/tailwind.config.js diff --git a/package-lock.json b/package-lock.json index d2a8716..8a453e7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,8 @@ "version": "1.0.0", "license": "ISC", "devDependencies": { - "tailwindcss": "^3.4.10" + "daisyui": "^4.12.10", + "tailwindcss": "3.4.10" } }, "node_modules/@alloc/quick-lru": { @@ -308,6 +309,17 @@ "node": ">= 8" } }, + "node_modules/css-selector-tokenizer": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/css-selector-tokenizer/-/css-selector-tokenizer-0.8.0.tgz", + "integrity": "sha512-Jd6Ig3/pe62/qe5SBPTN8h8LeUg/pT4lLgtavPf7updwwHpvFzxvOQBHYj2LZDMjUnBzgvIUSjRcf6oT5HzHFg==", + "dev": true, + "license": "MIT", + "dependencies": { + "cssesc": "^3.0.0", + "fastparse": "^1.1.2" + } + }, "node_modules/cssesc": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", @@ -320,6 +332,36 @@ "node": ">=4" } }, + "node_modules/culori": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/culori/-/culori-3.3.0.tgz", + "integrity": "sha512-pHJg+jbuFsCjz9iclQBqyL3B2HLCBF71BwVNujUYEvCeQMvV97R59MNK3R2+jgJ3a1fcZgI9B3vYgz8lzr/BFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, + "node_modules/daisyui": { + "version": "4.12.10", + "resolved": "https://registry.npmjs.org/daisyui/-/daisyui-4.12.10.tgz", + "integrity": "sha512-jp1RAuzbHhGdXmn957Z2XsTZStXGHzFfF0FgIOZj3Wv9sH7OZgLfXTRZNfKVYxltGUOBsG1kbWAdF5SrqjebvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "css-selector-tokenizer": "^0.8", + "culori": "^3", + "picocolors": "^1", + "postcss-js": "^4" + }, + "engines": { + "node": ">=16.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/daisyui" + } + }, "node_modules/didyoumean": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz", @@ -372,6 +414,13 @@ "node": ">= 6" } }, + "node_modules/fastparse": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/fastparse/-/fastparse-1.1.2.tgz", + "integrity": "sha512-483XLLxTVIwWK3QTrMGRqUfUpoOs/0hbQrl2oz4J0pAcm3A3bu84wxTFqGqkJzewCLdME38xJLJAxBABfQT8sQ==", + "dev": true, + "license": "MIT" + }, "node_modules/fastq": { "version": "1.17.1", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz", diff --git a/package.json b/package.json index 6616415..f792c4d 100644 --- a/package.json +++ b/package.json @@ -4,13 +4,14 @@ "description": "Your (almost) independent tech stack to host on a VPC.", "main": "index.js", "scripts": { - "build": "tailwindcss build -o static/css/tailwind.css --minify", - "watch": "tailwindcss build -o static/css/tailwind.css --watch" + "build": "tailwindcss build -o static/css/tailwind.css --minify", + "watch": "tailwindcss build -o static/css/tailwind.css --watch" }, "keywords": [], "author": "", "license": "ISC", "devDependencies": { + "daisyui": "^4.12.10", "tailwindcss": "3.4.10" } } diff --git a/service/static_ui.go b/service/static_ui.go index fff37f7..bc5e565 100644 --- a/service/static_ui.go +++ b/service/static_ui.go @@ -12,7 +12,7 @@ func HandleStaticUi(w http.ResponseWriter, r *http.Request) { if r.URL.Path != "/" { comp = templates.Layout(templates.NotFound()) } else { - comp = templates.Layout(nil) + comp = templates.Layout(templates.Index()) } comp.Render(r.Context(), w) diff --git a/tailwind.config.js b/tailwind.config.js index 4f68882..cafdb9b 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,9 +1,14 @@ /** @type {import('tailwindcss').Config} */ module.exports = { - content: ["./templates/**/*.templ"], - theme: { - extend: {}, - }, - plugins: [], + content: ["./templates/**/*.templ"], + theme: { + extend: {}, + }, + plugins: [ + require('daisyui'), + ], + daisyui: { + themes: ["retro"], + }, } diff --git a/templates/footer.templ b/templates/footer.templ deleted file mode 100644 index 0fe36a5..0000000 --- a/templates/footer.templ +++ /dev/null @@ -1,5 +0,0 @@ -package templates - -templ footer() { -
Footer
-} diff --git a/templates/header.templ b/templates/header.templ index 513854c..3a17fec 100644 --- a/templates/header.templ +++ b/templates/header.templ @@ -2,5 +2,12 @@ package templates templ header() { -
Header
+
+ + ME-FIT logo + ME-FIT + + Sign Up + Sign In +
} diff --git a/templates/index.templ b/templates/index.templ new file mode 100644 index 0000000..352c04c --- /dev/null +++ b/templates/index.templ @@ -0,0 +1,16 @@ +package templates + +templ Index() { +
+
+
+

Next Level Workout Tracker

+

+ Ever wanted to track your workouts and see your progress over time? ME-FIT is the perfect + solution for you. +

+ Get Started +
+
+
+} diff --git a/templates/layout.templ b/templates/layout.templ index 7db4d1b..0a71e1d 100644 --- a/templates/layout.templ +++ b/templates/layout.templ @@ -12,11 +12,14 @@ templ Layout(comp templ.Component) { - @header() - if comp != nil { - @comp - } - @footer() +
+ @header() +
+ if comp != nil { + @comp + } +
+
} diff --git a/view/package.json b/view/package.json deleted file mode 100644 index 32c8858..0000000 --- a/view/package.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "template", - "version": "0.0.2", - "private": true, - "scripts": { - "dev": "PUBLIC_BASE_API_URL=http://localhost:8080 vite dev", - "build": "vite build", - "preview": "vite preview", - "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", - "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", - "lint": "prettier --check . && eslint .", - "format": "prettier --write ." - }, - "devDependencies": { - "@iconify/json": "2.2.240", - "@sveltejs/adapter-static": "3.0.4", - "@sveltejs/kit": "2.5.24", - "@sveltejs/vite-plugin-svelte": "3.1.2", - "@types/eslint": "9.6.0", - "autoprefixer": "10.4.20", - "daisyui": "4.12.10", - "eslint": "9.9.1", - "eslint-config-prettier": "9.1.0", - "eslint-plugin-svelte": "2.43.0", - "firebaseui": "6.1.0", - "globals": "15.9.0", - "postcss": "8.4.41", - "prettier": "3.3.3", - "prettier-plugin-svelte": "3.2.6", - "svelte": "4.2.18", - "svelte-check": "3.8.6", - "tailwindcss": "3.4.10", - "tslib": "2.6.3", - "typescript": "5.5.4", - "typescript-eslint": "8.2.0", - "unplugin-icons": "0.19.2", - "vite": "5.4.2" - }, - "type": "module" -} diff --git a/view/src/lib/firebase.ts b/view/src/lib/firebase.ts deleted file mode 100644 index 52393fa..0000000 --- a/view/src/lib/firebase.ts +++ /dev/null @@ -1,16 +0,0 @@ - -import { getAuth } from 'firebase/auth'; -import { initializeApp } from 'firebase/app'; - -const app = initializeApp({ - apiKey: 'AIzaSyCrJBW3c3Wut8DqjyVJoFAEyJ9Had__q-Q', - authDomain: 'me-fit-a9365.firebaseapp.com', - projectId: 'me-fit-a9365', - storageBucket: 'me-fit-a9365.appspot.com', - messagingSenderId: '631045688520', - appId: '1:631045688520:web:c7e0534927b52b0db629fd' -}); - -const auth = getAuth(app); - -export { auth }; diff --git a/view/src/lib/toast.ts b/view/src/lib/toast.ts deleted file mode 100644 index e834c04..0000000 --- a/view/src/lib/toast.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { writable } from "svelte/store"; - - -type Type = 'success' | 'info' | 'warning' | 'error'; -type Toast = { - message: string; - type: Type; -} - -const toastStore = writable([]); - - -const addToast = (message: string, type: Type) => { - const newToast = { message, type }; - - toastStore.update((toasts) => { - return [...toasts, newToast]; - }); - - setTimeout(() => { - toastStore.update((toasts) => toasts.filter((t) => t !== newToast)); - }, 5000); -} - - -export { toastStore, addToast, }; -export type { Toast } diff --git a/view/src/routes/+layout.svelte b/view/src/routes/+layout.svelte deleted file mode 100644 index 2c159c7..0000000 --- a/view/src/routes/+layout.svelte +++ /dev/null @@ -1,82 +0,0 @@ - - - - ME-FIT - - -
-
- - ME-FIT logo - ME-FIT - - {#if user} - - - {:else} - Sign Up - Sign In - {/if} -
- -
- -
- - - - - -
- {#each toasts as toast} -
- {toast.message} -
- {/each} -
-
diff --git a/view/src/routes/+layout.ts b/view/src/routes/+layout.ts deleted file mode 100644 index b4182ca..0000000 --- a/view/src/routes/+layout.ts +++ /dev/null @@ -1,4 +0,0 @@ -// This is needed for adapter-static -export const prerender = true; -// This is needed for nginx to work -export const trailingSlash = 'always'; diff --git a/view/src/routes/+page.svelte b/view/src/routes/+page.svelte index 778bd23..e69de29 100644 --- a/view/src/routes/+page.svelte +++ b/view/src/routes/+page.svelte @@ -1,12 +0,0 @@ -
-
-
-

Next Level Workout Tracker

-

- Ever wanted to track your workouts and see your progress over time? ME-FIT is the perfect - solution for you. -

- Get Started -
-
-
diff --git a/view/src/routes/signin/+page.svelte b/view/src/routes/signin/+page.svelte deleted file mode 100644 index d52900a..0000000 --- a/view/src/routes/signin/+page.svelte +++ /dev/null @@ -1,66 +0,0 @@ - - -
-

Sign In

- - - - -
diff --git a/view/src/routes/signup/+page.svelte b/view/src/routes/signup/+page.svelte deleted file mode 100644 index a07c216..0000000 --- a/view/src/routes/signup/+page.svelte +++ /dev/null @@ -1,67 +0,0 @@ - - -
-

Sign Up

- - - - -
diff --git a/view/tailwind.config.js b/view/tailwind.config.js deleted file mode 100644 index 97904eb..0000000 --- a/view/tailwind.config.js +++ /dev/null @@ -1,14 +0,0 @@ -/** @type {import('tailwindcss').Config} */ -export default { - content: ['./src/**/*.{html,js,svelte,ts}'], - theme: { - extend: {}, - }, - plugins: [ - require("daisyui"), - ], - daisyui: { - themes: ["retro"], - }, -} -