From 433391e8c1495f286ea043fce984a5997895773d Mon Sep 17 00:00:00 2001 From: atridadl Date: Fri, 24 Nov 2023 22:44:10 -0700 Subject: [PATCH] Client/server separation --- app/routes/dashboard.tsx | 2 +- app/routes/room.$roomId.tsx | 10 +++++++--- app/services/{consts.ts => consts.server.ts} | 0 app/services/{helpers.ts => helpers.client.ts} | 0 app/services/{types.ts => types.client.ts} | 9 +-------- 5 files changed, 9 insertions(+), 12 deletions(-) rename app/services/{consts.ts => consts.server.ts} (100%) rename app/services/{helpers.ts => helpers.client.ts} (100%) rename app/services/{types.ts => types.client.ts} (83%) diff --git a/app/routes/dashboard.tsx b/app/routes/dashboard.tsx index 78b38e8..1020e78 100644 --- a/app/routes/dashboard.tsx +++ b/app/routes/dashboard.tsx @@ -6,7 +6,7 @@ import { useState } from "react"; import LoadingIndicator from "~/components/LoadingIndicator"; import { useEventSource } from "remix-utils/sse/react"; import { useUser } from "@clerk/remix"; -import { isAdmin, isVIP } from "~/services/helpers"; +import { isAdmin, isVIP } from "~/services/helpers.client"; export const loader: LoaderFunction = async (args) => { const { userId } = await getAuth(args); diff --git a/app/routes/room.$roomId.tsx b/app/routes/room.$roomId.tsx index 1d405d8..a1510ad 100644 --- a/app/routes/room.$roomId.tsx +++ b/app/routes/room.$roomId.tsx @@ -17,13 +17,17 @@ import { import { useEffect, useState } from "react"; import LoadingIndicator from "~/components/LoadingIndicator"; import { useEventSource } from "remix-utils/sse/react"; -import { PresenceItem, RoomResponse, VoteResponse } from "~/services/types"; -import { isAdmin, jsonToCsv } from "~/services/helpers"; +import { + PresenceItem, + RoomResponse, + VoteResponse, +} from "~/services/types.client"; +import { isAdmin, jsonToCsv } from "~/services/helpers.client"; import { useUser } from "@clerk/remix"; import { db } from "~/services/db.server"; import { rooms } from "~/services/schema"; import { eq } from "drizzle-orm"; -import { shitList } from "~/services/consts"; +import { shitList } from "~/services/consts.server"; // Loader export const loader: LoaderFunction = async (args) => { diff --git a/app/services/consts.ts b/app/services/consts.server.ts similarity index 100% rename from app/services/consts.ts rename to app/services/consts.server.ts diff --git a/app/services/helpers.ts b/app/services/helpers.client.ts similarity index 100% rename from app/services/helpers.ts rename to app/services/helpers.client.ts diff --git a/app/services/types.ts b/app/services/types.client.ts similarity index 83% rename from app/services/types.ts rename to app/services/types.client.ts index 3c6c2d7..28ed460 100644 --- a/app/services/types.ts +++ b/app/services/types.client.ts @@ -1,11 +1,4 @@ -type BetterEnum = T[keyof T]; - -export const EventTypes = { - ROOM_LIST_UPDATE: "room.list.update", - ROOM_UPDATE: "room.update", - VOTE_UPDATE: "vote.update", -} as const; -export type EventType = BetterEnum; +// type BetterEnum = T[keyof T]; export interface PresenceItem { id: string;