diff --git a/web/src/components/BaseHead.astro b/web/src/components/BaseHead.astro new file mode 100644 index 0000000..ba3fac5 --- /dev/null +++ b/web/src/components/BaseHead.astro @@ -0,0 +1,9 @@ +--- +import "../styles/global.css" +--- + + + + + +Astro \ No newline at end of file diff --git a/web/src/components/Header.astro b/web/src/components/Header.astro new file mode 100644 index 0000000..89595c5 --- /dev/null +++ b/web/src/components/Header.astro @@ -0,0 +1,15 @@ + +
+ +

Recipie

+ + 🥧 +
+ +
+ new + add + + search +
+
\ No newline at end of file diff --git a/web/src/data/pb.ts b/web/src/data/pb.ts new file mode 100644 index 0000000..6b8fb43 --- /dev/null +++ b/web/src/data/pb.ts @@ -0,0 +1,16 @@ +import PocketBase from "pocketbase"; + +console.log("STUFF", import.meta.env.PUBLIC_PB_URL) + +const pb = new PocketBase(import.meta.env.PUBLIC_PB_URL); +pb.autoCancellation(false) + +export const authPB = async () => { + if (!pb.authStore.isValid) { + await pb.collection('users').authWithPassword( + import.meta.env.PB_EMAIL, + import.meta.env.PB_PW + ); + } + return pb; +}; diff --git a/web/src/layouts/Base.astro b/web/src/layouts/Base.astro new file mode 100644 index 0000000..5686540 --- /dev/null +++ b/web/src/layouts/Base.astro @@ -0,0 +1,18 @@ +--- +import BaseHead from '@component/BaseHead' +import Header from '@component/Header' +--- + + + + + + +
+
+
+ +
+
+ + diff --git a/web/src/pages/api/[...proxy].ts b/web/src/pages/api/[...proxy].ts new file mode 100644 index 0000000..344aa38 --- /dev/null +++ b/web/src/pages/api/[...proxy].ts @@ -0,0 +1,19 @@ +import type { APIRoute } from "astro"; + +export const prerender = false + +const getProxyUrl = (request: Request) => { + const proxyUrl = new URL(import.meta.env.PUBLIC_PB_URL); + const requestUrl = new URL(request.url); + return new URL(requestUrl.pathname + requestUrl.search, proxyUrl); +}; + +export const ALL: APIRoute = async ({ request }) => { + const proxyUrl = getProxyUrl(request); + const response = await fetch(proxyUrl.href, request); + return new Response(response.body, { + status: response.status, + statusText: response.statusText, + headers: response.headers + }); +}; \ No newline at end of file diff --git a/web/src/pages/index.astro b/web/src/pages/index.astro index 2d14107..1305c7b 100644 --- a/web/src/pages/index.astro +++ b/web/src/pages/index.astro @@ -1,5 +1,7 @@ --- +import { authPB } from "@data/pb"; +const pb = await authPB() --- diff --git a/web/src/styles/global.css b/web/src/styles/global.css index a461c50..bdf651e 100644 --- a/web/src/styles/global.css +++ b/web/src/styles/global.css @@ -1 +1,14 @@ -@import "tailwindcss"; \ No newline at end of file +@import "tailwindcss"; + +html { + @apply bg-[#1d1f21]; + /* @apply bg-[#fafafa]; */ + @apply text-white; + /* @apply font-; */ + @apply font-sans; + /* font-family: 'SF Pro Display', 'Segoe UI', 'Helvetica Neue', Arial, 'Noto Sans', sans-serif; */ +} + +.title { + @apply text-2xl; +} \ No newline at end of file diff --git a/web/tsconfig.json b/web/tsconfig.json index 8bf91d3..6562fcc 100644 --- a/web/tsconfig.json +++ b/web/tsconfig.json @@ -1,5 +1,14 @@ { "extends": "astro/tsconfigs/strict", "include": [".astro/types.d.ts", "**/*"], - "exclude": ["dist"] + "exclude": ["dist"], + "compilerOptions": { + "baseUrl": ".", + "paths": { + "@component/*": ["src/components/*.astro"], + "@layout/*": ["src/layouts/*.astro"], + "@utils": ["src/utils/index.ts"], + "@data/*": ["src/data/*"], + } + } }