From 6fa20403e052b68040693d1b3e1a3548dd8c2768 Mon Sep 17 00:00:00 2001 From: matushl Date: Fri, 10 Nov 2023 16:47:43 +0100 Subject: [PATCH 1/3] Add profile detail page --- .../Authentication/Authentication.tsx | 1 + .../Profile/ProfileDetail.module.scss | 6 +++ .../Profile/ProfileDetail.module.scss.d.ts | 9 ++++ src/components/Profile/ProfileDetail.tsx | 48 +++++++++++++++++++ src/pages/strom/profil/index.tsx | 12 +++++ 5 files changed, 76 insertions(+) create mode 100644 src/components/Profile/ProfileDetail.module.scss create mode 100644 src/components/Profile/ProfileDetail.module.scss.d.ts create mode 100644 src/components/Profile/ProfileDetail.tsx create mode 100644 src/pages/strom/profil/index.tsx diff --git a/src/components/PageLayout/Authentication/Authentication.tsx b/src/components/PageLayout/Authentication/Authentication.tsx index e03d30de..97e72320 100644 --- a/src/components/PageLayout/Authentication/Authentication.tsx +++ b/src/components/PageLayout/Authentication/Authentication.tsx @@ -37,6 +37,7 @@ export const Authentication: FC = () => { } else { return (
+ Profil logout()}>Odhlásiť
) diff --git a/src/components/Profile/ProfileDetail.module.scss b/src/components/Profile/ProfileDetail.module.scss new file mode 100644 index 00000000..defc1ea7 --- /dev/null +++ b/src/components/Profile/ProfileDetail.module.scss @@ -0,0 +1,6 @@ +.label { + font-weight: bold; + text-transform: uppercase; + font-style: italic; + padding-right: .5rem; +} diff --git a/src/components/Profile/ProfileDetail.module.scss.d.ts b/src/components/Profile/ProfileDetail.module.scss.d.ts new file mode 100644 index 00000000..214131f0 --- /dev/null +++ b/src/components/Profile/ProfileDetail.module.scss.d.ts @@ -0,0 +1,9 @@ +export type Styles = { + label: string +} + +export type ClassNames = keyof Styles + +declare const styles: Styles + +export default styles diff --git a/src/components/Profile/ProfileDetail.tsx b/src/components/Profile/ProfileDetail.tsx new file mode 100644 index 00000000..ed11d9cd --- /dev/null +++ b/src/components/Profile/ProfileDetail.tsx @@ -0,0 +1,48 @@ +import {Stack, Typography} from '@mui/material' +import {useQuery} from '@tanstack/react-query' +import axios from 'axios' +import {FC} from 'react' + +import {Profile} from '@/types/api/personal' +import {AuthContainer} from '@/utils/AuthContainer' + +import styles from './ProfileDetail.module.scss' + +type ProfileLineInput = { + label: string + value?: string +} + +const ProfileLine: FC = ({label, value}) => { + return ( + // font-size: 30px podla designu + + {label} + {value} + + ) +} + +export const ProfileDetail: FC = () => { + const {isAuthed} = AuthContainer.useContainer() + + const {data} = useQuery({ + queryKey: ['personal', 'profiles', 'myprofile'], + queryFn: () => axios.get(`/api/personal/profiles/myprofile`), + enabled: isAuthed, + }) + const profile = data?.data + + return ( + + + {/* TODO: pockat na BE kym to posle v datach */} + + + {/* TODO: pockat na BE kym to posle v datach */} + + + + + ) +} diff --git a/src/pages/strom/profil/index.tsx b/src/pages/strom/profil/index.tsx new file mode 100644 index 00000000..96b9940f --- /dev/null +++ b/src/pages/strom/profil/index.tsx @@ -0,0 +1,12 @@ +import {NextPage} from 'next' + +import {PageLayout} from '@/components/PageLayout/PageLayout' +import {ProfileDetail} from '@/components/Profile/ProfileDetail' + +const Profil: NextPage = () => ( + + + +) + +export default Profil From a23fb71c657fa3d14162e580a5b304370b5bab59 Mon Sep 17 00:00:00 2001 From: matushl Date: Fri, 10 Nov 2023 18:35:20 +0100 Subject: [PATCH 2/3] Adjust to new BE --- src/components/Profile/ProfileDetail.tsx | 6 ++---- src/types/api/personal.ts | 2 ++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/Profile/ProfileDetail.tsx b/src/components/Profile/ProfileDetail.tsx index ed11d9cd..31cf4547 100644 --- a/src/components/Profile/ProfileDetail.tsx +++ b/src/components/Profile/ProfileDetail.tsx @@ -36,11 +36,9 @@ export const ProfileDetail: FC = () => { return ( - {/* TODO: pockat na BE kym to posle v datach */} - + - {/* TODO: pockat na BE kym to posle v datach */} - + diff --git a/src/types/api/personal.ts b/src/types/api/personal.ts index 58530dbf..795fb75e 100644 --- a/src/types/api/personal.ts +++ b/src/types/api/personal.ts @@ -62,12 +62,14 @@ export interface SchoolProfile { export interface Profile { first_name: string last_name: string + email: string nickname: string | null school: SchoolProfile phone: string | null parent_phone: string | null gdpr: boolean grade: number + grade_name: string is_student: boolean has_school: boolean school_id: number From 1ef4400ccf5495ff6177ca35bd48bfcf63ab762a Mon Sep 17 00:00:00 2001 From: matushl Date: Sat, 11 Nov 2023 12:28:41 +0100 Subject: [PATCH 3/3] Add pages for Matik and Malynar --- src/pages/malynar/profil/index.tsx | 9 +++++++++ src/pages/matik/profil/index.tsx | 9 +++++++++ 2 files changed, 18 insertions(+) create mode 100644 src/pages/malynar/profil/index.tsx create mode 100644 src/pages/matik/profil/index.tsx diff --git a/src/pages/malynar/profil/index.tsx b/src/pages/malynar/profil/index.tsx new file mode 100644 index 00000000..7caea213 --- /dev/null +++ b/src/pages/malynar/profil/index.tsx @@ -0,0 +1,9 @@ +import {NextPage} from 'next' + +import Page from '../../strom/profil/index' + +const Vysledky: NextPage = () => { + return +} + +export default Vysledky diff --git a/src/pages/matik/profil/index.tsx b/src/pages/matik/profil/index.tsx new file mode 100644 index 00000000..7caea213 --- /dev/null +++ b/src/pages/matik/profil/index.tsx @@ -0,0 +1,9 @@ +import {NextPage} from 'next' + +import Page from '../../strom/profil/index' + +const Vysledky: NextPage = () => { + return +} + +export default Vysledky