diff --git a/bun.lockb b/bun.lockb index a780a30..f1bd967 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 93f4d30..00471af 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "@lucia-auth/adapter-sqlite": "^2.0.0", "@t3-oss/env-core": "^0.6.1", "@tlscipher/holt": "1.1.0", - "beth-stack": "0.0.22", + "beth-stack": "0.0.24", "drizzle-orm": "^0.28.6", "drizzle-typebox": "^0.1.1", "elysia": "0.7.4", diff --git a/src/components/base.tsx b/src/components/base.tsx index fda217c..ef5bfe3 100644 --- a/src/components/base.tsx +++ b/src/components/base.tsx @@ -2,8 +2,13 @@ import { liveReloadScript } from "beth-stack/dev"; import { type PropsWithChildren } from "beth-stack/jsx"; import { config } from "../config"; + const safeScript = - config.env.NODE_ENV === "development" ? liveReloadScript() : ""; + config.env.NODE_ENV === "development" + ? liveReloadScript({ + url: "https://upgraded-orbit-qw9457vrwv39669-3001.app.github.dev/ws", + }) + : ""; export const BaseHtml = ({ children }: PropsWithChildren) => ( @@ -25,4 +30,4 @@ export const BaseHtml = ({ children }: PropsWithChildren) => ( {children} -); +); \ No newline at end of file diff --git a/src/components/tweets.tsx b/src/components/tweets.tsx index 07eba80..583b0d1 100644 --- a/src/components/tweets.tsx +++ b/src/components/tweets.tsx @@ -1,24 +1,44 @@ import { db } from "../db"; -import { tweets, type Tweet } from "../db/schema/tweets"; +import { tweets } from "../db/schema/tweets"; -export function TweetCard({ authorId, createdAt, content }: Tweet) { +export function TweetCard({ + author: { handle }, + createdAt, + content, +}: { + createdAt: Date; + content: string; + author: { + handle: string; + }; +}) { return (

- {authorId} + @{handle}

{content}

- {new Date(createdAt).toLocaleString()} + {createdAt.toLocaleString()}
); } export async function TweetList() { - const tweetData = await db.select().from(tweets).limit(10); + const tweetData = await db.query.tweets.findMany({ + limit: 10, + orderBy: (tweets, { desc }) => [desc(tweets.createdAt)], + with: { + author: { + columns: { + handle: true, + }, + }, + }, + }); return (
@@ -33,17 +53,15 @@ export function TweetCreationForm() { return (

Create a new Tweet

-
+ - + />