-
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.
- Loading branch information
1 parent
e2f590e
commit 11914a0
Showing
22 changed files
with
409 additions
and
210 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
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,135 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
import {useDispatch} from 'react-redux'; | ||
import {useTheme} from '../../hooks/useTheme'; | ||
import {showModal} from '../../store/slices/uiSlice'; | ||
import {ThemeName} from '../../themes/themes'; | ||
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome'; | ||
import {faCog, faHome, faSignInAlt, faSignOutAlt} from '@fortawesome/free-solid-svg-icons'; | ||
import {ThemeMenu} from "./ThemeMenu"; | ||
|
||
const MenuContainer = styled.div` | ||
display: flex; | ||
justify-content: space-between; | ||
padding: ${({theme}) => theme.sizing.spacing.sm}; | ||
background-color: ${({theme}) => theme.colors.surface}; | ||
border-bottom: 1px solid ${({theme}) => theme.colors.border}; | ||
`; | ||
|
||
const ToolbarLeft = styled.div` | ||
display: flex; | ||
gap: ${({theme}) => theme.sizing.spacing.md}; | ||
`; | ||
|
||
const Dropdown = styled.div` | ||
position: relative; | ||
display: inline-block; | ||
&:hover .dropdown-content { | ||
display: block; | ||
} | ||
`; | ||
|
||
const DropButton = styled.a` | ||
color: ${({theme}) => theme.colors.text.primary}; | ||
padding: ${({theme}) => theme.sizing.spacing.sm}; | ||
text-decoration: none; | ||
cursor: pointer; | ||
&:hover { | ||
background-color: ${({theme}) => theme.colors.primary}; | ||
color: white; | ||
} | ||
`; | ||
|
||
const DropdownContent = styled.div` | ||
display: none; | ||
position: absolute; | ||
background-color: ${({theme}) => theme.colors.surface}; | ||
min-width: 160px; | ||
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2); | ||
z-index: 1; | ||
`; | ||
|
||
const DropdownItem = styled.a` | ||
color: ${({theme}) => theme.colors.text.primary}; | ||
padding: ${({theme}) => theme.sizing.spacing.sm}; | ||
text-decoration: none; | ||
display: block; | ||
cursor: pointer; | ||
&:hover { | ||
background-color: ${({theme}) => theme.colors.primary}; | ||
color: white; | ||
} | ||
`; | ||
|
||
export const Menu: React.FC = () => { | ||
const dispatch = useDispatch(); | ||
const [, setTheme] = useTheme(); | ||
|
||
const handleThemeChange = (theme: ThemeName) => { | ||
setTheme(theme); | ||
}; | ||
|
||
const handleModalOpen = (modalType: string) => { | ||
dispatch(showModal(modalType)); | ||
}; | ||
|
||
return ( | ||
<MenuContainer> | ||
<ToolbarLeft> | ||
<DropButton href="/"> | ||
<FontAwesomeIcon icon={faHome}/> Home | ||
</DropButton> | ||
|
||
<Dropdown> | ||
<DropButton>App</DropButton> | ||
<DropdownContent> | ||
<DropdownItem onClick={() => handleModalOpen('sessions')}>Session List</DropdownItem> | ||
<DropdownItem href="">New</DropdownItem> | ||
</DropdownContent> | ||
</Dropdown> | ||
|
||
<Dropdown> | ||
<DropButton> | ||
<FontAwesomeIcon icon={faCog}/> Session | ||
</DropButton> | ||
<DropdownContent> | ||
<DropdownItem onClick={() => handleModalOpen('settings')}>Settings</DropdownItem> | ||
<DropdownItem onClick={() => handleModalOpen('files')}>Files</DropdownItem> | ||
<DropdownItem onClick={() => handleModalOpen('usage')}>Usage</DropdownItem> | ||
<DropdownItem onClick={() => handleModalOpen('threads')}>Threads</DropdownItem> | ||
<DropdownItem onClick={() => handleModalOpen('share')}>Share</DropdownItem> | ||
<DropdownItem onClick={() => handleModalOpen('cancel')}>Cancel</DropdownItem> | ||
<DropdownItem onClick={() => handleModalOpen('delete')}>Delete</DropdownItem> | ||
<DropdownItem onClick={() => handleModalOpen('verbose')}>Show Verbose</DropdownItem> | ||
</DropdownContent> | ||
</Dropdown> | ||
|
||
<ThemeMenu/> | ||
|
||
<Dropdown> | ||
<DropButton>About</DropButton> | ||
<DropdownContent> | ||
<DropdownItem onClick={() => handleModalOpen('privacy')}>Privacy Policy</DropdownItem> | ||
<DropdownItem onClick={() => handleModalOpen('tos')}>Terms of Service</DropdownItem> | ||
</DropdownContent> | ||
</Dropdown> | ||
</ToolbarLeft> | ||
|
||
<Dropdown> | ||
<DropButton> | ||
<FontAwesomeIcon icon={faSignInAlt}/> Login | ||
</DropButton> | ||
<DropdownContent> | ||
<DropdownItem onClick={() => handleModalOpen('user-settings')}>Settings</DropdownItem> | ||
<DropdownItem onClick={() => handleModalOpen('user-usage')}>Usage</DropdownItem> | ||
<DropdownItem> | ||
<FontAwesomeIcon icon={faSignOutAlt}/> Logout | ||
</DropdownItem> | ||
</DropdownContent> | ||
</Dropdown> | ||
</MenuContainer> | ||
); | ||
}; |
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,80 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
import {useTheme} from '../../hooks/useTheme'; | ||
import {themes} from '../../themes/themes'; | ||
|
||
const ThemeMenuContainer = styled.div` | ||
position: relative; | ||
display: inline-block; | ||
`; | ||
|
||
const ThemeButton = styled.button` | ||
padding: ${({theme}) => theme.sizing.spacing.sm}; | ||
color: ${({theme}) => theme.colors.text.primary}; | ||
background: ${({theme}) => theme.colors.surface}; | ||
border: 1px solid ${({theme}) => theme.colors.border}; | ||
border-radius: ${({theme}) => theme.sizing.borderRadius.sm}; | ||
&:hover { | ||
background: ${({theme}) => theme.colors.primary}; | ||
color: ${({theme}) => theme.colors.background}; | ||
} | ||
`; | ||
|
||
const ThemeList = styled.div` | ||
position: absolute; | ||
top: 100%; | ||
right: 0; | ||
background: ${({theme}) => theme.colors.surface}; | ||
border: 1px solid ${({theme}) => theme.colors.border}; | ||
border-radius: ${({theme}) => theme.sizing.borderRadius.sm}; | ||
padding: ${({theme}) => theme.sizing.spacing.xs}; | ||
z-index: 10; | ||
min-width: 150px; | ||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); | ||
`; | ||
|
||
const ThemeOption = styled.button` | ||
width: 100%; | ||
padding: ${({theme}) => theme.sizing.spacing.sm}; | ||
text-align: left; | ||
color: ${({theme}) => theme.colors.text.primary}; | ||
background: none; | ||
border: none; | ||
border-radius: ${({theme}) => theme.sizing.borderRadius.sm}; | ||
&:hover { | ||
background: ${({theme}) => theme.colors.primary}; | ||
color: ${({theme}) => theme.colors.background}; | ||
} | ||
`; | ||
|
||
export const ThemeMenu: React.FC = () => { | ||
const [currentTheme, setTheme] = useTheme(); | ||
const [isOpen, setIsOpen] = React.useState(false); | ||
|
||
const handleThemeChange = (themeName: keyof typeof themes) => { | ||
setTheme(themeName); | ||
setIsOpen(false); | ||
}; | ||
|
||
return ( | ||
<ThemeMenuContainer> | ||
<ThemeButton onClick={() => setIsOpen(!isOpen)}> | ||
Theme: {currentTheme} | ||
</ThemeButton> | ||
{isOpen && ( | ||
<ThemeList> | ||
{Object.keys(themes).map((themeName) => ( | ||
<ThemeOption | ||
key={themeName} | ||
onClick={() => handleThemeChange(themeName as keyof typeof themes)} | ||
> | ||
{themeName} | ||
</ThemeOption> | ||
))} | ||
</ThemeList> | ||
)} | ||
</ThemeMenuContainer> | ||
); | ||
}; |
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 @@ | ||
export {ThemeMenu} from './ThemeMenu'; |
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.