Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Add social home screen

Anand Baburajan1bfafafe68f7
diff --git a/web/apps/social/public/images/mock-profile-picture.jpg b/web/apps/social/public/images/mock-profile-picture.jpg
deleted file mode 100644
index 032884885a..0000000000
Binary files a/web/apps/social/public/images/mock-profile-picture.jpg and /dev/null differ
diff --git a/web/apps/social/public/images/sample-avatar.jpg b/web/apps/social/public/images/sample-avatar.jpg
new file mode 100644
index 0000000000..c054f50b44
Binary files /dev/null and b/web/apps/social/public/images/sample-avatar.jpg differ
diff --git a/web/apps/social/src/pages/index.tsx b/web/apps/social/src/pages/index.tsx
index 80b7fe4de6..d0a0dd63a0 100644
--- a/web/apps/social/src/pages/index.tsx
+++ b/web/apps/social/src/pages/index.tsx
@@ -4,6 +4,7 @@ import {
CreateAccountScreen,
createAccountBackground,
} from "screens/CreateAccountScreen";
+import { HomeScreen, homeBackground } from "screens/HomeScreen";
import { LoginScreen, loginBackground } from "screens/LoginScreen";
import {
OnboardingScreen,
@@ -35,7 +36,8 @@ type Screen =
| "verify-email"
| "recovery-key"
| "setup-profile"
- | "share-profile-link";
+ | "share-profile-link"
+ | "home";
type ProfileBackScreen = "login" | "recovery-key";
@@ -69,7 +71,9 @@ const Page: React.FC = () => {
? setupProfileBackground
: screen == "share-profile-link"
? shareProfileLinkBackground
- : createAccountBackground
+ : screen == "home"
+ ? homeBackground
+ : createAccountBackground
}
/>
<meta name="description" content={onboardingDescription} />
@@ -134,9 +138,10 @@ const Page: React.FC = () => {
<ShareProfileLinkScreen
profile={profile}
onBack={() => setScreen("setup-profile")}
- onDone={() => undefined}
+ onDone={() => setScreen("home")}
/>
)}
+ {screen == "home" && profile && <HomeScreen profile={profile} />}
</>
);
};
diff --git a/web/apps/social/src/screens/HomeScreen.tsx b/web/apps/social/src/screens/HomeScreen.tsx
new file mode 100644
index 0000000000..ba7f2b86ac
--- /dev/null
+++ b/web/apps/social/src/screens/HomeScreen.tsx
@@ -0,0 +1,147 @@
+import { Box } from "@mui/material";
+import { EnteLogo } from "ente-base/components/EnteLogo";
+import React from "react";
+import type { SetupProfile } from "screens/SetupProfileScreen";
+
+export const homeBackground = "#FFFFFF";
+
+const green = "#08C225";
+const paleGreen = "#E7F6E9";
+const textBase = "#000";
+
+interface HomeScreenProps {
+ profile: SetupProfile;
+}
+
+const PlusIcon: React.FC = () => (
+ <Box
+ component="svg"
+ viewBox="0 0 24 24"
+ aria-hidden
+ sx={{ display: "block", height: 28, width: 28 }}
+ >
+ <path
+ d="M12 5V19M5 12H19"
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.8"
+ />
+ </Box>
+);
+
+export const HomeScreen: React.FC<HomeScreenProps> = ({ profile }) => {
+ const initialsSource = profile.fullName.trim() || profile.username.trim();
+ const initials = initialsSource
+ .split(/\s+/)
+ .slice(0, 2)
+ .map((part) => part[0]?.toUpperCase())
+ .join("");
+
+ return (
+ <Box
+ component="main"
+ sx={{
+ bgcolor: homeBackground,
+ color: textBase,
+ display: "grid",
+ minHeight: "100svh",
+ overflow: "hidden",
+ placeItems: { xs: "stretch", sm: "start center" },
+ }}
+ >
+ <Box
+ sx={{
+ bgcolor: homeBackground,
+ boxSizing: "border-box",
+ minHeight: "100svh",
+ mx: "auto",
+ px: 3,
+ width: "100%",
+ "@media (min-width: 600px)": { maxWidth: 375 },
+ }}
+ >
+ <Box
+ component="header"
+ sx={{
+ alignItems: "center",
+ display: "grid",
+ gridTemplateColumns: "40px 1fr 40px",
+ height: 40,
+ mt: "20px",
+ width: "100%",
+ }}
+ >
+ <Box
+ sx={{
+ alignItems: "center",
+ color: textBase,
+ display: "flex",
+ height: 40,
+ justifyContent: "flex-start",
+ width: 40,
+ }}
+ >
+ <PlusIcon />
+ </Box>
+ <Box
+ sx={{
+ alignSelf: "center",
+ color: textBase,
+ justifySelf: "center",
+ lineHeight: 0,
+ }}
+ >
+ <EnteLogo height={24} />
+ </Box>
+ <Box
+ sx={{
+ alignItems: "center",
+ bgcolor: profile.avatarUrl
+ ? "transparent"
+ : paleGreen,
+ borderRadius: "50%",
+ color: green,
+ display: "flex",
+ height: 24,
+ justifyContent: "center",
+ justifySelf: "flex-end",
+ overflow: "hidden",
+ width: 24,
+ }}
+ >
+ {profile.avatarUrl ? (
+ <Box
+ component="img"
+ alt=""
+ src={profile.avatarUrl}
+ sx={{
+ display: "block",
+ height: "100%",
+ borderRadius: "50%",
+ objectFit: "cover",
+ objectPosition: "center",
+ width: "100%",
+ }}
+ />
+ ) : (
+ <Box
+ sx={{
+ color: green,
+ fontFamily:
+ '"Inter Variable", Inter, sans-serif',
+ fontSize: 10,
+ fontWeight: 700,
+ lineHeight: 1,
+ }}
+ >
+ {initials}
+ </Box>
+ )}
+ </Box>
+ </Box>
+ </Box>
+ </Box>
+ );
+};
diff --git a/web/apps/social/src/screens/OnboardingScreen.tsx b/web/apps/social/src/screens/OnboardingScreen.tsx
index 2d18832f55..e80e08aa23 100644
--- a/web/apps/social/src/screens/OnboardingScreen.tsx
+++ b/web/apps/social/src/screens/OnboardingScreen.tsx
@@ -93,35 +93,26 @@ export const OnboardingScreen: React.FC<OnboardingScreenProps> = ({
<Box
component="header"
sx={{
- display: "flex",
+ alignItems: "center",
+ display: "grid",
flexShrink: 0,
- height: 78,
- pt: "28px",
+ gridTemplateColumns: "40px 1fr 40px",
+ height: 40,
+ mt: "44px",
width: "100%",
- "@media (max-height: 760px)": { height: 70, pt: "28px" },
}}
>
+ <Box />
<Box
sx={{
- alignItems: "center",
- display: "grid",
- gridTemplateColumns: "24px 1fr 24px",
- height: 42,
- width: "100%",
+ color: "white",
+ justifySelf: "center",
+ lineHeight: 0,
}}
>
- <Box />
- <Box
- sx={{
- color: "white",
- justifySelf: "center",
- lineHeight: 0,
- }}
- >
- <EnteLogo height={24} />
- </Box>
- <Box />
+ <EnteLogo height={24} />
</Box>
+ <Box />
</Box>
<Box
component="img"
diff --git a/web/apps/social/src/screens/SetupProfileScreen.tsx b/web/apps/social/src/screens/SetupProfileScreen.tsx
index 8bf19c5f90..a52376da61 100644
--- a/web/apps/social/src/screens/SetupProfileScreen.tsx
+++ b/web/apps/social/src/screens/SetupProfileScreen.tsx
@@ -10,7 +10,7 @@ const warning = "#F63A3A";
const paleGreen = "#E7F6E9";
const mockSetupProfileData = {
- avatarUrl: "/images/mock-profile-picture.jpg",
+ avatarUrl: "/images/sample-avatar.jpg",
username: "maya",
fullName: "Maya Iyer",
};