diff --git a/002_source/cms/src/app/dashboard/students/edit/[customerId]/page.tsx b/002_source/cms/src/app/dashboard/students/edit/[customerId]/page.tsx index 8b623fd..4864d14 100644 --- a/002_source/cms/src/app/dashboard/students/edit/[customerId]/page.tsx +++ b/002_source/cms/src/app/dashboard/students/edit/[customerId]/page.tsx @@ -1,4 +1,5 @@ 'use client'; +// src/app/dashboard/students/edit/[customerId]/page.tsx import * as React from 'react'; import RouterLink from 'next/link'; diff --git a/002_source/cms/src/app/dashboard/users/SampleTeachers.tsx b/002_source/cms/src/app/dashboard/user_metas/SampleTeachers.tsx similarity index 100% rename from 002_source/cms/src/app/dashboard/users/SampleTeachers.tsx rename to 002_source/cms/src/app/dashboard/user_metas/SampleTeachers.tsx diff --git a/002_source/cms/src/app/dashboard/users/_GUIDELINES.md b/002_source/cms/src/app/dashboard/user_metas/_GUIDELINES.md similarity index 100% rename from 002_source/cms/src/app/dashboard/users/_GUIDELINES.md rename to 002_source/cms/src/app/dashboard/user_metas/_GUIDELINES.md diff --git a/002_source/cms/src/app/dashboard/users/create/page.tsx b/002_source/cms/src/app/dashboard/user_metas/create/page.tsx similarity index 100% rename from 002_source/cms/src/app/dashboard/users/create/page.tsx rename to 002_source/cms/src/app/dashboard/user_metas/create/page.tsx diff --git a/002_source/cms/src/app/dashboard/users/view/[id]/_PROMPT.md b/002_source/cms/src/app/dashboard/user_metas/edit/[id]/_PROMPT.md similarity index 60% rename from 002_source/cms/src/app/dashboard/users/view/[id]/_PROMPT.md rename to 002_source/cms/src/app/dashboard/user_metas/edit/[id]/_PROMPT.md index d148073..65f2da7 100644 --- a/002_source/cms/src/app/dashboard/users/view/[id]/_PROMPT.md +++ b/002_source/cms/src/app/dashboard/user_metas/edit/[id]/_PROMPT.md @@ -1,3 +1,3 @@ -this `tsx` file is clone from elsewhere, please understand, modify and update the content of `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/app/dashboard/teachers/view/[id]/TitleCard.tsx.draft` to handle `Teacher` record thanks, modify comments/variables/paths/functions name please +this `tsx` file is clone from elsewhere, please understand, modify and update the content of `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/app/dashboard/user_metas/edit/[id]/page.tsx.draft` to handle `UserMeta` record thanks, modify comments/variables/paths/functions name please e.g. why `lessonCategories` still exist ? diff --git a/002_source/cms/src/app/dashboard/users/edit/[id]/page.tsx b/002_source/cms/src/app/dashboard/user_metas/edit/[id]/page.tsx similarity index 86% rename from 002_source/cms/src/app/dashboard/users/edit/[id]/page.tsx rename to 002_source/cms/src/app/dashboard/user_metas/edit/[id]/page.tsx index f7bef10..22154ab 100644 --- a/002_source/cms/src/app/dashboard/users/edit/[id]/page.tsx +++ b/002_source/cms/src/app/dashboard/user_metas/edit/[id]/page.tsx @@ -1,4 +1,5 @@ 'use client'; +// src/app/dashboard/user_metas/edit/[id]/page.tsx import * as React from 'react'; import RouterLink from 'next/link'; @@ -11,7 +12,7 @@ import { useTranslation } from 'react-i18next'; import { paths } from '@/paths'; import { CrCategoryEditForm } from '@/components/dashboard/cr/categories/cr-category-edit-form'; -import { TeacherEditForm } from '@/components/dashboard/teacher/teacher-edit-form'; +import { UserMetaEditForm } from '@/components/dashboard/user_meta/user-meta-edit-form'; export default function Page(): React.JSX.Element { const { t } = useTranslation(['lp_categories']); @@ -35,7 +36,7 @@ export default function Page(): React.JSX.Element { @@ -47,7 +48,7 @@ export default function Page(): React.JSX.Element { {t('edit.title')} - + ); diff --git a/002_source/cms/src/app/dashboard/users/list/_PROMPT.md b/002_source/cms/src/app/dashboard/user_metas/list/_PROMPT.md similarity index 61% rename from 002_source/cms/src/app/dashboard/users/list/_PROMPT.md rename to 002_source/cms/src/app/dashboard/user_metas/list/_PROMPT.md index 3e3b1e2..7f40b94 100644 --- a/002_source/cms/src/app/dashboard/users/list/_PROMPT.md +++ b/002_source/cms/src/app/dashboard/user_metas/list/_PROMPT.md @@ -1,3 +1,3 @@ -this `tsx` file is clone from elsewhere, please understand, modify and update the content of `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/app/dashboard/teachers/list/page.tsx.draft` to handle `Teacher` record thanks, modify comments/variables/paths/functions name please +this `tsx` file is clone from elsewhere, please understand, modify and update the content of `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/app/dashboard/user_metas/list/page.tsx.draft` to handle `UserMeta` record thanks, modify comments/variables/paths/functions name please e.g. why `lessonCategories` still exist ? diff --git a/002_source/cms/src/app/dashboard/users/list/page.tsx b/002_source/cms/src/app/dashboard/user_metas/list/page.tsx similarity index 79% rename from 002_source/cms/src/app/dashboard/users/list/page.tsx rename to 002_source/cms/src/app/dashboard/user_metas/list/page.tsx index c16289d..2f26e35 100644 --- a/002_source/cms/src/app/dashboard/users/list/page.tsx +++ b/002_source/cms/src/app/dashboard/user_metas/list/page.tsx @@ -1,8 +1,8 @@ -// src/app/dashboard/teachers/list/page.tsx +// src/app/dashboard/user_metas/list/page.tsx 'use client'; // RULES: -// contains list page for teachers (Teachers) +// contains list page for user metas (UserMetas) // import * as React from 'react'; import { useRouter } from 'next/navigation'; @@ -16,11 +16,11 @@ import Typography from '@mui/material/Typography'; import { Plus as PlusIcon } from '@phosphor-icons/react/dist/ssr/Plus'; import type { ListResult, RecordModel } from 'pocketbase'; -import { TeachersFilters } from '@/components/dashboard/teacher/teachers-filters'; -import { TeachersPagination } from '@/components/dashboard/teacher/teachers-pagination'; -import { TeachersSelectionProvider } from '@/components/dashboard/teacher/teachers-selection-context'; -import { TeachersTable } from '@/components/dashboard/teacher/teachers-table'; -import type { Teacher } from '@/components/dashboard/teacher/type.d'; +import { UserMetasFilters } from '@/components/dashboard/user_meta/user-metas-filters'; +import { UserMetasPagination } from '@/components/dashboard/user_meta/user-metas-pagination'; +import { UserMetasSelectionProvider } from '@/components/dashboard/user_meta/user-metas-selection-context'; +import { UserMetasTable } from '@/components/dashboard/user_meta/user-metas-table'; +import type { UserMeta } from '@/components/dashboard/user_meta/type.d'; import { useTranslation } from 'react-i18next'; import { paths } from '@/paths'; @@ -28,7 +28,7 @@ import isDevelopment from '@/lib/check-is-development'; import { logger } from '@/lib/default-logger'; import { pb } from '@/lib/pb'; import ErrorDisplay from '@/components/dashboard/error'; -import { defaultTeacher } from '@/components/dashboard/teacher/_constants'; +import { defaultUserMeta } from '@/components/dashboard/user_meta/_constants'; import FormLoading from '@/components/loading'; export default function Page({ searchParams }: PageProps): React.JSX.Element { @@ -37,7 +37,7 @@ export default function Page({ searchParams }: PageProps): React.JSX.Element { const { email, phone, sortDir, status } = searchParams; - const [teacherData, setTeacherData] = React.useState([]); + const [userMetaData, setUserMetaData] = React.useState([]); const [isLoadingAddPage, setIsLoadingAddPage] = React.useState(false); const [showLoading, setShowLoading] = React.useState(true); @@ -45,7 +45,7 @@ export default function Page({ searchParams }: PageProps): React.JSX.Element { // const [rowsPerPage, setRowsPerPage] = React.useState(5); // - const [f, setF] = React.useState([]); + const [f, setF] = React.useState([]); const [currentPage, setCurrentPage] = React.useState(0); // const [recordCount, setRecordCount] = React.useState(0); @@ -58,23 +58,17 @@ export default function Page({ searchParams }: PageProps): React.JSX.Element { // const reloadRows = async (): Promise => { try { - const listOptionTeacherOnly = isListOptionChanged() - ? { filter: `role = "teacher"` } - : { filter: [listOption.filter, `role = "teacher"`].join(' && ') }; - - console.log({ listOptionTeacherOnly }); - const models: ListResult = await pb .collection(COL_USER_METAS) - .getList(currentPage + 1, rowsPerPage, listOptionTeacherOnly); + .getList(currentPage + 1, rowsPerPage, listOption); const { items, totalItems } = models; - const tempTeacher: Teacher[] = items.map((lt) => { - return { ...defaultTeacher, ...lt }; + const tempUserMeta: UserMeta[] = items.map((lt) => { + return { ...defaultUserMeta, ...lt }; }); - setTeacherData(tempTeacher); + setUserMetaData(tempUserMeta); setRecordCount(totalItems); - setF(tempTeacher); + setF(tempUserMeta); } catch (error) { logger.error(error); setShowError({ @@ -166,7 +160,7 @@ export default function Page({ searchParams }: PageProps): React.JSX.Element { loading={isLoadingAddPage} onClick={(): void => { setIsLoadingAddPage(true); - router.push(paths.dashboard.teachers.create); + router.push(paths.dashboard.user_metas.create); }} startIcon={} variant="contained" @@ -175,22 +169,22 @@ export default function Page({ searchParams }: PageProps): React.JSX.Element { - + - - - - +
{JSON.stringify(f, null, 2)}
diff --git a/002_source/cms/src/app/dashboard/users/mail/[labelId]/SampleThreads.tsx b/002_source/cms/src/app/dashboard/user_metas/mail/[labelId]/SampleThreads.tsx similarity index 100% rename from 002_source/cms/src/app/dashboard/users/mail/[labelId]/SampleThreads.tsx rename to 002_source/cms/src/app/dashboard/user_metas/mail/[labelId]/SampleThreads.tsx diff --git a/002_source/cms/src/app/dashboard/users/mail/[labelId]/[threadId]/page.tsx b/002_source/cms/src/app/dashboard/user_metas/mail/[labelId]/[threadId]/page.tsx similarity index 100% rename from 002_source/cms/src/app/dashboard/users/mail/[labelId]/[threadId]/page.tsx rename to 002_source/cms/src/app/dashboard/user_metas/mail/[labelId]/[threadId]/page.tsx diff --git a/002_source/cms/src/app/dashboard/users/mail/[labelId]/layout.tsx b/002_source/cms/src/app/dashboard/user_metas/mail/[labelId]/layout.tsx similarity index 100% rename from 002_source/cms/src/app/dashboard/users/mail/[labelId]/layout.tsx rename to 002_source/cms/src/app/dashboard/user_metas/mail/[labelId]/layout.tsx diff --git a/002_source/cms/src/app/dashboard/users/mail/[labelId]/list/page.tsx b/002_source/cms/src/app/dashboard/user_metas/mail/[labelId]/list/page.tsx similarity index 100% rename from 002_source/cms/src/app/dashboard/users/mail/[labelId]/list/page.tsx rename to 002_source/cms/src/app/dashboard/user_metas/mail/[labelId]/list/page.tsx diff --git a/002_source/cms/src/app/dashboard/users/mail/[labelId]/page.tsx b/002_source/cms/src/app/dashboard/user_metas/mail/[labelId]/page.tsx similarity index 100% rename from 002_source/cms/src/app/dashboard/users/mail/[labelId]/page.tsx rename to 002_source/cms/src/app/dashboard/user_metas/mail/[labelId]/page.tsx diff --git a/002_source/cms/src/app/dashboard/users/view/[id]/BasicDetailCard.tsx b/002_source/cms/src/app/dashboard/user_metas/view/[id]/BasicDetailCard.tsx similarity index 86% rename from 002_source/cms/src/app/dashboard/users/view/[id]/BasicDetailCard.tsx rename to 002_source/cms/src/app/dashboard/user_metas/view/[id]/BasicDetailCard.tsx index fdb0dac..9c467fe 100644 --- a/002_source/cms/src/app/dashboard/users/view/[id]/BasicDetailCard.tsx +++ b/002_source/cms/src/app/dashboard/user_metas/view/[id]/BasicDetailCard.tsx @@ -14,13 +14,13 @@ import { useTranslation } from 'react-i18next'; import { PropertyItem } from '@/components/core/property-item'; import { PropertyList } from '@/components/core/property-list'; // import { CrCategory } from '@/components/dashboard/cr/categories/type'; -import type { Customer } from '@/components/dashboard/customer/type.d'; +import type { UserMeta } from '@/components/dashboard/user_meta/type.d'; export default function BasicDetailCard({ - lpModel: model, + userMeta, handleEditClick, }: { - lpModel: Customer; + userMeta: UserMeta; handleEditClick: () => void; }): React.JSX.Element { const { t } = useTranslation(); @@ -55,15 +55,15 @@ export default function BasicDetailCard({ key: 'Customer ID', value: ( ), }, - { key: 'Email', value: model.email }, - { key: 'Quota', value: model.quota }, - { key: 'Status', value: model.status }, + { key: 'Email', value: userMeta.email }, + { key: 'Quota', value: userMeta.quota }, + { key: 'Status', value: userMeta.status }, ] satisfies { key: string; value: React.ReactNode }[] ).map( (item): React.JSX.Element => ( diff --git a/002_source/cms/src/app/dashboard/users/view/[id]/TitleCard.tsx b/002_source/cms/src/app/dashboard/user_metas/view/[id]/TitleCard.tsx similarity index 100% rename from 002_source/cms/src/app/dashboard/users/view/[id]/TitleCard.tsx rename to 002_source/cms/src/app/dashboard/user_metas/view/[id]/TitleCard.tsx diff --git a/002_source/cms/src/app/dashboard/user_metas/view/[id]/_PROMPT.md b/002_source/cms/src/app/dashboard/user_metas/view/[id]/_PROMPT.md new file mode 100644 index 0000000..bcb3d80 --- /dev/null +++ b/002_source/cms/src/app/dashboard/user_metas/view/[id]/_PROMPT.md @@ -0,0 +1,7 @@ +working file: `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/app/dashboard/user_metas/view/[id]/page.tsx.draft` + +this file is clone from elsewhere, please understand, modify and update the content of working file to handle `UserMeta` record thanks, modify comments/variables/paths/functions name please + +restrict your modifications in this file only + +e.g. why `lessonCategories` still exist ? diff --git a/002_source/cms/src/app/dashboard/users/view/[id]/page.tsx b/002_source/cms/src/app/dashboard/user_metas/view/[id]/page.tsx similarity index 85% rename from 002_source/cms/src/app/dashboard/users/view/[id]/page.tsx rename to 002_source/cms/src/app/dashboard/user_metas/view/[id]/page.tsx index 9f4b729..ff1f083 100644 --- a/002_source/cms/src/app/dashboard/users/view/[id]/page.tsx +++ b/002_source/cms/src/app/dashboard/user_metas/view/[id]/page.tsx @@ -24,12 +24,12 @@ import { toast } from '@/components/core/toaster'; import ErrorDisplay from '@/components/dashboard/error'; -import { Notifications } from '@/components/dashboard/teacher/notifications'; +import { Notifications } from '@/components/dashboard/user_meta/notifications'; import FormLoading from '@/components/loading'; import BasicDetailCard from './BasicDetailCard'; import TitleCard from './TitleCard'; -import { defaultTeacher } from '@/components/dashboard/teacher/_constants'; -import type { Teacher } from '@/components/dashboard/teacher/type.d'; +import { defaultUserMeta } from '@/components/dashboard/user_meta/_constants'; +import type { UserMeta } from '@/components/dashboard/user_meta/type.d'; import { COL_USER_METAS } from '@/constants'; export default function Page(): React.JSX.Element { @@ -41,10 +41,10 @@ export default function Page(): React.JSX.Element { const [showLoading, setShowLoading] = React.useState(true); const [showError, setShowError] = React.useState({ show: false, detail: '' }); // - const [showLessonCategory, setShowLessonCategory] = React.useState(defaultTeacher); + const [userMeta, setUserMeta] = React.useState(defaultUserMeta); function handleEditClick(): void { - router.push(paths.dashboard.teachers.edit(showLessonCategory.id)); + router.push(paths.dashboard.user_metas.edit(userMeta.id)); } React.useEffect(() => { @@ -52,7 +52,7 @@ export default function Page(): React.JSX.Element { pb.collection(COL_USER_METAS) .getOne(id) .then((model: RecordModel) => { - setShowLessonCategory({ ...defaultTeacher, ...model }); + setUserMeta({ ...defaultUserMeta, ...model }); }) .catch((err) => { logger.error(err); @@ -94,12 +94,12 @@ export default function Page(): React.JSX.Element { - Teachers + User Metas - + diff --git a/002_source/cms/src/app/dashboard/users/list/page.tsx.notworking b/002_source/cms/src/app/dashboard/users/list/page.tsx.notworking deleted file mode 100644 index 33d7590..0000000 --- a/002_source/cms/src/app/dashboard/users/list/page.tsx.notworking +++ /dev/null @@ -1,216 +0,0 @@ -// src/app/dashboard/teachers/list/page.tsx -'use client'; - -// RULES: -// contains list page for teachers (Teachers) -// -import * as React from 'react'; -import { useRouter } from 'next/navigation'; -import { COL_USER_METAS } from '@/constants'; -import { LoadingButton } from '@mui/lab'; -import Box from '@mui/material/Box'; -import Card from '@mui/material/Card'; -import Divider from '@mui/material/Divider'; -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 { TeachersFilters } from '@/components/dashboard/teacher/teachers-filters'; -import { TeachersPagination } from '@/components/dashboard/teacher/teachers-pagination'; -import { TeachersSelectionProvider } from '@/components/dashboard/teacher/teachers-selection-context'; -import { TeachersTable } from '@/components/dashboard/teacher/teachers-table'; -import type { Teacher } from '@/components/dashboard/teacher/type.d'; -import { useTranslation } from 'react-i18next'; - -import { paths } from '@/paths'; -import isDevelopment from '@/lib/check-is-development'; -import { logger } from '@/lib/default-logger'; -import { pb } from '@/lib/pb'; -import ErrorDisplay from '@/components/dashboard/error'; -import { defaultTeacher } from '@/components/dashboard/teacher/_constants'; -import FormLoading from '@/components/loading'; - -export default function Page({ searchParams }: PageProps): React.JSX.Element { - const { t } = useTranslation(['teachers']); - const router = useRouter(); - - const { email, phone, sortDir, status } = searchParams; - - const [teacherData, setTeacherData] = React.useState([]); - - const [isLoadingAddPage, setIsLoadingAddPage] = React.useState(false); - const [showLoading, setShowLoading] = React.useState(true); - const [showError, setShowError] = React.useState({ show: false, detail: '' }); - // - const [rowsPerPage, setRowsPerPage] = React.useState(5); - // - const [f, setF] = React.useState([]); - const [currentPage, setCurrentPage] = React.useState(0); - // - const [recordCount, setRecordCount] = React.useState(0); - const [listOption, setListOption] = React.useState({ filter: '' }); - const [listSort, setListSort] = React.useState({}); - - function isListOptionChanged() { - return JSON.stringify(listOption) === '{}'; - } - // - const reloadRows = async (): Promise => { - try { - const listOptionTeacherOnly = isListOptionChanged() - ? { filter: `role = "teacher"` } - : { filter: [listOption.filter, `role = "teacher"`].join(' && ') }; - - const models: ListResult = await pb - .collection(COL_USER_METAS) - .getList(currentPage + 1, rowsPerPage, listOptionTeacherOnly); - const { items, totalItems } = models; - const tempTeacher: Teacher[] = items.map((lt) => { - return { ...defaultTeacher, ...lt }; - }); - - setTeacherData(tempTeacher); - setRecordCount(totalItems); - setF(tempTeacher); - } catch (error) { - logger.error(error); - setShowError({ - // - show: true, - detail: JSON.stringify(error, null, 2), - }); - } finally { - setShowLoading(false); - } - }; - - const [lastListOption, setLastListOption] = React.useState({}); - const isFirstRun = React.useRef(false); - React.useEffect(() => { - if (!isFirstRun.current) { - isFirstRun.current = true; - } else if (JSON.stringify(listOption) !== JSON.stringify(lastListOption)) { - // reset page number as tab changes - setLastListOption(listOption); - setCurrentPage(0); - void reloadRows(); - } else { - void reloadRows(); - } - }, [currentPage, rowsPerPage, listOption]); - - React.useEffect(() => { - const tempFilter = []; - let tempSortDir = ''; - - if (status) { - tempFilter.push(`status = "${status}"`); - } - - if (sortDir) { - tempSortDir = `-created`; - } - - if (email) { - tempFilter.push(`email ~ "%${email}%"`); - } - - if (phone) { - tempFilter.push(`phone ~ "%${phone}%"`); - } - - let preFinalListOption = { filter: '' }; - if (tempFilter.length > 0) { - preFinalListOption = { filter: tempFilter.join(' && ') }; - } - if (tempSortDir.length > 0) { - preFinalListOption = { ...preFinalListOption, sort: tempSortDir }; - } - setListOption(preFinalListOption); - }, [sortDir, email, phone, status]); - - if (showLoading) return ; - - if (showError.show) - return ( - - ); - - return ( - - - - - {t('list.title')} - - - { - setIsLoadingAddPage(true); - router.push(paths.dashboard.teachers.create); - }} - startIcon={} - variant="contained" - > - {t('list.add')} - - - - - - - - - - - - - - - - -
{JSON.stringify(f, null, 2)}
-
-
- ); -} - -interface PageProps { - searchParams: { - email?: string; - phone?: string; - sortDir?: 'asc' | 'desc'; - status?: string; - // - }; -} diff --git a/002_source/cms/src/app/dashboard/users/view/[id]/page.tsx.notworking b/002_source/cms/src/app/dashboard/users/view/[id]/page.tsx.notworking deleted file mode 100644 index 448a8d3..0000000 --- a/002_source/cms/src/app/dashboard/users/view/[id]/page.tsx.notworking +++ /dev/null @@ -1,143 +0,0 @@ -'use client'; - -import * as React from 'react'; -import RouterLink from 'next/link'; -import { useParams, useRouter } from 'next/navigation'; -import SampleAddressCard from '@/app/dashboard/Sample/AddressCard'; -import { SampleNotifications } from '@/app/dashboard/Sample/Notifications'; -import SamplePaymentCard from '@/app/dashboard/Sample/PaymentCard'; -import SampleSecurityCard from '@/app/dashboard/Sample/SecurityCard'; - -import Box from '@mui/material/Box'; -import Link from '@mui/material/Link'; -import Stack from '@mui/material/Stack'; -import Grid from '@mui/material/Unstable_Grid2'; -import { ArrowLeft as ArrowLeftIcon } from '@phosphor-icons/react/dist/ssr/ArrowLeft'; -import type { RecordModel } from 'pocketbase'; -import { useTranslation } from 'react-i18next'; - -import { config } from '@/config'; -import { paths } from '@/paths'; -import { logger } from '@/lib/default-logger'; -import { pb } from '@/lib/pb'; -import { toast } from '@/components/core/toaster'; - -import ErrorDisplay from '@/components/dashboard/error'; - -import { Notifications } from '@/components/dashboard/teacher/notifications'; -import FormLoading from '@/components/loading'; -import BasicDetailCard from './BasicDetailCard'; -import TitleCard from './TitleCard'; -import { defaultTeacher } from '@/components/dashboard/teacher/_constants'; -import type { Teacher } from '@/components/dashboard/teacher/type.d'; -import { COL_USER_METAS } from '@/constants'; - -export default function Page(): React.JSX.Element { - const { t } = useTranslation(['teachers']); - const router = useRouter(); - // - const { id } = useParams<{ id: string }>(); - // - const [showLoading, setShowLoading] = React.useState(true); - const [showError, setShowError] = React.useState({ show: false, detail: '' }); - // - const [teacherData, setTeacherData] = React.useState(defaultTeacher); - - function handleEditClick(): void { - router.push(paths.dashboard.teachers.edit(teacherData.id)); - } - - React.useEffect(() => { - if (id) { - pb.collection(COL_USER_METAS) - .getOne(id) - .then((model: RecordModel) => { - setTeacherData({ ...defaultTeacher, ...model }); - }) - .catch((err) => { - logger.error(err); - toast(t('list.error')); - - setShowError({ show: true, detail: JSON.stringify(err) }); - }) - .finally(() => { - setShowLoading(false); - }); - } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [id]); - - // return <>{JSON.stringify({ showError, showLessonCategory }, null, 2)}; - - if (showLoading) return ; - if (showError.show) - return ( - - ); - - return ( - - - -
- - - {t('back-to-list')} - -
- - - -
- - - - - - - - - - - - - - - -
-
- ); -} diff --git a/002_source/cms/src/components/dashboard/layout/config.ts b/002_source/cms/src/components/dashboard/layout/config.ts index 14aca33..f702d54 100644 --- a/002_source/cms/src/components/dashboard/layout/config.ts +++ b/002_source/cms/src/components/dashboard/layout/config.ts @@ -116,9 +116,9 @@ export const layoutConfig = { title: 'users', icon: 'users', items: [ - { key: 'users', title: 'List users', href: paths.dashboard.users.list }, - { key: 'users:create', title: 'Create user', href: paths.dashboard.users.create }, - { key: 'users:details', title: 'User details', href: paths.dashboard.users.view('1') }, + { key: 'users', title: 'List users', href: paths.dashboard.user_metas.list }, + { key: 'users:create', title: 'Create user', href: paths.dashboard.user_metas.create }, + { key: 'users:details', title: 'User details', href: paths.dashboard.user_metas.view('1') }, ], }, { diff --git a/002_source/cms/src/components/dashboard/student/type.d.tsx b/002_source/cms/src/components/dashboard/student/type.d.tsx index ed3c667..bf753b6 100644 --- a/002_source/cms/src/components/dashboard/student/type.d.tsx +++ b/002_source/cms/src/components/dashboard/student/type.d.tsx @@ -6,6 +6,7 @@ export type SortDir = 'asc' | 'desc'; // RULES: core student data structure export interface Student { id: string; + collectionId: string; name: string; avatar?: string; email: string; diff --git a/002_source/cms/src/components/dashboard/user.de/user-create-form.tsx b/002_source/cms/src/components/dashboard/user.de/user-create-form.tsx index da9316b..7762893 100644 --- a/002_source/cms/src/components/dashboard/user.de/user-create-form.tsx +++ b/002_source/cms/src/components/dashboard/user.de/user-create-form.tsx @@ -104,7 +104,7 @@ export function UserCreateForm(): React.JSX.Element { // Use standard create method from db/Customers/Create const record = await createUser(values); toast.success('User created successfully'); - router.push(paths.dashboard.users.details(record.id)); + router.push(paths.dashboard.user_metas.details(record.id)); } catch (err) { logger.error(err); toast.error('Failed to create user. Please try again.'); @@ -509,7 +509,7 @@ export function UserCreateForm(): React.JSX.Element { diff --git a/002_source/cms/src/components/dashboard/user.de/user-edit-form.tsx b/002_source/cms/src/components/dashboard/user.de/user-edit-form.tsx index 8effa39..bc08af1 100644 --- a/002_source/cms/src/components/dashboard/user.de/user-edit-form.tsx +++ b/002_source/cms/src/components/dashboard/user.de/user-edit-form.tsx @@ -125,7 +125,7 @@ export function UserEditForm(): React.JSX.Element { try { await pb.collection(COL_USERS).update(userId, updateData); toast.success('User updated successfully'); - router.push(paths.dashboard.users.list); + router.push(paths.dashboard.user_metas.list); } catch (error) { logger.error(error); toast.error('Failed to update user'); @@ -581,7 +581,7 @@ export function UserEditForm(): React.JSX.Element { diff --git a/002_source/cms/src/components/dashboard/user.de/users-table.tsx b/002_source/cms/src/components/dashboard/user.de/users-table.tsx index a607330..8e13573 100644 --- a/002_source/cms/src/components/dashboard/user.de/users-table.tsx +++ b/002_source/cms/src/components/dashboard/user.de/users-table.tsx @@ -44,7 +44,7 @@ function columns(handleDeleteClick: (testId: string) => void): ColumnDef[] @@ -143,7 +143,7 @@ function columns(handleDeleteClick: (testId: string) => void): ColumnDef[] // color="secondary" component={RouterLink} - href={paths.dashboard.users.view(row.id)} + href={paths.dashboard.user_metas.view(row.id)} > diff --git a/002_source/cms/src/components/dashboard/user/_GUIDELINES.md b/002_source/cms/src/components/dashboard/user/_GUIDELINES.md deleted file mode 100644 index 6302b64..0000000 --- a/002_source/cms/src/components/dashboard/user/_GUIDELINES.md +++ /dev/null @@ -1,25 +0,0 @@ -# GUIDELINES & KEY COMPONENTS - -- `_constants.ts` contains the constant for - - - default value (defaultValue) - - empty value (emptyValue) - -- `teachers-table.tsx` - -- `confirm-delete-modal.tsx` - delete modal component when click delete button on list - - - `teachers-filters.tsx` - - `teachers-pagination.tsx` - - `email-filter-popover.tsx` - - `phone-filter-popover.tsx` - - `teachers-selection-context.tsx` - -- `teacher-create-form.tsx` - form to create a new teacher -- `teacher-edit-form.tsx` - form to edit an existing teacher - -- `type.d.tsx` - contains type definition - -- `notifications.tsx` - constants used for demonstration -- `payments.tsx` - constants used for demonstration -- `shipping-address.tsx` - constants used for demonstration diff --git a/002_source/cms/src/components/dashboard/user/teachers-selection-context.tsx b/002_source/cms/src/components/dashboard/user/teachers-selection-context.tsx deleted file mode 100644 index 1e92ad2..0000000 --- a/002_source/cms/src/components/dashboard/user/teachers-selection-context.tsx +++ /dev/null @@ -1,43 +0,0 @@ -'use client'; - -import * as React from 'react'; - -import { useSelection } from '@/hooks/use-selection'; -import type { Selection } from '@/hooks/use-selection'; - -import type { Teacher } from './type.d'; - -function noop(): void { - return undefined; -} - -export interface CustomersSelectionContextValue extends Selection {} - -export const CustomersSelectionContext = React.createContext({ - deselectAll: noop, - deselectOne: noop, - selectAll: noop, - selectOne: noop, - selected: new Set(), - selectedAny: false, - selectedAll: false, -}); - -interface CustomersSelectionProviderProps { - children: React.ReactNode; - teachers: Teacher[]; -} - -export function TeachersSelectionProvider({ - children, - teachers = [], -}: CustomersSelectionProviderProps): React.JSX.Element { - const customerIds = React.useMemo(() => teachers.map((customer) => customer.id), [teachers]); - const selection = useSelection(customerIds); - - return {children}; -} - -export function useTeachersSelection(): CustomersSelectionContextValue { - return React.useContext(CustomersSelectionContext); -} diff --git a/002_source/cms/src/components/dashboard/user_meta/_GUIDELINES.md b/002_source/cms/src/components/dashboard/user_meta/_GUIDELINES.md new file mode 100644 index 0000000..942dcd4 --- /dev/null +++ b/002_source/cms/src/components/dashboard/user_meta/_GUIDELINES.md @@ -0,0 +1,26 @@ +# USER META GUIDELINES & KEY COMPONENTS + +## Core Files + +- `_constants.ts` - Contains default and empty values for UserMeta records +- `user-meta-table.tsx` - Main table component for displaying UserMeta records +- `type.d.tsx` - Type definitions for UserMeta + +## CRUD Components + +- `confirm-delete-modal.tsx` - Delete confirmation modal +- `user-meta-create-form.tsx` - Form for creating new UserMeta records +- `user-meta-edit-form.tsx` - Form for editing existing UserMeta records + +## Supporting Components + +- `user-meta-filters.tsx` - Filter controls for the table +- `user-meta-pagination.tsx` - Pagination controls +- `user-meta-selection-context.tsx` - Context for selected records + +## Implementation Notes + +1. All components should work with the UserMeta type from `type.d.tsx` +2. Follow existing patterns for API calls and state management +3. Ensure proper validation for all UserMeta fields +4. Maintain consistent naming conventions (userMeta prefix for components) diff --git a/002_source/cms/src/components/dashboard/user_meta/_PROMPT.md b/002_source/cms/src/components/dashboard/user_meta/_PROMPT.md new file mode 100644 index 0000000..adb1707 --- /dev/null +++ b/002_source/cms/src/components/dashboard/user_meta/_PROMPT.md @@ -0,0 +1,3 @@ +this `tsx` file is clone from elsewhere, please understand, modify and update the content of `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/components/dashboard/user_meta/confirm-delete-modal.tsx.draft` to handle `UserMeta` record thanks, modify comments/variables/paths/functions name please + +e.g. why `lessonCategories` still exist ? diff --git a/002_source/cms/src/components/dashboard/user/_constants.ts b/002_source/cms/src/components/dashboard/user_meta/_constants.ts similarity index 63% rename from 002_source/cms/src/components/dashboard/user/_constants.ts rename to 002_source/cms/src/components/dashboard/user_meta/_constants.ts index 0aa0baf..47de880 100644 --- a/002_source/cms/src/components/dashboard/user/_constants.ts +++ b/002_source/cms/src/components/dashboard/user_meta/_constants.ts @@ -3,9 +3,9 @@ // empty valur for customer import { dayjs } from '@/lib/dayjs'; -import type { Teacher } from './type.d'; +import type { UserMeta } from './type.d'; -export const defaultTeacher: Teacher = { +export const defaultUserMeta: UserMeta = { id: '', name: '', avatar: undefined, @@ -16,6 +16,6 @@ export const defaultTeacher: Teacher = { createdAt: dayjs().toDate(), }; -export const emptyLpCategory: Teacher = { - ...defaultTeacher, +export const emptyLpCategory: UserMeta = { + ...defaultUserMeta, }; diff --git a/002_source/cms/src/components/dashboard/user/confirm-delete-modal.tsx b/002_source/cms/src/components/dashboard/user_meta/confirm-delete-modal.tsx similarity index 93% rename from 002_source/cms/src/components/dashboard/user/confirm-delete-modal.tsx rename to 002_source/cms/src/components/dashboard/user_meta/confirm-delete-modal.tsx index afbb10e..55d5ddf 100644 --- a/002_source/cms/src/components/dashboard/user/confirm-delete-modal.tsx +++ b/002_source/cms/src/components/dashboard/user_meta/confirm-delete-modal.tsx @@ -12,7 +12,7 @@ import { useTranslation } from 'react-i18next'; import { logger } from '@/lib/default-logger'; import { toast } from '@/components/core/toaster'; -import { deleteTeacher } from '@/db/Teachers/Delete'; +import { deleteUserMeta } from '@/db/UserMetas/Delete'; export default function ConfirmDeleteModal({ open, @@ -45,7 +45,7 @@ export default function ConfirmDeleteModal({ setIsDeleteing(true); // RULES: delete - deleteTeacher(idToDelete) + deleteUserMeta(idToDelete) .then(() => { reloadRows(); handleClose(); @@ -83,12 +83,12 @@ export default function ConfirmDeleteModal({ - {t('Delete Teacher ?')} + {t('Delete This User ?')} - {t('Are you sure you want to delete this teacher ?')} + {t('Are you sure you want to delete this user ?')} { @@ -89,7 +89,7 @@ export function TeachersFilters({ searchParams.set('phone', newFilters.phone); } - router.push(`${paths.dashboard.teachers.list}?${searchParams.toString()}`); + router.push(`${paths.dashboard.user_metas.list}?${searchParams.toString()}`); }, [router] ); @@ -131,7 +131,7 @@ export function TeachersFilters({ React.useEffect(() => { const fetchCount = async (): Promise => { try { - const tc = await getAllTeachersCount(); + const tc = await getAllUserMetasCount(); setTotalCount(tc); const bc = await GetBlockedCount(); diff --git a/002_source/cms/src/components/dashboard/user/teachers-pagination.tsx b/002_source/cms/src/components/dashboard/user_meta/user-metas-pagination.tsx similarity index 89% rename from 002_source/cms/src/components/dashboard/user/teachers-pagination.tsx rename to 002_source/cms/src/components/dashboard/user_meta/user-metas-pagination.tsx index 5aea10d..986e6c9 100644 --- a/002_source/cms/src/components/dashboard/user/teachers-pagination.tsx +++ b/002_source/cms/src/components/dashboard/user_meta/user-metas-pagination.tsx @@ -7,7 +7,7 @@ function noop(): void { return undefined; } -interface CustomersPaginationProps { +interface UserMetasPaginationProps { count: number; page: number; // @@ -16,14 +16,14 @@ interface CustomersPaginationProps { rowsPerPage: number; } -export function TeachersPagination({ +export function UserMetasPagination({ count, page, // setPage, setRowsPerPage, rowsPerPage, -}: CustomersPaginationProps): React.JSX.Element { +}: UserMetasPaginationProps): React.JSX.Element { // You should implement the pagination using a similar logic as the filters. // Note that when page change, you should keep the filter search params. const handleChangePage = (event: unknown, newPage: number) => { diff --git a/002_source/cms/src/components/dashboard/user_meta/user-metas-selection-context.tsx b/002_source/cms/src/components/dashboard/user_meta/user-metas-selection-context.tsx new file mode 100644 index 0000000..446d2f1 --- /dev/null +++ b/002_source/cms/src/components/dashboard/user_meta/user-metas-selection-context.tsx @@ -0,0 +1,43 @@ +'use client'; + +import * as React from 'react'; + +import { useSelection } from '@/hooks/use-selection'; +import type { Selection } from '@/hooks/use-selection'; + +import type { UserMeta } from './type.d'; + +function noop(): void { + return undefined; +} + +export interface UserMetasSelectionContextValue extends Selection {} + +export const UserMetasSelectionContext = React.createContext({ + deselectAll: noop, + deselectOne: noop, + selectAll: noop, + selectOne: noop, + selected: new Set(), + selectedAny: false, + selectedAll: false, +}); + +interface UserMetasSelectionProviderProps { + children: React.ReactNode; + userMetas: UserMeta[]; +} + +export function UserMetasSelectionProvider({ + children, + userMetas: teachers = [], +}: UserMetasSelectionProviderProps): React.JSX.Element { + const customerIds = React.useMemo(() => teachers.map((customer) => customer.id), [teachers]); + const selection = useSelection(customerIds); + + return {children}; +} + +export function useUserMetasSelection(): UserMetasSelectionContextValue { + return React.useContext(UserMetasSelectionContext); +} diff --git a/002_source/cms/src/components/dashboard/user/teachers-table.tsx b/002_source/cms/src/components/dashboard/user_meta/user-metas-table.tsx similarity index 87% rename from 002_source/cms/src/components/dashboard/user/teachers-table.tsx rename to 002_source/cms/src/components/dashboard/user_meta/user-metas-table.tsx index f1c4bb2..2129a1e 100644 --- a/002_source/cms/src/components/dashboard/user/teachers-table.tsx +++ b/002_source/cms/src/components/dashboard/user_meta/user-metas-table.tsx @@ -18,19 +18,16 @@ 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'; import { DataTable } from '@/components/core/data-table'; import type { ColumnDef } from '@/components/core/data-table'; import ConfirmDeleteModal from './confirm-delete-modal'; -import { useTeachersSelection } from './teachers-selection-context'; -import type { Teacher } from './type.d'; +import { useUserMetasSelection } from './user-metas-selection-context'; +import type { UserMeta } from './type.d'; -function columns(handleDeleteClick: (testId: string) => void): ColumnDef[] { +function columns(handleDeleteClick: (userMetaId: string) => void): ColumnDef[] { return [ { formatter: (row): React.JSX.Element => ( @@ -47,7 +44,7 @@ function columns(handleDeleteClick: (testId: string) => void): ColumnDef @@ -144,14 +141,12 @@ function columns(handleDeleteClick: (testId: string) => void): ColumnDef { handleDeleteClick(row.id); }} @@ -167,14 +162,13 @@ function columns(handleDeleteClick: (testId: string) => void): ColumnDef void; } -export function TeachersTable({ rows, reloadRows }: TeachersTableProps): React.JSX.Element { - const { t } = useTranslation(['teachers']); - const { deselectAll, deselectOne, selectAll, selectOne, selected } = useTeachersSelection(); +export function UserMetasTable({ rows, reloadRows }: UserMetasTableProps): React.JSX.Element { + const { deselectAll, deselectOne, selectAll, selectOne, selected } = useUserMetasSelection(); const [idToDelete, setIdToDelete] = React.useState(''); const [open, setOpen] = React.useState(false); @@ -192,7 +186,7 @@ export function TeachersTable({ rows, reloadRows }: TeachersTableProps): React.J reloadRows={reloadRows} setOpen={setOpen} /> - + columns={columns(handleDeleteClick)} onDeselectAll={deselectAll} onDeselectOne={(_, row) => { @@ -213,8 +207,7 @@ export function TeachersTable({ rows, reloadRows }: TeachersTableProps): React.J sx={{ textAlign: 'center' }} variant="body2" > - {/* TODO: update this */} - {t('no-teachers-found')} + No user metadata found
) : null} diff --git a/002_source/cms/src/db/UserMetas/Create.tsx b/002_source/cms/src/db/UserMetas/Create.tsx index 957f577..6bb4ba0 100644 --- a/002_source/cms/src/db/UserMetas/Create.tsx +++ b/002_source/cms/src/db/UserMetas/Create.tsx @@ -2,10 +2,10 @@ // RULES: // TBA import { pb } from '@/lib/pb'; -import { COL_CUSTOMERS } from '@/constants'; -import type { CreateFormProps } from '@/components/dashboard/customer/type.d'; +import { COL_USER_METAS } from '@/constants'; +import type { CreateFormProps } from '@/components/dashboard/user_meta/type.d'; import type { RecordModel } from 'pocketbase'; -export async function createCustomer(data: CreateFormProps): Promise { - return pb.collection(COL_CUSTOMERS).create(data); +export async function createUserMeta(data: CreateFormProps): Promise { + return pb.collection(COL_USER_METAS).create(data); } diff --git a/002_source/cms/src/db/UserMetas/Delete.tsx b/002_source/cms/src/db/UserMetas/Delete.tsx index 52760f1..9236b17 100644 --- a/002_source/cms/src/db/UserMetas/Delete.tsx +++ b/002_source/cms/src/db/UserMetas/Delete.tsx @@ -1,6 +1,6 @@ import { pb } from '@/lib/pb'; -import { COL_CUSTOMERS } from '@/constants'; +import { COL_USER_METAS } from '@/constants'; -export async function deleteCustomer(id: string): Promise { - return pb.collection(COL_CUSTOMERS).delete(id); +export async function deleteUserMeta(id: string): Promise { + return pb.collection(COL_USER_METAS).delete(id); } diff --git a/002_source/cms/src/db/UserMetas/GetActiveCount.tsx b/002_source/cms/src/db/UserMetas/GetActiveCount.tsx index a8679de..9bb17f8 100644 --- a/002_source/cms/src/db/UserMetas/GetActiveCount.tsx +++ b/002_source/cms/src/db/UserMetas/GetActiveCount.tsx @@ -1,8 +1,8 @@ -import { COL_CUSTOMERS } from '@/constants'; +import { COL_USER_METAS } from '@/constants'; import { pb } from '@/lib/pb'; export default async function GetActiveCount(): Promise { - const { totalItems: count } = await pb.collection(COL_CUSTOMERS).getList(1, 1, { + const { totalItems: count } = await pb.collection(COL_USER_METAS).getList(1, 1, { filter: 'status = "active"', }); return count; diff --git a/002_source/cms/src/db/UserMetas/GetAll.tsx b/002_source/cms/src/db/UserMetas/GetAll.tsx index 1130771..4dd4c4c 100644 --- a/002_source/cms/src/db/UserMetas/GetAll.tsx +++ b/002_source/cms/src/db/UserMetas/GetAll.tsx @@ -1,7 +1,7 @@ import { pb } from '@/lib/pb'; -import { COL_CUSTOMERS } from '@/constants'; +import { COL_USER_METAS } from '@/constants'; import { RecordModel } from 'pocketbase'; -export async function getAllCustomers(options = {}): Promise { - return pb.collection(COL_CUSTOMERS).getFullList(options); +export async function getAllUserMetas(options = {}): Promise { + return pb.collection(COL_USER_METAS).getFullList(options); } diff --git a/002_source/cms/src/db/UserMetas/GetBlockedCount.tsx b/002_source/cms/src/db/UserMetas/GetBlockedCount.tsx index 261321c..54875c4 100644 --- a/002_source/cms/src/db/UserMetas/GetBlockedCount.tsx +++ b/002_source/cms/src/db/UserMetas/GetBlockedCount.tsx @@ -1,8 +1,8 @@ -import { COL_CUSTOMERS } from '@/constants'; +import { COL_USER_METAS } from '@/constants'; import { pb } from '@/lib/pb'; export default async function GetBlockedCount(): Promise { - const { totalItems: count } = await pb.collection(COL_CUSTOMERS).getList(1, 1, { + const { totalItems: count } = await pb.collection(COL_USER_METAS).getList(1, 1, { filter: 'status = "blocked"', }); return count; diff --git a/002_source/cms/src/db/UserMetas/GetById.tsx b/002_source/cms/src/db/UserMetas/GetById.tsx index 7c8ef98..04193af 100644 --- a/002_source/cms/src/db/UserMetas/GetById.tsx +++ b/002_source/cms/src/db/UserMetas/GetById.tsx @@ -1,7 +1,7 @@ import { pb } from '@/lib/pb'; -import { COL_CUSTOMERS } from '@/constants'; +import { COL_USER_METAS } from '@/constants'; import { RecordModel } from 'pocketbase'; -export async function getCustomerById(id: string): Promise { - return pb.collection(COL_CUSTOMERS).getOne(id); +export async function getUserMetaById(id: string): Promise { + return pb.collection(COL_USER_METAS).getOne(id); } diff --git a/002_source/cms/src/db/UserMetas/GetPendingCount.tsx b/002_source/cms/src/db/UserMetas/GetPendingCount.tsx index d6661ca..dc117d4 100644 --- a/002_source/cms/src/db/UserMetas/GetPendingCount.tsx +++ b/002_source/cms/src/db/UserMetas/GetPendingCount.tsx @@ -1,8 +1,8 @@ -import { COL_CUSTOMERS } from '@/constants'; +import { COL_USER_METAS } from '@/constants'; import { pb } from '@/lib/pb'; export default async function GetPendingCount(): Promise { - const { totalItems: count } = await pb.collection(COL_CUSTOMERS).getList(1, 1, { + const { totalItems: count } = await pb.collection(COL_USER_METAS).getList(1, 1, { filter: 'status = "pending"', }); return count; diff --git a/002_source/cms/src/db/UserMetas/Update.tsx b/002_source/cms/src/db/UserMetas/Update.tsx index 7beeff7..509a102 100644 --- a/002_source/cms/src/db/UserMetas/Update.tsx +++ b/002_source/cms/src/db/UserMetas/Update.tsx @@ -1,8 +1,8 @@ import { pb } from '@/lib/pb'; -import { COL_CUSTOMERS } from '@/constants'; +import { COL_USER_METAS } from '@/constants'; import type { RecordModel } from 'pocketbase'; import type { EditFormProps } from '@/components/dashboard/customer/type.d'; export async function updateCustomer(id: string, data: Partial): Promise { - return pb.collection(COL_CUSTOMERS).update(id, data); + return pb.collection(COL_USER_METAS).update(id, data); } diff --git a/002_source/cms/src/db/UserMetas/_PROMPT.md b/002_source/cms/src/db/UserMetas/_PROMPT.md new file mode 100644 index 0000000..6c8f25b --- /dev/null +++ b/002_source/cms/src/db/UserMetas/_PROMPT.md @@ -0,0 +1,11 @@ +`working directory`: `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/db/UserMetas` + +these files are clone from elsewhere, +please help to list `*.tsx.draft` files in `working directory` (e.g. `find`), +iterate the files listed in the result. +please understand, modify and update the content to handle `UserMeta` record thanks, modify comments/variables/paths/functions name please + +restrict your modifications in working directory only, +I will handle all the modification outside this direcotry + +e.g. if `lessonCategories` exist in file, modify it to `userMetas` diff --git a/002_source/cms/src/paths.ts b/002_source/cms/src/paths.ts index 9830cb3..1c085c5 100644 --- a/002_source/cms/src/paths.ts +++ b/002_source/cms/src/paths.ts @@ -149,13 +149,13 @@ export const paths = { // edit: (id: string) => `/dashboard/teachers/edit/${id}`, }, }, - users: { - list: '/dashboard/users/list', - create: '/dashboard/users/create', - view: (id: string) => `/dashboard/users/view/${id}`, + user_metas: { + list: '/dashboard/user_metas/list', + create: '/dashboard/user_metas/create', + view: (id: string) => `/dashboard/user_metas/view/${id}`, // RULES: details is obsoleted, use view instead - details: (id: string) => `/dashboard/teachers/view/${id}`, - edit: (id: string) => `/dashboard/users/edit/${id}`, + // details: (id: string) => `/dashboard/teachers/view/${id}`, + edit: (id: string) => `/dashboard/user_metas/edit/${id}`, }, students: { list: '/dashboard/students/list', diff --git a/002_source/cms/tsconfig.json b/002_source/cms/tsconfig.json index 9c98697..f097462 100644 --- a/002_source/cms/tsconfig.json +++ b/002_source/cms/tsconfig.json @@ -1,8 +1,11 @@ { "compilerOptions": { "target": "es5", - "lib": ["dom", "dom.iterable", "esnext"], - + "lib": [ + "dom", + "dom.iterable", + "esnext" + ], "allowJs": true, "skipLibCheck": true, "strict": true, @@ -16,11 +19,23 @@ "jsx": "preserve", "incremental": true, "allowImportingTsExtensions": true, - - "plugins": [{ "name": "next" }], - "paths": { "@/*": ["./src/*"] } + "plugins": [ + { + "name": "next" + } + ], + "paths": { + "@/*": [ + "./src/*" + ] + } }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], + "include": [ + "next-env.d.ts", + "**/*.ts", + "**/*.tsx", + ".next/types/**/*.ts" + ], "exclude": [ "node_modules", ".next",