π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Add social logout confirmation sheet
Anand Baburajanfc005ce6727b
diff --git a/web/apps/social/src/pages/index.tsx b/web/apps/social/src/pages/index.tsxindex b09273afff..fb475fa138 100644--- a/web/apps/social/src/pages/index.tsx+++ b/web/apps/social/src/pages/index.tsx@@ -264,9 +264,13 @@ const Page: React.FC = () => {)}{screen == "settings" && profile && (<SettingsScreen- email={email}- profile={profile}onBack={() => setScreen("profile")}+ onLogout={() => {+ setProfile(null);+ setSelectedFriendID(null);+ setFriends(sampleFriends);+ setScreen("login");+ }}/>)}</>diff --git a/web/apps/social/src/screens/SettingsScreen.tsx b/web/apps/social/src/screens/SettingsScreen.tsxindex e9a9d1bed2..c8b955dc94 100644--- a/web/apps/social/src/screens/SettingsScreen.tsx+++ b/web/apps/social/src/screens/SettingsScreen.tsx@@ -6,29 +6,27 @@ import {Logout05Icon,} from "@hugeicons/core-free-icons";import { HugeiconsIcon, type IconSvgElement } from "@hugeicons/react";-import { Box } from "@mui/material";+import { Box, Dialog } from "@mui/material";import React from "react";-import type { SetupProfile } from "screens/SetupProfileScreen";export const settingsBackground = "#FAFAFA";const green = "#08C225";const textBase = "#000";-const textMuted = "rgba(0, 0, 0, 0.6)";const rowBackground = "#FFFFFF";const dangerColor = "#F63A3A";const iconMuted = "#8C8C8C";interface SettingsScreenProps {- email: string;+ onLogout: () => void;onBack?: () => void;- profile: SetupProfile;}interface SettingsRowProps {danger?: boolean;icon: IconSvgElement;label: string;+ onClick?: () => void;}interface SocialIconProps {@@ -36,10 +34,16 @@ interface SocialIconProps {src: string;}-const SettingsRow: React.FC<SettingsRowProps> = ({ danger, icon, label }) => (+const SettingsRow: React.FC<SettingsRowProps> = ({+ danger,+ icon,+ label,+ onClick,+}) => (<Boxcomponent="button"type="button"+ onClick={onClick}sx={{alignItems: "center",bgcolor: rowBackground,@@ -65,7 +69,7 @@ const SettingsRow: React.FC<SettingsRowProps> = ({ danger, icon, label }) => (sx={{alignItems: "center",display: "flex",- gap: "8px",+ gap: "4px",minWidth: 0,}}>@@ -81,7 +85,7 @@ const SettingsRow: React.FC<SettingsRowProps> = ({ danger, icon, label }) => (width: 40,}}>- <HugeiconsIcon icon={icon} size={24} strokeWidth={1.6} />+ <HugeiconsIcon icon={icon} size={20} strokeWidth={1.6} /></Box><Boxsx={{@@ -109,6 +113,129 @@ const SettingsRow: React.FC<SettingsRowProps> = ({ danger, icon, label }) => (</Box>);+interface LogoutConfirmationSheetProps {+ open: boolean;+ onCancel: () => void;+ onConfirm: () => void;+}++const LogoutConfirmationSheet: React.FC<LogoutConfirmationSheetProps> = ({+ open,+ onCancel,+ onConfirm,+}) => (+ <Dialog+ open={open}+ onClose={onCancel}+ maxWidth={false}+ aria-labelledby="logout-confirmation-title"+ slotProps={{+ backdrop: { sx: { backgroundColor: "rgba(0, 0, 0, 0.48)" } },+ paper: {+ sx: {+ bgcolor: settingsBackground,+ borderRadius: "20px 20px 0 0",+ bottom: 0,+ boxShadow: "none",+ boxSizing: "border-box",+ left: "50%",+ m: 0,+ p: "26px 20px 24px",+ position: "fixed",+ transform: "translateX(-50%)",+ width: "calc(100vw - 12px)",+ maxWidth: 363,+ },+ },+ }}+ >+ <Box+ component="h2"+ id="logout-confirmation-title"+ sx={{+ color: textBase,+ fontFamily: '"Inter Variable", Inter, sans-serif',+ fontSize: 15,+ fontWeight: 600,+ lineHeight: "20px",+ m: 0,+ px: "20px",+ textAlign: "center",+ }}+ >+ Are you sure you want to logout?+ </Box>+ <Box+ sx={{+ display: "flex",+ flexDirection: "column",+ gap: "12px",+ mt: "28px",+ }}+ >+ <SheetButton+ label="Yes, logout"+ backgroundColor={dangerColor}+ color="#FFFFFF"+ onClick={onConfirm}+ />+ <SheetButton+ label="Cancel"+ backgroundColor="#F2F2F2"+ color="#666666"+ onClick={onCancel}+ />+ </Box>+ </Dialog>+);++interface SheetButtonProps {+ backgroundColor: string;+ color: string;+ label: string;+ onClick: () => void;+}++const SheetButton: React.FC<SheetButtonProps> = ({+ backgroundColor,+ color,+ label,+ onClick,+}) => (+ <Box+ component="button"+ type="button"+ onClick={onClick}+ sx={{+ alignItems: "center",+ bgcolor: backgroundColor,+ border: 0,+ borderRadius: "20px",+ color,+ cursor: "pointer",+ display: "flex",+ fontFamily: '"Inter Variable", Inter, sans-serif',+ fontSize: 14,+ fontWeight: 600,+ height: 48,+ justifyContent: "center",+ lineHeight: "20px",+ px: "24px",+ py: "14px",+ transition: "filter 120ms ease, opacity 120ms ease",+ width: "100%",+ "&:active": { filter: "brightness(0.96)" },+ "&:focus-visible": {+ outline: `2px solid ${green}`,+ outlineOffset: 2,+ },+ "&:hover": { filter: "brightness(0.98)" },+ }}+ >+ {label}+ </Box>+);+const SocialIcon: React.FC<SocialIconProps> = ({ label, src }) => (<Boxaria-label={label}@@ -145,11 +272,15 @@ const SocialIcon: React.FC<SocialIconProps> = ({ label, src }) => ();export const SettingsScreen: React.FC<SettingsScreenProps> = ({- email,+ onLogout,onBack,- profile,}) => {- const accountLabel = email.trim() || `${profile.username}@ente.io`;+ const [logoutSheetOpen, setLogoutSheetOpen] = React.useState(false);++ const handleConfirmLogout = () => {+ setLogoutSheetOpen(false);+ onLogout();+ };return (<Box@@ -231,37 +362,25 @@ export const SettingsScreen: React.FC<SettingsScreenProps> = ({</Box></Box>- <Box- sx={{- color: textMuted,- fontFamily: '"Inter Variable", Inter, sans-serif',- fontSize: 16,- fontWeight: 600,- lineHeight: "20px",- mt: "29px",- overflow: "hidden",- px: "22px",- textOverflow: "ellipsis",- whiteSpace: "nowrap",- }}- >- {accountLabel}- </Box>-<Boxcomponent="section"sx={{display: "flex",flexDirection: "column",gap: "8px",- mt: "16px",+ mt: "24px",px: "14px",width: "100%",}}><SettingsRow icon={HelpCircleIcon} label="Help" /><SettingsRow icon={CustomerSupportIcon} label="Support" />- <SettingsRow danger icon={Logout05Icon} label="Logout" />+ <SettingsRow+ danger+ icon={Logout05Icon}+ label="Logout"+ onClick={() => setLogoutSheetOpen(true)}+ /></Box><Box sx={{ flex: 1, minHeight: 72 }} />@@ -283,6 +402,11 @@ export const SettingsScreen: React.FC<SettingsScreenProps> = ({<SocialIcon label="Reddit" src="/images/reddit.svg" /></Box></Box>+ <LogoutConfirmationSheet+ open={logoutSheetOpen}+ onCancel={() => setLogoutSheetOpen(false)}+ onConfirm={handleConfirmLogout}+ /></Box>);};