Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
32 changes: 0 additions & 32 deletions apps/ui/src/components/user-menu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@ import * as Menu from '@/components/menu';
import { SidebarButton } from '@/components/sidebar-button';
import { useConnector } from '@/data/core';
import { useAuthUser, useLogin, useLogout } from '@/data/queries/use-auth-user';
import { useSaveUserPreferences, useUserPreferences } from '@/data/queries/use-user-preferences';
import { useColorScheme } from '@/hooks/use-color-scheme';
import { useOffline } from '@/hooks/use-offline';
import { moonIcon, sunIcon } from '@/lib/icons';
import styles from './style.module.css';
import type { ColorScheme } from '@/data/core';

const WPCOM_PROFILE_URL = 'https://wordpress.com/me';
const DOCS_URL = 'https://developer.wordpress.com/docs/developer-tools/studio/';
Expand All @@ -21,14 +18,11 @@ const REPORT_ISSUE_URL = 'https://github.com/Automattic/studio/issues/new/choose
export function UserMenu() {
const connector = useConnector();
const { data: user } = useAuthUser();
const { data: preferences } = useUserPreferences();
const savePreferences = useSaveUserPreferences();
const login = useLogin();
const logout = useLogout();
const navigate = useNavigate();

const isOffline = useOffline();
const currentScheme: ColorScheme = preferences?.colorScheme ?? 'system';
const themeIsDark = useColorScheme() === 'dark';

const openLink = ( url: string ) => {
Expand Down Expand Up @@ -90,32 +84,6 @@ export function UserMenu() {
onClick={ () => void navigate( { to: '/settings' } ) }
/>
) : null }
<Menu.Root modal={ false }>
<Menu.Trigger
render={
<IconButton
variant="minimal"
tone="neutral"
size="small"
className={ styles.themeToggle }
icon={ themeIsDark ? sunIcon : moonIcon }
label={ __( 'Appearance' ) }
/>
}
/>
<Menu.Popup side="top" align="end">
<Menu.RadioGroup
value={ currentScheme }
onValueChange={ ( value ) =>
savePreferences.mutate( { colorScheme: value as ColorScheme } )
}
>
<Menu.RadioItem value="system">{ __( 'System' ) }</Menu.RadioItem>
<Menu.RadioItem value="light">{ __( 'Light' ) }</Menu.RadioItem>
<Menu.RadioItem value="dark">{ __( 'Dark' ) }</Menu.RadioItem>
</Menu.RadioGroup>
</Menu.Popup>
</Menu.Root>
</div>
</div>
);
Expand Down
7 changes: 0 additions & 7 deletions apps/ui/src/components/user-menu/style.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,13 @@
}

.userName,
.themeToggle,
.settingsButton {
color: var(--wpds-color-fg-content-neutral-weak);
}

.themeToggle {
margin-inline-end: calc(-1 * var(--wpds-dimension-padding-sm));
}

.row:hover .userName,
.row:hover .themeToggle,
.row:hover .settingsButton,
.row:focus-within .userName,
.row:focus-within .themeToggle,
.row:focus-within .settingsButton {
color: var(--wpds-color-fg-content-neutral);
}
Expand Down
23 changes: 0 additions & 23 deletions apps/ui/src/lib/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,3 @@ export const drawerIcon = (
<line x1="9.5" y1="5" x2="9.5" y2="19" stroke="currentColor" strokeWidth="1.5" />
</svg>
);

export const sunIcon = (
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none">
<circle cx="12" cy="12" r="4" stroke="currentColor" strokeWidth="1.5" />
<path
d="M12 3v2M12 19v2M3 12h2M19 12h2M5.6 5.6l1.4 1.4M17 17l1.4 1.4M5.6 18.4L7 17M17 7l1.4-1.4"
stroke="currentColor"
strokeWidth="1.5"
strokeLinecap="round"
/>
</svg>
);

export const moonIcon = (
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none">
<path
d="M20 14.5A8 8 0 019.5 4a8 8 0 1010.5 10.5z"
stroke="currentColor"
strokeWidth="1.5"
strokeLinejoin="round"
/>
</svg>
);
Loading