π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Polish social post actions
Anand Baburajana955d54ec501
diff --git a/web/apps/social/src/components/SocialActionFeedback.tsx b/web/apps/social/src/components/SocialActionFeedback.tsxindex af34ca735e..5361f5e2e5 100644--- a/web/apps/social/src/components/SocialActionFeedback.tsx+++ b/web/apps/social/src/components/SocialActionFeedback.tsx@@ -23,74 +23,89 @@ const socialActionSpin = keyframes`interface SocialActionFeedbackIconProps {idleIcon?: React.ReactNode;phase: SocialActionPhase | null;+ size?: number;}export const SocialActionFeedbackIcon: React.FC<SocialActionFeedbackIconProps-> = ({ idleIcon, phase }) => (- <Box- component="span"- sx={{- display: "grid",- height: 18,- lineHeight: 0,- placeItems: "center",- width: 18,- }}- >- {idleIcon && (+> = ({ idleIcon, phase, size = 18 }) => {+ const statusIconSize = size == 18 ? 22 : size;++ return (+ <Box+ component="span"+ sx={{+ display: "grid",+ height: size,+ lineHeight: 0,+ placeItems: "center",+ width: size,+ }}+ >+ {idleIcon && (+ <Box+ component="span"+ sx={{+ display: "flex",+ gridArea: "1 / 1",+ lineHeight: 0,+ opacity: phase == null ? 1 : 0,+ transform: phase == null ? "scale(1)" : "scale(0.82)",+ transition:+ phase == "busy"+ ? "none"+ : `opacity ${socialActionTransition}, transform ${socialActionTransition}`,+ }}+ >+ {idleIcon}+ </Box>+ )}<Boxcomponent="span"sx={{display: "flex",gridArea: "1 / 1",lineHeight: 0,- opacity: phase == null ? 1 : 0,- transform: phase == null ? "scale(1)" : "scale(0.82)",- transition: `opacity ${socialActionTransition}, transform ${socialActionTransition}`,+ opacity: phase == "busy" ? 1 : 0,+ transform: phase == "busy" ? "scale(1)" : "scale(0.82)",+ transition:+ phase == "busy"+ ? "none"+ : `opacity ${socialActionTransition}, transform ${socialActionTransition}`,}}>- {idleIcon}+ <Box+ component="span"+ sx={{+ animation: `${socialActionSpin} 2.4s linear infinite`,+ display: "flex",+ lineHeight: 0,+ }}+ >+ <HugeiconsIcon+ icon={Loading03Icon}+ size={statusIconSize}+ strokeWidth={1.8}+ />+ </Box></Box>- )}- <Box- component="span"- sx={{- display: "flex",- gridArea: "1 / 1",- lineHeight: 0,- opacity: phase == "busy" ? 1 : 0,- transform: phase == "busy" ? "scale(1)" : "scale(0.82)",- transition: `opacity ${socialActionTransition}, transform ${socialActionTransition}`,- }}- ><Boxcomponent="span"sx={{- animation: `${socialActionSpin} 2.4s linear infinite`,display: "flex",+ gridArea: "1 / 1",lineHeight: 0,+ opacity: phase == "done" ? 1 : 0,+ transform: phase == "done" ? "scale(1)" : "scale(0.82)",+ transition: `opacity ${socialActionTransition}, transform ${socialActionTransition}`,}}><HugeiconsIcon- icon={Loading03Icon}- size={22}+ icon={Tick02Icon}+ size={statusIconSize}strokeWidth={1.8}/></Box></Box>- <Box- component="span"- sx={{- display: "flex",- gridArea: "1 / 1",- lineHeight: 0,- opacity: phase == "done" ? 1 : 0,- transform: phase == "done" ? "scale(1)" : "scale(0.82)",- transition: `opacity ${socialActionTransition}, transform ${socialActionTransition}`,- }}- >- <HugeiconsIcon icon={Tick02Icon} size={22} strokeWidth={1.8} />- </Box>- </Box>-);+ );+};diff --git a/web/apps/social/src/screens/CreateAccountScreen.tsx b/web/apps/social/src/screens/CreateAccountScreen.tsxindex 77054ceb78..7cb62b2251 100644--- a/web/apps/social/src/screens/CreateAccountScreen.tsx+++ b/web/apps/social/src/screens/CreateAccountScreen.tsx@@ -361,7 +361,7 @@ export const CreateAccountScreen: React.FC<CreateAccountScreenProps> = ({<BoxclassName={acceptedTerms- ? "green-bg-with-noise-and-curves"+ ? "green-bg": undefined}sx={{@@ -452,7 +452,7 @@ export const CreateAccountScreen: React.FC<CreateAccountScreenProps> = ({<BoxclassName={canCreateAccount- ? "green-bg-with-noise-and-curves"+ ? "green-bg": undefined}component="button"diff --git a/web/apps/social/src/screens/HomeScreen.tsx b/web/apps/social/src/screens/HomeScreen.tsxindex b7e55109b0..c89300ddb2 100644--- a/web/apps/social/src/screens/HomeScreen.tsx+++ b/web/apps/social/src/screens/HomeScreen.tsx@@ -1,3 +1,5 @@+import { AddSquareIcon } from "@hugeicons/core-free-icons";+import { HugeiconsIcon } from "@hugeicons/react";import { Box } from "@mui/material";import {SocialActionFeedbackIcon,@@ -147,6 +149,11 @@ interface HomeScreenProps {profile: SetupProfile;}+interface FeedPhotoDimensions {+ height: number;+ width: number;+}+interface FeedItemProps {aspectRatio: number;avatarUrl: string;@@ -158,23 +165,15 @@ interface FeedItemProps {timestampMs: number;}-const PlusIcon: React.FC = () => (- <Box- component="svg"- viewBox="4 4 16 16"- aria-hidden- sx={{ display: "block", height: 18, width: 18 }}- >- <path- d="M12 5V19M5 12H19"- fill="none"- stroke="currentColor"- strokeLinecap="round"- strokeLinejoin="round"- strokeWidth="1.8"- />- </Box>-);+const dimensionsFromAspectRatio = (+ aspectRatio: number,+): FeedPhotoDimensions => {+ const safeAspectRatio =+ Number.isFinite(aspectRatio) && aspectRatio > 0 ? aspectRatio : 1;+ const height = 1000;++ return { height, width: Math.round(safeAspectRatio * height) };+};const FeedItem: React.FC<FeedItemProps> = ({aspectRatio,@@ -189,6 +188,27 @@ const FeedItem: React.FC<FeedItemProps> = ({const firstName = firstNameFrom(name);const dateLabel = formatSocialDate(timestampMs);const openFriend = () => onOpenFriend?.(friendID);+ const [loadedPhotoDimensions, setLoadedPhotoDimensions] =+ useState<FeedPhotoDimensions | null>(null);+ const photoDimensions =+ loadedPhotoDimensions ?? dimensionsFromAspectRatio(aspectRatio);+ const rememberLoadedPhotoDimensions: React.ReactEventHandler<+ HTMLImageElement+ > = ({ currentTarget }) => {+ const { naturalHeight, naturalWidth } = currentTarget;+ if (!naturalHeight || !naturalWidth) return;++ setLoadedPhotoDimensions((currentDimensions) => {+ if (+ currentDimensions?.height == naturalHeight &&+ currentDimensions.width == naturalWidth+ ) {+ return currentDimensions;+ }++ return { height: naturalHeight, width: naturalWidth };+ });+ };return (<Box@@ -320,14 +340,16 @@ const FeedItem: React.FC<FeedItemProps> = ({alt: `${name} post`,avatarUrl,friendID,+ height: photoDimensions.height,imageUrl,name,timestampMs,+ width: photoDimensions.width,})}sx={{appearance: "none",- aspectRatio,+ aspectRatio: `${photoDimensions.width} / ${photoDimensions.height}`,bgcolor: paleGreen,border: 0,borderRadius: "20px",@@ -347,6 +369,7 @@ const FeedItem: React.FC<FeedItemProps> = ({component="img"alt={`${name} post`}src={imageUrl}+ onLoad={rememberLoadedPhotoDimensions}sx={{display: "block",height: "100%",@@ -461,7 +484,7 @@ export const HomeScreen: React.FC<HomeScreenProps> = ({sx={{alignItems: "center",display: "grid",- gridTemplateColumns: "24px 1fr 24px",+ gridTemplateColumns: "32px 1fr 32px",p: 2,width: "100%",}}@@ -474,78 +497,31 @@ export const HomeScreen: React.FC<HomeScreenProps> = ({onChange={handlePostPhotoSelect}sx={{ display: "none" }}/>- <Box- component="button"- type="button"- aria-label={- isPostActionPosting- ? "Posting photo"- : isPostActionPosted- ? "Photo posted"- : "Post photo"- }- disabled={postActionPhase != null}- onClick={openPostPhotoPicker}- sx={{- alignItems: "center",- bgcolor: "transparent",- border: 0,- color: isPostActionPosted ? green : textBase,- cursor:- postActionPhase == null ? "pointer" : "default",- display: "flex",- height: 24,- justifyContent: "flex-start",- opacity: 1,- p: 0,- width: 24,- transition: `color ${socialActionTransition}`,- "&:focus-visible": {- borderRadius: "50%",- outline: `2px solid ${green}`,- outlineOffset: 2,- },- }}- >- <SocialActionFeedbackIcon- idleIcon={<PlusIcon />}- phase={postActionFeedbackPhase}- />- </Box>- <Box- sx={{- alignSelf: "center",- color: textBase,- justifySelf: "center",- lineHeight: 0,- overflow: "visible",- width: 58,- "& svg": { display: "block", overflow: "visible" },- }}- >- <EnteLogo height={18} />- </Box><Boxcomponent="button"type="button"aria-label="Open profile"onClick={onOpenProfile}sx={{+ appearance: "none",alignItems: "center",bgcolor: profile.avatarUrl? "transparent": paleGreen,border: 0,borderRadius: "50%",+ boxSizing: "border-box",color: green,cursor: onOpenProfile ? "pointer" : "default",display: "flex",- height: 24,+ height: 28,justifyContent: "center",- justifySelf: "flex-end",+ justifySelf: "flex-start",+ lineHeight: 0,+ placeSelf: "center start",overflow: "hidden",p: 0,- width: 24,+ width: 28,"&:focus-visible": {outline: `2px solid ${green}`,outlineOffset: 2,@@ -581,6 +557,72 @@ export const HomeScreen: React.FC<HomeScreenProps> = ({</Box>)}</Box>+ <Box+ sx={{+ alignSelf: "center",+ color: textBase,+ justifySelf: "center",+ lineHeight: 0,+ overflow: "visible",+ placeSelf: "center",+ width: 58,+ "& svg": { display: "block", overflow: "visible" },+ }}+ >+ <EnteLogo height={18} />+ </Box>+ <Box+ component="button"+ type="button"+ aria-label={+ isPostActionPosting+ ? "Posting photo"+ : isPostActionPosted+ ? "Photo posted"+ : "Post photo"+ }+ disabled={postActionPhase != null}+ onClick={openPostPhotoPicker}+ sx={{+ appearance: "none",+ alignItems: "center",+ bgcolor: "transparent",+ border: 0,+ boxSizing: "border-box",+ color: isPostActionPosted ? green : textBase,+ cursor:+ postActionPhase == null ? "pointer" : "default",+ display: "flex",+ fontSize: 0,+ height: 32,+ justifyContent: "center",+ justifySelf: "flex-end",+ lineHeight: 0,+ opacity: 1,+ p: 0,+ placeSelf: "center end",+ width: 32,+ transition: `color ${socialActionTransition}`,+ "& svg": { display: "block" },+ "&:focus-visible": {+ borderRadius: "6px",+ outline: `2px solid ${green}`,+ outlineOffset: 2,+ },+ }}+ >+ <SocialActionFeedbackIcon+ idleIcon={+ <HugeiconsIcon+ icon={AddSquareIcon}+ size={28}+ strokeWidth={1.8}+ />+ }+ phase={postActionFeedbackPhase}+ size={28}+ />+ </Box></Box><Boxsx={{@@ -589,7 +631,7 @@ export const HomeScreen: React.FC<HomeScreenProps> = ({flexDirection: "column",gap: hasFeedItems ? "36px" : 0,justifyContent: hasFeedItems ? "flex-start" : "center",- minHeight: "calc(100svh - 56px)",+ minHeight: "calc(100svh - 64px)",pb: hasFeedItems ? "16px" : "56px",pt: hasFeedItems ? "22px" : 0,width: "100%",diff --git a/web/apps/social/src/screens/LoginScreen.tsx b/web/apps/social/src/screens/LoginScreen.tsxindex c27b383406..a2de044446 100644--- a/web/apps/social/src/screens/LoginScreen.tsx+++ b/web/apps/social/src/screens/LoginScreen.tsx@@ -317,7 +317,7 @@ export const LoginScreen: React.FC<LoginScreenProps> = ({<BoxclassName={canContinue- ? "green-bg-with-noise-and-curves"+ ? "green-bg": undefined}component="button"diff --git a/web/apps/social/src/screens/OnboardingScreen.tsx b/web/apps/social/src/screens/OnboardingScreen.tsxindex 708dd83450..477204e52d 100644--- a/web/apps/social/src/screens/OnboardingScreen.tsx+++ b/web/apps/social/src/screens/OnboardingScreen.tsx@@ -64,7 +64,7 @@ export const OnboardingScreen: React.FC<OnboardingScreenProps> = ({onLogin,}) => (<Box- className="green-bg-with-noise-and-curves"+ className="green-bg"component="main"sx={{bgcolor: onboardingGreen,@@ -76,7 +76,7 @@ export const OnboardingScreen: React.FC<OnboardingScreenProps> = ({}}><Box- className="green-bg-with-noise-and-curves"+ className="green-bg"sx={{alignItems: "center",bgcolor: onboardingGreen,diff --git a/web/apps/social/src/screens/ProfileScreen.tsx b/web/apps/social/src/screens/ProfileScreen.tsxindex a04abbc533..a817f9440c 100644--- a/web/apps/social/src/screens/ProfileScreen.tsx+++ b/web/apps/social/src/screens/ProfileScreen.tsx@@ -1,14 +1,13 @@import {+ AddSquareIcon,ArrowLeft02Icon,- Loading03Icon,MoreHorizontalIcon,Settings01Icon,- Tick02Icon,} from "@hugeicons/core-free-icons";import { HugeiconsIcon } from "@hugeicons/react";import { Box, Menu, MenuItem } from "@mui/material";-import { keyframes } from "@mui/material/styles";import {+ SocialActionFeedbackIcon,socialActionBusyDurationMs,socialActionDoneDurationMs,socialActionTransition,@@ -41,7 +40,7 @@ const profileCoverHeight =const photoMasonryGap = "3px";const photoMasonryRadius = "12px";const showMockProfilePosts =- process.env.NEXT_PUBLIC_HIDE_SOCIAL_MOCK_PROFILE_POSTS != "true";+ process.env.NEXT_PUBLIC_HIDE_SOCIAL_MOCK_PROFILE_POSTS == "false";type PostActionPhase = "posting" | "posted";interface ProfilePhotoDimensions {@@ -53,16 +52,6 @@ interface SampleProfilePhoto extends ProfilePhotoDimensions {imageUrl: string;}-const postActionSpin = keyframes`- from {- transform: rotate(0deg);- }-- to {- transform: rotate(360deg);- }-`;-const samplePhotos = [{ height: 680, imageUrl: "/images/sample-feed-1.jpg", width: 900 },{@@ -387,7 +376,7 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({/>)}<Box- className="green-bg-with-noise-and-curves"+ className="green-bg"sx={{height: profileCoverHeight,insetInline: 0,@@ -1131,10 +1120,11 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({disabled={postActionPhase != null}onClick={openPostPhotoPicker}sx={{+ appearance: "none",alignItems: "center",- bgcolor: "#F2F2F2",+ bgcolor: "transparent",border: 0,- borderRadius: "50%",+ boxSizing: "border-box",color: isPostActionPosted? green: textBase,@@ -1142,108 +1132,36 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({postActionPhase == null? "pointer": "default",- display: "grid",- height: 40,+ display: "flex",+ fontSize: 0,+ height: 32,+ justifyContent: "center",lineHeight: 0,mt: "20px",p: 0,+ placeSelf: "center",placeItems: "center",- position: "relative",transition: `color ${socialActionTransition}`,- width: 40,+ width: 32,+ "& svg": { display: "block" },"&:focus-visible": {+ borderRadius: "6px",outline: `2px solid ${green}`,outlineOffset: 2,},- "&:hover": {- bgcolor:- postActionPhase == null- ? "#E8E8E8"- : "#F2F2F2",- },}}>- {postActionFeedbackPhase == "busy" ? (- <Box- component="span"- sx={{- display: "flex",- left: "50%",- lineHeight: 0,- position: "absolute",- top: "50%",- transform:- "translate(-50%, -50%)",- }}- >- <Box- component="span"- sx={{- animation: `${postActionSpin} 2.4s linear infinite`,- display: "flex",- lineHeight: 0,- }}- >- <HugeiconsIcon- icon={Loading03Icon}- size={22}- strokeWidth={1.8}- />- </Box>- </Box>- ) : postActionFeedbackPhase == "done" ? (- <Box- component="span"- sx={{- display: "flex",- left: "50%",- lineHeight: 0,- position: "absolute",- top: "50%",- transform:- "translate(-50%, -50%)",- }}- >+ <SocialActionFeedbackIcon+ idleIcon={<HugeiconsIcon- icon={Tick02Icon}- size={22}+ icon={AddSquareIcon}+ size={28}strokeWidth={1.8}/>- </Box>- ) : (- <>- <Box- aria-hidden- component="span"- sx={{- bgcolor: "currentColor",- borderRadius: "999px",- height: "2px",- left: "50%",- position: "absolute",- top: "50%",- transform:- "translate(-50%, -50%)",- width: "15px",- }}- />- <Box- aria-hidden- component="span"- sx={{- bgcolor: "currentColor",- borderRadius: "999px",- height: "15px",- left: "50%",- position: "absolute",- top: "50%",- transform:- "translate(-50%, -50%)",- width: "2px",- }}- />- </>- )}+ }+ phase={postActionFeedbackPhase}+ size={28}+ /></Box>)}</Box>diff --git a/web/apps/social/src/screens/SetupProfileScreen.tsx b/web/apps/social/src/screens/SetupProfileScreen.tsxindex 275ad2f61c..aa638ac6d4 100644--- a/web/apps/social/src/screens/SetupProfileScreen.tsx+++ b/web/apps/social/src/screens/SetupProfileScreen.tsx@@ -447,7 +447,7 @@ export const SetupProfileScreen: React.FC<SetupProfileScreenProps> = ({<BoxclassName={canContinue- ? "green-bg-with-noise-and-curves"+ ? "green-bg": undefined}component="button"diff --git a/web/apps/social/src/screens/ShareProfileLinkScreen.tsx b/web/apps/social/src/screens/ShareProfileLinkScreen.tsxindex 4ca7dfc68c..b5bb50912b 100644--- a/web/apps/social/src/screens/ShareProfileLinkScreen.tsx+++ b/web/apps/social/src/screens/ShareProfileLinkScreen.tsx@@ -436,7 +436,7 @@ export const ShareProfileLinkScreen: React.FC<ShareProfileLinkScreenProps> = ({}}><Box- className="green-bg-with-noise-and-curves"+ className="green-bg"component="button"type="button"onClick={onDone}diff --git a/web/apps/social/src/screens/VerifyEmailScreen.tsx b/web/apps/social/src/screens/VerifyEmailScreen.tsxindex 1fb47ee00e..85352b851b 100644--- a/web/apps/social/src/screens/VerifyEmailScreen.tsx+++ b/web/apps/social/src/screens/VerifyEmailScreen.tsx@@ -435,7 +435,7 @@ export const VerifyEmailScreen: React.FC<VerifyEmailScreenProps> = ({<BoxclassName={canVerify- ? "green-bg-with-noise-and-curves"+ ? "green-bg": undefined}component="button"diff --git a/web/apps/social/src/styles/globals.css b/web/apps/social/src/styles/globals.cssindex c98b76982a..01d8fe711b 100644--- a/web/apps/social/src/styles/globals.css+++ b/web/apps/social/src/styles/globals.css@@ -1,12 +1,3 @@-.green-bg-with-noise-and-curves {- background-image:- url("/images/noise.svg"), url("/images/bg-curved-lines.svg"),- url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACXBIWXMAAAsTAAALEwEAmpwYAAABaWlDQ1BEaXNwbGF5IFAzAAB4nHWQvUvDUBTFT6tS0DqIDh0cMolD1NIKdnFoKxRFMFQFq1OafgltfCQpUnETVyn4H1jBWXCwiFRwcXAQRAcR3Zw6KbhoeN6XVNoi3sfl/Ticc7lcwBtQGSv2AijplpFMxKS11Lrke4OHnlOqZrKooiwK/v276/PR9d5PiFlNu3YQ2U9cl84ul3aeAlN//V3Vn8maGv3f1EGNGRbgkYmVbYsJ3iUeMWgp4qrgvMvHgtMunzuelWSc+JZY0gpqhrhJLKc79HwHl4plrbWD2N6f1VeXxRzqUcxhEyYYilBRgQQF4X/8044/ji1yV2BQLo8CLMpESRETssTz0KFhEjJxCEHqkLhz634PrfvJbW3vFZhtcM4v2tpCAzidoZPV29p4BBgaAG7qTDVUR+qh9uZywPsJMJgChu8os2HmwiF3e38M6Hvh/GMM8B0CdpXzryPO7RqFn4Er/QcXKWq8MSlPPgAAABBJREFUeAEBBQD6/wAIwiX/A7QB7/maltEAAAAASUVORK5CYII=");- background-repeat: repeat, no-repeat, repeat;- background-size: auto, cover, auto;- background-blend-mode: normal;-}-.green-bg {background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACXBIWXMAAAsTAAALEwEAmpwYAAABaWlDQ1BEaXNwbGF5IFAzAAB4nHWQvUvDUBTFT6tS0DqIDh0cMolD1NIKdnFoKxRFMFQFq1OafgltfCQpUnETVyn4H1jBWXCwiFRwcXAQRAcR3Zw6KbhoeN6XVNoi3sfl/Ticc7lcwBtQGSv2AijplpFMxKS11Lrke4OHnlOqZrKooiwK/v276/PR9d5PiFlNu3YQ2U9cl84ul3aeAlN//V3Vn8maGv3f1EGNGRbgkYmVbYsJ3iUeMWgp4qrgvMvHgtMunzuelWSc+JZY0gpqhrhJLKc79HwHl4plrbWD2N6f1VeXxRzqUcxhEyYYilBRgQQF4X/8044/ji1yV2BQLo8CLMpESRETssTz0KFhEjJxCEHqkLhz634PrfvJbW3vFZhtcM4v2tpCAzidoZPV29p4BBgaAG7qTDVUR+qh9uZywPsJMJgChu8os2HmwiF3e38M6Hvh/GMM8B0CdpXzryPO7RqFn4Er/QcXKWq8MSlPPgAAABBJREFUeAEBBQD6/wAIwiX/A7QB7/maltEAAAAASUVORK5CYII=")repeat;