π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Open friend profiles from friends list
Anand Baburajan656969f1b4e1
diff --git a/web/apps/social/src/data/friends.ts b/web/apps/social/src/data/friends.tsindex 4655b15212..4dd1eb4638 100644--- a/web/apps/social/src/data/friends.ts+++ b/web/apps/social/src/data/friends.ts@@ -1,5 +1,6 @@export interface FriendProfile {avatarUrl: string;+ friendsCount: number;fullName: string;id: string;username: string;@@ -8,42 +9,49 @@ export interface FriendProfile {export const sampleFriends: FriendProfile[] = [{avatarUrl: "/images/sample-feed-4.jpg",+ friendsCount: 12,fullName: "Aparna Bhatnagar",id: "aparna-bhatnagar",username: "aparnab",},{avatarUrl: "/images/sample-feed-3.jpg",+ friendsCount: 18,fullName: "Mira Sen",id: "mira-sen",username: "mirasen",},{avatarUrl: "/images/sample-feed-5.jpg",+ friendsCount: 9,fullName: "Nikhil Rao",id: "nikhil-rao",username: "nikhilrao",},{avatarUrl: "/images/sample-feed-6.jpg",+ friendsCount: 24,fullName: "Riya Kapoor",id: "riya-kapoor",username: "riyakapoor",},{avatarUrl: "/images/sample-feed-1.jpg",+ friendsCount: 15,fullName: "Dev Shah",id: "dev-shah",username: "devshah",},{avatarUrl: "/images/sample-feed-2.jpg",+ friendsCount: 7,fullName: "Isha Mehta",id: "isha-mehta",username: "ishamehta",},{avatarUrl: "/images/sample-avatar.jpg",+ friendsCount: 21,fullName: "Kabir Menon",id: "kabir-menon",username: "kabirmenon",diff --git a/web/apps/social/src/pages/index.tsx b/web/apps/social/src/pages/index.tsxindex c643c48799..79856be085 100644--- a/web/apps/social/src/pages/index.tsx+++ b/web/apps/social/src/pages/index.tsx@@ -41,6 +41,7 @@ type Screen =| "home"| "profile"| "friends"+ | "friend-profile"| "settings";type ProfileBackScreen = "login" | "verify-email";@@ -88,6 +89,9 @@ const Page: React.FC = () => {const [profile, setProfile] = useState<SetupProfile | null>(null);const [profileBackScreen, setProfileBackScreen] =useState<ProfileBackScreen>("verify-email");+ const [selectedFriendID, setSelectedFriendID] = useState<string | null>(+ null,+ );const openSetupProfile = (backScreen: ProfileBackScreen) => {setProfileBackScreen(backScreen);@@ -103,6 +107,10 @@ const Page: React.FC = () => {);}, []);+ const selectedFriend = selectedFriendID+ ? friends.find((friend) => friend.id == selectedFriendID)+ : undefined;+const themeColor =routeMode.kind != "app"? profileBackground@@ -120,7 +128,7 @@ const Page: React.FC = () => {? homeBackground: screen == "profile"? profileBackground- : screen == "friends"+ : screen == "friends" || screen == "friend-profile"? friendsBackground: screen == "settings"? settingsBackground@@ -214,6 +222,10 @@ const Page: React.FC = () => {<FriendsScreenfriends={friends}onBack={() => setScreen("profile")}+ onOpenFriend={(friendID) => {+ setSelectedFriendID(friendID);+ setScreen("friend-profile");+ }}onUnfriend={(friendID) =>setFriends((currentFriends) =>currentFriends.filter(@@ -223,6 +235,18 @@ const Page: React.FC = () => {}/>)}+ {screen == "friend-profile" && selectedFriend && (+ <ProfileScreen+ friendsCount={selectedFriend.friendsCount}+ headerVariant="friend"+ profile={{+ avatarUrl: selectedFriend.avatarUrl,+ fullName: selectedFriend.fullName,+ username: selectedFriend.username,+ }}+ onBack={() => setScreen("friends")}+ />+ )}{screen == "settings" && profile && (<SettingsScreenemail={email}diff --git a/web/apps/social/src/screens/FriendsScreen.tsx b/web/apps/social/src/screens/FriendsScreen.tsxindex d23f817fc4..eb6ef94fde 100644--- a/web/apps/social/src/screens/FriendsScreen.tsx+++ b/web/apps/social/src/screens/FriendsScreen.tsx@@ -20,11 +20,13 @@ const dangerColor = "#F63A3A";interface FriendsScreenProps {friends: FriendProfile[];onBack?: () => void;+ onOpenFriend?: (friendID: string) => void;onUnfriend?: (friendID: string) => void;}interface FriendRowProps {friend: FriendProfile;+ onOpenFriend?: (friendID: string) => void;onUnfriend?: (friendID: string) => void;}@@ -36,7 +38,11 @@ const initialsFor = (name: string) =>.map((part) => part[0]?.toUpperCase()).join("");-const FriendRow: React.FC<FriendRowProps> = ({ friend, onUnfriend }) => {+const FriendRow: React.FC<FriendRowProps> = ({+ friend,+ onOpenFriend,+ onUnfriend,+}) => {const [actionsAnchor, setActionsAnchor] = useState<HTMLElement | null>(null,);@@ -59,7 +65,7 @@ const FriendRow: React.FC<FriendRowProps> = ({ friend, onUnfriend }) => {sx={{alignItems: "center",display: "grid",- gridTemplateColumns: "48px minmax(0, 1fr) 32px",+ gridTemplateColumns: "minmax(0, 1fr) 32px",gap: "12px",listStyle: "none",minHeight: 72,@@ -69,81 +75,106 @@ const FriendRow: React.FC<FriendRowProps> = ({ friend, onUnfriend }) => {}}><Box+ component="button"+ type="button"+ onClick={() => onOpenFriend?.(friend.id)}sx={{alignItems: "center",- bgcolor: friend.avatarUrl ? "transparent" : paleGreen,- borderRadius: "50%",- color: green,- display: "flex",- height: 48,- justifyContent: "center",- overflow: "hidden",- width: 48,- }}- >- {friend.avatarUrl ? (- <Box- component="img"- alt=""- src={friend.avatarUrl}- sx={{- display: "block",- height: "100%",- objectFit: "cover",- objectPosition: "center",- width: "100%",- }}- />- ) : (- <Box- sx={{- fontFamily: '"Inter Variable", Inter, sans-serif',- fontSize: 15,- fontWeight: 800,- lineHeight: 1,- }}- >- {initials}- </Box>- )}- </Box>- <Box- sx={{- display: "flex",- flexDirection: "column",- justifyContent: "center",+ bgcolor: "transparent",+ border: 0,+ borderRadius: "12px",+ cursor: onOpenFriend ? "pointer" : "default",+ display: "grid",+ gap: "12px",+ gridTemplateColumns: "48px minmax(0, 1fr)",minWidth: 0,+ p: 0,+ textAlign: "left",+ width: "100%",+ "&:focus-visible": {+ outline: `2px solid ${green}`,+ outlineOffset: 2,+ },}}><Boxsx={{- color: textStrong,- fontFamily: '"Inter Variable", Inter, sans-serif',- fontSize: 15,- fontWeight: 700,- lineHeight: "20px",- minWidth: 0,+ alignItems: "center",+ bgcolor: friend.avatarUrl ? "transparent" : paleGreen,+ borderRadius: "50%",+ color: green,+ display: "flex",+ height: 48,+ justifyContent: "center",overflow: "hidden",- textOverflow: "ellipsis",- whiteSpace: "nowrap",+ width: 48,}}>- {displayName}+ {friend.avatarUrl ? (+ <Box+ component="img"+ alt=""+ src={friend.avatarUrl}+ sx={{+ display: "block",+ height: "100%",+ objectFit: "cover",+ objectPosition: "center",+ width: "100%",+ }}+ />+ ) : (+ <Box+ sx={{+ fontFamily:+ '"Inter Variable", Inter, sans-serif',+ fontSize: 15,+ fontWeight: 800,+ lineHeight: 1,+ }}+ >+ {initials}+ </Box>+ )}</Box><Boxsx={{- color: textSoft,- fontFamily: '"Inter Variable", Inter, sans-serif',- fontSize: 13,- fontWeight: 600,- lineHeight: "18px",+ display: "flex",+ flexDirection: "column",+ justifyContent: "center",minWidth: 0,- overflow: "hidden",- textOverflow: "ellipsis",- whiteSpace: "nowrap",}}>- @{friend.username}+ <Box+ sx={{+ color: textStrong,+ fontFamily: '"Inter Variable", Inter, sans-serif',+ fontSize: 15,+ fontWeight: 700,+ lineHeight: "20px",+ minWidth: 0,+ overflow: "hidden",+ textOverflow: "ellipsis",+ whiteSpace: "nowrap",+ }}+ >+ {displayName}+ </Box>+ <Box+ sx={{+ color: textSoft,+ fontFamily: '"Inter Variable", Inter, sans-serif',+ fontSize: 13,+ fontWeight: 600,+ lineHeight: "18px",+ minWidth: 0,+ overflow: "hidden",+ textOverflow: "ellipsis",+ whiteSpace: "nowrap",+ }}+ >+ @{friend.username}+ </Box></Box></Box><Box@@ -244,6 +275,7 @@ const FriendRow: React.FC<FriendRowProps> = ({ friend, onUnfriend }) => {export const FriendsScreen: React.FC<FriendsScreenProps> = ({friends,onBack,+ onOpenFriend,onUnfriend,}) => (<Box@@ -340,6 +372,7 @@ export const FriendsScreen: React.FC<FriendsScreenProps> = ({<FriendRowkey={friend.id}friend={friend}+ onOpenFriend={onOpenFriend}onUnfriend={onUnfriend}/>))}diff --git a/web/apps/social/src/screens/ProfileScreen.tsx b/web/apps/social/src/screens/ProfileScreen.tsxindex 62d78ba2db..cc7ee431c9 100644--- a/web/apps/social/src/screens/ProfileScreen.tsx+++ b/web/apps/social/src/screens/ProfileScreen.tsx@@ -137,7 +137,7 @@ const buildPostMasonryRows = (items: SamplePostItem[]): PostMasonryRow[] => {interface ProfileScreenProps {friendsCount?: number;- headerVariant?: "owner" | "public";+ headerVariant?: "friend" | "owner" | "public";onBack?: () => void;onOpenFriends?: () => void;onOpenSettings?: () => void;@@ -155,6 +155,8 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({const [profileActionsAnchor, setProfileActionsAnchor] =useState<HTMLElement | null>(null);const isPublicProfile = headerVariant == "public";+ const isOwnerProfile = headerVariant == "owner";+ const isFriendProfile = headerVariant == "friend";const displayName = profile.fullName.trim() || profile.username.trim();const profileLink = profileLinkForUsername(profile.username.trim());const initialsSource = displayName || profile.username.trim();@@ -168,6 +170,7 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({0,);const isProfileActionsOpen = Boolean(profileActionsAnchor);+ const canOpenFriends = isOwnerProfile && Boolean(onOpenFriends);const closeProfileActions = () => setProfileActionsAnchor(null);@@ -264,7 +267,11 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({<Boxcomponent="button"type="button"- aria-label="Back to home"+ aria-label={+ isFriendProfile+ ? "Back to friends"+ : "Back to home"+ }onClick={onBack}sx={{alignItems: "center",@@ -348,7 +355,7 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({{profile.username}</Box>)}- {!isPublicProfile && (+ {isOwnerProfile ? (<Boxcomponent="button"type="button"@@ -378,6 +385,10 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({strokeWidth={1.8}/></Box>+ ) : (+ !isPublicProfile && (+ <Box aria-hidden sx={{ width: 24 }} />+ ))}</Box><Box@@ -481,7 +492,7 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({>{displayName}</Box>- {!isPublicProfile && (+ {isOwnerProfile && (<Boxcomponent="button"id="profile-actions-button"@@ -532,7 +543,7 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({</Box>)}</Box>- {!isPublicProfile && (+ {isOwnerProfile && (<Menuid="profile-actions-menu"anchorEl={profileActionsAnchor}@@ -691,35 +702,22 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({<Box component="span">posts</Box><Box component="span">Β·</Box><Box- component={- !isPublicProfile && onOpenFriends- ? "button"- : "span"- }- type={- !isPublicProfile && onOpenFriends- ? "button"- : undefined- }+ component={canOpenFriends ? "button" : "span"}+ type={canOpenFriends ? "button" : undefined}aria-label={- !isPublicProfile && onOpenFriends- ? "Open friends"- : undefined+ canOpenFriends ? "Open friends" : undefined}onClick={- !isPublicProfile && onOpenFriends- ? onOpenFriends- : undefined+ canOpenFriends ? onOpenFriends : undefined}sx={{alignItems: "baseline",bgcolor: "transparent",border: 0,color: "inherit",- cursor:- !isPublicProfile && onOpenFriends- ? "pointer"- : "default",+ cursor: canOpenFriends+ ? "pointer"+ : "default",display: "inline-flex",gap: "5px",font: "inherit",