π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Restore Space header avatar and profile settings navigation
Anand Baburajan6801000c8ff6
diff --git a/web/apps/space/src/components/HomeHeader.tsx b/web/apps/space/src/components/HomeHeader.tsxindex a514e6ea89..4c5813f209 100644--- a/web/apps/space/src/components/HomeHeader.tsx+++ b/web/apps/space/src/components/HomeHeader.tsx@@ -1,7 +1,10 @@-import { BubbleChatIcon, Menu01Icon } from "@hugeicons/core-free-icons";+import { BubbleChatIcon } from "@hugeicons/core-free-icons";import { HugeiconsIcon } from "@hugeicons/react";-import { alpha, Box } from "@mui/material";+import { alpha, Box, Skeleton } from "@mui/material";+import { SpaceAvatarImage } from "components/AvatarImage";import React from "react";+import type { SetupProfile } from "screens/SetupProfileScreen";+import { useSpaceAppState } from "state/app-state";import {spaceAppBackgroundColor,spaceSurface,@@ -12,23 +15,31 @@ import { spaceTouchTargetSize } from "styles/touch-targets";const green = "#08C225";const dangerColor = "#F63A3A";const headerActionSize = spaceTouchTargetSize;+const headerAvatarImageSize = 28;const headerChatCircleSize = 36;const headerIconSize = 25;const headerSideWidth = 36;+const avatarFadeSx = {+ "@keyframes spaceAvatarFade": { from: { opacity: 0 }, to: { opacity: 1 } },+ animation: "spaceAvatarFade 320ms cubic-bezier(0.22, 1, 0.36, 1) both",+ "@media (prefers-reduced-motion: reduce)": { animation: "none" },+} as const;export const spaceHomeHeaderHeight = 64;interface SpaceHomeHeaderProps {children?: React.ReactNode;onOpenMessages?: () => void;- onOpenSettings?: () => void;+ onOpenProfile?: () => void;+ profile: SetupProfile | null;showUnreadIndicator?: boolean;}export const SpaceHomeHeader: React.FC<SpaceHomeHeaderProps> = ({children,onOpenMessages,- onOpenSettings,+ onOpenProfile,+ profile,showUnreadIndicator = false,}) => (<Box@@ -85,8 +96,8 @@ export const SpaceHomeHeader: React.FC<SpaceHomeHeaderProps> = ({<Boxcomponent="button"type="button"- aria-label="Settings"- onClick={onOpenSettings}+ aria-label="Open profile"+ onClick={onOpenProfile}sx={{appearance: "none",alignItems: "center",@@ -95,7 +106,7 @@ export const SpaceHomeHeader: React.FC<SpaceHomeHeaderProps> = ({borderRadius: "50%",boxSizing: "border-box",color: spaceText,- cursor: onOpenSettings ? "pointer" : "default",+ cursor: onOpenProfile ? "pointer" : "default",display: "flex",height: headerActionSize,justifyContent: "center",@@ -112,11 +123,7 @@ export const SpaceHomeHeader: React.FC<SpaceHomeHeaderProps> = ({},}}>- <HugeiconsIcon- icon={Menu01Icon}- size={headerIconSize}- strokeWidth={2.5}- />+ <SpaceHomeHeaderAvatar profile={profile} /></Box><Boxsx={{@@ -215,3 +222,36 @@ export const SpaceHomeHeader: React.FC<SpaceHomeHeaderProps> = ({</Box></Box>);++const SpaceHomeHeaderAvatar: React.FC<{ profile: SetupProfile | null }> = ({+ profile,+}) => {+ const { cachedProfileAvatarUrl } = useSpaceAppState();+ const avatarUrl = profile ? profile.avatarUrl : cachedProfileAvatarUrl;++ return avatarUrl || (profile && !profile.avatarObjectID) ? (+ <Box+ key={avatarUrl ?? "default-avatar"}+ sx={{+ ...avatarFadeSx,+ borderRadius: "50%",+ filter: avatarUrl ? undefined : "brightness(0.9)",+ height: headerAvatarImageSize,+ overflow: "hidden",+ width: headerAvatarImageSize,+ }}+ >+ <SpaceAvatarImage src={avatarUrl} />+ </Box>+ ) : (+ <Skeleton+ variant="circular"+ sx={{+ bgcolor: spaceSurface,+ height: headerAvatarImageSize,+ transform: "none",+ width: headerAvatarImageSize,+ }}+ />+ );+};diff --git a/web/apps/space/src/pages/app/index.tsx b/web/apps/space/src/pages/app/index.tsxindex f10fdab1b3..7381fc88d2 100644--- a/web/apps/space/src/pages/app/index.tsx+++ b/web/apps/space/src/pages/app/index.tsx@@ -430,7 +430,6 @@ const Page: React.FC = () => {? () => void router.push(spaceRoutes.profile): undefined}- onOpenSettings={() => void router.push(spaceRoutes.settings)}onReplyToPost={profile?.spaceId? (diff --git a/web/apps/space/src/pages/app/profile.tsx b/web/apps/space/src/pages/app/profile.tsxindex e51d3dbd8c..b4ce4e9fd6 100644--- a/web/apps/space/src/pages/app/profile.tsx+++ b/web/apps/space/src/pages/app/profile.tsx@@ -172,6 +172,7 @@ const Page: React.FC = () => {onOpenProfilePhoto={() =>void router.push(spaceRoutes.profilePhoto)}+ onOpenSettings={() => void router.push(spaceRoutes.settings)}onLoadPostImage={loadCurrentSpacePostAssetURL}onSetPostLiked={async (postId, liked) => {await setCurrentPostLiked(actorSpaceId, postId, liked);diff --git a/web/apps/space/src/pages/app/settings.tsx b/web/apps/space/src/pages/app/settings.tsxindex d7bb2c981b..60285b03df 100644--- a/web/apps/space/src/pages/app/settings.tsx+++ b/web/apps/space/src/pages/app/settings.tsx@@ -32,7 +32,7 @@ const Page: React.FC = () => {<><SpacePageMeta themeColor={spaceAppBackgroundColor} /><SettingsScreen- onBack={() => void router.push(spaceRoutes.home)}+ onBack={() => void router.push(spaceRoutes.profile)}onChangeCoverImage={() =>void router.push(spaceRoutes.profileCoverFrom("settings"))}diff --git a/web/apps/space/src/pages/layout-demo.tsx b/web/apps/space/src/pages/layout-demo.tsxindex b5838a4e1d..d64fff66e7 100644--- a/web/apps/space/src/pages/layout-demo.tsx+++ b/web/apps/space/src/pages/layout-demo.tsx@@ -246,9 +246,8 @@ const LayoutDemoPage: React.FC = () => {}}><SpaceHomeHeader- onOpenSettings={() =>- void router.push(spaceRoutes.settings)- }+ profile={demoProfile}+ onOpenProfile={() => void router.push(spaceRoutes.profile)}/><Boxsx={{diff --git a/web/apps/space/src/screens/HomeScreen.tsx b/web/apps/space/src/screens/HomeScreen.tsxindex b35bf74707..52b23f9e31 100644--- a/web/apps/space/src/screens/HomeScreen.tsx+++ b/web/apps/space/src/screens/HomeScreen.tsx@@ -111,7 +111,6 @@ interface HomeScreenProps {onMessageFriend: (friend: FriendProfile) => void;onPokeFriend: (friend: FriendProfile) => Promise<void>;onOpenProfile?: () => void;- onOpenSettings?: () => void;onReplyToPost?: (postSpaceId: string,postId: number,@@ -1017,7 +1016,6 @@ export const HomeScreen: React.FC<HomeScreenProps> = ({onMessageFriend,onPokeFriend,onOpenProfile,- onOpenSettings,onReplyToPost,onSetPostLiked,profile,@@ -1742,9 +1740,10 @@ export const HomeScreen: React.FC<HomeScreenProps> = ({}}><SpaceHomeHeader+ profile={profile}showUnreadIndicator={showUnreadIndicator}onOpenMessages={onOpenMessages}- onOpenSettings={onOpenSettings}+ onOpenProfile={onOpenProfile}><Boxref={postInputRef}diff --git a/web/apps/space/src/screens/ProfileScreen.tsx b/web/apps/space/src/screens/ProfileScreen.tsxindex 6afe0ce075..4268b9db77 100644--- a/web/apps/space/src/screens/ProfileScreen.tsx+++ b/web/apps/space/src/screens/ProfileScreen.tsx@@ -2,6 +2,7 @@ import {AddSquareIcon,ArrowLeft02Icon,BubbleChatIcon,+ Menu01Icon,MoreHorizontalIcon,Tick02Icon,UserRemove01Icon,@@ -542,6 +543,7 @@ interface ProfileScreenProps {onOpenPost?: (post: ProfilePostItem) => void;onOpenProfileCover?: () => void;onOpenProfilePhoto?: () => void;+ onOpenSettings?: () => void;onLoadPostImage?: (asset: SpacePostAsset) => Promise<string>;onMessageFriend?: () => void;onReplyToPost?: (@@ -579,6 +581,7 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({onOpenPost,onOpenProfileCover,onOpenProfilePhoto,+ onOpenSettings,onLoadPostImage,onMessageFriend,onReplyToPost,@@ -1375,7 +1378,39 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({>{firstName}</Box>- {!isOwnerProfile && onMessageFriend ? (+ {isOwnerProfile ? (+ <Box+ component="button"+ type="button"+ aria-label="Settings"+ onClick={onOpenSettings}+ sx={{+ alignItems: "center",+ bgcolor: "transparent",+ border: 0,+ color: "inherit",+ cursor: onOpenSettings+ ? "pointer"+ : "default",+ display: "flex",+ height: spaceTouchTargetSize,+ justifyContent: "flex-end",+ p: 0,+ width: spaceTouchTargetSize,+ "&:focus-visible": {+ borderRadius: "50%",+ outline: `2px solid ${green}`,+ outlineOffset: 2,+ },+ }}+ >+ <HugeiconsIcon+ icon={Menu01Icon}+ size={20}+ strokeWidth={2.4}+ />+ </Box>+ ) : onMessageFriend ? (<Boxcomponent="button"type="button"diff --git a/web/apps/space/src/screens/SettingsScreen.tsx b/web/apps/space/src/screens/SettingsScreen.tsxindex 5b6d7a7e0a..06af17c37e 100644--- a/web/apps/space/src/screens/SettingsScreen.tsx+++ b/web/apps/space/src/screens/SettingsScreen.tsx@@ -443,7 +443,7 @@ export const SettingsScreen: React.FC<SettingsScreenProps> = ({<Boxcomponent="button"type="button"- aria-label="Back to home"+ aria-label="Back to profile"onClick={onBack}sx={{alignItems: "center",