``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,11 +1,14 @@
|
||||
'use client';
|
||||
|
||||
// RULES:
|
||||
// T.B.A.
|
||||
//
|
||||
import * as React from 'react';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import GetActiveCount from '@/db/Customers/GetActiveCount';
|
||||
import GetBlockedCount from '@/db/Customers/GetBlockedCount';
|
||||
import GetPendingCount from '@/db/Customers/GetPendingCount';
|
||||
import { getAllTeachersCount } from '@/db/Teachers/GetAllCount';
|
||||
|
||||
import Button from '@mui/material/Button';
|
||||
import Chip from '@mui/material/Chip';
|
||||
import Divider from '@mui/material/Divider';
|
||||
@@ -18,17 +21,14 @@ import Typography from '@mui/material/Typography';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { paths } from '@/paths';
|
||||
import { logger } from '@/lib/default-logger';
|
||||
import { FilterButton } from '@/components/core/filter-button';
|
||||
import { Option } from '@/components/core/option';
|
||||
|
||||
import { useTeachersSelection } from './teachers-selection-context';
|
||||
import GetBlockedCount from '@/db/Customers/GetBlockedCount';
|
||||
import GetPendingCount from '@/db/Customers/GetPendingCount';
|
||||
import GetActiveCount from '@/db/Customers/GetActiveCount';
|
||||
import PhoneFilterPopover from './phone-filter-popover';
|
||||
import EmailFilterPopover from './email-filter-popover';
|
||||
import type { TeachersFiltersProps, Filters, SortDir } from './type.d';
|
||||
import { logger } from '@/lib/default-logger';
|
||||
import PhoneFilterPopover from './phone-filter-popover';
|
||||
import { useTeachersSelection } from './teachers-selection-context';
|
||||
import type { Filters, SortDir, TeachersFiltersProps } from './type.d';
|
||||
|
||||
export function TeachersFilters({
|
||||
filters = {},
|
||||
@@ -38,7 +38,7 @@ export function TeachersFilters({
|
||||
}: TeachersFiltersProps): React.JSX.Element {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const { email, phone, status } = filters;
|
||||
const { email, phone, state } = filters;
|
||||
|
||||
const [totalCount, setTotalCount] = React.useState<number>(0);
|
||||
const [activeCount, setActiveCount] = React.useState<number>(0);
|
||||
@@ -77,8 +77,8 @@ export function TeachersFilters({
|
||||
searchParams.set('sortDir', newSortDir);
|
||||
}
|
||||
|
||||
if (newFilters.status) {
|
||||
searchParams.set('status', newFilters.status);
|
||||
if (newFilters.state) {
|
||||
searchParams.set('state', newFilters.state);
|
||||
}
|
||||
|
||||
if (newFilters.email) {
|
||||
@@ -100,7 +100,7 @@ export function TeachersFilters({
|
||||
|
||||
const handleStatusChange = React.useCallback(
|
||||
(_: React.SyntheticEvent, value: string) => {
|
||||
updateSearchParams({ ...filters, status: value }, sortDir);
|
||||
updateSearchParams({ ...filters, state: value }, sortDir);
|
||||
},
|
||||
[updateSearchParams, filters, sortDir]
|
||||
);
|
||||
@@ -126,7 +126,7 @@ export function TeachersFilters({
|
||||
[updateSearchParams, filters]
|
||||
);
|
||||
|
||||
const hasFilters = status || email || phone;
|
||||
const hasFilters = state || email || phone;
|
||||
|
||||
React.useEffect(() => {
|
||||
const fetchCount = async (): Promise<void> => {
|
||||
@@ -153,7 +153,7 @@ export function TeachersFilters({
|
||||
<Tabs
|
||||
onChange={handleStatusChange}
|
||||
sx={{ px: 3 }}
|
||||
value={status ?? ''}
|
||||
value={state ?? ''}
|
||||
variant="scrollable"
|
||||
//
|
||||
>
|
||||
@@ -240,8 +240,8 @@ export function TeachersFilters({
|
||||
sx={{ maxWidth: '100%', width: '120px' }}
|
||||
value={sortDir}
|
||||
>
|
||||
<Option value="desc">Newest</Option>
|
||||
<Option value="asc">Oldest</Option>
|
||||
<Option value="desc">{t('newest')}</Option>
|
||||
<Option value="asc">{t('oldest')}</Option>
|
||||
</Select>
|
||||
</Stack>
|
||||
</div>
|
||||
|
@@ -1,6 +1,7 @@
|
||||
'use client';
|
||||
|
||||
// src/components/dashboard/teacher/teachers-table.tsx
|
||||
//
|
||||
// PURPOSE:
|
||||
// handle change details for teachers collection
|
||||
//
|
||||
@@ -9,21 +10,17 @@ import RouterLink from 'next/link';
|
||||
import { LoadingButton } from '@mui/lab';
|
||||
import Avatar from '@mui/material/Avatar';
|
||||
import Box from '@mui/material/Box';
|
||||
import Button from '@mui/material/Button';
|
||||
import Chip from '@mui/material/Chip';
|
||||
import IconButton from '@mui/material/IconButton';
|
||||
import LinearProgress from '@mui/material/LinearProgress';
|
||||
import Link from '@mui/material/Link';
|
||||
import Stack from '@mui/material/Stack';
|
||||
import Typography from '@mui/material/Typography';
|
||||
import { CheckCircle as CheckCircleIcon } from '@phosphor-icons/react/dist/ssr/CheckCircle';
|
||||
import { Clock as ClockIcon } from '@phosphor-icons/react/dist/ssr/Clock';
|
||||
import { Images as ImagesIcon } from '@phosphor-icons/react/dist/ssr/Images';
|
||||
import { Minus as MinusIcon } from '@phosphor-icons/react/dist/ssr/Minus';
|
||||
import { PencilSimple as PencilSimpleIcon } from '@phosphor-icons/react/dist/ssr/PencilSimple';
|
||||
import { TrashSimple as TrashSimpleIcon } from '@phosphor-icons/react/dist/ssr/TrashSimple';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { toast } from 'sonner';
|
||||
|
||||
import { paths } from '@/paths';
|
||||
import { dayjs } from '@/lib/dayjs';
|
||||
|
@@ -84,5 +84,5 @@ export interface TeachersFiltersProps {
|
||||
export interface Filters {
|
||||
email?: string;
|
||||
phone?: string;
|
||||
status?: string;
|
||||
state?: string;
|
||||
}
|
||||
|
Reference in New Issue
Block a user