Continue porting from V1

This commit is contained in:
2025-11-17 13:48:51 +13:00
parent 3ed4a0f9fe
commit 758fa316cc
8 changed files with 103 additions and 2 deletions

View File

@@ -0,0 +1,9 @@
---
import "../styles/global.css"
---
<meta charset="utf-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="viewport" content="width=device-width" />
<meta name="generator" content={Astro.generator} />
<title>Astro</title>

View File

@@ -0,0 +1,15 @@
<div class="flex w-full items-center bg-[#2a2b2c] text-white p-5">
<a class="flex" href="/">
<p class="text-3xl">Recipie</p>
<!-- <p class=" text-3xl text-amber-500">pie</p> -->
🥧
</a>
<div class="ml-auto space-x-5">
<a class="hover:underline underline-offset-4" href="/recipe/new">new</a>
<a class="hover:underline underline-offset-4" href="/recipe/import">add</a>
<!-- <a class="hover:underline underline-offset-4" href="/tags">tags</a> -->
<a class="hover:underline underline-offset-4" >search</a>
</div>
</div>

16
web/src/data/pb.ts Normal file
View File

@@ -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;
};

View File

@@ -0,0 +1,18 @@
---
import BaseHead from '@component/BaseHead'
import Header from '@component/Header'
---
<html lang=en>
<head>
<BaseHead title="Recipie" />
</head>
<body>
<main id="main" class="flex-1">
<Header/>
<div class="px-3 mb-5 md:px-5 pt-2">
<slot />
</div>
</main>
</body>
</html>

View File

@@ -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
});
};

View File

@@ -1,5 +1,7 @@
---
import { authPB } from "@data/pb";
const pb = await authPB()
---
<html lang="en">

View File

@@ -1 +1,14 @@
@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;
}

View File

@@ -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/*"],
}
}
}