This commit is contained in:
louiscklaw
2025-04-16 07:46:18 +08:00
parent 7c63b9d0d9
commit 9b39e82488
7 changed files with 107 additions and 55 deletions

View File

@@ -26,19 +26,26 @@ import { PencilSimple as PencilSimpleIcon } from '@phosphor-icons/react/dist/ssr
import { Plus as PlusIcon } from '@phosphor-icons/react/dist/ssr/Plus';
import { ShieldWarning as ShieldWarningIcon } from '@phosphor-icons/react/dist/ssr/ShieldWarning';
import { User as UserIcon } from '@phosphor-icons/react/dist/ssr/User';
import type { RecordModel } from 'pocketbase';
import PocketBase from 'pocketbase';
import { useTranslation } from 'react-i18next';
import { paths } from '@/paths';
import { dayjs } from '@/lib/dayjs';
import { logger } from '@/lib/default-logger';
import { PropertyItem } from '@/components/core/property-item';
import { PropertyList } from '@/components/core/property-list';
import { toast } from '@/components/core/toaster';
// import { getLessonTypeById } from '@/components/dashboard/lesson_type/http-actions';
import { LessonTypeDefaultValue, type LessonType } from '@/components/dashboard/lesson_type/ILessonType';
import { defaultLessonType } from '@/components/dashboard/lesson_type/interfaces';
import { Notifications } from '@/components/dashboard/lesson_type/notifications';
import { Payments } from '@/components/dashboard/lesson_type/payments';
import type { Address } from '@/components/dashboard/lesson_type/shipping-address';
import { ShippingAddress } from '@/components/dashboard/lesson_type/shipping-address';
const pb = new PocketBase(process.env.NEXT_PUBLIC_POCKETBASE_URL);
export default function Page(): React.JSX.Element {
const { t } = useTranslation();
const { typeId } = useParams<{ typeId: string }>();
@@ -51,17 +58,20 @@ export default function Page(): React.JSX.Element {
}
React.useEffect(() => {
// getLessonTypeById(typeId)
// .then((lessonType: LessonType) => {
// setIsLoading(false);
// setShowLessonType(lessonType);
// })
// .catch((err) => {
// // console.error(err);
// console.error(t('lessonType.load_error'));
// });
// console.log('hello');
}, []);
if (typeId) {
pb.collection('LessonsTypes')
.getOne(typeId)
.then((lessonType: RecordModel) => {
setShowLessonType({ ...defaultLessonType, ...lessonType });
setIsLoading(false);
})
.catch((err) => {
logger.error(err);
toast(t('dashboard.lessonTypes.list.error'));
});
}
}, [typeId]);
if (isLoading) return <div>{t('common.loading')}</div>;
return (

View File

@@ -14,6 +14,11 @@ import { LessonTypeEditForm } from '@/components/dashboard/lesson_type/lesson-ty
export default function Page(): React.JSX.Element {
const { t } = useTranslation();
React.useEffect(() => {
console.log('helloworld');
}, []);
return (
<Box
sx={{

View File

@@ -0,0 +1,14 @@
'use client';
import * as React from 'react';
import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
function Page(): React.JSX.Element {
React.useLayoutEffect(() => {
console.log('helloworld');
}, []);
return <>helloworld</>;
}
export default Page;