Skip to content

armgit / ente

Public Imported from GitHub
0

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

Update Space empty state copy

Anand Baburajan11c87d845d1b
diff --git a/web/apps/space/src/components/SpaceNotificationsPage.tsx b/web/apps/space/src/components/SpaceNotificationsPage.tsx
index a996c2268b..436aa678a5 100644
--- a/web/apps/space/src/components/SpaceNotificationsPage.tsx
+++ b/web/apps/space/src/components/SpaceNotificationsPage.tsx
@@ -8,6 +8,7 @@ import {
import {
createCurrentProfileLink,
loadCurrentNotifications,
+ loadCurrentSpaceFriends,
markCurrentNotificationsRead,
type SpaceNotification,
} from "services/space";
@@ -17,10 +18,17 @@ import { useSpaceRouter } from "utils/spaceRouteTransitions";
export const SpaceNotificationsPage: React.FC = () => {
const router = useSpaceRouter();
- const { profile, profileLoadError, profileLoadStatus } = useSpaceAppState();
+ const {
+ friends,
+ profile,
+ profileLoadError,
+ profileLoadStatus,
+ setFriends,
+ } = useSpaceAppState();
const [notifications, setNotifications] = React.useState<
SpaceNotification[]
>([]);
+ const [isFriendsLoading, setIsFriendsLoading] = React.useState(true);
const [isLoading, setIsLoading] = React.useState(true);
React.useEffect(() => {
@@ -64,6 +72,30 @@ export const SpaceNotificationsPage: React.FC = () => {
};
}, [profile]);
+ React.useEffect(() => {
+ if (!profile?.spaceId) {
+ setIsFriendsLoading(false);
+ return;
+ }
+
+ let cancelled = false;
+ setIsFriendsLoading(true);
+ void loadCurrentSpaceFriends(profile.spaceId)
+ .then((nextFriends) => {
+ if (!cancelled) setFriends(nextFriends);
+ })
+ .catch((error: unknown) =>
+ console.error("Failed to load space friends", error),
+ )
+ .finally(() => {
+ if (!cancelled) setIsFriendsLoading(false);
+ });
+
+ return () => {
+ cancelled = true;
+ };
+ }, [profile?.spaceId, setFriends]);
+
if (profileLoadStatus != "ready" || !profile) {
return (
<SpaceRouteFallback
@@ -80,7 +112,8 @@ export const SpaceNotificationsPage: React.FC = () => {
title="Notifications | Ente Space"
/>
<NotificationsScreen
- isLoading={isLoading}
+ friendsCount={friends.length}
+ isLoading={isLoading || isFriendsLoading}
notifications={notifications}
onBack={() => void router.push(spaceRoutes.home)}
onOpenFriendMessages={(spaceId) =>
diff --git a/web/apps/space/src/screens/MessagesScreen.tsx b/web/apps/space/src/screens/MessagesScreen.tsx
index 9d42215ee5..88324d000a 100644
--- a/web/apps/space/src/screens/MessagesScreen.tsx
+++ b/web/apps/space/src/screens/MessagesScreen.tsx
@@ -1270,6 +1270,10 @@ export const MessagesScreen: React.FC<MessagesScreenProps> = ({
: "";
const showInviteEmptyState =
friendsCount == 0 && Boolean(onShareProfileLink);
+ const emptyConversationsCopy =
+ friendsCount == 0
+ ? "No messages yet. Once you add friends, you'll see your their messages and replies to your posts here."
+ : "No messages yet. You'll see your friends' messages and replies to your posts here.";
const conversationSections = React.useMemo(
() => conversationTimeSections(conversations),
[conversations],
@@ -2226,9 +2230,7 @@ export const MessagesScreen: React.FC<MessagesScreenProps> = ({
maxWidth: 260,
}}
>
- No messages yet. Once you add friends,
- you&apos;ll see their messages and replies
- to your posts here.
+ {emptyConversationsCopy}
</Box>
{showInviteEmptyState && (
<Box
diff --git a/web/apps/space/src/screens/NotificationsScreen.tsx b/web/apps/space/src/screens/NotificationsScreen.tsx
index e01fd26ce9..b9f6d40f8a 100644
--- a/web/apps/space/src/screens/NotificationsScreen.tsx
+++ b/web/apps/space/src/screens/NotificationsScreen.tsx
@@ -20,6 +20,7 @@ const dayMs = 24 * 60 * 60 * 1000;
const microsForTimestamp = (timestampMs: number) => timestampMs * 1000;
interface NotificationsScreenProps {
+ friendsCount?: number;
isLoading?: boolean;
notifications: SpaceNotification[];
onBack?: () => void;
@@ -407,6 +408,7 @@ const NotificationSection: React.FC<{
};
export const NotificationsScreen: React.FC<NotificationsScreenProps> = ({
+ friendsCount,
isLoading = false,
notifications,
onBack,
@@ -423,7 +425,12 @@ export const NotificationsScreen: React.FC<NotificationsScreenProps> = ({
() => timeSections(notifications),
[notifications],
);
- const showInviteEmptyState = Boolean(onShareProfileLink);
+ const showInviteEmptyState =
+ friendsCount == 0 && Boolean(onShareProfileLink);
+ const emptyStateCopy =
+ friendsCount == 0
+ ? "No notifications yet. Once you add friends, you'll see likes on posts and friend updates here."
+ : "No notifications yet. You'll see likes on posts and friend updates here.";
const openInviteDialog = () => {
setInviteShareError(null);
@@ -584,9 +591,7 @@ export const NotificationsScreen: React.FC<NotificationsScreenProps> = ({
maxWidth: 292,
}}
>
- No notifications yet. Once you add friends,
- you&apos;ll see post likes and friend updates
- here.
+ {emptyStateCopy}
</Box>
{showInviteEmptyState && (
<Box