``refactor Standardize status/state naming across students, teachers, and user metas pages, update filters and tabs to use 'state' parameter consistently
``
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
// src/app/dashboard/students/list/page.tsx
|
||||
'use client';
|
||||
|
||||
// src/app/dashboard/students/list/page.tsx
|
||||
//
|
||||
// RULES:
|
||||
// contains list page for students (Students)
|
||||
//
|
||||
@@ -15,12 +16,6 @@ import Stack from '@mui/material/Stack';
|
||||
import Typography from '@mui/material/Typography';
|
||||
import { Plus as PlusIcon } from '@phosphor-icons/react/dist/ssr/Plus';
|
||||
import type { ListResult, RecordModel } from 'pocketbase';
|
||||
|
||||
import { StudentsFilters } from '@/components/dashboard/student/students-filters';
|
||||
import { StudentsPagination } from '@/components/dashboard/student/students-pagination';
|
||||
import { StudentsSelectionProvider } from '@/components/dashboard/student/students-selection-context';
|
||||
import { StudentsTable } from '@/components/dashboard/student/students-table';
|
||||
import type { Student } from '@/components/dashboard/student/type.d';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { paths } from '@/paths';
|
||||
@@ -29,13 +24,18 @@ import { logger } from '@/lib/default-logger';
|
||||
import { pb } from '@/lib/pb';
|
||||
import ErrorDisplay from '@/components/dashboard/error';
|
||||
import { defaultStudent } from '@/components/dashboard/student/_constants';
|
||||
import { StudentsFilters } from '@/components/dashboard/student/students-filters';
|
||||
import { StudentsPagination } from '@/components/dashboard/student/students-pagination';
|
||||
import { StudentsSelectionProvider } from '@/components/dashboard/student/students-selection-context';
|
||||
import { StudentsTable } from '@/components/dashboard/student/students-table';
|
||||
import type { Student } from '@/components/dashboard/student/type.d';
|
||||
import FormLoading from '@/components/loading';
|
||||
|
||||
export default function Page({ searchParams }: PageProps): React.JSX.Element {
|
||||
const { t } = useTranslation(['students']);
|
||||
const router = useRouter();
|
||||
|
||||
const { email, phone, sortDir, status } = searchParams;
|
||||
const { email, phone, sortDir, state } = searchParams;
|
||||
|
||||
const [studentsData, setStudentsData] = React.useState<Student[]>([]);
|
||||
|
||||
@@ -104,8 +104,8 @@ export default function Page({ searchParams }: PageProps): React.JSX.Element {
|
||||
const tempFilter = [];
|
||||
let tempSortDir = '';
|
||||
|
||||
if (status) {
|
||||
tempFilter.push(`status = "${status}"`);
|
||||
if (state) {
|
||||
tempFilter.push(`state = "${state}"`);
|
||||
}
|
||||
|
||||
if (sortDir) {
|
||||
@@ -128,7 +128,7 @@ export default function Page({ searchParams }: PageProps): React.JSX.Element {
|
||||
preFinalListOption = { ...preFinalListOption, sort: tempSortDir };
|
||||
}
|
||||
setListOption(preFinalListOption);
|
||||
}, [sortDir, email, phone, status]);
|
||||
}, [sortDir, email, phone, state]);
|
||||
|
||||
if (showLoading) return <FormLoading />;
|
||||
|
||||
@@ -176,7 +176,7 @@ export default function Page({ searchParams }: PageProps): React.JSX.Element {
|
||||
<StudentsSelectionProvider students={f}>
|
||||
<Card>
|
||||
<StudentsFilters
|
||||
filters={{ email, phone, status }}
|
||||
filters={{ email, phone, status: state }}
|
||||
fullData={studentsData}
|
||||
sortDir={sortDir}
|
||||
/>
|
||||
@@ -210,7 +210,7 @@ interface PageProps {
|
||||
email?: string;
|
||||
phone?: string;
|
||||
sortDir?: 'asc' | 'desc';
|
||||
status?: string;
|
||||
state?: string;
|
||||
//
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user