Skip to content

armgit / ente

Public Imported from GitHub
0

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

Polish social empty states

Anand Baburajan953a7d171e83
diff --git a/web/apps/social/src/pages/index.tsx b/web/apps/social/src/pages/index.tsx
index 22564d655b..e0a7cdf818 100644
--- a/web/apps/social/src/pages/index.tsx
+++ b/web/apps/social/src/pages/index.tsx
@@ -1,3 +1,4 @@
+import { Box } from "@mui/material";
import { SocialPageMeta } from "components/SocialPageMeta";
import { SocialRouteFallback } from "components/SocialRouteFallback";
import { useRouter } from "next/router";
@@ -38,6 +39,55 @@ type RouteMode =
| { kind: "app" }
| ({ kind: "public-profile" } & PendingSocialInvite);
+const PublicProfileUnavailable: React.FC = () => (
+ <Box
+ className="green-bg"
+ component="main"
+ sx={{
+ alignItems: "center",
+ bgcolor: onboardingGreen,
+ boxSizing: "border-box",
+ color: "white",
+ display: "grid",
+ minHeight: "100svh",
+ placeItems: "center",
+ px: 3,
+ textAlign: "center",
+ }}
+ >
+ <Box sx={{ maxWidth: 314 }}>
+ <Box
+ component="h1"
+ sx={{
+ fontFamily: "Nunito, sans-serif",
+ fontSize: 24,
+ fontWeight: 800,
+ letterSpacing: 0,
+ lineHeight: "29px",
+ m: 0,
+ whiteSpace: "nowrap",
+ }}
+ >
+ Profile unavailable
+ </Box>
+ <Box
+ component="p"
+ sx={{
+ color: "#AAFFB8",
+ fontFamily: '"Inter Variable", Inter, sans-serif',
+ fontSize: 14,
+ fontWeight: 500,
+ lineHeight: "20px",
+ m: 0,
+ mt: "6px",
+ }}
+ >
+ This profile link is invalid or expired.
+ </Box>
+ </Box>
+ </Box>
+);
+
const parseOnboardingEntrySource = (): OnboardingEntrySource => {
const params = new URLSearchParams(window.location.search);
return params.get(onboardingSourceSearchParam) ==
@@ -111,7 +161,8 @@ const Page: React.FC = () => {
})
.catch((error: unknown) => {
console.error("Failed to load public social invite", error);
- if (!cancelled) setPublicError("This invite link is invalid or expired.");
+ if (!cancelled)
+ setPublicError("This profile link is invalid or expired.");
});
return () => {
@@ -146,12 +197,7 @@ const Page: React.FC = () => {
return (
<>
<SocialPageMeta themeColor={profileBackground} />
- <OnboardingScreen
- description={publicError}
- onCreateAccount={() => void router.push(socialRoutes.signup)}
- onLogin={() => void router.push(socialRoutes.login)}
- title="Invite unavailable"
- />
+ <PublicProfileUnavailable />
</>
);
}
diff --git a/web/apps/social/src/screens/HomeScreen.tsx b/web/apps/social/src/screens/HomeScreen.tsx
index f7ff02f1c3..270668c181 100644
--- a/web/apps/social/src/screens/HomeScreen.tsx
+++ b/web/apps/social/src/screens/HomeScreen.tsx
@@ -805,8 +805,8 @@ export const HomeScreen: React.FC<HomeScreenProps> = ({
sx={{
display: "block",
height: "auto",
- width: 156,
- "@media (max-width: 340px)": { width: 140 },
+ width: 196,
+ "@media (max-width: 340px)": { width: 176 },
}}
/>
<Box
@@ -819,7 +819,7 @@ export const HomeScreen: React.FC<HomeScreenProps> = ({
fontWeight: 500,
lineHeight: "20px",
m: 0,
- mt: "36px",
+ mt: "30px",
maxWidth: 220,
}}
>
@@ -846,7 +846,7 @@ export const HomeScreen: React.FC<HomeScreenProps> = ({
height: 36,
justifyContent: "center",
lineHeight: "18px",
- mt: "18px",
+ mt: "30px",
px: "14px",
whiteSpace: "nowrap",
"&:focus-visible": {
@@ -857,7 +857,7 @@ export const HomeScreen: React.FC<HomeScreenProps> = ({
}}
>
<ShareIcon />
- Share link
+ Share profile
</Box>
)}
</Box>
diff --git a/web/apps/social/src/screens/NotificationsScreen.tsx b/web/apps/social/src/screens/NotificationsScreen.tsx
index 32fddb43e5..77a4265320 100644
--- a/web/apps/social/src/screens/NotificationsScreen.tsx
+++ b/web/apps/social/src/screens/NotificationsScreen.tsx
@@ -351,6 +351,7 @@ export const NotificationsScreen: React.FC<NotificationsScreenProps> = ({
const [selectedPost, setSelectedPost] =
React.useState<SocialViewerPhoto | null>(null);
const profileName = profile.fullName.trim() || profile.username.trim();
+ const hasNotifications = notifications.length > 0;
const openPost = (notification: SocialNotification) => {
if (!notification.postThumbnailUrl) return;
@@ -384,6 +385,7 @@ export const NotificationsScreen: React.FC<NotificationsScreenProps> = ({
boxSizing: "border-box",
minHeight: "100svh",
mx: "auto",
+ position: "relative",
width: "100%",
"@media (min-width: 600px)": { maxWidth: 390 },
}}
@@ -445,30 +447,79 @@ export const NotificationsScreen: React.FC<NotificationsScreenProps> = ({
</Box>
</Box>
- <Box
- component="ul"
- sx={{
- boxSizing: "border-box",
- display: "flex",
- flexDirection: "column",
- m: 0,
- mt: "21px",
- pb: "28px",
- pl: timelineListInset,
- pr: thumbnailRightInset,
- pt: 0,
- width: "100%",
- }}
- >
- {notifications.map((notification) => (
- <NotificationRow
- key={notification.id}
- notification={notification}
- onOpenFriend={onOpenFriend}
- onOpenPost={openPost}
- />
- ))}
- </Box>
+ {hasNotifications ? (
+ <Box
+ component="ul"
+ sx={{
+ boxSizing: "border-box",
+ display: "flex",
+ flexDirection: "column",
+ m: 0,
+ mt: "21px",
+ pb: "28px",
+ pl: timelineListInset,
+ pr: thumbnailRightInset,
+ pt: 0,
+ width: "100%",
+ }}
+ >
+ {notifications.map((notification) => (
+ <NotificationRow
+ key={notification.id}
+ notification={notification}
+ onOpenFriend={onOpenFriend}
+ onOpenPost={openPost}
+ />
+ ))}
+ </Box>
+ ) : (
+ <Box
+ sx={{
+ alignItems: "center",
+ boxSizing: "border-box",
+ display: "flex",
+ flexDirection: "column",
+ inset: 0,
+ justifyContent: "center",
+ pointerEvents: "none",
+ position: "absolute",
+ px: 3,
+ textAlign: "center",
+ }}
+ >
+ <Box
+ component="h2"
+ sx={{
+ color: textBase,
+ fontFamily:
+ '"Inter Variable", Inter, sans-serif',
+ fontSize: 16,
+ fontWeight: 700,
+ letterSpacing: 0,
+ lineHeight: "22px",
+ m: 0,
+ }}
+ >
+ No notifications yet
+ </Box>
+ <Box
+ component="p"
+ sx={{
+ color: textSoft,
+ fontFamily:
+ '"Inter Variable", Inter, sans-serif',
+ fontSize: 14,
+ fontWeight: 500,
+ lineHeight: "20px",
+ m: 0,
+ mt: "8px",
+ maxWidth: 240,
+ }}
+ >
+ Likes, replies and new friends will appear here.
+ </Box>
+ </Box>
+ )}
</Box>
{selectedPost && (
<SocialFileViewer
diff --git a/web/apps/social/src/screens/ProfileScreen.tsx b/web/apps/social/src/screens/ProfileScreen.tsx
index 7398eeb6b3..96999fa891 100644
--- a/web/apps/social/src/screens/ProfileScreen.tsx
+++ b/web/apps/social/src/screens/ProfileScreen.tsx
@@ -3,6 +3,7 @@ import {
ArrowLeft02Icon,
MoreHorizontalIcon,
Settings01Icon,
+ Tick02Icon,
} from "@hugeicons/core-free-icons";
import { HugeiconsIcon } from "@hugeicons/react";
import { Box, Menu, MenuItem } from "@mui/material";
@@ -165,6 +166,7 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({
}) => {
const [profileActionsAnchor, setProfileActionsAnchor] =
useState<HTMLElement | null>(null);
+ const [isProfileLinkCopied, setIsProfileLinkCopied] = useState(false);
const [selectedPost, setSelectedPost] =
useState<SelectedProfilePost | null>(null);
const [deletedPostIDs, setDeletedPostIDs] = useState<Set<string>>(
@@ -174,6 +176,9 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({
useState<Record<string, ProfilePhotoDimensions>>({});
const postInputRef = React.useRef<HTMLInputElement | null>(null);
const localPostObjectUrlsRef = React.useRef<Set<string>>(new Set());
+ const profileLinkCopiedTimerRef = React.useRef<number | undefined>(
+ undefined,
+ );
const isPublicProfile = headerVariant == "public";
const isOwnerProfile = headerVariant == "owner";
const isFriendProfile = headerVariant == "friend";
@@ -201,7 +206,21 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({
? "like-with-count"
: "like-only";
- const closeProfileActions = () => setProfileActionsAnchor(null);
+ const clearProfileLinkCopiedTimer = () => {
+ if (profileLinkCopiedTimerRef.current == undefined) return;
+ window.clearTimeout(profileLinkCopiedTimerRef.current);
+ profileLinkCopiedTimerRef.current = undefined;
+ };
+ const openProfileActions = (anchor: HTMLElement) => {
+ clearProfileLinkCopiedTimer();
+ setIsProfileLinkCopied(false);
+ setProfileActionsAnchor(anchor);
+ };
+ const closeProfileActions = ({ resetCopied = true } = {}) => {
+ clearProfileLinkCopiedTimer();
+ if (resetCopied) setIsProfileLinkCopied(false);
+ setProfileActionsAnchor(null);
+ };
const revokeLocalPostObjectUrl = React.useCallback((objectUrl?: string) => {
if (!objectUrl || !localPostObjectUrlsRef.current.has(objectUrl))
return;
@@ -274,9 +293,16 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({
};
const copyProfileURL = async () => {
- closeProfileActions();
- if (!onShareProfileLink) return;
+ clearProfileLinkCopiedTimer();
+ if (!onShareProfileLink) {
+ closeProfileActions();
+ return;
+ }
await navigator.clipboard.writeText(await onShareProfileLink());
+ setIsProfileLinkCopied(true);
+ profileLinkCopiedTimerRef.current = window.setTimeout(() => {
+ closeProfileActions({ resetCopied: false });
+ }, 1200);
};
const shareProfile = async () => {
@@ -312,6 +338,7 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({
React.useEffect(
() => () => {
+ clearProfileLinkCopiedTimer();
localPostObjectUrlsRef.current.forEach((objectUrl) =>
URL.revokeObjectURL(objectUrl),
);
@@ -661,9 +688,7 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({
}
aria-haspopup="menu"
onClick={(event) =>
- setProfileActionsAnchor(
- event.currentTarget,
- )
+ openProfileActions(event.currentTarget)
}
sx={{
alignItems: "center",
@@ -699,7 +724,7 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({
id="profile-actions-menu"
anchorEl={profileActionsAnchor}
open={isProfileActionsOpen}
- onClose={closeProfileActions}
+ onClose={() => closeProfileActions()}
anchorOrigin={{
horizontal: "center",
vertical: "bottom",
@@ -757,12 +782,22 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({
<Box
sx={{
alignItems: "center",
- color: textBase,
+ color: isProfileLinkCopied
+ ? green
+ : textBase,
display: "flex",
flexShrink: 0,
}}
>
- <LinkIcon />
+ {isProfileLinkCopied ? (
+ <HugeiconsIcon
+ icon={Tick02Icon}
+ size={20}
+ strokeWidth={2}
+ />
+ ) : (
+ <LinkIcon />
+ )}
</Box>
<Box
sx={{
@@ -1069,12 +1104,16 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({
alignItems: "center",
boxSizing: "border-box",
display: "flex",
- flex: 1,
flexDirection: "column",
justifyContent: "center",
minHeight: 0,
- pb: "12px",
+ pb: 0,
+ pointerEvents: "none",
+ position: "absolute",
px: 3,
+ top: `${profileCoverHeight}px`,
+ bottom: 0,
+ insetInline: 0,
textAlign: "center",
width: "100%",
}}
@@ -1087,7 +1126,7 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({
sx={{
display: "block",
height: "auto",
- width: 128,
+ width: 160,
}}
/>
)}
@@ -1101,7 +1140,7 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({
fontWeight: 500,
lineHeight: "20px",
m: 0,
- mt: isOwnerProfile ? "28px" : 0,
+ mt: isOwnerProfile ? "30px" : 0,
maxWidth: isOwnerProfile ? 230 : 250,
}}
>
@@ -1130,8 +1169,9 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({
height: 32,
justifyContent: "center",
lineHeight: 0,
- mt: "20px",
+ mt: "26px",
p: 0,
+ pointerEvents: "auto",
placeSelf: "center",
placeItems: "center",
width: 32,