This commit is contained in:
Atridad Lahiji 2023-11-22 14:38:16 -07:00
parent dd0172cd44
commit d3f9c8b176
No known key found for this signature in database
4 changed files with 40 additions and 47 deletions

View file

@ -2,23 +2,12 @@
DATABASE_URL="" DATABASE_URL=""
DATABASE_AUTH_TOKEN="" DATABASE_AUTH_TOKEN=""
# Redis
REDIS_URL=""
REDIS_EXPIRY_SECONDS=""
#Auth #Auth
NEXT_PUBLIC_CLERK_SIGN_UP_URL="/sign-up" CLERK_SIGN_UP_URL="/sign-up"
NEXT_PUBLIC_CLERK_SIGN_IN_URL="/sign-in" CLERK_SIGN_IN_URL="/sign-in"
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY="" CLERK_PUBLISHABLE_KEY=""
CLERK_SECRET_KEY="" CLERK_SECRET_KEY=""
CLERK_WEBHOOK_SIGNING_SECRET="" CLERK_WEBHOOK_SIGNING_SECRET=""
# Ably
ABLY_API_KEY=""
# Unkey
UNKEY_ROOT_KEY=""
# Misc # Misc
APP_ENV="" APP_ENV=""
NEXT_PUBLIC_APP_ENV=""

View file

@ -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 ## Environment Vars
npm run dev
```
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 - I use a bastardized version of semantic versioning. I jump to a new minor release whenever I feel like I made enough patch releases.
npm run build - 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 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.
npm start
```
Now you'll need to pick a host to deploy it to. ## Stats
### DIY ![Alt](https://repobeats.axiom.co/api/embed/852f886f9cf9682a5355b574f59716dca985e7cc.svg "Repobeats analytics image")
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/`

View file

@ -41,7 +41,6 @@ export async function loader({ context, params, request }: LoaderFunctionArgs) {
} }
// Initial fetch // Initial fetch
console.log("HI");
db.query.rooms db.query.rooms
.findFirst({ .findFirst({
where: eq(rooms.id, roomId || ""), where: eq(rooms.id, roomId || ""),
@ -50,7 +49,6 @@ export async function loader({ context, params, request }: LoaderFunctionArgs) {
}, },
}) })
.then((roomFromDb) => { .then((roomFromDb) => {
console.log(roomId);
return send({ return send({
event: `room-${roomId}`, event: `room-${roomId}`,
data: JSON.stringify(roomFromDb), data: JSON.stringify(roomFromDb),

View file

@ -28,6 +28,10 @@ export async function loader({ context, params, request }: LoaderFunctionArgs) {
const name = sessionClaims.name as string; const name = sessionClaims.name as string;
const image = sessionClaims.image as string; const image = sessionClaims.image as string;
const metadata = sessionClaims.metadata as {
isAdmin: boolean;
isVIP: boolean;
};
return eventStream(request.signal, function setup(send) { return eventStream(request.signal, function setup(send) {
async function handler() { async function handler() {
@ -37,7 +41,15 @@ export async function loader({ context, params, request }: LoaderFunctionArgs) {
send({ send({
event: `${userId}-${params.roomId}`, 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, userFullName: name,
userId: userId, userId: userId,
userImageUrl: image, userImageUrl: image,
isAdmin: 0, isAdmin: metadata.isAdmin ? 1 : 0,
isVIP: 0, isVIP: metadata.isVIP ? 1 : 0,
}) })
.onConflictDoUpdate({ .onConflictDoUpdate({
target: [presence.userId, presence.roomId], target: [presence.userId, presence.roomId],
@ -58,8 +70,8 @@ export async function loader({ context, params, request }: LoaderFunctionArgs) {
userFullName: name, userFullName: name,
userId: userId, userId: userId,
userImageUrl: image, userImageUrl: image,
isAdmin: 0, isAdmin: metadata.isAdmin ? 1 : 0,
isVIP: 0, isVIP: metadata.isVIP ? 1 : 0,
}, },
}) })
.then(async () => { .then(async () => {