-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add profile detail page * Adjust to new BE * Add pages for Matik and Malynar
- Loading branch information
Showing
8 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.label { | ||
font-weight: bold; | ||
text-transform: uppercase; | ||
font-style: italic; | ||
padding-right: .5rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export type Styles = { | ||
label: string | ||
} | ||
|
||
export type ClassNames = keyof Styles | ||
|
||
declare const styles: Styles | ||
|
||
export default styles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
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<ProfileLineInput> = ({label, value}) => { | ||
return ( | ||
// font-size: 30px podla designu | ||
<Typography sx={{fontSize: '1.875rem'}}> | ||
<span className={styles.label}>{label}</span> | ||
{value} | ||
</Typography> | ||
) | ||
} | ||
|
||
export const ProfileDetail: FC = () => { | ||
const {isAuthed} = AuthContainer.useContainer() | ||
|
||
const {data} = useQuery({ | ||
queryKey: ['personal', 'profiles', 'myprofile'], | ||
queryFn: () => axios.get<Profile>(`/api/personal/profiles/myprofile`), | ||
enabled: isAuthed, | ||
}) | ||
const profile = data?.data | ||
|
||
return ( | ||
<Stack spacing={2}> | ||
<ProfileLine label={'meno'} value={profile?.first_name + ' ' + profile?.last_name} /> | ||
<ProfileLine label={'e-mail'} value={profile?.email} /> | ||
<ProfileLine label={'škola'} value={profile?.school.verbose_name} /> | ||
<ProfileLine label={'ročník'} value={profile?.grade_name} /> | ||
<ProfileLine label={'tel. č.'} value={profile?.phone || '-'} /> | ||
<ProfileLine label={'tel. č. na rodiča'} value={profile?.parent_phone || '-'} /> | ||
</Stack> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import {NextPage} from 'next' | ||
|
||
import Page from '../../strom/profil/index' | ||
|
||
const Vysledky: NextPage = () => { | ||
return <Page /> | ||
} | ||
|
||
export default Vysledky |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import {NextPage} from 'next' | ||
|
||
import Page from '../../strom/profil/index' | ||
|
||
const Vysledky: NextPage = () => { | ||
return <Page /> | ||
} | ||
|
||
export default Vysledky |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import {NextPage} from 'next' | ||
|
||
import {PageLayout} from '@/components/PageLayout/PageLayout' | ||
import {ProfileDetail} from '@/components/Profile/ProfileDetail' | ||
|
||
const Profil: NextPage = () => ( | ||
<PageLayout contentWidth={2} title="Profil"> | ||
<ProfileDetail /> | ||
</PageLayout> | ||
) | ||
|
||
export default Profil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters