From d3f9c8b1766f2a70fd93a893011b45016c6875f0 Mon Sep 17 00:00:00 2001 From: atridadl Date: Wed, 22 Nov 2023 14:38:16 -0700 Subject: [PATCH] 4.0.0 --- .env.example | 17 ++------ README.md | 46 +++++++++----------- app/routes/api.room.get.$roomId.tsx | 2 - app/routes/api.room.presence.get.$roomId.tsx | 22 +++++++--- 4 files changed, 40 insertions(+), 47 deletions(-) diff --git a/.env.example b/.env.example index 2dbc567..620f20f 100644 --- a/.env.example +++ b/.env.example @@ -2,23 +2,12 @@ DATABASE_URL="" DATABASE_AUTH_TOKEN="" -# Redis -REDIS_URL="" -REDIS_EXPIRY_SECONDS="" - #Auth -NEXT_PUBLIC_CLERK_SIGN_UP_URL="/sign-up" -NEXT_PUBLIC_CLERK_SIGN_IN_URL="/sign-in" -NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY="" +CLERK_SIGN_UP_URL="/sign-up" +CLERK_SIGN_IN_URL="/sign-in" +CLERK_PUBLISHABLE_KEY="" CLERK_SECRET_KEY="" CLERK_WEBHOOK_SIGNING_SECRET="" -# Ably -ABLY_API_KEY="" - -# Unkey -UNKEY_ROOT_KEY="" - # Misc APP_ENV="" -NEXT_PUBLIC_APP_ENV="" diff --git a/README.md b/README.md index da8d02a..359a985 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,32 @@ -# Welcome to Remix! +# Sprint Padawan -- [Remix Docs](https://remix.run/docs) +A scrum poker tool that helps agile teams plan their sprints in real-time. -## Development +## Stack -From your terminal: +- Front-end framework: Remix +- Front-end library: React +- Rendering method: SSR +- Hosting: Fly +- ORM: Drizzle ORM +- Database: Turso (libSQL) -```sh -npm run dev -``` +## Environment Vars -This starts your app in development mode, rebuilding assets on file changes. +Add variables to the following places: -## Deployment +- Github Secrets +- Fly Secrets -First, build your app for production: +## Versioning -```sh -npm run build -``` +- I use a bastardized version of semantic versioning. I jump to a new minor release whenever I feel like I made enough patch releases. +- All released are named using the corperate BS generator, found [here](https://www.atrixnet.com/bs-generator.html). -Then run the app in production mode: +## Contributing -```sh -npm start -``` +Feel free to propose changes via PR. I'm not awfully picky about formatting right now, so I'll accept/reject on a case-by-case basis. Please make sure to have an issue first though. -Now you'll need to pick a host to deploy it to. +## Stats -### DIY - -If you're familiar with deploying node applications, the built-in Remix app server is production-ready. - -Make sure to deploy the output of `remix build` - -- `build/` -- `public/build/` +![Alt](https://repobeats.axiom.co/api/embed/852f886f9cf9682a5355b574f59716dca985e7cc.svg "Repobeats analytics image") diff --git a/app/routes/api.room.get.$roomId.tsx b/app/routes/api.room.get.$roomId.tsx index 718411b..085ffb7 100644 --- a/app/routes/api.room.get.$roomId.tsx +++ b/app/routes/api.room.get.$roomId.tsx @@ -41,7 +41,6 @@ export async function loader({ context, params, request }: LoaderFunctionArgs) { } // Initial fetch - console.log("HI"); db.query.rooms .findFirst({ where: eq(rooms.id, roomId || ""), @@ -50,7 +49,6 @@ export async function loader({ context, params, request }: LoaderFunctionArgs) { }, }) .then((roomFromDb) => { - console.log(roomId); return send({ event: `room-${roomId}`, data: JSON.stringify(roomFromDb), diff --git a/app/routes/api.room.presence.get.$roomId.tsx b/app/routes/api.room.presence.get.$roomId.tsx index 12fb2d1..ffdcd7c 100644 --- a/app/routes/api.room.presence.get.$roomId.tsx +++ b/app/routes/api.room.presence.get.$roomId.tsx @@ -28,6 +28,10 @@ export async function loader({ context, params, request }: LoaderFunctionArgs) { const name = sessionClaims.name as string; const image = sessionClaims.image as string; + const metadata = sessionClaims.metadata as { + isAdmin: boolean; + isVIP: boolean; + }; return eventStream(request.signal, function setup(send) { async function handler() { @@ -37,7 +41,15 @@ export async function loader({ context, params, request }: LoaderFunctionArgs) { send({ event: `${userId}-${params.roomId}`, - data: JSON.stringify(presenceData), + data: JSON.stringify( + presenceData.map((presenceItem) => { + return { + ...presenceItem, + isAdmin: presenceItem.isAdmin === 0 ? false : true, + isVIP: presenceItem.isVIP === 0 ? false : true, + }; + }) + ), }); } @@ -48,8 +60,8 @@ export async function loader({ context, params, request }: LoaderFunctionArgs) { userFullName: name, userId: userId, userImageUrl: image, - isAdmin: 0, - isVIP: 0, + isAdmin: metadata.isAdmin ? 1 : 0, + isVIP: metadata.isVIP ? 1 : 0, }) .onConflictDoUpdate({ target: [presence.userId, presence.roomId], @@ -58,8 +70,8 @@ export async function loader({ context, params, request }: LoaderFunctionArgs) { userFullName: name, userId: userId, userImageUrl: image, - isAdmin: 0, - isVIP: 0, + isAdmin: metadata.isAdmin ? 1 : 0, + isVIP: metadata.isVIP ? 1 : 0, }, }) .then(async () => {