-
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.
[126] settings page and organization structure
- Loading branch information
1 parent
b6f4584
commit 98d5ea8
Showing
11 changed files
with
170 additions
and
51 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
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,7 @@ | ||
import { RadixIcons } from '@/components/ui/Icon.tsx'; | ||
|
||
export interface MenuItem { | ||
title: string; | ||
value: string; | ||
icon?: RadixIcons; | ||
} |
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
30 changes: 30 additions & 0 deletions
30
frontend/spa/src/components/SettingsPage/SettingsPageHeader.tsx
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,30 @@ | ||
import React from 'react'; | ||
|
||
import Icon from '@/components/ui/Icon.tsx'; | ||
import { useActiveTab } from '@/context/ActiveTabContext.tsx'; | ||
|
||
interface SettingsPageHeaderProps { | ||
children?: React.ReactNode; | ||
} | ||
|
||
function SettingsPageHeader(props: SettingsPageHeaderProps) { | ||
const { activeTab } = useActiveTab(); | ||
|
||
return ( | ||
<> | ||
<div className="flex flex-row justify-between"> | ||
<h1 className="flex flex-row gap-2 items-center h-10"> | ||
{activeTab?.icon && <Icon icon={activeTab.icon} size="md" />} | ||
{activeTab?.title} | ||
</h1> | ||
|
||
<div>{props.children}</div> | ||
</div> | ||
<div className="py-4"> | ||
<hr /> | ||
</div> | ||
</> | ||
); | ||
} | ||
|
||
export default SettingsPageHeader; |
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
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,21 @@ | ||
import { createContext, useContext } from 'react'; | ||
|
||
import { MenuItem } from '@/components/SettingsPage/MenuItem.ts'; | ||
|
||
interface ActiveTabContextProps { | ||
activeTab?: MenuItem; | ||
setActiveTab: (value: string) => void; | ||
} | ||
|
||
export const ActiveTabContext = createContext<ActiveTabContextProps>({ | ||
activeTab: undefined, | ||
setActiveTab: () => {}, | ||
}); | ||
|
||
export const useActiveTab = () => { | ||
const context = useContext(ActiveTabContext); | ||
if (!context) { | ||
throw new Error('useActiveTab must be used within an ActiveTabProvider'); | ||
} | ||
return context; | ||
}; |
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