Skip to content

Commit 0bfde0e

Browse files
committed
chore: format
1 parent 3344ae0 commit 0bfde0e

8 files changed

Lines changed: 29 additions & 59 deletions

File tree

web/src/components/Navbar.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ function ToggleTheme() {
220220
setTheme(theme === "light" ? "dark" : "light");
221221
}}
222222
>
223-
{/* <SunMoon className="text-foreground" /> */}
224223
{theme === "light" ? <Sun /> : <Moon />}
225224
</Button>
226225
);

web/src/components/count-btn.tsx

Lines changed: 0 additions & 21 deletions
This file was deleted.

web/src/pages/AllProblems.tsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -364,9 +364,7 @@ function OtherCompaniesCellRenderer({
364364
);
365365
}
366366

367-
/* ─────────────────────────────────────────────────────────── */
368-
/* Main Component */
369-
/* ─────────────────────────────────────────────────────────── */
367+
/* ------------------- MAIN COMPONENT ------------------- */
370368
export default function AllProblems() {
371369
const { theme } = useAppContext();
372370

@@ -385,7 +383,7 @@ export default function AllProblems() {
385383

386384
const gridRef = useRef<AgGridReact<Problem>>(null);
387385

388-
/* ─── Fetch ──────────────────────────────────────────────── */
386+
// fetch
389387
useEffect(() => {
390388
async function fetchData() {
391389
setLoading(true);
@@ -455,7 +453,7 @@ export default function AllProblems() {
455453
fetchTags();
456454
}, []);
457455

458-
/* ─── Quick filter (search + difficulty) ────────────────── */
456+
// filter - AG Grid external filter handles difficulty, tag, and hide completed; quick filter handles search
459457
useEffect(() => {
460458
if (!gridRef.current?.api) return;
461459

@@ -505,8 +503,7 @@ export default function AllProblems() {
505503
[diffFilter, selectedTags, tagMatchMode, hideCompleted],
506504
);
507505

508-
/* ─── Column Definitions ────────────────────────────────── */
509-
506+
/* --------------------- Column Defs -------------------- */
510507
const columnDefs = useMemo<ColDef<Problem>[]>(
511508
() => [
512509
{
@@ -610,13 +607,12 @@ export default function AllProblems() {
610607
[],
611608
);
612609

613-
/* ─── Stats ─────────────────────────────────────────────── */
610+
/* ------------------------ Stats ----------------------- */
614611
const easyCnt = problems.filter((p) => p.difficulty === "Easy").length;
615612
const medCnt = problems.filter((p) => p.difficulty === "Medium").length;
616613
const hardCnt = problems.filter((p) => p.difficulty === "Hard").length;
617614
const completedCnt = problems.filter((p) => p.completed).length;
618615

619-
/* ─── Render ─────────────────────────────────────────────── */
620616
if (loading) {
621617
return (
622618
<div className="flex items-center justify-center">

web/src/pages/CompanyProblems.tsx

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ import { TagFilterDropdown } from "~/components/TagFilterDropdown";
3030

3131
ModuleRegistry.registerModules([AllCommunityModule]);
3232

33-
/* ─────────────────────────────────────────────────────────── */
34-
/* Types */
35-
/* ─────────────────────────────────────────────────────────── */
33+
/* ------------------------------------------------------ */
34+
/* Types */
35+
/* ------------------------------------------------------ */
3636
type Difficulty = "Easy" | "Medium" | "Hard";
3737

3838
type Problem = {
@@ -53,8 +53,9 @@ type Company = { id: number; name: string };
5353
type TimeFrameTag = "six-months" | "three-months" | "thirty-days";
5454

5555
/* ─────────────────────────────────────────────────────────── */
56-
/* Constants */
57-
/* ─────────────────────────────────────────────────────────── */
56+
/* ------------------------------------------------------ */
57+
/* Constants */
58+
/* ------------------------------------------------------ */
5859
const DIFFICULTY_ORDER: Record<string, number> = {
5960
Easy: 0,
6061
Medium: 1,
@@ -67,9 +68,9 @@ const DIFFICULTY_STYLES: Record<string, string> = {
6768
Hard: "text-rose-500 bg-rose-500/10",
6869
};
6970

70-
/* ─────────────────────────────────────────────────────────── */
71-
/* Helpers */
72-
/* ─────────────────────────────────────────────────────────── */
71+
/* ------------------------------------------------------ */
72+
/* Helpers */
73+
/* ------------------------------------------------------ */
7374
async function fetchAllCompanyProblems(companyId: number) {
7475
const PAGE_SIZE = 4000;
7576
let from = 0;
@@ -107,9 +108,9 @@ async function fetchAllCompanyProblems(companyId: number) {
107108
return allRows;
108109
}
109110

110-
/* ─────────────────────────────────────────────────────────── */
111-
/* Cell Renderers */
112-
/* ─────────────────────────────────────────────────────────── */
111+
/* ------------------------------------------------------ */
112+
/* Cell Renderers */
113+
/* ------------------------------------------------------ */
113114
function CompletedCellRenderer(props: ICellRendererParams<Problem>) {
114115
const { value, data, api } = props;
115116

@@ -142,7 +143,7 @@ function CompletedCellRenderer(props: ICellRendererParams<Problem>) {
142143
update: [loadingRow],
143144
});
144145

145-
// 👇 FORCE CELL REFRESH
146+
// FORCE CELL REFRESH
146147
api.refreshCells({
147148
rowNodes: [props.node],
148149
force: true,
@@ -167,7 +168,7 @@ function CompletedCellRenderer(props: ICellRendererParams<Problem>) {
167168
if (error) throw error;
168169
}
169170

170-
// Success update completed state
171+
// Success -> update completed state
171172
api.applyTransaction({
172173
update: [
173174
{
@@ -365,9 +366,9 @@ function OtherCompaniesCellRenderer({
365366
);
366367
}
367368

368-
/* ─────────────────────────────────────────────────────────── */
369-
/* Main Component */
370-
/* ─────────────────────────────────────────────────────────── */
369+
/* ------------------------------------------------------ */
370+
/* Main Component */
371+
/* ------------------------------------------------------ */
371372
export default function CompanyProblems() {
372373
const { theme } = useAppContext();
373374
const { id } = useParams<{ id: string }>();
@@ -389,7 +390,7 @@ export default function CompanyProblems() {
389390

390391
const gridRef = useRef<AgGridReact<Problem>>(null);
391392

392-
/* ─── Fetch ──────────────────────────────────────────────── */
393+
/* ------------------------ Fetch ----------------------- */
393394
useEffect(() => {
394395
if (!companyId) return;
395396

@@ -479,7 +480,7 @@ export default function CompanyProblems() {
479480
fetchTags();
480481
}, []);
481482

482-
/* ─── Quick filter (search + difficulty) ────────────────── */
483+
/* ----------------------- Filters ---------------------- */
483484
useEffect(() => {
484485
if (!gridRef.current?.api) return;
485486

@@ -529,8 +530,7 @@ export default function CompanyProblems() {
529530
[diffFilter, selectedTags, tagMatchMode, hideCompleted],
530531
);
531532

532-
/* ─── Column Definitions ────────────────────────────────── */
533-
533+
/* --------------------- Column Defs -------------------- */
534534
const columnDefs = useMemo<ColDef<Problem>[]>(
535535
() => [
536536
{
@@ -677,13 +677,12 @@ export default function CompanyProblems() {
677677
[],
678678
);
679679

680-
/* ─── Stats ─────────────────────────────────────────────── */
680+
/* ------------------------ Stats ----------------------- */
681681
const easyCnt = problems.filter((p) => p.difficulty === "Easy").length;
682682
const medCnt = problems.filter((p) => p.difficulty === "Medium").length;
683683
const hardCnt = problems.filter((p) => p.difficulty === "Hard").length;
684684
const completedCnt = problems.filter((p) => p.completed).length;
685685

686-
/* ─── Render ─────────────────────────────────────────────── */
687686
if (loading) {
688687
return (
689688
<div className="flex items-center justify-center">

web/src/pages/ErrorPage.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { TriangleAlert } from "lucide-react";
22
import { useRouteError } from "react-router";
3-
import CountBtn from "~/components/count-btn";
43
import huhGif from "~/assets/huh.gif";
54

65
export default function ErrorPage() {
@@ -34,7 +33,6 @@ export default function ErrorPage() {
3433
{data && <div className="text-muted-foreground text-sm">{data}</div>}
3534
</div>
3635
</div>
37-
<CountBtn className="absolute top-4 right-4" />
3836
</div>
3937
);
4038
}

web/src/pages/Home.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,12 @@ export default function Home() {
2222
/* --------------------- FETCH STATS -------------------- */
2323
useEffect(() => {
2424
async function fetchStats() {
25-
// 1️⃣ Memory cache
2625
if (memoryCache) {
2726
setStats(memoryCache);
2827
setLoading(false);
2928
return;
3029
}
3130

32-
// 2️⃣ LocalStorage cache
3331
const cached = localStorage.getItem(CACHE_KEY);
3432
if (cached) {
3533
const parsed = JSON.parse(cached);
@@ -41,7 +39,6 @@ export default function Home() {
4139
}
4240
}
4341

44-
// 3️⃣ Fetch counts from Supabase
4542
const [companiesRes, problemsRes] = await Promise.all([
4643
supabase.from("companies").select("*", { count: "exact", head: true }),
4744

web/src/pages/SignUp.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Eye, EyeOff } from "lucide-react";
2-
import React, { useState } from "react";
2+
import { useState } from "react";
33
import { Link, useNavigate } from "react-router";
44
import { Button } from "~/components/ui/button";
55
import { ButtonGroup } from "~/components/ui/button-group";

web/src/styles/globals.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
@import url("https://fonts.googleapis.com/css2?family=Geist:wght@100..900&display=swap");
66
/* ------------------------------------------------------ */
77

8+
/* ---------------- AG GRID Custom Styles --------------- */
89
.fader {
910
/* Apply a fading effect */
1011
-webkit-mask-image: linear-gradient(
@@ -36,6 +37,7 @@
3637
border-radius: 2px;
3738
transform: translateY(-50%);
3839
}
40+
/* ------------------------------------------------------ */
3941

4042
@import "tailwindcss";
4143

0 commit comments

Comments
 (0)