Skip to content

armgit / ente

Public Imported from GitHub
0

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

Polish Space friends, photo browsing, and app presentation

Anand Baburajandbe7be160640
diff --git a/web/apps/space/public/images/apple-touch-icon.png b/web/apps/space/public/images/apple-touch-icon.png
index 0eaae02741..7ce1a7c59b 100644
Binary files a/web/apps/space/public/images/apple-touch-icon.png and b/web/apps/space/public/images/apple-touch-icon.png differ
diff --git a/web/apps/space/public/images/pwa-icon-192.png b/web/apps/space/public/images/pwa-icon-192.png
index 9a916eee05..27c009c680 100644
Binary files a/web/apps/space/public/images/pwa-icon-192.png and b/web/apps/space/public/images/pwa-icon-192.png differ
diff --git a/web/apps/space/public/images/pwa-icon-512.png b/web/apps/space/public/images/pwa-icon-512.png
index 62be5e459f..dce34c9e6f 100644
Binary files a/web/apps/space/public/images/pwa-icon-512.png and b/web/apps/space/public/images/pwa-icon-512.png differ
diff --git a/web/apps/space/public/manifest-public.webmanifest b/web/apps/space/public/manifest-public.webmanifest
index 0e254eddf8..5a384edf35 100644
--- a/web/apps/space/public/manifest-public.webmanifest
+++ b/web/apps/space/public/manifest-public.webmanifest
@@ -1,11 +1,11 @@
{
- "name": "Ente Space",
- "short_name": "Ente Space",
+ "name": "Space",
+ "short_name": "Space",
"description": "Share everyday photos with friends and family, privately.",
"id": "/app",
"scope": "/",
"display": "standalone",
- "background_color": "#08C225",
+ "background_color": "#000000",
"theme_color": "#000000",
"icons": [
{
diff --git a/web/apps/space/public/manifest.webmanifest b/web/apps/space/public/manifest.webmanifest
index efa85ddb41..e9ed9aa937 100644
--- a/web/apps/space/public/manifest.webmanifest
+++ b/web/apps/space/public/manifest.webmanifest
@@ -1,12 +1,12 @@
{
- "name": "Ente Space",
- "short_name": "Ente Space",
+ "name": "Space",
+ "short_name": "Space",
"description": "Share everyday photos with friends and family, privately.",
"id": "/app",
"start_url": "/app",
"scope": "/",
"display": "standalone",
- "background_color": "#08C225",
+ "background_color": "#000000",
"theme_color": "#000000",
"icons": [
{
diff --git a/web/apps/space/src/components/AppNavigation.tsx b/web/apps/space/src/components/AppNavigation.tsx
index 9cb1e33a36..b11cbc3975 100644
--- a/web/apps/space/src/components/AppNavigation.tsx
+++ b/web/apps/space/src/components/AppNavigation.tsx
@@ -284,7 +284,7 @@ export const SpaceAppLayout = ({ children }: { children: React.ReactNode }) => {
aria-hidden
className="space-unread-indicator"
sx={{
- bgcolor: "#F63A3A",
+ bgcolor: "#FF0000",
border: `2.5px solid ${spaceAppBackgroundColor}`,
borderRadius: "50%",
height: 11.5,
diff --git a/web/apps/space/src/components/FileViewer.tsx b/web/apps/space/src/components/FileViewer.tsx
index 03e7b9d6c8..ba8993350b 100644
--- a/web/apps/space/src/components/FileViewer.tsx
+++ b/web/apps/space/src/components/FileViewer.tsx
@@ -72,7 +72,6 @@ const viewerHeaderAvatarSize = 32;
const draftPostExitDurationMs = 320;
const keyboardInsetThresholdPx = 80;
const keyboardDismissMaxDurationMs = 500;
-const postTransitionDurationMs = 300;
interface ViewerViewportSize {
x: number;
@@ -158,7 +157,6 @@ interface SpaceFileViewerProps {
onLoadPhoto?: SpacePostAssetURLLoader;
isDraftPostPreviewPending?: boolean;
onClose: () => void;
- onNavigatePost?: (direction: -1 | 1) => boolean;
onAddDraftPhoto?: () => void;
onEditDraftPhoto?: () => void;
onDeletePost?: () => Promise<void> | void;
@@ -367,7 +365,6 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({
focusReplyOnOpen = false,
isDraftPostPreviewPending = false,
onClose,
- onNavigatePost,
onAddDraftPhoto,
onEditDraftPhoto,
onDeletePost,
@@ -458,12 +455,6 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({
videoLoaderRef.current = onLoadPhoto;
const viewerPhotosRef = React.useRef(viewerPhotos);
const onCloseRef = React.useRef(onClose);
- const onNavigatePostRef = React.useRef(onNavigatePost);
- const postAnimationsRef = React.useRef<Animation[]>([]);
- const postSnapshotRef = React.useRef<HTMLElement | undefined>(undefined);
- const postNavigationRef = React.useRef<
- { offset: number; direction: -1 | 1 } | undefined
- >(undefined);
const onPhotoIndexChangeRef = React.useRef(onPhotoIndexChange);
const initialPhotoIndexRef = React.useRef(activePhotoIndex);
const fallbackPhotoRef = React.useRef(activePhoto);
@@ -476,7 +467,6 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({
closeOnSwipePastEndRef.current = closeOnSwipePastEnd;
viewerPhotosRef.current = viewerPhotos;
onCloseRef.current = onClose;
- onNavigatePostRef.current = onNavigatePost;
onPhotoIndexChangeRef.current = onPhotoIndexChange;
fallbackPhotoRef.current = activePhoto;
const viewerPhotosContentKey = viewerPhotos
@@ -616,25 +606,6 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({
return nextSize;
}, []);
- const animatePostOffset = React.useCallback((from: number, to: number) => {
- const root = viewerRootRef.current!;
- const options = {
- duration: window.matchMedia("(prefers-reduced-motion: reduce)")
- .matches
- ? 0
- : postTransitionDurationMs,
- easing: "cubic-bezier(0.22, 1, 0.36, 1)",
- };
- root.style.setProperty("--space-viewer-post-offset", `${to}px`);
- postAnimationsRef.current = [
- pswpRef.current!.element!.animate(
- [{ translate: `0 ${from}px` }, { translate: `0 ${to}px` }],
- options,
- ),
- ];
- return options;
- }, []);
-
const requestAddFriendForPostAction = (intent: SpaceInviteIntent) => {
if (!onAddFriendForPostAction) return;
setAddFriendIntent(intent);
@@ -1077,31 +1048,6 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({
isSyncingPhotosRef.current = false;
}, [activePhotoIndex, viewerPhotosContentKey]);
- React.useLayoutEffect(() => {
- const navigation = postNavigationRef.current;
- const snapshot = postSnapshotRef.current;
- if (!navigation || !snapshot) return;
- postNavigationRef.current = undefined;
- const height = viewerViewportSize().y;
- const options = animatePostOffset(
- navigation.direction * height + navigation.offset,
- 0,
- );
- const animation = snapshot.animate(
- [
- { translate: `0 ${navigation.offset}px` },
- { translate: `0 ${-navigation.direction * height}px` },
- ],
- options,
- );
- postAnimationsRef.current.push(animation);
- animation.onfinish = () => {
- snapshot.remove();
- postSnapshotRef.current = undefined;
- postAnimationsRef.current = [];
- };
- }, [activePostKey, animatePostOffset, viewerViewportSize]);
-
React.useEffect(() => {
pswpRef.current?.updateSize(true);
}, [hasDraftPhotoControls]);
@@ -1189,13 +1135,6 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({
let pswp: PhotoSwipe | undefined;
let swipeStart:
{ x: number; y: number; photoIndex: number } | undefined;
- let postDragOffset = 0;
-
- const resetPostDrag = () => {
- if (!postDragOffset) return;
- animatePostOffset(postDragOffset, 0);
- postDragOffset = 0;
- };
void import("photoswipe").then(({ default: PhotoSwipeClass }) => {
if (disposed || !viewerRootRef.current) return;
@@ -1310,18 +1249,7 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({
if (!closedByReact) onCloseRef.current();
});
pswp.on("verticalDrag", (event) => {
- if (isDismissBlockedRef.current) {
- event.preventDefault();
- return;
- }
- if (!onNavigatePostRef.current) return;
- event.preventDefault();
- if (!swipeStart) return;
- postDragOffset = pswp!.gestures.p1.y - pswp!.gestures.startP1.y;
- root.style.setProperty(
- "--space-viewer-post-offset",
- `${postDragOffset}px`,
- );
+ if (isDismissBlockedRef.current) event.preventDefault();
});
pswp.on("zoomPanUpdate", () => {
root.style.setProperty(
@@ -1346,23 +1274,16 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({
}
});
pswp.on("pointerDown", (event) => {
- if (
- isSwipeBlockedRef.current ||
- postAnimationsRef.current.some(
- (animation) => animation.playState == "running",
- )
- ) {
+ if (isSwipeBlockedRef.current) {
event.preventDefault();
return;
}
if (swipeStart) {
swipeStart = undefined;
- resetPostDrag();
return;
}
if (
- (!closeOnSwipePastEndRef.current &&
- !onNavigatePostRef.current) ||
+ !closeOnSwipePastEndRef.current ||
isDismissBlockedRef.current ||
viewerSwipeStartsOnInteractiveTarget(
event.originalEvent.target,
@@ -1383,45 +1304,13 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({
isDismissBlockedRef.current ||
pswp!.gestures.isMultitouch ||
pswp!.currSlide?.isPannable()
- ) {
- resetPostDrag();
+ )
return;
- }
const end = viewerTouchPoint(originalEvent);
if (!end) return;
const dx = end.x - start.x;
const dy = end.y - start.y;
if (
- onNavigatePostRef.current &&
- Math.abs(dy) > 72 &&
- Math.abs(dy) > Math.abs(dx) * 1.5
- ) {
- const direction = dy < 0 ? 1 : -1;
- const snapshot = pswp!.element!.cloneNode(
- true,
- ) as HTMLElement;
- snapshot.setAttribute("aria-hidden", "true");
- snapshot.setAttribute(
- "data-space-viewer-post-snapshot",
- "true",
- );
- snapshot.inert = true;
- snapshot.style.pointerEvents = "none";
- snapshot.style.zIndex = "1";
- root.append(snapshot);
- postSnapshotRef.current = snapshot;
- postNavigationRef.current = {
- offset: postDragOffset,
- direction,
- };
- if (onNavigatePostRef.current(direction)) {
- postDragOffset = 0;
- return;
- }
- snapshot.remove();
- postSnapshotRef.current = undefined;
- postNavigationRef.current = undefined;
- } else if (
closeOnSwipePastEndRef.current &&
Math.abs(dx) > 72 &&
Math.abs(dx) > Math.abs(dy) * 1.5 &&
@@ -1432,7 +1321,6 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({
) {
onCloseRef.current();
}
- resetPostDrag();
});
pswp.init();
});
@@ -1442,14 +1330,9 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({
closedByReact = true;
pswpRef.current = undefined;
pswp?.destroy();
- postAnimationsRef.current.forEach((animation) =>
- animation.cancel(),
- );
- postSnapshotRef.current?.remove();
root.style.removeProperty("--space-viewer-bg-opacity");
- root.style.removeProperty("--space-viewer-post-offset");
};
- }, [animatePostOffset, isDraftPost, viewerViewportSize]);
+ }, [isDraftPost, viewerViewportSize]);
React.useEffect(() => {
if (typeof document == "undefined") return;
@@ -1527,11 +1410,6 @@ export const SpaceFileViewer: React.FC<SpaceFileViewerProps> = ({
transition: `opacity ${draftPostExitDurationMs}ms cubic-bezier(0.22, 1, 0.36, 1)`,
width: "100%",
zIndex: 1300,
- "& > .pswp:not([data-space-viewer-post-snapshot])": {
- translate: onNavigatePost
- ? "0 var(--space-viewer-post-offset, 0px)"
- : undefined,
- },
"& .space-photo-placeholder": {
alignItems: "center",
color: spaceTextMuted,
diff --git a/web/apps/space/src/components/FriendOrbit.tsx b/web/apps/space/src/components/FriendOrbit.tsx
index fa2585f244..9e9a2e81c0 100644
--- a/web/apps/space/src/components/FriendOrbit.tsx
+++ b/web/apps/space/src/components/FriendOrbit.tsx
@@ -127,6 +127,7 @@ export const FriendOrbit: React.FC<FriendOrbitProps> = ({
);
paint();
field.style.opacity = "1";
+ field.dataset.ready = "true";
};
const observer = new ResizeObserver(resize);
observer.observe(field);
@@ -236,9 +237,20 @@ export const FriendOrbit: React.FC<FriendOrbitProps> = ({
position: "relative",
userSelect: "none",
width: "100%",
+ "&[data-ready] > li > button": {
+ animation:
+ "spaceFriendCircleEnter 650ms cubic-bezier(0.22, 1, 0.36, 1) var(--space-friend-enter-delay) both",
+ },
+ "@keyframes spaceFriendCircleEnter": {
+ from: { transform: "scale(0)" },
+ to: { transform: "scale(1)" },
+ },
+ "@media (prefers-reduced-motion: reduce)": {
+ "&[data-ready] > li > button": { animation: "none" },
+ },
}}
>
- {items.map((item) => (
+ {items.map((item, index) => (
<Box
component="li"
key={item.id}
@@ -253,6 +265,7 @@ export const FriendOrbit: React.FC<FriendOrbitProps> = ({
onLostPointerCapture={endDrag}
onContextMenu={(event) => event.preventDefault()}
sx={{
+ "--space-friend-enter-delay": `${(index * 137) % 480}ms`,
borderRadius: "50%",
cursor: heldFriendID == item.id ? "grabbing" : "grab",
left: 0,
diff --git a/web/apps/space/src/components/HomeHeader.tsx b/web/apps/space/src/components/HomeHeader.tsx
index bb746af352..9d094f201a 100644
--- a/web/apps/space/src/components/HomeHeader.tsx
+++ b/web/apps/space/src/components/HomeHeader.tsx
@@ -130,7 +130,7 @@ export const SpaceHomeHeader: React.FC = () => {
aria-hidden
className="space-unread-indicator"
sx={{
- bgcolor: "#F63A3A",
+ bgcolor: "#FF0000",
border: `2.5px solid ${spaceAppBackgroundColor}`,
borderRadius: "50%",
height: 11.5,
diff --git a/web/apps/space/src/components/NotificationPermissionInstructions.tsx b/web/apps/space/src/components/NotificationPermissionInstructions.tsx
index 69143e729c..6ec6779416 100644
--- a/web/apps/space/src/components/NotificationPermissionInstructions.tsx
+++ b/web/apps/space/src/components/NotificationPermissionInstructions.tsx
@@ -36,7 +36,7 @@ export const SpaceNotificationPermissionInstructions: React.FC<
? [
"Open Settings",
'Tap "Notifications"',
- 'Tap "Ente Space" and turn on "Allow Notifications"',
+ 'Tap "Space" and turn on "Allow Notifications"',
]
: [
"Open your browser's site settings for Space",
diff --git a/web/apps/space/src/components/PostGrid.tsx b/web/apps/space/src/components/PostGrid.tsx
index 285b913089..9f0216400f 100644
--- a/web/apps/space/src/components/PostGrid.tsx
+++ b/web/apps/space/src/components/PostGrid.tsx
@@ -52,12 +52,10 @@ export const SpacePostGrid = <Item extends PostGridItem>({
(item.width && item.height
? item.width / item.height
: 1);
- const aspectRatio = fullWidth
- ? Math.max(
- minimumPostPhotoFrameAspectRatio,
- photoAspectRatio,
- )
- : photoAspectRatio;
+ const aspectRatio = Math.max(
+ minimumPostPhotoFrameAspectRatio,
+ photoAspectRatio,
+ );
const height = columnWidth / aspectRatio;
columnHeights[column] = top + height + gap;
return (
diff --git a/web/apps/space/src/components/PostPhotoStrip.tsx b/web/apps/space/src/components/PostPhotoStrip.tsx
index eacb142a14..98b88531fa 100644
--- a/web/apps/space/src/components/PostPhotoStrip.tsx
+++ b/web/apps/space/src/components/PostPhotoStrip.tsx
@@ -370,8 +370,10 @@ export const SpacePostPhotoStrip: React.FC<{
...iconButtonSx,
bgcolor: spaceControlBackground,
outline:
+ !photo.isLoading &&
+ photo.imageUrl &&
photo.id ==
- photos[activeIndex]?.id
+ photos[activeIndex]?.id
? "1.5px solid #FFFFFF"
: "none",
outlineOffset: "-1.5px",
diff --git a/web/apps/space/src/components/PostTile.tsx b/web/apps/space/src/components/PostTile.tsx
index 06f09cd906..c93f38bab1 100644
--- a/web/apps/space/src/components/PostTile.tsx
+++ b/web/apps/space/src/components/PostTile.tsx
@@ -161,12 +161,23 @@ export const SpacePostTile: React.FC<SpacePostTileProps> = ({
cursor: imageUrl && !isUnavailable ? "pointer" : "default",
display: "block",
height: "100%",
+ isolation: "isolate",
minWidth: 0,
opacity: 1,
overflow: "hidden",
p: 0,
position: "relative",
width: "100%",
+ "&::after": {
+ borderRadius: "inherit",
+ boxShadow: "inset 0 0 0 1px #282828",
+ content: '""',
+ inset: 0,
+ mixBlendMode: "lighten",
+ pointerEvents: "none",
+ position: "absolute",
+ zIndex: 2,
+ },
"&:focus-visible": {
outline: `2px solid ${green}`,
outlineOffset: -2,
diff --git a/web/apps/space/src/pages/_app.tsx b/web/apps/space/src/pages/_app.tsx
index 17e272e006..8870b11a5d 100644
--- a/web/apps/space/src/pages/_app.tsx
+++ b/web/apps/space/src/pages/_app.tsx
@@ -130,10 +130,10 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {
/>
<meta name="color-scheme" content="dark" />
<meta name="theme-color" content={spaceAppBackgroundColor} />
- <meta name="application-name" content="Ente Space" />
+ <meta name="application-name" content="Space" />
<meta name="mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-capable" content="yes" />
- <meta name="apple-mobile-web-app-title" content="Ente Space" />
+ <meta name="apple-mobile-web-app-title" content="Space" />
<meta
name="apple-mobile-web-app-status-bar-style"
content="black"
diff --git a/web/apps/space/src/pages/app/posts/[spaceId]/[postId].tsx b/web/apps/space/src/pages/app/posts/[spaceId]/[postId].tsx
index ecc3cfb87e..a9ffedde1b 100644
--- a/web/apps/space/src/pages/app/posts/[spaceId]/[postId].tsx
+++ b/web/apps/space/src/pages/app/posts/[spaceId]/[postId].tsx
@@ -4,10 +4,12 @@ import { SpaceRouteFallback } from "components/RouteFallback";
import log from "ente-base/log";
import React from "react";
import {
+ deleteCurrentPost,
loadCurrentSpacePost,
loadCurrentSpacePostAssetURL,
replyToCurrentPost,
setCurrentPostLiked,
+ updateCurrentPostCaption,
type SpacePost,
} from "services/space";
import { useSpaceAppState } from "state/app-state";
@@ -65,7 +67,13 @@ const viewerPhotoFromPost = (post: SpacePost) => ({
const Page: React.FC = () => {
const router = useSpaceRouter();
- const { profile, profileLoadError, profileLoadStatus } = useSpaceAppState();
+ const {
+ profile,
+ profileLoadError,
+ profileLoadStatus,
+ setLocalFeedPosts,
+ setPostPublication,
+ } = useSpaceAppState();
const pathParams = routeParamsFromPath();
const spaceId =
valueFromQuery(router.query.spaceId) ?? pathParams.spaceId ?? "";
@@ -201,6 +209,73 @@ const Page: React.FC = () => {
postActionMode={isOwnPost ? "hidden" : "like-only"}
onClose={closePost}
onOpenProfile={openOwnerProfile}
+ onDeletePost={
+ isOwnPost
+ ? async () => {
+ await deleteCurrentPost(actorSpaceId, postId);
+ setPostPublication((current) =>
+ current?.post.postId == postId
+ ? null
+ : current,
+ );
+ setLocalFeedPosts((currentPosts) =>
+ currentPosts.filter(
+ (item) =>
+ item.status == "pending" ||
+ item.status == "failed" ||
+ item.post.postId != postId,
+ ),
+ );
+ }
+ : undefined
+ }
+ onUpdatePostCaption={
+ isOwnPost
+ ? async (nextPostId, caption) => {
+ await updateCurrentPostCaption(
+ actorSpaceId,
+ nextPostId,
+ caption,
+ );
+ const normalizedCaption =
+ caption.trim() || undefined;
+ setPost((current) =>
+ current?.postId == nextPostId
+ ? {
+ ...current,
+ caption: normalizedCaption,
+ }
+ : current,
+ );
+ setPostPublication((current) =>
+ current?.post.postId == nextPostId
+ ? {
+ ...current,
+ post: {
+ ...current.post,
+ caption: normalizedCaption,
+ },
+ }
+ : current,
+ );
+ setLocalFeedPosts((currentPosts) =>
+ currentPosts.map((item) =>
+ (item.status == "posted" ||
+ item.status == "ready") &&
+ item.post.postId == nextPostId
+ ? {
+ ...item,
+ post: {
+ ...item.post,
+ caption: normalizedCaption,
+ },
+ }
+ : item,
+ ),
+ );
+ }
+ : undefined
+ }
onReplyToPost={
isOwnPost
? undefined
diff --git a/web/apps/space/src/pages/index.tsx b/web/apps/space/src/pages/index.tsx
index 26275b2940..ca5e009a40 100644
--- a/web/apps/space/src/pages/index.tsx
+++ b/web/apps/space/src/pages/index.tsx
@@ -522,7 +522,10 @@ export const Page: React.FC<PageProps> = ({ invitePreview }) => {
if (!publicIdentity && publicError) {
return (
<>
- <SpacePageMeta themeColor="#FFFFFF" preview="invite" />
+ <SpacePageMeta
+ themeColor={spaceAppBackgroundColor}
+ preview="invite"
+ />
<PublicProfileUnavailable />
</>
);
@@ -603,11 +606,7 @@ export const Page: React.FC<PageProps> = ({ invitePreview }) => {
return (
<>
<SpacePageMeta
- themeColor={
- publicLink || profile
- ? spaceAppBackgroundColor
- : "#FFFFFF"
- }
+ themeColor={spaceAppBackgroundColor}
title={profile && !publicLink ? "Add friend" : undefined}
preview="invite"
/>
@@ -686,7 +685,10 @@ export const Page: React.FC<PageProps> = ({ invitePreview }) => {
return (
<>
- <SpacePageMeta themeColor={onboardingGreen} preview="home" />
+ <SpacePageMeta
+ themeColor={spaceAppBackgroundColor}
+ preview="home"
+ />
<OnboardingScreen
onCreateAccount={() => void router.push(spaceRoutes.signup)}
onLogin={() => void router.push(spaceRoutes.login)}
diff --git a/web/apps/space/src/screens/FriendsScreen.tsx b/web/apps/space/src/screens/FriendsScreen.tsx
index eec850ab2b..471fc23818 100644
--- a/web/apps/space/src/screens/FriendsScreen.tsx
+++ b/web/apps/space/src/screens/FriendsScreen.tsx
@@ -12,7 +12,13 @@ import type { FriendProfile } from "data/friends";
import log from "ente-base/log";
import React, { useState } from "react";
import type { SpaceFriendRequest } from "services/space";
-import { spaceAppBackground, spaceSurface, spaceText } from "styles/colors";
+import { spaceEmptyStateButtonSx } from "styles/buttons";
+import {
+ spaceAppBackground,
+ spaceSurface,
+ spaceText,
+ spaceTextMuted,
+} from "styles/colors";
import { spaceTouchTargetSize } from "styles/touch-targets";
const green = "#08C225";
@@ -20,6 +26,32 @@ const avatarSkeletonBackground = spaceSurface;
const textBase = spaceText;
const friendAvatarLoadRootMargin = "800px 0px";
+const orbitGlassSx = {
+ isolation: "isolate",
+ overflow: "hidden",
+ position: "relative",
+ "&::after": {
+ content: '""',
+ borderRadius: "inherit",
+ inset: 0,
+ pointerEvents: "none",
+ position: "absolute",
+ zIndex: 1,
+ opacity: 0.9,
+ background:
+ "linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.75) 4%, transparent 24%, transparent 76%, rgba(230, 240, 255, 0.55) 96%, rgba(230, 240, 255, 0.75))",
+ mask: "radial-gradient(farthest-side, transparent 94%, #000 98%)",
+ animation: "spaceFriendGlassShimmer 12s ease-in-out infinite alternate",
+ },
+ "@keyframes spaceFriendGlassShimmer": {
+ from: { transform: "rotate(-5deg)", opacity: 0.85 },
+ to: { transform: "rotate(5deg)", opacity: 1 },
+ },
+ "@media (prefers-reduced-motion: reduce)": {
+ "&::after": { animation: "none" },
+ },
+} as const;
+
const friendAvatarCacheKey = (friend: FriendProfile) =>
[
friend.id,
@@ -127,6 +159,7 @@ const FriendIdentity: React.FC<FriendIdentityProps> = ({
<Box
ref={avatarRef}
sx={{
+ ...orbitGlassSx,
alignItems: "center",
bgcolor: avatarSkeletonBackground,
border: "1px solid #454545",
@@ -136,7 +169,6 @@ const FriendIdentity: React.FC<FriendIdentityProps> = ({
height: "auto",
aspectRatio: "1",
justifyContent: "center",
- overflow: "hidden",
width: "100%",
boxShadow: "0 8px 28px rgba(0, 0, 0, 0.2)",
}}
@@ -160,6 +192,7 @@ const FriendIdentity: React.FC<FriendIdentityProps> = ({
};
const orbitCircleSx = {
+ ...orbitGlassSx,
alignItems: "center",
bgcolor: spaceSurface,
border: "1px solid #454545",
@@ -392,7 +425,6 @@ export const FriendsScreen: React.FC<FriendsScreenProps> = ({
justifySelf: "flex-end",
p: 0,
width: spaceTouchTargetSize,
- "&:disabled": { opacity: 0.45 },
"&:focus-visible": {
outline: `2px solid ${green}`,
outlineOffset: 2,
@@ -435,7 +467,7 @@ export const FriendsScreen: React.FC<FriendsScreenProps> = ({
>
<SpaceLoadingSpinner ariaLabel="Loading friends" />
</Box>
- ) : (
+ ) : friends.length > 0 || friendRequests.length > 0 ? (
<FriendOrbit
items={[
...friends.map((friend) => ({
@@ -469,6 +501,49 @@ export const FriendsScreen: React.FC<FriendsScreenProps> = ({
})),
]}
/>
+ ) : (
+ <Box
+ sx={{
+ alignItems: "center",
+ color: spaceTextMuted,
+ display: "flex",
+ flexDirection: "column",
+ gap: "22px",
+ justifyContent: "center",
+ fontFamily:
+ '"Inter Variable", Inter, sans-serif',
+ fontSize: 14,
+ fontWeight: 500,
+ lineHeight: "20px",
+ pointerEvents: "none",
+ position: "absolute",
+ px: "24px",
+ textAlign: "center",
+ top: "calc(var(--space-viewport-height, 100svh) / 2)",
+ transform: "translateY(-50%)",
+ width: "100%",
+ }}
+ >
+ <Box component="p" sx={{ m: 0, maxWidth: 260 }}>
+ Invite your friends and family. Share everyday
+ photos and keep up with each other.
+ </Box>
+ <Box
+ className="green-bg"
+ component="button"
+ type="button"
+ aria-haspopup="dialog"
+ onClick={() => setIsAddFriendOpen(true)}
+ sx={spaceEmptyStateButtonSx}
+ >
+ <HugeiconsIcon
+ icon={UserAdd02Icon}
+ size={18}
+ strokeWidth={1.8}
+ />
+ Add friends
+ </Box>
+ </Box>
)}
</Box>
</Box>
diff --git a/web/apps/space/src/screens/HomeScreen.tsx b/web/apps/space/src/screens/HomeScreen.tsx
index 93ef5e3684..3d629ea445 100644
--- a/web/apps/space/src/screens/HomeScreen.tsx
+++ b/web/apps/space/src/screens/HomeScreen.tsx
@@ -1179,12 +1179,23 @@ const FeedItem: React.FC<FeedItemProps> = ({
aspectRatio: frameAspectRatio,
bgcolor: "transparent",
borderRadius: showFooter ? "24px 24px 0 0" : "24px",
+ isolation: "isolate",
maxWidth: "100%",
minWidth: 0,
overflow: "hidden",
position: "relative",
transition: "aspect-ratio 220ms ease",
width: "100%",
+ "&::after": {
+ borderRadius: "inherit",
+ boxShadow: "inset 0 0 0 1px #282828",
+ content: '""',
+ inset: 0,
+ mixBlendMode: "lighten",
+ pointerEvents: "none",
+ position: "absolute",
+ zIndex: 2,
+ },
"@media (prefers-reduced-motion: reduce)": {
transition: "none",
},
@@ -1897,20 +1908,6 @@ export const HomeScreen: React.FC<HomeScreenProps> = ({
);
const hasFeedItems =
latestFeedEntries.length > 0 || gridFeedItems.length > 0;
- const viewerPosts = [
- ...latestFeedEntries.flatMap((entry) =>
- entry.kind == "remote"
- ? [entry.item]
- : entry.item.status == "posted" || entry.item.status == "ready"
- ? [entry.item.post]
- : [],
- ),
- ...gridFeedItems,
- ].filter(
- (item) =>
- !item.isUnavailable &&
- !unavailableFeedPostsByKey[feedPostImageCacheKey(item)],
- );
const isEmptyFeedLoading = !hasFeedItems && isFeedLoading;
const showFeedCards = hasFeedItems;
const isInstallPromptEnabled =
@@ -2051,42 +2048,6 @@ export const HomeScreen: React.FC<HomeScreenProps> = ({
},
[loadedFeedAvatarURLFor, onLoadPostAvatar],
);
- const navigatePost = (direction: -1 | 1) => {
- const postIndex = viewerPosts.findIndex(
- (post) => post.postId == selectedViewer?.photo.postId,
- );
- const post = viewerPosts[postIndex + direction];
- if (!post) return false;
- const photo = viewerPhotosFromPost({
- ...post,
- avatarUrl: loadedFeedAvatarURLFor(post),
- })[0]!;
- openFeedPhoto(post, {
- ...photo,
- imageUrl:
- loadedFeedImageURLFor({
- ...spacePostPhotos(post)[0]!,
- postId: post.postId,
- spaceId: post.spaceId,
- }) ?? "",
- });
- setFeedPhotoIndices((current) => ({ ...current, [post.postId]: 0 }));
- void loadFeedPostAvatar(post).then((avatarUrl) => {
- setSelectedViewer((current) =>
- current?.photo.postId == post.postId
- ? {
- ...current,
- photo: { ...current.photo, avatarUrl },
- photos: current.photos.map((photo) => ({
- ...photo,
- avatarUrl,
- })),
- }
- : current,
- );
- });
- return true;
- };
const feedItemFor = (
item: SpacePost,
key: React.Key,
@@ -2633,7 +2594,6 @@ export const HomeScreen: React.FC<HomeScreenProps> = ({
onLoadPhoto={onLoadPostImage}
postActionMode={selectedViewer.postActionMode}
onClose={closeSelectedPhoto}
- onNavigatePost={navigatePost}
onOpenProfile={
selectedPhotoIsOwn && onOpenProfile
? () => {
diff --git a/web/apps/space/src/screens/MessagesScreen.tsx b/web/apps/space/src/screens/MessagesScreen.tsx
index cb91e31727..4d07c164f6 100644
--- a/web/apps/space/src/screens/MessagesScreen.tsx
+++ b/web/apps/space/src/screens/MessagesScreen.tsx
@@ -2905,12 +2905,14 @@ export const MessagesScreen: React.FC<MessagesScreenProps> = ({
display: "flex",
flexDirection: "column",
gap: "22px",
- inset: 0,
justifyContent: "center",
pointerEvents: "none",
position: "absolute",
px: 3,
textAlign: "center",
+ top: "calc(var(--space-viewport-height, 100svh) / 2)",
+ transform: "translateY(-50%)",
+ width: "100%",
}}
>
<Box
diff --git a/web/apps/space/src/screens/ProfileScreen.tsx b/web/apps/space/src/screens/ProfileScreen.tsx
index 3f8d5b6a9f..5ea323f7d7 100644
--- a/web/apps/space/src/screens/ProfileScreen.tsx
+++ b/web/apps/space/src/screens/ProfileScreen.tsx
@@ -328,9 +328,7 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({
!item.isUnavailable &&
!unavailablePostsByKey[profilePostImageCacheKey(item)],
);
- const viewerPostIndexByID = new Map(
- viewerPostItems.map((item, index) => [item.id, index]),
- );
+ const viewerPostIDs = new Set(viewerPostItems.map((item) => item.id));
const postsSharedCount = visiblePostItems.length;
const displayedPostsCount = postsCount ?? postsSharedCount;
const canOpenFriends = isOwnerProfile && Boolean(onOpenFriends);
@@ -511,38 +509,30 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({
[loadedPhotoDimensionsByID],
);
- const profileViewerPhotos = viewerPostItems.map((item) =>
+ const profileViewerPhotos = viewerPostItems.flatMap((item) =>
viewerPhotosFromPost({
...item,
...dimensionsForPost(item),
avatarUrl: profile.avatarUrl,
imageUrl: loadedPostImageURLFor(item),
name: displayName,
- }),
+ }).map((photo) => ({ ...photo, id: item.id })),
);
- const selectedPostIndex = selectedPost
- ? viewerPostIndexByID.get(selectedPost.id)
- : undefined;
- const selectedPostPhotos =
- selectedPostIndex == undefined
- ? undefined
- : profileViewerPhotos[selectedPostIndex];
+ const selectedPhotoIndex = selectedPost
+ ? profileViewerPhotos.findIndex(
+ (photo) =>
+ photo.id == selectedPost.id &&
+ photo.postPhotoIndex == selectedPost.photoIndex,
+ )
+ : 0;
const handleSelectedPostIndexChange = (photoIndex: number) => {
- const photo = selectedPostPhotos?.[photoIndex];
- if (photo && selectedPost)
- setSelectedPost({ ...selectedPost, photo, photoIndex });
- };
- const navigatePost = (direction: -1 | 1) => {
- if (selectedPostIndex == undefined) return false;
- const postIndex = selectedPostIndex + direction;
- const item = viewerPostItems[postIndex];
- if (!item) return false;
- setSelectedPost({
- id: item.id,
- photo: profileViewerPhotos[postIndex]![0]!,
- photoIndex: 0,
- });
- return true;
+ const photo = profileViewerPhotos[photoIndex];
+ if (photo)
+ setSelectedPost({
+ id: photo.id,
+ photo,
+ photoIndex: photo.postPhotoIndex!,
+ });
};
const shareInvite = async () => {
@@ -579,7 +569,7 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({
const renderPostTile = (item: ProfilePostItem, index: number) => {
const imageUrl = loadedPostImageURLFor(item);
- const isUnavailable = !viewerPostIndexByID.has(item.id);
+ const isUnavailable = !viewerPostIDs.has(item.id);
return (
<SpacePostTile
key={item.id}
@@ -597,15 +587,14 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({
}))
}
onOpen={(openedImageUrl) => {
- const postIndex = viewerPostIndexByID.get(item.id);
- if (postIndex == undefined) return;
+ const photo = profileViewerPhotos.find(
+ (photo) => photo.id == item.id,
+ );
+ if (!photo) return;
setSelectedPost({
id: item.id,
photoIndex: 0,
- photo: {
- ...profileViewerPhotos[postIndex]![0]!,
- imageUrl: openedImageUrl,
- },
+ photo: { ...photo, imageUrl: openedImageUrl },
});
}}
onRememberDimensions={rememberLoadedPhotoDimensions}
@@ -1417,13 +1406,12 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({
<SpaceFileViewer
closeOnSwipePastEnd
photo={selectedPost.photo}
- photos={selectedPostPhotos}
- photoIndex={selectedPost.photoIndex}
+ photos={profileViewerPhotos}
+ photoIndex={selectedPhotoIndex}
onPhotoIndexChange={handleSelectedPostIndexChange}
onLoadPhoto={onLoadPostImage}
postActionMode={selectedPostActionMode}
onClose={closeSelectedPost}
- onNavigatePost={navigatePost}
onAddFriendForPostAction={
isPublicProfile
? onAddFriendForPostAction
diff --git a/web/apps/space/src/state/AppStateProvider.tsx b/web/apps/space/src/state/AppStateProvider.tsx
index c9a20a8d1c..8154b04622 100644
--- a/web/apps/space/src/state/AppStateProvider.tsx
+++ b/web/apps/space/src/state/AppStateProvider.tsx
@@ -184,11 +184,7 @@ export const SpaceAppStateProvider: React.FC<React.PropsWithChildren> = ({
},
};
const prepared: PreparedSpacePostMedia[] = [];
- const videoCount = images.filter((image) => image.video).length;
- const mediaCounts = {
- photo: images.length - videoCount,
- video: videoCount,
- };
+ const hasVideo = images.some((image) => image.video);
const session: SpacePostUploadSession = {
requestId: crypto.randomUUID(),
uploads: [],
@@ -220,23 +216,18 @@ export const SpaceAppStateProvider: React.FC<React.PropsWithChildren> = ({
);
pending = (async () => {
try {
- const processingCounts = { photo: 0, video: 0 };
for (const [index, image] of images.entries()) {
signal.throwIfAborted();
- const mediaType = image.video ? "video" : "photo";
- const mediaIndex = ++processingCounts[mediaType];
if (prepared[index]) continue;
- if (videoCount > 0 || images.length >= 3) {
- const count = mediaCounts[mediaType];
- const processing =
- images.length == 1
- ? "Processing"
- : `Processing ${mediaType}${count > 1 ? ` ${mediaIndex}/${count}` : ""}`;
+ if (hasVideo) {
setLocalFeedPosts((current) =>
current.map((item) =>
item.id == localPostId &&
item.status == "pending"
- ? { ...item, processing }
+ ? {
+ ...item,
+ processing: "Processing",
+ }
: item,
),
);
diff --git a/web/apps/space/src/styles/globals.css b/web/apps/space/src/styles/globals.css
index f134154ac3..c3e13860c4 100644
--- a/web/apps/space/src/styles/globals.css
+++ b/web/apps/space/src/styles/globals.css
@@ -62,10 +62,10 @@
html[data-space-route-motion]::view-transition-old(root),
html[data-space-route-motion]::view-transition-new(root) {
- animation-duration: 180ms;
+ animation-duration: 220ms;
animation-fill-mode: both;
- animation-timing-function: cubic-bezier(0.2, 0, 0, 1);
- mix-blend-mode: normal;
+ animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
+ mix-blend-mode: plus-lighter;
}
html[data-space-route-motion]::view-transition-old(root) {
diff --git a/web/apps/space/src/utils/activity-sections.ts b/web/apps/space/src/utils/activity-sections.ts
index cd6fe34b81..df4f345cee 100644
--- a/web/apps/space/src/utils/activity-sections.ts
+++ b/web/apps/space/src/utils/activity-sections.ts
@@ -13,29 +13,16 @@ export const groupSpaceActivities = <T>(
today.getMonth(),
today.getDate() - 1,
).getTime();
- const mondayDate = today.getDate() - ((today.getDay() + 6) % 7);
- const startOfThisWeekMs = new Date(
+ const startOfLast7DaysMs = new Date(
today.getFullYear(),
today.getMonth(),
- mondayDate,
- ).getTime();
- const startOfLastWeekMs = new Date(
- today.getFullYear(),
- today.getMonth(),
- mondayDate - 7,
- ).getTime();
- const startOfThisMonthMs = new Date(
- today.getFullYear(),
- today.getMonth(),
- 1,
+ today.getDate() - 7,
).getTime();
const sections: { title: string; items: T[] }[] = [
{ title: "New", items: [] },
{ title: "Today", items: [] },
{ title: "Yesterday", items: [] },
- { title: "This week", items: [] },
- { title: "Last week", items: [] },
- { title: "This month", items: [] },
+ { title: "Last 7 days", items: [] },
{ title: "Earlier", items: [] },
];
for (const item of items) {
@@ -46,13 +33,9 @@ export const groupSpaceActivities = <T>(
? 1
: createdAtMs >= startOfYesterdayMs
? 2
- : createdAtMs >= startOfThisWeekMs
+ : createdAtMs >= startOfLast7DaysMs
? 3
- : createdAtMs >= startOfLastWeekMs
- ? 4
- : createdAtMs >= startOfThisMonthMs
- ? 5
- : 6;
+ : 4;
sections[index]!.items.push(item);
}
return sections;
diff --git a/web/apps/space/src/utils/post-photos.ts b/web/apps/space/src/utils/post-photos.ts
index 1eecb4d776..fd718315bf 100644
--- a/web/apps/space/src/utils/post-photos.ts
+++ b/web/apps/space/src/utils/post-photos.ts
@@ -25,7 +25,7 @@ export const spacePostFrameAspectRatio = (
photo.height &&
Math.abs(photo.width / photo.height / aspectRatio - 1) < 0.01,
)
- ? aspectRatio
+ ? Math.max(minimumPostPhotoFrameAspectRatio, aspectRatio)
: 1;
};
diff --git a/web/apps/space/tests/activity-sections.test.ts b/web/apps/space/tests/activity-sections.test.ts
index 92db5eaeb9..44fe71cece 100644
--- a/web/apps/space/tests/activity-sections.test.ts
+++ b/web/apps/space/tests/activity-sections.test.ts
@@ -23,18 +23,18 @@ test("new activity takes priority and history follows local calendar boundaries"
isNew: false,
},
{
- id: "this-week",
+ id: "two-days-ago",
createdAtMs: new Date(2026, 9, 19).getTime(),
isNew: false,
},
{
- id: "last-week",
- createdAtMs: new Date(2026, 9, 12).getTime(),
+ id: "seven-days-ago",
+ createdAtMs: new Date(2026, 9, 14).getTime(),
isNew: false,
},
{
- id: "this-month",
- createdAtMs: new Date(2026, 9, 1).getTime(),
+ id: "before-seven-days",
+ createdAtMs: new Date(2026, 9, 13, 23, 59, 59, 999).getTime(),
isNew: false,
},
{
@@ -52,19 +52,17 @@ test("new activity takes priority and history follows local calendar boundaries"
{ title: "New", ids: ["old-unread"] },
{ title: "Today", ids: ["today"] },
{ title: "Yesterday", ids: ["yesterday"] },
- { title: "This week", ids: ["this-week"] },
- { title: "Last week", ids: ["last-week"] },
- { title: "This month", ids: ["this-month"] },
- { title: "Earlier", ids: ["earlier"] },
+ { title: "Last 7 days", ids: ["two-days-ago", "seven-days-ago"] },
+ { title: "Earlier", ids: ["before-seven-days", "earlier"] },
]);
});
test.each([
{
- name: "Sunday stays in the current week",
+ name: "seven-day range crosses calendar weeks",
now: new Date(2026, 9, 25, 12),
- dates: [new Date(2026, 9, 19), new Date(2026, 9, 18, 23, 59)],
- titles: ["This week", "Last week"],
+ dates: [new Date(2026, 9, 18), new Date(2026, 9, 17, 23, 59)],
+ titles: ["Last 7 days", "Earlier"],
},
{
name: "yesterday takes priority when Monday crosses a year boundary",
@@ -75,18 +73,18 @@ test.each([
new Date(2026, 11, 28),
new Date(2026, 11, 27, 23, 59),
],
- titles: ["Yesterday", "Last week", "Last week", "Earlier"],
+ titles: ["Yesterday", "Last 7 days", "Last 7 days", "Earlier"],
},
{
- name: "calendar weeks span month and daylight-saving boundaries",
+ name: "seven-day range spans month and daylight-saving boundaries",
now: new Date(2026, 10, 4, 12),
dates: [
new Date(2026, 10, 2),
new Date(2026, 10, 1),
- new Date(2026, 9, 26),
- new Date(2026, 9, 25, 23, 59),
+ new Date(2026, 9, 28),
+ new Date(2026, 9, 27, 23, 59),
],
- titles: ["This week", "Last week", "Last week", "Earlier"],
+ titles: ["Last 7 days", "Last 7 days", "Last 7 days", "Earlier"],
},
])("$name", ({ now, dates, titles }) => {
vi.useFakeTimers();
diff --git a/web/apps/space/tests/post-photos.test.ts b/web/apps/space/tests/post-photos.test.ts
index 5d9ad45fda..871f25e131 100644
--- a/web/apps/space/tests/post-photos.test.ts
+++ b/web/apps/space/tests/post-photos.test.ts
@@ -4,7 +4,7 @@ import {
viewerPhotosFromPost,
} from "../src/utils/post-photos";
-test("matching portrait videos use their full frame before and after publication", () => {
+test("matching tall portraits use a 3:4 preview before and after publication", () => {
const drafts = [
{ width: 1440, height: 2560 },
{ width: 720, height: 1280 },
@@ -12,8 +12,8 @@ test("matching portrait videos use their full frame before and after publication
];
const published = drafts.map(() => ({ width: 576, height: 1024 }));
- expect(spacePostFrameAspectRatio(drafts)).toBe(9 / 16);
- expect(spacePostFrameAspectRatio(published)).toBe(9 / 16);
+ expect(spacePostFrameAspectRatio(drafts)).toBe(3 / 4);
+ expect(spacePostFrameAspectRatio(published)).toBe(3 / 4);
});
test.each([0, 1, 2])(
@@ -44,6 +44,18 @@ test("a single portrait keeps the feed height limit", () => {
);
});
+test.each([
+ { width: 900, height: 1200 },
+ { width: 960, height: 1200 },
+ { width: 1200, height: 1200 },
+ { width: 1600, height: 900 },
+])("previews preserve wider ratios $width Γ— $height", (photo) => {
+ expect(spacePostFrameAspectRatio([photo])).toBe(photo.width / photo.height);
+ expect(spacePostFrameAspectRatio([photo, photo])).toBe(
+ photo.width / photo.height,
+ );
+});
+
test("matching ratios tolerate rounding during resizing", () => {
expect(
spacePostFrameAspectRatio([
@@ -97,6 +109,7 @@ test("profile navigation groups photos under their post and resets each counter"
});
test.each([
+ { width: 720, height: 1280 },
{ width: 800, height: 1200 },
{ width: 800, height: 800 },
])("preserves measured cover dimensions $width Γ— $height", (dimensions) => {