This commit is contained in:
louiscklaw
2025-05-08 14:38:34 +08:00
parent 61c10821b6
commit 7105bc85e3
57 changed files with 2973 additions and 5129 deletions

View 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[];

View File

@@ -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 };
}
```

View File

@@ -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,

View File

@@ -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) => {