Skip to content

Commit

Permalink
Merge branch 'dev' into chore/141-redis-refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuasilva414 committed Jan 2, 2025
2 parents b8be971 + b1d8b89 commit c774463
Show file tree
Hide file tree
Showing 18 changed files with 376 additions and 244 deletions.
1 change: 1 addition & 0 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@radix-ui/react-switch": "^1.0.3",
"@react-email/components": "^0.0.21",
"@t3-oss/env-nextjs": "^0.10.1",
"@tanstack/match-sorter-utils": "^8.19.4",
"@tanstack/react-query": "^5.51.11",
"@tanstack/react-table": "^8.19.3",
"@trpc/client": "11.0.0-rc.466",
Expand Down
Binary file removed apps/web/public/img/dash/pass/bg.png
Binary file not shown.
Binary file added apps/web/public/img/dash/pass/bg.webp
Binary file not shown.
6 changes: 5 additions & 1 deletion apps/web/src/app/admin/users/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ export default async function Page({ params }: { params: { slug: string } }) {
<Link href={`/@${user.hackerTag}`} target="_blank">
<Button variant={"outline"}>Hacker Profile</Button>
</Link>
<Button variant={"outline"}>Email Hacker</Button>

<Link href={`mailto:${user.email}`}>
<Button variant={"outline"}>Email Hacker</Button>
</Link>

<UpdateRoleDialog
name={`${user.firstName} ${user.lastName}`}
canMakeAdmins={admin.role === "super_admin"}
Expand Down
50 changes: 8 additions & 42 deletions apps/web/src/app/admin/users/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,16 @@ import { DataTable } from "@/components/admin/users/UserDataTable";
import { columns } from "@/components/admin/users/UserColumns";
import { Button } from "@/components/shadcn/ui/button";
import { FolderInput } from "lucide-react";
import { DefaultPagination } from "@/components/admin/users/DefaultPagination";
import SearchBar from "@/components/admin/users/SearchBar";
import { getAllUsers } from "db/functions";
import { userCommonData } from "db/schema";

export default async function Page({
searchParams,
}: {
searchParams: { [key: string]: string | undefined };
}) {
// COME BACK AND CHANGE
const maxPerPage = 30;

let page = +(searchParams["page"] ?? "1");
let user = searchParams["user"] ?? "";
const checkedBoxes = searchParams["checkedBoxes"] ?? "";

console.log(checkedBoxes);

const start = maxPerPage * (page - 1);
const end = maxPerPage + start;

// Might want to work with cache in prod to see if this will be plausible to do
const userData = await db.query.userCommonData.findMany({
with: { hackerData: true },
where: and(
or(
ilike(userCommonData.firstName, `%${user}%`),
ilike(userCommonData.lastName, `%${user}%`),
),
),
});
// This begs a question where we might want to have an option later on to sort by the role as we might want different things
export default async function Page() {
const userData = await getAllUsers();

return (
<div className="mx-auto max-w-7xl px-5 pt-44">
<div className="mb-5 grid w-full grid-cols-3">
<div className="mx-auto max-w-7xl px-5 pt-40">
<div className="mb-5 grid w-full grid-cols-2">
<div className="flex items-center">
<div>
<h2 className="text-3xl font-bold tracking-tight">
Expand All @@ -48,7 +23,6 @@ export default async function Page({
</p>
</div>
</div>
<SearchBar />
<div className="flex items-center justify-end">
<a download href="/api/admin/export">
<Button className="flex gap-x-1">
Expand All @@ -58,25 +32,17 @@ export default async function Page({
</a>
</div>
</div>
{/* TODO: Would very much like to not have "as any" here in the future */}
<div className="flex w-full space-x-10">
<div className="flex w-full justify-center">
{userData && userData.length > 0 ? (
<>
<DataTable
columns={columns}
data={userData.slice(start, end) as any}
/>
<DataTable columns={columns} data={userData} />
</>
) : (
<div className="flex w-full items-center justify-center">
<h1>No Results :(</h1>
</div>
)}
{/* <Filters/> */}
</div>
<DefaultPagination
maxPages={Math.ceil(userData.length / maxPerPage)}
/>
</div>
);
}
Expand Down
1 change: 1 addition & 0 deletions apps/web/src/app/dash/pass/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ function EventPass({ qrPayload, user, clerk, guild }: EventPassProps) {
src={c.eventPassBgImage}
alt={""}
fill
priority
className="no-select -translate-y-[15%] scale-[0.8] object-contain"
/>
<div className="grid h-20 w-full grid-cols-2">
Expand Down
73 changes: 0 additions & 73 deletions apps/web/src/components/admin/users/DefaultPagination.tsx

This file was deleted.

45 changes: 0 additions & 45 deletions apps/web/src/components/admin/users/SearchBar.tsx

This file was deleted.

9 changes: 8 additions & 1 deletion apps/web/src/components/admin/users/ServerSections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,14 @@ export function ProfileInfo({ user }: { user: Hacker }) {
/>
</div>
<div className="flex flex-col gap-y-5 pt-5">
<Cell title="Skills" value={"Coming soon..."} />
<Cell
title="Skills"
value={
user.skills && (user.skills as string[]).length > 0
? (user.skills as string[]).join(", ")
: ""
}
/>
<Cell title="Bio" value={user.bio} />
</div>
</UserInfoSection>
Expand Down
Loading

0 comments on commit c774463

Please sign in to comment.