forked from solidcouch/solidcouch
-
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.
feat(ui): add dark theme (solidcouch#128)
- add theme switch - add dark theme styles everywhere - add new optional environment variable VITE_DARK_MODE_LOGO_STYLE=invert - replace classnames with clsx - move redux files to src/redux/
- Loading branch information
Showing
57 changed files
with
360 additions
and
156 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
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,58 @@ | ||
import { Avatar } from '@/components' | ||
import { SignOut } from '@/components/SignOut.tsx' | ||
import { useConfig } from '@/config/hooks' | ||
import { useProfile } from '@/hooks/data/useProfile' | ||
import { useReadMessagesFromInbox } from '@/hooks/data/useReadThreads' | ||
import { selectAuth } from '@/redux/authSlice' | ||
import { useAppSelector } from '@/redux/hooks' | ||
import { selectTheme } from '@/redux/uiSlice' | ||
import { Menu, MenuButton, MenuDivider, MenuItem } from '@szhsin/react-menu' | ||
import { Link } from 'react-router-dom' | ||
|
||
export const MainMenu = () => { | ||
const { communityId } = useConfig() | ||
const auth = useAppSelector(selectAuth) | ||
const [profile] = useProfile(auth.webId ?? '', communityId) | ||
|
||
const { data: newMessages } = useReadMessagesFromInbox(auth.webId ?? '') | ||
|
||
const theme = useAppSelector(selectTheme) | ||
|
||
return ( | ||
<Menu | ||
menuButton={ | ||
<MenuButton data-cy="menu-button"> | ||
<Avatar photo={profile.photo} /> | ||
</MenuButton> | ||
} | ||
theming={theme === 'dark' ? 'dark' : undefined} | ||
> | ||
<MenuItem> | ||
<Link to="profile">{profile?.name || 'profile'}</Link> | ||
</MenuItem> | ||
<MenuItem> | ||
<Link to="profile/edit" data-cy="menu-item-edit-profile"> | ||
edit profile | ||
</Link> | ||
</MenuItem> | ||
<MenuItem> | ||
<Link to="messages"> | ||
messages | ||
{newMessages?.length ? ` (${newMessages.length} new)` : null} | ||
</Link> | ||
</MenuItem> | ||
<MenuItem> | ||
<Link to={`profile/${encodeURIComponent(auth.webId!)}/contacts`}> | ||
contacts | ||
</Link> | ||
</MenuItem> | ||
<MenuItem> | ||
<Link to="host/offers">my hosting</Link> | ||
</MenuItem> | ||
<MenuDivider /> | ||
<MenuItem> | ||
<SignOut /> | ||
</MenuItem> | ||
</Menu> | ||
) | ||
} |
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.