Skip to content

armgit / ente

Public Imported from GitHub
0

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

Update Space empty states and invite sharing

Anand Baburajan7c46e18842db
diff --git a/web/apps/space/src/components/PostUnreadBadge.tsx b/web/apps/space/src/components/PostUnreadBadge.tsx
index e5abaf298b..31397cdb6d 100644
--- a/web/apps/space/src/components/PostUnreadBadge.tsx
+++ b/web/apps/space/src/components/PostUnreadBadge.tsx
@@ -23,9 +23,9 @@ export const SpacePostBadge: React.FC<SpacePostBadgeProps> = ({
color,
display: "inline-flex",
fontFamily: '"Inter Variable", Inter, sans-serif',
- fontSize: placement == "center" ? 12 : 10,
+ fontSize: placement == "center" ? 14 : 10,
fontVariantNumeric: "tabular-nums",
- fontWeight: 700,
+ fontWeight: placement == "center" ? 500 : 700,
height: placement == "center" ? 24 : 20,
justifyContent: "center",
lineHeight: 1,
diff --git a/web/apps/space/src/components/ShareInviteButton.tsx b/web/apps/space/src/components/ShareInviteButton.tsx
index 032634da17..97bd9df71b 100644
--- a/web/apps/space/src/components/ShareInviteButton.tsx
+++ b/web/apps/space/src/components/ShareInviteButton.tsx
@@ -37,7 +37,7 @@ export const SpaceShareInviteButton: React.FC<SpaceShareInviteButtonProps> = ({
}) => {
const isSharing = sharing ?? false;
const isDisabled = isSharing || !profileLink;
- const buttonLabel = label ?? "Share profile";
+ const buttonLabel = label ?? "Share invite";
const shareInvite = () => {
if (isDisabled || !profileLink) return;
diff --git a/web/apps/space/src/components/ShareLinkDialog.tsx b/web/apps/space/src/components/ShareLinkDialog.tsx
index 0ea8e10006..6a7d813a13 100644
--- a/web/apps/space/src/components/ShareLinkDialog.tsx
+++ b/web/apps/space/src/components/ShareLinkDialog.tsx
@@ -167,7 +167,7 @@ export const SpaceShareLinkDialogHost: React.FC = () => {
copied
? "Copied"
: useNativeShare
- ? "Share profile"
+ ? "Share invite"
: "Copy link"
}
onClick={share}
diff --git a/web/apps/space/src/pages/app/post.tsx b/web/apps/space/src/pages/app/post.tsx
index c242f9db07..3ee1bfd242 100644
--- a/web/apps/space/src/pages/app/post.tsx
+++ b/web/apps/space/src/pages/app/post.tsx
@@ -149,7 +149,7 @@ const Page: React.FC = () => {
color: textSecondary,
fontFamily:
'"Inter Variable", Inter, sans-serif',
- fontSize: 15,
+ fontSize: 14,
fontWeight: 500,
lineHeight: "22px",
m: 0,
diff --git a/web/apps/space/src/screens/FriendsScreen.tsx b/web/apps/space/src/screens/FriendsScreen.tsx
index 7dfa99e064..1aac284ad1 100644
--- a/web/apps/space/src/screens/FriendsScreen.tsx
+++ b/web/apps/space/src/screens/FriendsScreen.tsx
@@ -20,11 +20,12 @@ import {
spaceActionDoneDurationMs,
type SpaceActionPhase,
} from "components/ActionFeedback";
+import { spaceToastAutoDismissDurationMs } from "components/ActionToast";
import { SpaceAvatarImage } from "components/AvatarImage";
import { SpaceBottomSheetTransition } from "components/BottomSheetTransition";
import { ConfirmationActionSheet } from "components/ConfirmationActionSheet";
import { SpaceLoadingSpinner } from "components/RouteFallback";
-import { SpaceShareInviteButton } from "components/ShareInviteButton";
+import { SpaceShareIcon } from "components/ShareInviteButton";
import type { FriendProfile } from "data/friends";
import log from "ente-base/log";
import React, { useState } from "react";
@@ -968,12 +969,54 @@ export const FriendsScreen: React.FC<FriendsScreenProps> = ({
const [loadedAvatarURLsByKey, setLoadedAvatarURLsByKey] = React.useState<
Record<string, string>
>({});
- const [isInviteSharing, setIsInviteSharing] = React.useState(false);
+ const [inviteShareStatus, setInviteShareStatus] = React.useState<
+ "idle" | "sharing" | "copied"
+ >("idle");
const avatarLoadsInFlightRef = React.useRef<
Map<string, Promise<string | null | undefined>>
>(new Map());
const isUnfriendActionRunning = unfriendActionPhase != null;
+ React.useEffect(() => {
+ if (inviteShareStatus != "copied") return;
+ const timeoutID = window.setTimeout(
+ () => setInviteShareStatus("idle"),
+ spaceToastAutoDismissDurationMs,
+ );
+ return () => window.clearTimeout(timeoutID);
+ }, [inviteShareStatus]);
+
+ const shareInvite = async () => {
+ if (!profileLink || inviteShareStatus == "sharing") return;
+
+ setInviteShareStatus("sharing");
+ try {
+ if (typeof navigator.share == "function") {
+ try {
+ await navigator.share({ url: profileLink });
+ return;
+ } catch (error) {
+ if (
+ error instanceof DOMException &&
+ error.name == "AbortError"
+ ) {
+ return;
+ }
+ log.warn("Failed to share Space invite link", error);
+ }
+ }
+
+ await navigator.clipboard.writeText(profileLink);
+ setInviteShareStatus("copied");
+ } catch (error) {
+ log.error("Failed to copy Space invite link", error);
+ } finally {
+ setInviteShareStatus((status) =>
+ status == "sharing" ? "idle" : status,
+ );
+ }
+ };
+
const loadedAvatarURLFor = React.useCallback(
(friend: FriendProfile) =>
friend.avatarUrl ??
@@ -1235,7 +1278,7 @@ export const FriendsScreen: React.FC<FriendsScreenProps> = ({
justifyContent: "center",
fontFamily: '"Inter Variable", Inter, sans-serif',
fontSize: 14,
- fontWeight: 600,
+ fontWeight: 500,
lineHeight: "20px",
pointerEvents: "none",
position: "absolute",
@@ -1243,15 +1286,16 @@ export const FriendsScreen: React.FC<FriendsScreenProps> = ({
textAlign: "center",
}}
>
- Add the people you want to keep up with.
- <SpaceShareInviteButton
- label="Invite friends"
- profileLink={profileLink}
- sharing={isInviteSharing}
- onShareError={(error) =>
- log.error("Failed to share space invite", error)
+ Invite your close friends and family. Share everyday
+ photos and keep up with each other.
+ <Box
+ component="button"
+ type="button"
+ aria-live="polite"
+ disabled={
+ !profileLink || inviteShareStatus == "sharing"
}
- onSharingChange={setIsInviteSharing}
+ onClick={() => void shareInvite()}
sx={{
alignItems: "center",
bgcolor: spaceSurface,
@@ -1259,7 +1303,8 @@ export const FriendsScreen: React.FC<FriendsScreenProps> = ({
borderRadius: "18px",
color: textBase,
cursor:
- profileLink && !isInviteSharing
+ profileLink &&
+ inviteShareStatus != "sharing"
? "pointer"
: "default",
display: "inline-flex",
@@ -1281,11 +1326,17 @@ export const FriendsScreen: React.FC<FriendsScreenProps> = ({
outlineOffset: 2,
},
"&:hover":
- profileLink && !isInviteSharing
+ profileLink &&
+ inviteShareStatus != "sharing"
? { bgcolor: spaceSurfaceHover }
: undefined,
}}
- />
+ >
+ <SpaceShareIcon />
+ {inviteShareStatus == "copied"
+ ? "Copied"
+ : "Share invite"}
+ </Box>
</Box>
)}
</Box>
diff --git a/web/apps/space/src/screens/HomeScreen.tsx b/web/apps/space/src/screens/HomeScreen.tsx
index ff310c790f..9ac4bfd5ee 100644
--- a/web/apps/space/src/screens/HomeScreen.tsx
+++ b/web/apps/space/src/screens/HomeScreen.tsx
@@ -640,7 +640,7 @@ export const FriendPostCircle: React.FC<FriendPostCircleProps> = ({
color={textSecondary}
placement="center"
>
- No posts yet
+ No posts yet.
</SpacePostBadge>
)}
{!isLoading && postUnavailable && (
diff --git a/web/apps/space/src/screens/MessagesScreen.tsx b/web/apps/space/src/screens/MessagesScreen.tsx
index 5df7ed823d..fc31aa5493 100644
--- a/web/apps/space/src/screens/MessagesScreen.tsx
+++ b/web/apps/space/src/screens/MessagesScreen.tsx
@@ -2324,13 +2324,13 @@ export const MessagesScreen: React.FC<MessagesScreenProps> = ({
fontFamily:
'"Inter Variable", Inter, sans-serif',
fontSize: 14,
- fontWeight: 650,
+ fontWeight: 500,
lineHeight: "20px",
m: 0,
}}
>
{isThreadReadOnly
- ? "No messages"
+ ? "No messages."
: "Say hello!"}
</Box>
</Box>
diff --git a/web/apps/space/src/screens/OnboardingScreen.tsx b/web/apps/space/src/screens/OnboardingScreen.tsx
index 5a7a4c4248..b17cc9527f 100644
--- a/web/apps/space/src/screens/OnboardingScreen.tsx
+++ b/web/apps/space/src/screens/OnboardingScreen.tsx
@@ -5,7 +5,7 @@ import React from "react";
export const onboardingGreen = "#08C225";
export const onboardingTitle = "Share everyday moments";
export const onboardingDescription =
- "Keep up with the people closest to you through everyday photos. No ads. No algorithms.";
+ "Keep up with close friends and family through everyday photos. No ads. No algorithms.";
const softGreen = "#E7F6E9";
const copyGreen = "#AAFFB8";
diff --git a/web/apps/space/src/screens/ProfileScreen.tsx b/web/apps/space/src/screens/ProfileScreen.tsx
index fa030bb88c..e9d9d46f4a 100644
--- a/web/apps/space/src/screens/ProfileScreen.tsx
+++ b/web/apps/space/src/screens/ProfileScreen.tsx
@@ -1529,7 +1529,7 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({
<Box
component="button"
type="button"
- aria-label="Share profile"
+ aria-label="Share invite"
onClick={shareProfile}
sx={{
alignItems: "center",