Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/pages/dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ type ClassListItem = {
};

const roleColors = ["#f97316", "#0ea5e9", "#22c55e", "#a855f7"];
const EMPTY_USERS: User[] = [];
const EMPTY_SUBJECTS: Subject[] = [];
const EMPTY_DEPARTMENTS: Department[] = [];
const EMPTY_CLASSES: ClassListItem[] = [];

const Dashboard = () => {
const Link = useLink();
Expand All @@ -61,10 +65,10 @@ const Dashboard = () => {
pagination: { mode: "off" },
});

const users = usersQuery.data?.data ?? [];
const subjects = subjectsQuery.data?.data ?? [];
const departments = departmentsQuery.data?.data ?? [];
const classes = classesQuery.data?.data ?? [];
const users = usersQuery.data?.data ?? EMPTY_USERS;
const subjects = subjectsQuery.data?.data ?? EMPTY_SUBJECTS;
const departments = departmentsQuery.data?.data ?? EMPTY_DEPARTMENTS;
const classes = classesQuery.data?.data ?? EMPTY_CLASSES;
Comment on lines +68 to +71
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix indentation on Line 68.

Line 68 has one leading space instead of the two used on lines 69–71, creating an inconsistent indent within the same declaration block.

🔧 Proposed fix
-  const users = usersQuery.data?.data ?? EMPTY_USERS;
+  const users = usersQuery.data?.data ?? EMPTY_USERS;
   const subjects = subjectsQuery.data?.data ?? EMPTY_SUBJECTS;
   const departments = departmentsQuery.data?.data ?? EMPTY_DEPARTMENTS;
   const classes = classesQuery.data?.data ?? EMPTY_CLASSES;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const users = usersQuery.data?.data ?? EMPTY_USERS;
const subjects = subjectsQuery.data?.data ?? EMPTY_SUBJECTS;
const departments = departmentsQuery.data?.data ?? EMPTY_DEPARTMENTS;
const classes = classesQuery.data?.data ?? EMPTY_CLASSES;
const users = usersQuery.data?.data ?? EMPTY_USERS;
const subjects = subjectsQuery.data?.data ?? EMPTY_SUBJECTS;
const departments = departmentsQuery.data?.data ?? EMPTY_DEPARTMENTS;
const classes = classesQuery.data?.data ?? EMPTY_CLASSES;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/pages/dashboard.tsx` around lines 68 - 71, Fix the inconsistent
indentation on the const declaration for users so it matches the other
declarations: align the leading spaces of "const users = usersQuery.data?.data
?? EMPTY_USERS;" with the lines for "subjects", "departments", and "classes"
(use the same two-space indent), ensuring the variable name "users" and its
references to "usersQuery" and "EMPTY_USERS" remain unchanged.


const usersByRole = useMemo(() => {
const counts = users.reduce<Record<string, number>>((acc, user) => {
Expand Down