Skip to content

Commit

Permalink
updates pass scanner
Browse files Browse the repository at this point in the history
  • Loading branch information
xwilson03 committed Aug 7, 2024
1 parent 5c8d395 commit 209e243
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
7 changes: 7 additions & 0 deletions apps/web/src/app/admin/scanner/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ export default async function Page({
const [scan, scanUser] = await db.transaction(async (tx) => {
const scanUser = await tx.query.userCommonData.findFirst({
where: eq(userCommonData.clerkID, searchParams.user!),
with: {
hackerData: {
with: {
team: true
}
}
}
});
if (!scanUser) {
return [null, null];
Expand Down
13 changes: 6 additions & 7 deletions apps/web/src/components/admin/scanner/PassScanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,25 @@
import { useState, useEffect } from "react";
import { QrScanner } from "@yudiel/react-qr-scanner";
import superjson from "superjson";
import { getScan, createScan } from "@/actions/admin/scanner-admin-actions";
import { useAction, useOptimisticAction } from "next-safe-action/hook";
import { createScan } from "@/actions/admin/scanner-admin-actions";
import { useAction } from "next-safe-action/hook";
import { type QRDataInterface } from "@/lib/utils/shared/qr";
import type { scansType, userType, eventType } from "@/lib/utils/shared/types";
import c from "config";

import {
Drawer,
DrawerClose,
DrawerContent,
DrawerDescription,
DrawerFooter,
DrawerHeader,
DrawerTitle,
DrawerTrigger,
} from "@/components/shadcn/ui/drawer";
import { Button } from "@/components/shadcn/ui/button";
import Link from "next/link";
import { useRouter, usePathname, useSearchParams } from "next/navigation";
import { toast } from "sonner";
import { UserWithAllData } from "@/lib/utils/server/types";

/*
Expand All @@ -38,7 +37,7 @@ interface PassScannerProps {
event: eventType;
hasScanned: boolean;
scan: scansType | null;
scanUser: userType | null;
scanUser: UserWithAllData | null;
}

export default function PassScanner({
Expand All @@ -60,8 +59,8 @@ export default function PassScanner({
const path = usePathname();
const router = useRouter();

const register = scanUser?.checkedIn ? "Checked in!" : "Not Checked In";
const guild = Object.keys(c.groups)[scanUser?.group || 0] ?? "None";
const register = scanUser?.checkinTimestamp ? "Checked in!" : "Not Checked In";
const guild = Object.keys(c.groups)[scanUser?.hackerData.group || 0] ?? "None";
const role = scanUser?.role ? scanUser?.role : "Not Found";

function handleScanCreate() {
Expand Down

0 comments on commit 209e243

Please sign in to comment.