From d2f94727430c9faab3b10dc2895356054557ba70 Mon Sep 17 00:00:00 2001 From: louiscklaw Date: Mon, 21 Apr 2025 05:36:41 +0800 Subject: [PATCH] update , --- .../lp_categories/[cat_id]/TitleCard.tsx | 2 +- .../dashboard/lp_categories/[cat_id]/page.tsx | 6 ++-- .../src/app/dashboard/lp_categories/page.tsx | 2 -- .../dashboard/lp_categories/_constants.ts | 4 ++- .../lp_categories/lp-category-edit-form.tsx | 3 +- .../dashboard/lp_categories/type.d.ts | 2 ++ .../summary/LessonTypeCount/index.tsx | 29 +++++++++++++++++-- 002_source/cms/src/lib/file-to-base64.tsx | 1 + 002_source/cms/tsconfig.json | 3 +- 9 files changed, 39 insertions(+), 13 deletions(-) diff --git a/002_source/cms/src/app/dashboard/lp_categories/[cat_id]/TitleCard.tsx b/002_source/cms/src/app/dashboard/lp_categories/[cat_id]/TitleCard.tsx index e0312e6..f1ad1bc 100644 --- a/002_source/cms/src/app/dashboard/lp_categories/[cat_id]/TitleCard.tsx +++ b/002_source/cms/src/app/dashboard/lp_categories/[cat_id]/TitleCard.tsx @@ -12,7 +12,7 @@ import { useTranslation } from 'react-i18next'; import { LpCategory } from '@/components/dashboard/lp_categories/type'; -function getImageUrlFrRecord(record) { +function getImageUrlFrRecord(record: LpCategory): string { return `http://127.0.0.1:8090/api/files/${record.collectionId}/${record.id}/${record.cat_image}`; } diff --git a/002_source/cms/src/app/dashboard/lp_categories/[cat_id]/page.tsx b/002_source/cms/src/app/dashboard/lp_categories/[cat_id]/page.tsx index 2e9443c..9e56186 100644 --- a/002_source/cms/src/app/dashboard/lp_categories/[cat_id]/page.tsx +++ b/002_source/cms/src/app/dashboard/lp_categories/[cat_id]/page.tsx @@ -45,14 +45,12 @@ export default function Page(): React.JSX.Element { router.push(paths.dashboard.lp_categories.edit(showLessonCategory.id)); } - const [lpModel, setLpModel] = React.useState(null); React.useEffect(() => { if (catId) { pb.collection(COL_LISTENINGS_PRACTICE_CATEGORIES) .getOne(catId) .then((model: RecordModel) => { setShowLessonCategory({ ...defaultLpCategory, ...model }); - setLpModel(model); }) .catch((err) => { logger.error(err); @@ -104,7 +102,7 @@ export default function Page(): React.JSX.Element { spacing={3} sx={{ alignItems: 'flex-start' }} > - + 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 ad1d24f..a566b7b 100644 --- a/002_source/cms/src/app/dashboard/lp_categories/page.tsx +++ b/002_source/cms/src/app/dashboard/lp_categories/page.tsx @@ -99,8 +99,6 @@ export default function Page({ searchParams }: PageProps): React.JSX.Element { width: 'var(--Content-width)', }} > - {JSON.stringify({ currentPage, rowsPerPage })} - ; + return ( + + ); } if (error) { - return ; + return ( + + ); } - return ; + return ( + + ); } export default React.memo(LessonTypeCount); diff --git a/002_source/cms/src/lib/file-to-base64.tsx b/002_source/cms/src/lib/file-to-base64.tsx index 85d37a6..5acdf73 100644 --- a/002_source/cms/src/lib/file-to-base64.tsx +++ b/002_source/cms/src/lib/file-to-base64.tsx @@ -14,6 +14,7 @@ export function fileToBase64(file: Blob): Promise { export function base64ToFile(base64String: string, filename?: string): Promise { return new Promise((resolve, reject) => { const arr = base64String.split(','); + // eslint-disable-next-line prefer-named-capture-group const type = arr[0].match(/:(.*?);/)![1]; const bstr = atob(arr[1]); let n = bstr.length; diff --git a/002_source/cms/tsconfig.json b/002_source/cms/tsconfig.json index d82ce56..82ae8a6 100644 --- a/002_source/cms/tsconfig.json +++ b/002_source/cms/tsconfig.json @@ -44,7 +44,8 @@ "temp", ".next", "_archive", - "_del" + "_del", + "*.del" // ], "excludeFiles": [