update,
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -3,7 +3,7 @@
|
||||
import * as React from 'react';
|
||||
import GetAllLessonCategoriesCount from '@/db/LessonCategories/GetAllCount';
|
||||
import GetAllLessonTypesCount from '@/db/LessonTypes/GetAllCount';
|
||||
import GetAllUsersCount from '@/db/Users/GetAllCount';
|
||||
import { GetAllUsersCount } from '@/db/Users/GetAllCount';
|
||||
import Box from '@mui/material/Box';
|
||||
import Button from '@mui/material/Button';
|
||||
import Stack from '@mui/material/Stack';
|
||||
@@ -59,21 +59,37 @@ export default function Page(): React.JSX.Element {
|
||||
}}
|
||||
>
|
||||
<Stack spacing={4}>
|
||||
<Stack direction={{ xs: 'column', sm: 'row' }} spacing={3} sx={{ alignItems: 'flex-start' }}>
|
||||
<Stack
|
||||
direction={{ xs: 'column', sm: 'row' }}
|
||||
spacing={3}
|
||||
sx={{ alignItems: 'flex-start' }}
|
||||
>
|
||||
<Box sx={{ flex: '1 1 auto' }}>
|
||||
<Typography variant="h4">{t('Overview')}</Typography>
|
||||
</Box>
|
||||
<div>
|
||||
<Button startIcon={<PlusIcon />} variant="contained">
|
||||
<Button
|
||||
startIcon={<PlusIcon />}
|
||||
variant="contained"
|
||||
>
|
||||
{t('Dashboard')}
|
||||
</Button>
|
||||
</div>
|
||||
</Stack>
|
||||
<Grid container spacing={4}>
|
||||
<Grid md={4} xs={12}>
|
||||
<Grid
|
||||
container
|
||||
spacing={4}
|
||||
>
|
||||
<Grid
|
||||
md={4}
|
||||
xs={12}
|
||||
>
|
||||
<ActiveUserCount />
|
||||
</Grid>
|
||||
<Grid md={4} xs={12}>
|
||||
<Grid
|
||||
md={4}
|
||||
xs={12}
|
||||
>
|
||||
<Summary
|
||||
amount={lessonCategoriesCount}
|
||||
diff={15}
|
||||
@@ -82,7 +98,10 @@ export default function Page(): React.JSX.Element {
|
||||
trend="up"
|
||||
/>
|
||||
</Grid>
|
||||
<Grid md={4} xs={12}>
|
||||
<Grid
|
||||
md={4}
|
||||
xs={12}
|
||||
>
|
||||
<Summary
|
||||
amount={lessonTypesCount}
|
||||
diff={15}
|
||||
@@ -91,7 +110,10 @@ export default function Page(): React.JSX.Element {
|
||||
trend="up"
|
||||
/>
|
||||
</Grid>
|
||||
<Grid md={8} xs={12}>
|
||||
<Grid
|
||||
md={8}
|
||||
xs={12}
|
||||
>
|
||||
<AppUsage
|
||||
data={[
|
||||
{ name: 'Jan', v1: 36, v2: 19 },
|
||||
@@ -109,22 +131,41 @@ export default function Page(): React.JSX.Element {
|
||||
]}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid md={4} xs={12}>
|
||||
<Grid
|
||||
md={4}
|
||||
xs={12}
|
||||
>
|
||||
<Subscriptions subscriptions={SamplesubScriptions} />
|
||||
</Grid>
|
||||
<Grid md={4} xs={12}>
|
||||
<Grid
|
||||
md={4}
|
||||
xs={12}
|
||||
>
|
||||
<AppChat messages={SampleMessages} />
|
||||
</Grid>
|
||||
<Grid md={4} xs={12}>
|
||||
<Grid
|
||||
md={4}
|
||||
xs={12}
|
||||
>
|
||||
<Events events={SampleEvents} />
|
||||
</Grid>
|
||||
<Grid md={4} xs={12}>
|
||||
<Grid
|
||||
md={4}
|
||||
xs={12}
|
||||
>
|
||||
<AppLimits usage={80} />
|
||||
</Grid>
|
||||
<Grid md={4} xs={12}>
|
||||
<Grid
|
||||
md={4}
|
||||
xs={12}
|
||||
>
|
||||
<HelperWidget
|
||||
action={
|
||||
<Button color="secondary" endIcon={<ArrowRightIcon />} size="small">
|
||||
<Button
|
||||
color="secondary"
|
||||
endIcon={<ArrowRightIcon />}
|
||||
size="small"
|
||||
>
|
||||
{t('Search jobs')}
|
||||
</Button>
|
||||
}
|
||||
@@ -134,10 +175,17 @@ export default function Page(): React.JSX.Element {
|
||||
title={t('Find your dream job')}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid md={4} xs={12}>
|
||||
<Grid
|
||||
md={4}
|
||||
xs={12}
|
||||
>
|
||||
<HelperWidget
|
||||
action={
|
||||
<Button color="secondary" endIcon={<ArrowRightIcon />} size="small">
|
||||
<Button
|
||||
color="secondary"
|
||||
endIcon={<ArrowRightIcon />}
|
||||
size="small"
|
||||
>
|
||||
{t('Help center')}
|
||||
</Button>
|
||||
}
|
||||
@@ -147,10 +195,17 @@ export default function Page(): React.JSX.Element {
|
||||
title={t('Need help figuring things out?')}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid md={4} xs={12}>
|
||||
<Grid
|
||||
md={4}
|
||||
xs={12}
|
||||
>
|
||||
<HelperWidget
|
||||
action={
|
||||
<Button color="secondary" endIcon={<ArrowRightIcon />} size="small">
|
||||
<Button
|
||||
color="secondary"
|
||||
endIcon={<ArrowRightIcon />}
|
||||
size="small"
|
||||
>
|
||||
{t('Documentation')}
|
||||
</Button>
|
||||
}
|
||||
|
57
002_source/cms/src/app/dashboard/students/SampleStudents.tsx
Normal file
57
002_source/cms/src/app/dashboard/students/SampleStudents.tsx
Normal file
@@ -0,0 +1,57 @@
|
||||
// src/app/dashboard/students/page.tsx
|
||||
'use client';
|
||||
import type { Student } from '@/db/Students/type.d';
|
||||
import { dayjs } from '@/lib/dayjs';
|
||||
|
||||
export const SampleStudents = [
|
||||
{
|
||||
id: 'STU-005',
|
||||
name: 'Fran Perez',
|
||||
avatar: '/assets/avatar-5.png',
|
||||
email: 'fran.perez@domain.com',
|
||||
phone: '(815) 704-0045',
|
||||
quota: 50,
|
||||
status: 'active',
|
||||
createdAt: dayjs().subtract(1, 'hour').toDate(),
|
||||
},
|
||||
{
|
||||
id: 'STU-004',
|
||||
name: 'Penjani Inyene',
|
||||
avatar: '/assets/avatar-4.png',
|
||||
email: 'penjani.inyene@domain.com',
|
||||
phone: '(803) 937-8925',
|
||||
quota: 100,
|
||||
status: 'active',
|
||||
createdAt: dayjs().subtract(3, 'hour').toDate(),
|
||||
},
|
||||
{
|
||||
id: 'STU-003',
|
||||
name: 'Carson Darrin',
|
||||
avatar: '/assets/avatar-3.png',
|
||||
email: 'carson.darrin@domain.com',
|
||||
phone: '(715) 278-5041',
|
||||
quota: 10,
|
||||
status: 'blocked',
|
||||
createdAt: dayjs().subtract(1, 'hour').subtract(1, 'day').toDate(),
|
||||
},
|
||||
{
|
||||
id: 'STU-002',
|
||||
name: 'Siegbert Gottfried',
|
||||
avatar: '/assets/avatar-2.png',
|
||||
email: 'siegbert.gottfried@domain.com',
|
||||
phone: '(603) 766-0431',
|
||||
quota: 0,
|
||||
status: 'pending',
|
||||
createdAt: dayjs().subtract(7, 'hour').subtract(1, 'day').toDate(),
|
||||
},
|
||||
{
|
||||
id: 'STU-001',
|
||||
name: 'Miron Vitold',
|
||||
avatar: '/assets/avatar-1.png',
|
||||
email: 'miron.vitold@domain.com',
|
||||
phone: '(425) 434-5535',
|
||||
quota: 50,
|
||||
status: 'active',
|
||||
createdAt: dayjs().subtract(2, 'hour').subtract(2, 'day').toDate(),
|
||||
},
|
||||
] satisfies Student[];
|
@@ -1,11 +1,11 @@
|
||||
# GUIDELINES
|
||||
|
||||
this folder is part of nextjs typescript project and containing page definition for `Customer` / `Customers` record:
|
||||
this folder is part of nextjs typescript project and containing page definition for `Student` / `Students` record:
|
||||
|
||||
- list (./page.tsx)
|
||||
- view (./[customerId]/page.tsx)
|
||||
- view (./[studentId]/page.tsx)
|
||||
- create (./create/page.tsx)
|
||||
- edit (./[customerId]/page.tsx)
|
||||
- edit (./[studentId]/page.tsx)
|
||||
- translation provided by react-i18next
|
||||
|
||||
the `@` sign refer to `<base_dir>/002_source/002_source/cms/src`
|
||||
@@ -13,17 +13,17 @@ the `@` sign refer to `<base_dir>/002_source/002_source/cms/src`
|
||||
## Assumption and Requirements
|
||||
|
||||
- let one file contains one component only.
|
||||
- type information defined in `<base_dir>/002_source/cms/src/db/Customers/type.d.tsx`
|
||||
- it mainly consume the db drivers `Customres` in `<base_dir>/002_source/cms/src/db/Customers`
|
||||
- type information defined in `<base_dir>/002_source/cms/src/db/Students/type.d.tsx`
|
||||
- it mainly consume the db drivers `Students` in `<base_dir>/002_source/cms/src/db/Students`
|
||||
|
||||
simple template:
|
||||
|
||||
```typescript
|
||||
// src/app/dashboard/customers/page.tsx
|
||||
// src/app/dashboard/students/page.tsx
|
||||
'use client';
|
||||
|
||||
// RULES:
|
||||
// contains list page for customers (Customers)
|
||||
// contains list page for students (Students)
|
||||
// contain definition to collection only
|
||||
//
|
||||
import statements here ...
|
||||
@@ -46,4 +46,3 @@ export default function Page({ searchParams }: PageProps): React.JSX.Element {
|
||||
interface PageProps {
|
||||
searchParams: { email?: string; phone?: string; sortDir?: 'asc' | 'desc'; status?: string };
|
||||
}
|
||||
```
|
||||
|
@@ -1,11 +0,0 @@
|
||||
# task
|
||||
|
||||
## instruction
|
||||
|
||||
with reference to `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/app/_helloworld/page.tsx`
|
||||
|
||||
with reference to `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/app/dashboard/lesson_types/edit/[typeId]/page.tsx`
|
||||
|
||||
please modify `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/app/dashboard/lesson_categories/edit/page.tsx`
|
||||
|
||||
please draft a tsx for showing error to user thanks,
|
@@ -1,13 +1,13 @@
|
||||
// src/app/dashboard/customers/page.tsx
|
||||
// src/app/dashboard/students/list/page.tsx
|
||||
'use client';
|
||||
|
||||
// RULES:
|
||||
// contains list page for customers (Customers)
|
||||
// contains list page for students (Students)
|
||||
// contain definition to collection only
|
||||
//
|
||||
import * as React from 'react';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { COL_CUSTOMERS } from '@/constants';
|
||||
import { COL_STUDENTS } from '@/constants';
|
||||
import { LoadingButton } from '@mui/lab';
|
||||
import Box from '@mui/material/Box';
|
||||
import Card from '@mui/material/Card';
|
||||
@@ -33,7 +33,7 @@ import { defaultStudent } from '@/components/dashboard/student/_constants';
|
||||
import FormLoading from '@/components/loading';
|
||||
|
||||
export default function Page({ searchParams }: PageProps): React.JSX.Element {
|
||||
const { t } = useTranslation(['customers']);
|
||||
const { t } = useTranslation(['students']);
|
||||
const router = useRouter();
|
||||
|
||||
const { email, phone, sortDir, status } = searchParams;
|
||||
@@ -57,7 +57,7 @@ export default function Page({ searchParams }: PageProps): React.JSX.Element {
|
||||
const reloadRows = async (): Promise<void> => {
|
||||
try {
|
||||
const models: ListResult<RecordModel> = await pb
|
||||
.collection(COL_CUSTOMERS)
|
||||
.collection(COL_STUDENTS)
|
||||
.getList(currentPage + 1, rowsPerPage, listOption);
|
||||
const { items, totalItems } = models;
|
||||
const tempLessonTypes: Student[] = items.map((lt) => {
|
||||
|
Reference in New Issue
Block a user