add user profile navigation logic and update button in SettingContainer
```
This commit is contained in:
louiscklaw
2025-05-15 09:19:59 +08:00
parent ba8e9cca69
commit e34782844e

View File

@@ -3,6 +3,7 @@ import { arrowBack } from 'ionicons/icons';
import { LESSON_LINK, VERSIONS } from '../../constants';
import SettingSvg from './image.svg';
import { Paths } from '../../Paths';
import { pb } from '../../lib/pb';
interface ContainerProps {
name: string;
@@ -15,6 +16,14 @@ const SettingContainer: React.FC<ContainerProps> = ({ name }) => {
router.push(Paths.AuthHome);
}
function handleUserProfileClick() {
if (pb.authStore.record?.id) {
router.push(Paths.GetStudentInfoLink(pb.authStore.record.id));
} else {
router.push(Paths.AuthLogin);
}
}
return (
<div
style={{
@@ -40,7 +49,7 @@ const SettingContainer: React.FC<ContainerProps> = ({ name }) => {
<p>T.B.A.</p>
</div>
<div>{VERSIONS}</div>
<IonButton onClick={handleAuthHomeClick}>AuthHome</IonButton>
<IonButton onClick={handleUserProfileClick}>User Profile</IonButton>
<IonButton
onClick={() => {
router.push(LESSON_LINK, undefined, 'replace');