-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Footer #224
Merged
Merged
Footer #224
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
d559726
renaming Footer to DebugFooter
michalmasrna1 8cc6247
basic footer layout and positioning
michalmasrna1 8b4d8be
Footer positioning
michalmasrna1 773c101
Addedd Logo component
michalmasrna1 954a8f6
Footer containing logos
michalmasrna1 21d1e22
Change position of Footer
Matushl b9e7433
Style images in Footer
Matushl 9bc020c
Add menuitems to Footer
Matushl 7b5cf91
Fix some thinks after review
Matushl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
src/components/PageLayout/DebugFooter/DebugFooter.module.scss
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,13 @@ | ||
.debugFooter { | ||
position: fixed; | ||
left: 25%; | ||
right: 0; | ||
bottom: 0; | ||
|
||
background-color: black; | ||
color: white; | ||
|
||
display: flex; | ||
flex-direction: row; | ||
gap: 40px; | ||
} |
9 changes: 9 additions & 0 deletions
9
src/components/PageLayout/DebugFooter/DebugFooter.module.scss.d.ts
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 = { | ||
debugFooter: 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,27 @@ | ||
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 './DebugFooter.module.scss' | ||
|
||
export const DebugFooter: 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 ( | ||
<div className={styles.debugFooter}> | ||
<span>Debug info: </span> | ||
<span>user name: {profile?.first_name + ' ' + profile?.last_name} </span> | ||
<span>isAuthed: {`${isAuthed}`}</span> | ||
</div> | ||
) | ||
} |
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 |
---|---|---|
@@ -1,13 +1,35 @@ | ||
.footer { | ||
position: fixed; | ||
left: 25%; | ||
right: 0; | ||
bottom: 0; | ||
|
||
.container { | ||
width: 100%; | ||
display: grid; | ||
grid-template-columns: repeat(4, 1fr); | ||
background-color: black; | ||
color: white; | ||
// bottom offset because of sticky debug footer | ||
padding-bottom: 1rem; | ||
} | ||
|
||
display: flex; | ||
flex-direction: row; | ||
gap: 40px; | ||
.content { | ||
grid-column-start: 2; | ||
grid-column-end: 4; | ||
} | ||
|
||
.menuItem { | ||
background-color: transparent; | ||
|
||
a { | ||
padding: 0px 5px; | ||
border-bottom: 5px solid white; | ||
color: white; | ||
background-color: inherit; | ||
} | ||
} | ||
|
||
.menuItem:hover { | ||
background-color: white; | ||
|
||
a { | ||
color: black; | ||
border-color: black; | ||
background-color: inherit; | ||
} | ||
} |
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 |
---|---|---|
@@ -1,27 +1,61 @@ | ||
import {Stack} 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 {Link} from '@/components/Clickable/Link' | ||
import {Loading} from '@/components/Loading/Loading' | ||
import {ILogo, Logo} from '@/components/PageLayout/Footer/Logo' | ||
import {MenuItemShort} from '@/types/api/cms' | ||
import {useSeminarInfo} from '@/utils/useSeminarInfo' | ||
|
||
import styles from './Footer.module.scss' | ||
|
||
export const Footer: FC = () => { | ||
const {isAuthed} = AuthContainer.useContainer() | ||
const {seminar, seminarId} = useSeminarInfo() | ||
|
||
const {data} = useQuery({ | ||
queryKey: ['personal', 'profiles', 'myprofile'], | ||
queryFn: () => axios.get<Profile>(`/api/personal/profiles/myprofile`), | ||
enabled: isAuthed, | ||
const { | ||
data: menuItemsData, | ||
isLoading: menuItemsIsLoading, | ||
error: menuItemsError, | ||
} = useQuery({ | ||
queryKey: ['cms', 'menu-item', 'on-site', seminarId], | ||
queryFn: () => axios.get<MenuItemShort[]>(`/api/cms/menu-item/on-site/${seminarId}`), | ||
}) | ||
const profile = data?.data | ||
const menuItems = menuItemsData?.data ?? [] | ||
|
||
const { | ||
data: logosData, | ||
isLoading: logosIsLoading, | ||
error: logosError, | ||
} = useQuery({ | ||
queryKey: ['cms', 'logo'], | ||
queryFn: () => axios.get<ILogo[]>('/api/cms/logo'), | ||
}) | ||
const logos = logosData?.data.filter((logo) => !logo.disabled) ?? [] | ||
|
||
return ( | ||
<div className={styles.footer}> | ||
<span>Debug info: </span> | ||
<span>user name: {profile?.first_name + ' ' + profile?.last_name} </span> | ||
<span>isAuthed: {`${isAuthed}`}</span> | ||
<div className={styles.container}> | ||
<div className={styles.content}> | ||
<Stack direction="row" m={2} gap={2} justifyContent="center" sx={{flexWrap: 'wrap'}}> | ||
{menuItemsIsLoading && <Loading />} | ||
{menuItems.map((item) => ( | ||
<div key={item.id} className={styles.menuItem}> | ||
<Link variant="button2" href={`/${seminar}${item.url}`}> | ||
{item.caption} | ||
</Link> | ||
</div> | ||
))} | ||
{menuItemsError && <p>{menuItemsError.message}</p>} | ||
</Stack> | ||
<Stack direction="row" m={2} gap={2} justifyContent="center" sx={{flexWrap: 'wrap'}}> | ||
{logosIsLoading && <Loading />} | ||
{logos.map((logo) => ( | ||
<Logo key={logo.id} {...logo} /> | ||
))} | ||
{logosError && <p>{logosError.message}</p>} | ||
</Stack> | ||
</div> | ||
</div> | ||
) | ||
} |
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,22 @@ | ||
import {Box} from '@mui/material' | ||
import {FC} from 'react' | ||
|
||
export interface ILogo { | ||
id: number | ||
name: string | ||
disabled: string | ||
image: string | ||
} | ||
|
||
export const Logo: FC<ILogo> = ({name, image}) => { | ||
return ( | ||
<Box | ||
component={'img'} | ||
src={image} | ||
alt={name} // TODO: alt from backend | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. comment |
||
sx={{ | ||
maxHeight: '9rem', | ||
}} | ||
/> | ||
) | ||
} |
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nie som nadseny z novych class ale chapem nechut k skusaniu prepisania do MUI... 😄