From 407d851b928b36a56e1d55cb7a85ee2983421230 Mon Sep 17 00:00:00 2001 From: louiscklaw Date: Tue, 22 Apr 2025 04:40:01 +0800 Subject: [PATCH] update mf build ok, --- .../001_guideline/001_GUIDELINE.md | 15 +++ 002_source/cms/_AI_WORKSPACE/DB_PROMPT.MD | 99 +++++++++++++++++++ 002_source/cms/_AI_WORKSPACE/_PROMPT.md | 10 ++ .../src/app/dashboard/lp/categories/page.tsx | 4 + .../src/app/dashboard/lp/questions/page.tsx | 5 +- .../src/app/dashboard/mf/categories/page.tsx | 4 + .../dashboard/mf/questions/[cat_id]/page.tsx | 8 +- .../dashboard/mf/questions/create/page.tsx | 2 +- .../mf/questions/edit/[cat_id]/page.tsx | 2 +- .../src/app/dashboard/mf/questions/page.tsx | 5 +- .../mf/categories/lp-category-create-form.tsx | 4 +- .../mf/questions/mf-questions-table.tsx | 4 +- 12 files changed, 150 insertions(+), 12 deletions(-) create mode 100644 002_source/cms/_AI_WORKSPACE/001_guideline/001_GUIDELINE.md create mode 100644 002_source/cms/_AI_WORKSPACE/DB_PROMPT.MD create mode 100644 002_source/cms/_AI_WORKSPACE/_PROMPT.md diff --git a/002_source/cms/_AI_WORKSPACE/001_guideline/001_GUIDELINE.md b/002_source/cms/_AI_WORKSPACE/001_guideline/001_GUIDELINE.md new file mode 100644 index 0000000..d79e657 --- /dev/null +++ b/002_source/cms/_AI_WORKSPACE/001_guideline/001_GUIDELINE.md @@ -0,0 +1,15 @@ +# guideline + +- please divide the problem into small parts +- if you found youself cannot understand the problem, please stop and ask how to do +- if you found youself cannot solve the problem, plesae stop and ask how to do +- review the whole solution before you reply to user +- if code syntax is already there, do follow (e.g. naming convention, syntax) the existing code + +- example for page can be found in `./src/app/_helloworld/page.tsx` +- example for component can be found in `./src/components/_helloworld/index.tsx` + +- no need to explain the reason until you are told to do so +- no need to show me the code change, at the end just simple summary in point form is ok + +Thanks diff --git a/002_source/cms/_AI_WORKSPACE/DB_PROMPT.MD b/002_source/cms/_AI_WORKSPACE/DB_PROMPT.MD new file mode 100644 index 0000000..ac18017 --- /dev/null +++ b/002_source/cms/_AI_WORKSPACE/DB_PROMPT.MD @@ -0,0 +1,99 @@ +# AI GUIDELINE + +## getting started + +Imagine there is a software developer and a QA engineer to solve the problems together + +They will: + +no need to reply me what you are going on and your digest in this phase. +just reply me "OK" when done + +base_dir=`/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project` + +- `schema.dbml` + + - read `/001_documentation/Requirements/REQ0006/schema.dbml` + this is file in dbml syntax state the main database + +- `schema.json` + + - read `/002_source/cms/src/db/schema.json` + this is the file of live pocketbase schema output + +- read `/002_source/cms/src/constants.ts` + this is the content of `@/constants` + +- look into the md files in folder `/002_source/cms/_AI_WORKSPACE/001_guideline` + +- read, remember and link up the ideas in file stated above, + i will tell them the task afterwards + +--- + +The software engineer will provide solutions, +while QA engineer will feedback the opinion. + +this is now not in debug phase, +so, no need to reply me what they are going on or their insight throught the prompt. +just reply me "OK" when done + +--- + +clone `GetVisibleCount.tsx` and `GetHiddenCount.tsx` from `LessonTypes` to `LessonCategories` and update it + +please draft `GetHiddenCount.tsx` for COL_LESSON_TYPES and `status = hidden` + +well done !, please proceed to another request + +working directory: `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/db` + +according information from `schema.json`, get the collection of `Students` + +pleaes clone the `tsx` files from `LessonTypes` and `LessonCategories` to `Students` and update the content + +when you draft coding, review file and append with `.tsx.draft` + +--- + +- this is part of react typescript project, with pocketbase +- `schema.dbml`, describe the collections(tables) +- folder `LessonCategories`, the correct references +- folder `LessonTypes`, the correct references +- you can find the `schema.dbml` and schema information from `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/001_documentation/Requirements/REQ0006` +- do not read root directory, assume it is a fresh copy of nextjs project is ok + +## instruction + +- break the questions into smaller parts +- review file append with `.draft`, see if the content aligned with the correct references +- read and understand `dbml` file +- lookup the every folder + +## tasks + +Thanks + +--- + +--- + +please revise + +please revise +`/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/types/LpCategory.tsx` `interface LpCategory` + +to the collection `QuizLPCategories` align the dbml file in the previous prompt + +please modify `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/components/dashboard/lp_categories/_constants.tsx` + +to follow the type definition in `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/types/LpCategory.tsx`, the constant `defaultLpCategory` + +--- + +the constants file (`@/constants`) was `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/constants.ts` + +please help to fix the `tsx` files in folder `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/db/QuizMFCategories`, +the `COL` constants is wrongly used, it should refer to `COL_QUIZ_MF_CATEGORIES`. thanks + +please update the `COL_XXXX` TO COL_MF_CATEGORIES diff --git a/002_source/cms/_AI_WORKSPACE/_PROMPT.md b/002_source/cms/_AI_WORKSPACE/_PROMPT.md new file mode 100644 index 0000000..0b6a917 --- /dev/null +++ b/002_source/cms/_AI_WORKSPACE/_PROMPT.md @@ -0,0 +1,10 @@ +Hi, i need your help. + +i am working on a react typescript project +i will show you part of the code and it is located in folder `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/app/dashboard/mf` + +it is copied from `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/app/dashboard/lp`, i want you to help modifing from `lp` to `mf`, the corrosponding word is `lp -> listening practice` and `mf -> matching frenzy`, + +please help to update the `imports`, variables/constants, functions, classes + +thank you diff --git a/002_source/cms/src/app/dashboard/lp/categories/page.tsx b/002_source/cms/src/app/dashboard/lp/categories/page.tsx index 05e4b60..5ba8c17 100644 --- a/002_source/cms/src/app/dashboard/lp/categories/page.tsx +++ b/002_source/cms/src/app/dashboard/lp/categories/page.tsx @@ -18,6 +18,7 @@ import type { ListResult, RecordModel } from 'pocketbase'; 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 { toast } from '@/components/core/toaster'; @@ -147,6 +148,9 @@ export default function Page({ searchParams }: PageProps): React.JSX.Element { + +
{JSON.stringify(f, null, 2)}
+
); } diff --git a/002_source/cms/src/app/dashboard/lp/questions/page.tsx b/002_source/cms/src/app/dashboard/lp/questions/page.tsx index 5640ec4..66f19a9 100644 --- a/002_source/cms/src/app/dashboard/lp/questions/page.tsx +++ b/002_source/cms/src/app/dashboard/lp/questions/page.tsx @@ -18,6 +18,7 @@ import type { ListResult, RecordModel } from 'pocketbase'; 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 { toast } from '@/components/core/toaster'; @@ -202,7 +203,9 @@ export default function Page({ searchParams }: PageProps): React.JSX.Element { -
{JSON.stringify(f, null, 2)}
+ +
{JSON.stringify(f, null, 2)}
+
); } diff --git a/002_source/cms/src/app/dashboard/mf/categories/page.tsx b/002_source/cms/src/app/dashboard/mf/categories/page.tsx index da233d0..30e4499 100644 --- a/002_source/cms/src/app/dashboard/mf/categories/page.tsx +++ b/002_source/cms/src/app/dashboard/mf/categories/page.tsx @@ -18,6 +18,7 @@ import type { ListResult, RecordModel } from 'pocketbase'; 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 { toast } from '@/components/core/toaster'; @@ -148,6 +149,9 @@ export default function Page({ searchParams }: PageProps): React.JSX.Element { + +
{JSON.stringify(f, null, 2)}
+
); } diff --git a/002_source/cms/src/app/dashboard/mf/questions/[cat_id]/page.tsx b/002_source/cms/src/app/dashboard/mf/questions/[cat_id]/page.tsx index 135e49d..16c4a3f 100644 --- a/002_source/cms/src/app/dashboard/mf/questions/[cat_id]/page.tsx +++ b/002_source/cms/src/app/dashboard/mf/questions/[cat_id]/page.tsx @@ -23,7 +23,7 @@ import { toast } from '@/components/core/toaster'; import ErrorDisplay from '@/components/dashboard/error'; import { defaultMfQuestion } from '@/components/dashboard/mf/questions/_constants.ts'; import { Notifications } from '@/components/dashboard/mf/questions/notifications'; -import type { LpQuestion } from '@/components/dashboard/mf/questions/type'; +import type { MfQuestion } from '@/components/dashboard/mf/questions/type'; import FormLoading from '@/components/loading'; import BasicDetailCard from './BasicDetailCard'; @@ -39,10 +39,10 @@ export default function Page(): React.JSX.Element { const [showError, setShowError] = React.useState({ show: false, detail: '' }); // - const [showLessonQuestion, setShowLessonQuestion] = React.useState(defaultMfQuestion); + const [showLessonQuestion, setShowLessonQuestion] = React.useState(defaultMfQuestion); function handleEditClick() { - router.push(paths.dashboard.lp_questions.edit(showLessonQuestion.id)); + router.push(paths.dashboard.mf_questions.edit(showLessonQuestion.id)); } React.useEffect(() => { @@ -89,7 +89,7 @@ export default function Page(): React.JSX.Element { diff --git a/002_source/cms/src/app/dashboard/mf/questions/create/page.tsx b/002_source/cms/src/app/dashboard/mf/questions/create/page.tsx index a63af0e..c9f956b 100644 --- a/002_source/cms/src/app/dashboard/mf/questions/create/page.tsx +++ b/002_source/cms/src/app/dashboard/mf/questions/create/page.tsx @@ -34,7 +34,7 @@ export default function Page(): React.JSX.Element { diff --git a/002_source/cms/src/app/dashboard/mf/questions/edit/[cat_id]/page.tsx b/002_source/cms/src/app/dashboard/mf/questions/edit/[cat_id]/page.tsx index 0f01dad..427d00d 100644 --- a/002_source/cms/src/app/dashboard/mf/questions/edit/[cat_id]/page.tsx +++ b/002_source/cms/src/app/dashboard/mf/questions/edit/[cat_id]/page.tsx @@ -34,7 +34,7 @@ export default function Page(): React.JSX.Element { diff --git a/002_source/cms/src/app/dashboard/mf/questions/page.tsx b/002_source/cms/src/app/dashboard/mf/questions/page.tsx index eecb6a0..e162ad2 100644 --- a/002_source/cms/src/app/dashboard/mf/questions/page.tsx +++ b/002_source/cms/src/app/dashboard/mf/questions/page.tsx @@ -18,6 +18,7 @@ import type { ListResult, RecordModel } from 'pocketbase'; 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 { toast } from '@/components/core/toaster'; @@ -202,7 +203,9 @@ export default function Page({ searchParams }: PageProps): React.JSX.Element { -
{JSON.stringify(f, null, 2)}
+ +
{JSON.stringify(f, null, 2)}
+
); } diff --git a/002_source/cms/src/components/dashboard/mf/categories/lp-category-create-form.tsx b/002_source/cms/src/components/dashboard/mf/categories/lp-category-create-form.tsx index 5f341b8..83d9b60 100644 --- a/002_source/cms/src/components/dashboard/mf/categories/lp-category-create-form.tsx +++ b/002_source/cms/src/components/dashboard/mf/categories/lp-category-create-form.tsx @@ -3,7 +3,7 @@ import * as React from 'react'; import RouterLink from 'next/link'; import { useRouter } from 'next/navigation'; -import { COL_QUIZ_MF_CATEGORIES } from '@/constants'; +import { COL_QUIZ_LP_CATEGORIES } from '@/constants'; import { zodResolver } from '@hookform/resolvers/zod'; import { LoadingButton } from '@mui/lab'; import { Avatar, Divider, MenuItem, Select } from '@mui/material'; @@ -101,7 +101,7 @@ export function MfCategoryCreateForm(): React.JSX.Element { }; try { - const result = await pb.collection(COL_QUIZ_MF_CATEGORIES).create(payload); + const result = await pb.collection(COL_QUIZ_LP_CATEGORIES).create(payload); logger.debug(result); toast.success(t('create.success')); diff --git a/002_source/cms/src/components/dashboard/mf/questions/mf-questions-table.tsx b/002_source/cms/src/components/dashboard/mf/questions/mf-questions-table.tsx index 412aba8..bf1cd74 100644 --- a/002_source/cms/src/components/dashboard/mf/questions/mf-questions-table.tsx +++ b/002_source/cms/src/components/dashboard/mf/questions/mf-questions-table.tsx @@ -40,7 +40,7 @@ function columns(handleDeleteClick: (testId: string) => void): ColumnDef @@ -163,7 +163,7 @@ function columns(handleDeleteClick: (testId: string) => void): ColumnDef