This commit is contained in:
louiscklaw
2025-04-21 05:36:41 +08:00
parent f65f6df660
commit d2f9472743
9 changed files with 39 additions and 13 deletions

View File

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

View File

@@ -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<RecordModel>(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' }}
>
<TitleCard lpModel={lpModel} />
<TitleCard lpModel={showLessonCategory} />
</Stack>
</Stack>
<Grid
@@ -117,7 +115,7 @@ export default function Page(): React.JSX.Element {
>
<Stack spacing={4}>
<BasicDetailCard
lpModel={lpModel}
lpModel={showLessonCategory}
handleEditClick={handleEditClick}
/>
<SampleSecurityCard />

View File

@@ -99,8 +99,6 @@ export default function Page({ searchParams }: PageProps): React.JSX.Element {
width: 'var(--Content-width)',
}}
>
{JSON.stringify({ currentPage, rowsPerPage })}
<Stack spacing={4}>
<Stack
direction={{ xs: 'column', sm: 'row' }}