From c0c752eaadfcf9587fa270e23fdd0029b2ab0f66 Mon Sep 17 00:00:00 2001 From: gibbyb Date: Mon, 8 Sep 2025 11:25:57 -0500 Subject: [PATCH] Update bun packages and format --- convex/auth.ts | 3 +- convex/statuses.ts | 30 +++---- src/app/(auth)/signin/page.tsx | 11 +-- .../layout/profile/reset-password.tsx | 17 ++-- .../layout/status/history/index.tsx | 40 ++++----- src/components/layout/status/list/index.tsx | 23 ++--- src/components/layout/status/table/index.tsx | 4 +- src/components/ui/index.tsx | 4 +- src/components/ui/pagination.tsx | 84 +++++++++---------- src/components/ui/scroll-area.tsx | 42 +++++----- src/components/ui/table.tsx | 84 +++++++++---------- src/lib/types.ts | 3 +- src/lib/utils.ts | 1 - 13 files changed, 165 insertions(+), 181 deletions(-) diff --git a/convex/auth.ts b/convex/auth.ts index f31400a..23e1e0b 100644 --- a/convex/auth.ts +++ b/convex/auth.ts @@ -16,7 +16,8 @@ export const { auth, signIn, signOut, store, isAuthenticated } = convexAuth({ export const PASSWORD_MIN = 8; export const PASSWORD_MAX = 100; -export const PASSWORD_REGEX = /^(?=.{8,100}$)(?!.*\s)(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[\p{P}\p{S}]).*$/u; +export const PASSWORD_REGEX = + /^(?=.{8,100}$)(?!.*\s)(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[\p{P}\p{S}]).*$/u; export const getUser = query(async (ctx) => { const userId = await getAuthUserId(ctx); diff --git a/convex/statuses.ts b/convex/statuses.ts index 189e9a6..1dcc3ec 100644 --- a/convex/statuses.ts +++ b/convex/statuses.ts @@ -9,26 +9,26 @@ import { import type { Doc, Id } from './_generated/dataModel'; import { paginationOptsValidator } from 'convex/server'; -type RWCtx = MutationCtx | QueryCtx +type RWCtx = MutationCtx | QueryCtx; type StatusRow = { user: { id: Id<'users'>; name: string | null; imageUrl: string | null; - }, + }; status: { id: Id<'statuses'>; message: string; updatedAt: number; updatedBy: StatusRow['user'] | null; - } | null, + } | null; }; type Paginated = { - page: T[], - isDone: boolean, - continueCursor: string | null, + page: T[]; + isDone: boolean; + continueCursor: string | null; }; // CHANGED: typed helpers @@ -240,9 +240,10 @@ export const listHistory = query({ userId: v.optional(v.id('users')), paginationOpts: paginationOptsValidator, }, - handler: async (ctx, { userId, paginationOpts }): Promise< - Paginated - > => { + handler: async ( + ctx, + { userId, paginationOpts }, + ): Promise> => { // Query statuses newest-first, optionally filtered by user const result = userId ? await ctx.db @@ -250,17 +251,12 @@ export const listHistory = query({ .withIndex('by_user_updatedAt', (q) => q.eq('userId', userId)) .order('desc') .paginate(paginationOpts) - : await ctx.db - .query('statuses') - .order('desc') - .paginate(paginationOpts); + : await ctx.db.query('statuses').order('desc').paginate(paginationOpts); // Cache user display objects to avoid refetching repeatedly const displayCache = new Map(); - const getDisplay = async ( - uid: Id<'users'>, - ): Promise => { + const getDisplay = async (uid: Id<'users'>): Promise => { const key = uid as unknown as string; const cached = displayCache.get(key); if (cached) return cached; @@ -304,5 +300,3 @@ export const listHistory = query({ }; }, }); - - diff --git a/src/app/(auth)/signin/page.tsx b/src/app/(auth)/signin/page.tsx index 4611f98..848b878 100644 --- a/src/app/(auth)/signin/page.tsx +++ b/src/app/(auth)/signin/page.tsx @@ -30,11 +30,9 @@ const signInFormSchema = z.object({ email: z.email({ message: 'Please enter a valid email address.', }), - password: z.string() - .regex(PASSWORD_REGEX, { - message: 'Incorrect password. Does not meet requirements.', - }, - ), + password: z.string().regex(PASSWORD_REGEX, { + message: 'Incorrect password. Does not meet requirements.', + }), }); const signUpFormSchema = z @@ -51,8 +49,7 @@ const signUpFormSchema = z message: `Password must be at least ${PASSWORD_MIN} characters.`, }) .max(PASSWORD_MAX, { - message: - `Password must be no more than ${PASSWORD_MAX} characters.`, + message: `Password must be no more than ${PASSWORD_MAX} characters.`, }) .regex(/^\S+$/, { message: 'Password must not contain whitespace.', diff --git a/src/components/layout/profile/reset-password.tsx b/src/components/layout/profile/reset-password.tsx index 06b8085..67542f1 100644 --- a/src/components/layout/profile/reset-password.tsx +++ b/src/components/layout/profile/reset-password.tsx @@ -25,16 +25,17 @@ import { PASSWORD_MIN, PASSWORD_MAX, PASSWORD_REGEX } from '@/lib/types'; const formSchema = z .object({ - currentPassword: z - .string() - .regex(PASSWORD_REGEX, { - message: 'Incorrect current password. Does not meet requirements.', - }, - ), + currentPassword: z.string().regex(PASSWORD_REGEX, { + message: 'Incorrect current password. Does not meet requirements.', + }), newPassword: z .string() - .min(PASSWORD_MIN, { message: 'New password must be at least 8 characters.' }) - .max(PASSWORD_MAX, { message: 'New password must be less than 100 characters.' }) + .min(PASSWORD_MIN, { + message: 'New password must be at least 8 characters.', + }) + .max(PASSWORD_MAX, { + message: 'New password must be less than 100 characters.', + }) .regex(/^\S+$/, { message: 'Password must not contain whitespace.', }) diff --git a/src/components/layout/status/history/index.tsx b/src/components/layout/status/history/index.tsx index 6f80398..3fb32db 100644 --- a/src/components/layout/status/history/index.tsx +++ b/src/components/layout/status/history/index.tsx @@ -27,7 +27,7 @@ import { } from '@/components/ui'; type StatusHistoryProps = { - user?: typeof api.statuses.getCurrentForAll._returnType[0]['user'], + user?: (typeof api.statuses.getCurrentForAll._returnType)[0]['user']; }; const PAGE_SIZE = 25; @@ -58,8 +58,7 @@ export const StatusHistory = ({ user }: StatusHistoryProps) => { const nextIndex = pageIndex + 1; setCursors((prev) => { const copy = [...prev]; - if (copy[nextIndex] === undefined) - copy[nextIndex] = data.continueCursor; + if (copy[nextIndex] === undefined) copy[nextIndex] = data.continueCursor; return copy; }); }, [data, pageIndex]); @@ -91,14 +90,14 @@ export const StatusHistory = ({ user }: StatusHistoryProps) => { className='w-8 h-8 md:w-12 md:h-12' /> ) : ( - Tech Tracker Logo - )} + /> + )}

{user ? `${user.name ?? 'Technician'}'s History` : 'All History'}

@@ -135,10 +134,7 @@ export const StatusHistory = ({ user }: StatusHistoryProps) => { {r.user.name ?? 'Technician'} -
+
{r.status?.message ?? 'No status'}
@@ -147,9 +143,9 @@ export const StatusHistory = ({ user }: StatusHistoryProps) => { {r.status - ? `${formatTime(r.status.updatedAt)} · ${ - formatDate(r.status.updatedAt) - }` + ? `${formatTime(r.status.updatedAt)} · ${formatDate( + r.status.updatedAt, + )}` : '--:-- · --/--'} @@ -161,7 +157,6 @@ export const StatusHistory = ({ user }: StatusHistoryProps) => {
- { />
Page - - {pageIndex + 1} - + {pageIndex + 1}
{
- diff --git a/src/components/layout/status/list/index.tsx b/src/components/layout/status/list/index.tsx index 04a2add..d1faf44 100644 --- a/src/components/layout/status/list/index.tsx +++ b/src/components/layout/status/list/index.tsx @@ -151,7 +151,8 @@ export const StatusList = ({ >
-
-
-

-
@@ -187,7 +189,9 @@ export const StatusList = ({ text-muted-foreground flex-shrink-0' >
- + {s ? formatTime(s.updatedAt) : '--:--'} @@ -208,7 +212,9 @@ export const StatusList = ({ fullName={s.updatedBy.name ?? 'User'} className={tvMode ? 'w-6 h-6' : 'w-5 h-5'} /> - +

Updated by

{s.updatedBy.name ?? 'User'} @@ -267,10 +273,7 @@ export const StatusList = ({ > {selectedUserIds.length > 0 ? `Update ${selectedUserIds.length} - ${selectedUserIds.length > 1 - ? 'users' - : 'user' - }` + ${selectedUserIds.length > 1 ? 'users' : 'user'}` : 'Update Status'}
diff --git a/src/components/layout/status/table/index.tsx b/src/components/layout/status/table/index.tsx index 614d0da..5517d71 100644 --- a/src/components/layout/status/table/index.tsx +++ b/src/components/layout/status/table/index.tsx @@ -143,9 +143,7 @@ export const StatusTable = ({ Updated At - - - +
); diff --git a/src/components/ui/index.tsx b/src/components/ui/index.tsx index a54f406..1236b1c 100644 --- a/src/components/ui/index.tsx +++ b/src/components/ui/index.tsx @@ -51,9 +51,9 @@ export { PaginationPrevious, PaginationNext, PaginationEllipsis, -} from './pagination' +} from './pagination'; export { Progress } from './progress'; -export { ScrollArea, ScrollBar } from './scroll-area' +export { ScrollArea, ScrollBar } from './scroll-area'; export { Separator } from './separator'; export { StatusMessage } from './status-message'; export { SubmitButton } from './submit-button'; diff --git a/src/components/ui/pagination.tsx b/src/components/ui/pagination.tsx index 0d18541..f5b6188 100644 --- a/src/components/ui/pagination.tsx +++ b/src/components/ui/pagination.tsx @@ -1,68 +1,68 @@ -import * as React from "react" +import * as React from 'react'; import { ChevronLeftIcon, ChevronRightIcon, MoreHorizontalIcon, -} from "lucide-react" +} from 'lucide-react'; -import { cn } from "@/lib/utils" -import { Button, buttonVariants } from "@/components/ui/button" +import { cn } from '@/lib/utils'; +import { Button, buttonVariants } from '@/components/ui/button'; -function Pagination({ className, ...props }: React.ComponentProps<"nav">) { +function Pagination({ className, ...props }: React.ComponentProps<'nav'>) { return (