Skip to content

Commit 90d5ab2

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

7 files changed

Lines changed: 182 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: 113 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
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+
Button,
13+
OverlayBackdrop,
14+
Overlay,
15+
OverlayCenter,
16+
} from 'folds';
17+
import { SquaresFour, menuIcon, settingsNavIcon, sizedIcon } from '$components/icons/phosphor';
318
import { PageNav, PageNavHeader } from '$components/page';
4-
import { useEffect, useState } from 'react';
19+
import { useEffect, useMemo, useState } from 'react';
520
import { ScreenSize, useScreenSizeContext } from '$hooks/useScreenSize';
621
import { useSetting } from '$state/hooks/settings';
722
import { settingsAtom } from '$state/settings';
@@ -19,8 +34,14 @@ import { getMxIdLocalPart, mxcUrlToHttp } from '$utils/matrix';
1934
import { useMediaAuthentication } from '$hooks/useMediaAuthentication';
2035
import { useUserPresence } from '$hooks/useUserPresence';
2136
import { useUserProfile } from '$hooks/useUserProfile';
22-
import { useOpenSettings } from '$features/settings';
37+
import type { SettingsMenuItem } from '$features/settings';
38+
import { settingsMenuIcons, settingsSections, useOpenSettings } from '$features/settings';
2339
import { UserQuickTools } from '../sidebar/UserQuickTools';
40+
import { SignOutIcon } from '@phosphor-icons/react';
41+
import { UseStateProvider } from '$components/UseStateProvider';
42+
import { FocusTrap } from 'focus-trap-react';
43+
import { LogoutDialog } from '$components/LogoutDialog';
44+
import { stopPropagation } from '$utils/keyboard';
2445

2546
export function ProfileMobile() {
2647
const mx = useMatrixClient();
@@ -31,6 +52,7 @@ export function ProfileMobile() {
3152
const userId = mx.getUserId() ?? '';
3253
const profile = useUserProfile(userId);
3354
const presence = useUserPresence(userId);
55+
const [isSettingsOpen, setIsSettingsOpen] = useState(true);
3456

3557
const displayName = profile.displayName ?? getMxIdLocalPart(userId) ?? userId;
3658
const heroAvatarUrl = profile.avatarUrl
@@ -54,6 +76,18 @@ export function ProfileMobile() {
5476
const isMobile = screenSize === ScreenSize.Mobile;
5577
const hideText = curWidth <= 80 && !isMobile;
5678

79+
const [showPersona] = useSetting(settingsAtom, 'showPersonaSetting');
80+
const menuItems = useMemo<SettingsMenuItem[]>(
81+
() =>
82+
settingsSections
83+
.filter((section) => showPersona || section.id !== 'persona')
84+
.map((section) => {
85+
const icon = settingsMenuIcons[section.id];
86+
return { id: section.id, name: section.label, ...icon };
87+
}),
88+
[showPersona]
89+
);
90+
5791
return (
5892
<>
5993
{!isMobile && (
@@ -99,9 +133,18 @@ export function ProfileMobile() {
99133
direction="Column"
100134
gap="0"
101135
alignItems="Center"
136+
justifyContent="SpaceBetween"
102137
style={{ width: '100%', minWidth: '100%' }}
103138
>
104-
<Menu style={{ minWidth: '100%', overflowY: 'scroll' }}>
139+
<Menu
140+
style={{
141+
minWidth: '100%',
142+
minHeight: '100%',
143+
overflowY: 'scroll',
144+
border: 'none',
145+
background: color.Background.Container,
146+
}}
147+
>
105148
<UserHero
106149
userId={userId}
107150
avatarUrl={heroAvatarUrl}
@@ -119,7 +162,10 @@ export function ProfileMobile() {
119162
<UnverifiedMenuOption />
120163
</Box>
121164
<Line variant="Surface" size="300" />
122-
<PresenceMenuOption initialOpen isMobile />
165+
166+
<Box direction="Column" gap="100" style={{ padding: config.space.S100 }}>
167+
<PresenceMenuOption isMobile />
168+
</Box>
123169
<AccountMenuOption isMobile />
124170

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