Skip to content

Commit de07c02

Browse files
committed
some small changes
Signed-off-by: Shea <nu@she-a.eu>
1 parent f37a24b commit de07c02

7 files changed

Lines changed: 181 additions & 39 deletions

File tree

src/app/components/message/modals/Options.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -654,35 +654,35 @@ export function OptionMenu({
654654
Reply
655655
</Text>
656656
</MenuItem>
657-
{!isThreadedMessage && (
657+
{canEditEvent(mx, mEvent) && onEditId && (
658658
<MenuItem
659659
size="300"
660-
after={menuIcon(ChatCircleDots)}
660+
after={menuIcon(PencilSimple)}
661661
radii="300"
662662
data-event-id={mEvent.getId()}
663-
onClick={(evt) => {
664-
onReplyClick(evt, true);
663+
onClick={() => {
664+
onEditId(mEvent.getId());
665665
onTotalClose();
666666
}}
667667
>
668668
<Text className={css.MessageMenuItemText} as="span" size="T300" truncate>
669-
Reply in Thread
669+
Edit Message
670670
</Text>
671671
</MenuItem>
672672
)}
673-
{canEditEvent(mx, mEvent) && onEditId && (
673+
{!isThreadedMessage && (
674674
<MenuItem
675675
size="300"
676-
after={menuIcon(PencilSimple)}
676+
after={menuIcon(ChatCircleDots)}
677677
radii="300"
678678
data-event-id={mEvent.getId()}
679-
onClick={() => {
680-
onEditId(mEvent.getId());
679+
onClick={(evt) => {
680+
onReplyClick(evt, true);
681681
onTotalClose();
682682
}}
683683
>
684684
<Text className={css.MessageMenuItemText} as="span" size="T300" truncate>
685-
Edit Message
685+
Reply in Thread
686686
</Text>
687687
</MenuItem>
688688
)}

src/app/features/settings/Settings.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,14 @@ export enum SettingsPages {
7878

7979
type PhosphorIcon = ComponentType<IconProps>;
8080

81-
type SettingsMenuItem = {
81+
export type SettingsMenuItem = {
8282
id: SettingsSectionId;
8383
name: string;
8484
icon: PhosphorIcon;
8585
activeIcon?: PhosphorIcon;
8686
};
8787

88-
const settingsMenuIcons: Record<
88+
export const settingsMenuIcons: Record<
8989
SettingsSectionId,
9090
Pick<SettingsMenuItem, 'icon' | 'activeIcon'>
9191
> = {

src/app/pages/client/profile/Profile.tsx

Lines changed: 112 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
1-
import { Box, toRem, Text, color, config, Menu, Icon, Icons, Line, MenuItem } from 'folds';
2-
import { SquaresFour, sizedIcon } from '$components/icons/phosphor';
1+
import {
2+
Box,
3+
toRem,
4+
Text,
5+
color,
6+
config,
7+
Menu,
8+
Icon,
9+
Icons,
10+
Line,
11+
MenuItem,
12+
OverlayBackdrop,
13+
Overlay,
14+
OverlayCenter,
15+
} from 'folds';
16+
import { SquaresFour, menuIcon, settingsNavIcon, sizedIcon } from '$components/icons/phosphor';
317
import { PageNav, PageNavHeader } from '$components/page';
4-
import { useEffect, useState } from 'react';
18+
import { useEffect, useMemo, useState } from 'react';
519
import { ScreenSize, useScreenSizeContext } from '$hooks/useScreenSize';
620
import { useSetting } from '$state/hooks/settings';
721
import { settingsAtom } from '$state/settings';
@@ -19,8 +33,14 @@ import { getMxIdLocalPart, mxcUrlToHttp } from '$utils/matrix';
1933
import { useMediaAuthentication } from '$hooks/useMediaAuthentication';
2034
import { useUserPresence } from '$hooks/useUserPresence';
2135
import { useUserProfile } from '$hooks/useUserProfile';
22-
import { useOpenSettings } from '$features/settings';
36+
import type { SettingsMenuItem } from '$features/settings';
37+
import { settingsMenuIcons, settingsSections, useOpenSettings } from '$features/settings';
2338
import { UserQuickTools } from '../sidebar/UserQuickTools';
39+
import { SignOutIcon } from '@phosphor-icons/react';
40+
import { UseStateProvider } from '$components/UseStateProvider';
41+
import { FocusTrap } from 'focus-trap-react';
42+
import { LogoutDialog } from '$components/LogoutDialog';
43+
import { stopPropagation } from '$utils/keyboard';
2444

2545
export function ProfileMobile() {
2646
const mx = useMatrixClient();
@@ -31,6 +51,7 @@ export function ProfileMobile() {
3151
const userId = mx.getUserId() ?? '';
3252
const profile = useUserProfile(userId);
3353
const presence = useUserPresence(userId);
54+
const [isSettingsOpen, setIsSettingsOpen] = useState(true);
3455

3556
const displayName = profile.displayName ?? getMxIdLocalPart(userId) ?? userId;
3657
const heroAvatarUrl = profile.avatarUrl
@@ -54,6 +75,18 @@ export function ProfileMobile() {
5475
const isMobile = screenSize === ScreenSize.Mobile;
5576
const hideText = curWidth <= 80 && !isMobile;
5677

78+
const [showPersona] = useSetting(settingsAtom, 'showPersonaSetting');
79+
const menuItems = useMemo<SettingsMenuItem[]>(
80+
() =>
81+
settingsSections
82+
.filter((section) => showPersona || section.id !== 'persona')
83+
.map((section) => {
84+
const icon = settingsMenuIcons[section.id];
85+
return { id: section.id, name: section.label, ...icon };
86+
}),
87+
[showPersona]
88+
);
89+
5790
return (
5891
<>
5992
{!isMobile && (
@@ -99,9 +132,18 @@ export function ProfileMobile() {
99132
direction="Column"
100133
gap="0"
101134
alignItems="Center"
135+
justifyContent="SpaceBetween"
102136
style={{ width: '100%', minWidth: '100%' }}
103137
>
104-
<Menu style={{ minWidth: '100%', overflowY: 'scroll' }}>
138+
<Menu
139+
style={{
140+
minWidth: '100%',
141+
minHeight: '100%',
142+
overflowY: 'scroll',
143+
border: 'none',
144+
background: color.Background.Container,
145+
}}
146+
>
105147
<UserHero
106148
userId={userId}
107149
avatarUrl={heroAvatarUrl}
@@ -119,7 +161,10 @@ export function ProfileMobile() {
119161
<UnverifiedMenuOption />
120162
</Box>
121163
<Line variant="Surface" size="300" />
122-
<PresenceMenuOption initialOpen isMobile />
164+
165+
<Box direction="Column" gap="100" style={{ padding: config.space.S100 }}>
166+
<PresenceMenuOption isMobile />
167+
</Box>
123168
<AccountMenuOption isMobile />
124169

125170
<Line variant="Surface" size="300" />
@@ -128,13 +173,73 @@ export function ProfileMobile() {
128173
<MenuItem
129174
size="300"
130175
radii="300"
176+
variant="Background"
131177
before={<Icon size="100" src={Icons.Setting} />}
132-
onClick={() => openSettings()}
178+
after={
179+
<Icon
180+
size="100"
181+
src={isSettingsOpen && isMobile ? Icons.ChevronBottom : Icons.ChevronRight}
182+
/>
183+
}
184+
onClick={() => setIsSettingsOpen(!isSettingsOpen)}
133185
>
134186
<Text style={{ flexGrow: 1 }} size="T300">
135187
Settings
136188
</Text>
137189
</MenuItem>
190+
{isSettingsOpen && (
191+
<div style={{ paddingLeft: config.space.S100 }}>
192+
{menuItems.map((item) => {
193+
const IconComponent = item.icon;
194+
195+
return (
196+
<MenuItem
197+
key={item.id}
198+
radii="400"
199+
size="300"
200+
variant="Background"
201+
before={settingsNavIcon(IconComponent, false)}
202+
onClick={() => openSettings(item.id)}
203+
>
204+
<Text size="T300" truncate>
205+
{item.name}
206+
</Text>
207+
</MenuItem>
208+
);
209+
})}
210+
211+
<UseStateProvider initial={false}>
212+
{(logout, setLogout) => (
213+
<>
214+
<MenuItem
215+
size="300"
216+
variant="Background"
217+
style={{ color: color.Critical.OnContainer }}
218+
before={menuIcon(SignOutIcon)}
219+
onClick={() => setLogout(true)}
220+
>
221+
<Text size="B400">Logout</Text>
222+
</MenuItem>
223+
{logout && (
224+
<Overlay open backdrop={<OverlayBackdrop />}>
225+
<OverlayCenter>
226+
<FocusTrap
227+
focusTrapOptions={{
228+
onDeactivate: () => setLogout(false),
229+
clickOutsideDeactivates: true,
230+
escapeDeactivates: stopPropagation,
231+
}}
232+
>
233+
<LogoutDialog handleClose={() => setLogout(false)} />
234+
</FocusTrap>
235+
</OverlayCenter>
236+
</Overlay>
237+
)}
238+
</>
239+
)}
240+
</UseStateProvider>
241+
</div>
242+
)}
138243
</Box>
139244
</Menu>
140245
</Box>

src/app/pages/client/sidebar/InboxTab.tsx

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
import { ScreenSize, useScreenSizeContext } from '$hooks/useScreenSize';
2222
import { useNavToActivePathAtom } from '$state/hooks/navToActivePath';
2323
import { useInviteCount } from '$hooks/useInviteCount';
24-
import { Text, Box } from 'folds';
24+
import { Text, Box, color } from 'folds';
2525
import { searchModalAtom } from '$state/searchModal';
2626
import { EnvelopeSimple, getPhosphorIconSize, Tray } from '$components/icons/phosphor';
2727
import { BookmarkIcon, ChatCircleDotsIcon } from '@phosphor-icons/react';
@@ -56,7 +56,7 @@ export function InboxTab({ isBottom, isMobile }: { isBottom?: boolean; isMobile?
5656
};
5757

5858
return (
59-
<SidebarItem active={opened} isBottom={isBottom}>
59+
<SidebarItem active={opened && !isMobile} isBottom={isBottom}>
6060
<SidebarItemTooltip tooltip="Inbox" position={isBottom ? 'Top' : 'Right'}>
6161
{(triggerRef) => (
6262
<Box direction="Column" alignItems="Center">
@@ -68,15 +68,35 @@ export function InboxTab({ isBottom, isMobile }: { isBottom?: boolean; isMobile?
6868
size={'400'}
6969
>
7070
{(notificationsSelected && (
71-
<ChatCircleDotsIcon size={InboxIconSize} weight="fill" />
71+
<ChatCircleDotsIcon
72+
size={InboxIconSize}
73+
weight="fill"
74+
color={opened && isMobile ? color.Primary.Main : color.Background.OnContainer}
75+
/>
7276
)) ||
73-
(bookmarksSelected && <BookmarkIcon size={InboxIconSize} weight="fill" />) ||
74-
(invitesSelected && <EnvelopeSimple size={InboxIconSize} weight="fill" />) || (
75-
<Tray size={InboxIconSize} weight={inboxSelected ? 'fill' : 'regular'} />
77+
(bookmarksSelected && (
78+
<BookmarkIcon
79+
size={InboxIconSize}
80+
weight="fill"
81+
color={opened && isMobile ? color.Primary.Main : color.Background.OnContainer}
82+
/>
83+
)) ||
84+
(invitesSelected && (
85+
<EnvelopeSimple
86+
size={InboxIconSize}
87+
weight="fill"
88+
color={opened && isMobile ? color.Primary.Main : color.Background.OnContainer}
89+
/>
90+
)) || (
91+
<Tray
92+
size={InboxIconSize}
93+
weight={inboxSelected ? 'fill' : 'regular'}
94+
color={opened && isMobile ? color.Primary.Main : color.Background.OnContainer}
95+
/>
7696
)}
7797
</SidebarAvatar>
7898
{isMobile && (
79-
<Text size="O400" priority="300">
99+
<Text size="B300" priority="300">
80100
Inbox
81101
</Text>
82102
)}

src/app/pages/client/sidebar/MessageTab.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export function MessageTab({ isBottom, isMobile }: { isBottom?: boolean; isMobil
6363
: undefined;
6464

6565
return (
66-
<SidebarItem active={opened} isBottom={isBottom}>
66+
<SidebarItem active={opened && !isMobile} isBottom={isBottom}>
6767
<SidebarItemTooltip tooltip="Messages" position={isBottom ? 'Top' : 'Right'}>
6868
{(triggerRef) => (
6969
<Box direction="Column" alignItems="Center">
@@ -96,7 +96,7 @@ export function MessageTab({ isBottom, isMobile }: { isBottom?: boolean; isMobil
9696
</Box>
9797
)}
9898
{isMobile && (
99-
<Text size="O400" priority="300">
99+
<Text size="B300" priority="300">
100100
Messages
101101
</Text>
102102
)}

src/app/pages/client/sidebar/NavigateTab.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function NavigateTab({ isBottom, isMobile }: { isBottom?: boolean; isMobi
1919
};
2020

2121
return (
22-
<SidebarItem active={opened} isBottom={isBottom}>
22+
<SidebarItem active={opened && !isMobile} isBottom={isBottom}>
2323
<SidebarItemTooltip tooltip="Search" position={isBottom ? 'Top' : 'Right'}>
2424
{(triggerRef) => (
2525
<Box direction="Column" alignItems="Center">
@@ -37,7 +37,7 @@ export function NavigateTab({ isBottom, isMobile }: { isBottom?: boolean; isMobi
3737
/>
3838
</SidebarAvatar>
3939
{isMobile && (
40-
<Text size="O400" priority="300">
40+
<Text size="B300" priority="300">
4141
Navigate
4242
</Text>
4343
)}

0 commit comments

Comments
 (0)