Skip to content

armgit / ente

Public Imported from GitHub
0

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

Update Space home layout

Anand Baburajan3c89e09769bc
diff --git a/web/apps/space/src/components/HomeHeader.tsx b/web/apps/space/src/components/HomeHeader.tsx
new file mode 100644
index 0000000000..5656d491e9
--- /dev/null
+++ b/web/apps/space/src/components/HomeHeader.tsx
@@ -0,0 +1,251 @@
+import { BubbleChatIcon } from "@hugeicons/core-free-icons";
+import { HugeiconsIcon } from "@hugeicons/react";
+import { Box, Skeleton } from "@mui/material";
+import { SpaceAvatarImage } from "components/AvatarImage";
+import React from "react";
+import type { SetupProfile } from "screens/SetupProfileScreen";
+import { spaceAppBackgroundColor, spaceText } from "styles/colors";
+import { spaceTouchTargetSize } from "styles/touch-targets";
+
+const green = "#08C225";
+const dangerColor = "#F63A3A";
+const headerActionSize = spaceTouchTargetSize;
+const headerAvatarSize = 36;
+const headerAvatarImageSize = 26;
+const headerChatCircleSize = 36;
+const headerChromeColor = "#F0F0F0";
+const headerIconSize = 22;
+const headerSideWidth = 36;
+const mediaPlaceholderColor = "#E5E7EA";
+const avatarFadeSx = {
+ "@keyframes spaceAvatarFade": { from: { opacity: 0 }, to: { opacity: 1 } },
+ animation: "spaceAvatarFade 320ms cubic-bezier(0.22, 1, 0.36, 1) both",
+ "@media (prefers-reduced-motion: reduce)": { animation: "none" },
+} as const;
+
+export const spaceHomeHeaderHeight = 64;
+
+interface SpaceHomeHeaderProps {
+ children?: React.ReactNode;
+ onOpenMessages?: () => void;
+ onOpenProfile?: () => void;
+ profile: SetupProfile | null;
+ showUnreadIndicator?: boolean;
+}
+
+export const SpaceHomeHeader: React.FC<SpaceHomeHeaderProps> = ({
+ children,
+ onOpenMessages,
+ onOpenProfile,
+ profile,
+ showUnreadIndicator = false,
+}) => (
+ <Box
+ component="header"
+ sx={{
+ alignItems: "center",
+ background: "transparent",
+ boxSizing: "border-box",
+ color: spaceText,
+ display: "grid",
+ gap: "12px",
+ gridTemplateColumns: `${headerSideWidth}px minmax(0, 1fr) ${headerSideWidth}px`,
+ height: spaceHomeHeaderHeight,
+ maxWidth: "100%",
+ pb: 2,
+ position: "relative",
+ pt: 1.5,
+ px: 2,
+ width: "100%",
+ zIndex: 4,
+ "&::before": {
+ WebkitBackdropFilter: "blur(4px)",
+ WebkitMaskImage:
+ "linear-gradient(to bottom, #000 0%, transparent 100%)",
+ backdropFilter: "blur(4px)",
+ background: `linear-gradient(to bottom, ${spaceAppBackgroundColor}, rgba(255, 255, 255, 0.35) 75%, transparent)`,
+ content: '""',
+ height: "calc(100% + 28px)",
+ left: 0,
+ maskImage:
+ "linear-gradient(to bottom, #000 0%, transparent 100%)",
+ pointerEvents: "none",
+ position: "absolute",
+ right: 0,
+ top: 0,
+ zIndex: -1,
+ },
+ "@media (min-width: 600px)": { maxWidth: 390 },
+ }}
+ >
+ {children}
+ <Box
+ component="button"
+ type="button"
+ aria-label="Open profile"
+ onClick={onOpenProfile}
+ sx={{
+ appearance: "none",
+ alignItems: "center",
+ bgcolor: "transparent",
+ border: 0,
+ borderRadius: "50%",
+ boxSizing: "border-box",
+ color: green,
+ cursor: onOpenProfile ? "pointer" : "default",
+ display: "flex",
+ height: headerActionSize,
+ justifyContent: "center",
+ lineHeight: 0,
+ ml: "-6px",
+ overflow: "hidden",
+ p: 0,
+ placeSelf: "center start",
+ width: headerActionSize,
+ }}
+ >
+ <Box
+ sx={{
+ alignItems: "center",
+ bgcolor: "transparent",
+ border: `2.5px solid ${headerChromeColor}`,
+ borderRadius: "50%",
+ boxSizing: "border-box",
+ display: "flex",
+ height: headerAvatarSize,
+ justifyContent: "center",
+ overflow: "hidden",
+ p: "2.5px",
+ width: headerAvatarSize,
+ }}
+ >
+ {profile && (profile.avatarUrl || !profile.avatarObjectID) ? (
+ <Box
+ key={profile.avatarUrl ?? "default-avatar"}
+ sx={{
+ ...avatarFadeSx,
+ borderRadius: "50%",
+ height: headerAvatarImageSize,
+ overflow: "hidden",
+ width: headerAvatarImageSize,
+ }}
+ >
+ <SpaceAvatarImage src={profile.avatarUrl} />
+ </Box>
+ ) : (
+ <Skeleton
+ variant="circular"
+ sx={{
+ bgcolor: mediaPlaceholderColor,
+ height: headerAvatarImageSize,
+ transform: "none",
+ width: headerAvatarImageSize,
+ }}
+ />
+ )}
+ </Box>
+ </Box>
+ <Box
+ sx={{
+ alignItems: "center",
+ alignSelf: "center",
+ bgcolor: headerChromeColor,
+ borderRadius: "999px",
+ boxSizing: "border-box",
+ display: "flex",
+ height: 36,
+ justifyContent: "center",
+ justifySelf: "center",
+ lineHeight: 0,
+ minWidth: 0,
+ overflow: "visible",
+ placeSelf: "center",
+ px: "16px",
+ }}
+ >
+ <Box
+ component="img"
+ alt="Space"
+ src="/images/space.svg"
+ sx={{
+ display: "block",
+ filter: "invert(1)",
+ height: 18,
+ width: "auto",
+ }}
+ />
+ </Box>
+ <Box
+ component="button"
+ type="button"
+ aria-label={
+ showUnreadIndicator
+ ? "Open messages with unread activity"
+ : "Open messages"
+ }
+ onClick={onOpenMessages}
+ sx={{
+ appearance: "none",
+ alignItems: "center",
+ bgcolor: "transparent",
+ border: 0,
+ boxSizing: "border-box",
+ color: spaceText,
+ cursor: onOpenMessages ? "pointer" : "default",
+ display: "flex",
+ fontSize: 0,
+ height: headerActionSize,
+ justifyContent: "center",
+ justifySelf: "end",
+ lineHeight: 0,
+ mr: "-6px",
+ p: 0,
+ position: "relative",
+ width: headerActionSize,
+ "& svg": { display: "block" },
+ "&:focus-visible": {
+ borderRadius: "50%",
+ outline: `2px solid ${green}`,
+ outlineOffset: 2,
+ },
+ }}
+ >
+ <Box
+ aria-hidden
+ sx={{
+ alignItems: "center",
+ bgcolor: headerChromeColor,
+ borderRadius: "50%",
+ display: "flex",
+ height: headerChatCircleSize,
+ justifyContent: "center",
+ position: "relative",
+ width: headerChatCircleSize,
+ "& svg path:first-of-type": { display: "none" },
+ }}
+ >
+ <HugeiconsIcon
+ icon={BubbleChatIcon}
+ size={headerIconSize}
+ strokeWidth={2.5}
+ />
+ {showUnreadIndicator && (
+ <Box
+ sx={{
+ bgcolor: dangerColor,
+ border: `2px solid ${headerChromeColor}`,
+ borderRadius: "50%",
+ boxSizing: "border-box",
+ height: 11,
+ position: "absolute",
+ right: 5.5,
+ top: 6,
+ width: 11,
+ zIndex: 1,
+ }}
+ />
+ )}
+ </Box>
+ </Box>
+ </Box>
+);
diff --git a/web/apps/space/src/pages/layout-demo.tsx b/web/apps/space/src/pages/layout-demo.tsx
index e54ac76416..464b6903c2 100644
--- a/web/apps/space/src/pages/layout-demo.tsx
+++ b/web/apps/space/src/pages/layout-demo.tsx
@@ -1,9 +1,11 @@
import { ArrowLeft02Icon, ArrowRight01Icon } from "@hugeicons/core-free-icons";
import { HugeiconsIcon } from "@hugeicons/react";
import { Box } from "@mui/material";
+import { SpaceHomeHeader, spaceHomeHeaderHeight } from "components/HomeHeader";
import { SpacePostFloatingActionButton } from "components/PostFloatingActionButton";
import React from "react";
import { FriendPostCircle } from "screens/HomeScreen";
+import { useSpaceAppState } from "state/app-state";
import { spaceAppBackground, spaceSurface, spaceText } from "styles/colors";
import {
homeCircleGridLayout,
@@ -11,9 +13,10 @@ import {
usesHomeCircleGrid,
type HomeCirclePlacement,
} from "utils/home-circle-layout";
+import { useSpaceRouter } from "utils/route-transitions";
+import { spaceRoutes } from "utils/routes";
-const headerChromeColor = spaceSurface;
-const headerHeight = 64;
+const controlButtonColor = spaceSurface;
const maximumFriendCount = 15;
interface CanvasSize {
@@ -49,6 +52,8 @@ const LayoutDemoPost: React.FC<LayoutDemoPostProps> = ({
);
const LayoutDemoPage: React.FC = () => {
+ const router = useSpaceRouter();
+ const { profile } = useSpaceAppState();
const [friendCount, setFriendCount] = React.useState(1);
const [canvasSize, setCanvasSize] = React.useState<CanvasSize>({
height: 0,
@@ -122,14 +127,75 @@ const LayoutDemoPage: React.FC = () => {
"@media (min-width: 600px)": { maxWidth: 390 },
}}
>
+ <SpaceHomeHeader
+ profile={profile}
+ onOpenMessages={() =>
+ void router.push(spaceRoutes.messages)
+ }
+ onOpenProfile={
+ profile
+ ? () => void router.push(spaceRoutes.profile)
+ : undefined
+ }
+ />
<Box
- component="header"
sx={{
- alignItems: "center",
- display: "grid",
- gridTemplateColumns: "48px minmax(0, 1fr) 48px",
- height: headerHeight,
- px: "10px",
+ boxSizing: "border-box",
+ display: "flex",
+ flexDirection: "column",
+ height: `calc(100svh - ${spaceHomeHeaderHeight}px)`,
+ minWidth: 0,
+ pb: "calc(env(safe-area-inset-bottom) + 112px)",
+ px: "16px",
+ pt: `calc(env(safe-area-inset-bottom) + 112px - ${spaceHomeHeaderHeight}px)`,
+ width: "100%",
+ }}
+ >
+ <Box
+ ref={canvasRef}
+ sx={{
+ display: usesGrid ? "grid" : "block",
+ flex: "1 1 auto",
+ gap: gridLayout ? `${gridLayout.gap}px` : undefined,
+ gridTemplateColumns: gridLayout
+ ? `repeat(3, ${gridLayout.size}px)`
+ : undefined,
+ gridTemplateRows: gridLayout
+ ? `repeat(${gridLayout.rows}, ${gridLayout.size}px)`
+ : undefined,
+ minHeight: 0,
+ placeContent: usesGrid ? "center" : undefined,
+ position: "relative",
+ width: "100%",
+ }}
+ >
+ {usesGrid && gridLayout
+ ? Array.from(
+ { length: friendCount },
+ (_, index) => (
+ <LayoutDemoPost
+ key={index}
+ index={index}
+ />
+ ),
+ )
+ : placements.map((placement, index) => (
+ <LayoutDemoPost
+ key={index}
+ index={index}
+ placement={placement}
+ />
+ ))}
+ </Box>
+ </Box>
+ <Box
+ sx={{
+ bottom: "calc(env(safe-area-inset-bottom) + 20px)",
+ display: "flex",
+ gap: "8px",
+ left: "max(20px, calc((100vw - 390px) / 2 + 20px))",
+ position: "fixed",
+ zIndex: 5,
}}
>
<Box
@@ -143,7 +209,7 @@ const LayoutDemoPage: React.FC = () => {
sx={{
alignItems: "center",
appearance: "none",
- bgcolor: headerChromeColor,
+ bgcolor: controlButtonColor,
border: 0,
borderRadius: "50%",
color: spaceText,
@@ -162,30 +228,6 @@ const LayoutDemoPage: React.FC = () => {
strokeWidth={2.2}
/>
</Box>
- <Box
- sx={{
- alignItems: "center",
- bgcolor: headerChromeColor,
- borderRadius: "999px",
- display: "flex",
- fontFamily: '"Inter Variable", Inter, sans-serif',
- height: 36,
- justifySelf: "center",
- px: "15px",
- }}
- >
- <Box
- component="img"
- alt="Space"
- src="/images/space.svg"
- sx={{
- display: "block",
- filter: "invert(1)",
- height: 18,
- width: "auto",
- }}
- />
- </Box>
<Box
component="button"
type="button"
@@ -199,7 +241,7 @@ const LayoutDemoPage: React.FC = () => {
sx={{
alignItems: "center",
appearance: "none",
- bgcolor: headerChromeColor,
+ bgcolor: controlButtonColor,
border: 0,
borderRadius: "50%",
color: spaceText,
@@ -210,7 +252,6 @@ const LayoutDemoPage: React.FC = () => {
display: "flex",
height: 36,
justifyContent: "center",
- justifySelf: "end",
opacity:
friendCount == maximumFriendCount ? 0.3 : 1,
p: 0,
@@ -224,56 +265,6 @@ const LayoutDemoPage: React.FC = () => {
/>
</Box>
</Box>
- <Box
- sx={{
- boxSizing: "border-box",
- display: "flex",
- flexDirection: "column",
- height: `calc(100svh - ${headerHeight}px)`,
- minWidth: 0,
- pb: "calc(env(safe-area-inset-bottom) + 112px)",
- pt: `calc(env(safe-area-inset-bottom) + 112px - ${headerHeight}px)`,
- px: "16px",
- width: "100%",
- }}
- >
- <Box
- ref={canvasRef}
- sx={{
- display: usesGrid ? "grid" : "block",
- flex: "1 1 auto",
- gap: gridLayout ? `${gridLayout.gap}px` : undefined,
- gridTemplateColumns: gridLayout
- ? `repeat(3, ${gridLayout.size}px)`
- : undefined,
- gridTemplateRows: gridLayout
- ? `repeat(${gridLayout.rows}, ${gridLayout.size}px)`
- : undefined,
- minHeight: 0,
- placeContent: usesGrid ? "center" : undefined,
- position: "relative",
- width: "100%",
- }}
- >
- {usesGrid && gridLayout
- ? Array.from(
- { length: friendCount },
- (_, index) => (
- <LayoutDemoPost
- key={index}
- index={index}
- />
- ),
- )
- : placements.map((placement, index) => (
- <LayoutDemoPost
- key={index}
- index={index}
- placement={placement}
- />
- ))}
- </Box>
- </Box>
<SpacePostFloatingActionButton />
</Box>
</Box>
diff --git a/web/apps/space/src/screens/HomeScreen.tsx b/web/apps/space/src/screens/HomeScreen.tsx
index ba5d6e2b7a..3bfa7190e2 100644
--- a/web/apps/space/src/screens/HomeScreen.tsx
+++ b/web/apps/space/src/screens/HomeScreen.tsx
@@ -1,4 +1,4 @@
-import { BubbleChatIcon, UserAdd02Icon } from "@hugeicons/core-free-icons";
+import { UserAdd02Icon } from "@hugeicons/core-free-icons";
import { HugeiconsIcon } from "@hugeicons/react";
import { Box, Skeleton } from "@mui/material";
import {
@@ -12,6 +12,7 @@ import {
type SpaceViewerPhoto,
type SpaceViewerPostActionMode,
} from "components/FileViewer";
+import { SpaceHomeHeader, spaceHomeHeaderHeight } from "components/HomeHeader";
import { SpacePostFloatingActionButton } from "components/PostFloatingActionButton";
import {
SpacePostBadge,
@@ -32,13 +33,7 @@ import {
type SpacePost,
type SpacePostAssetURLLoader,
} from "services/space";
-import {
- spaceAppBackground,
- spaceAppBackgroundColor,
- spaceText,
- spaceTextMuted,
-} from "styles/colors";
-import { spaceTouchTargetSize } from "styles/touch-targets";
+import { spaceAppBackground, spaceText, spaceTextMuted } from "styles/colors";
import { firstNameFrom } from "utils/display";
import {
homeCircleGridLayout,
@@ -59,28 +54,14 @@ import { thumbHashDataURLFromBase64 } from "utils/thumbhash";
const green = "#08C225";
const textBase = spaceText;
const textSecondary = spaceTextMuted;
-const dangerColor = "#F63A3A";
-const headerActionSize = spaceTouchTargetSize;
-const headerAvatarSize = 36;
-const headerAvatarImageSize = 26;
-const headerChatCircleSize = 36;
-const headerChromeColor = "#F0F0F0";
const avatarFallbackColor = "#888888";
const avatarFallbackTextColor = "#FFFFFF";
const mediaPlaceholderColor = "#E5E7EA";
-const headerHeight = 64;
-const headerIconSize = 22;
-const headerSideWidth = 36;
const homeHorizontalPadding = "16px";
const postCircleMediaLoadRootMargin = "640px 0px";
const waveAnimationDurationMs = 1100;
const waveHoldDurationMs = 500;
const waveHoldMovementTolerancePx = 12;
-const avatarFadeSx = {
- "@keyframes spaceAvatarFade": { from: { opacity: 0 }, to: { opacity: 1 } },
- animation: "spaceAvatarFade 320ms cubic-bezier(0.22, 1, 0.36, 1) both",
- "@media (prefers-reduced-motion: reduce)": { animation: "none" },
-} as const;
interface HomeScreenProps {
latestPosts: SpacePost[];
unreadPosts: SpacePost[];
@@ -334,7 +315,7 @@ export const FriendPostCircle: React.FC<FriendPostCircleProps> = ({
isLoading ||
(isRequestPending && !onOpenFriendRequest) ||
Boolean(post && !postUnavailable && !isPhotoReady);
- const avatarSize = placement ? Math.min(32, placement.size * 0.2) : "20%";
+ const avatarSize = placement ? Math.min(36, placement.size * 0.22) : "22%";
const hasMediaToLoad =
isAvatarPending || Boolean(post && !postUnavailable && !imageUrl);
@@ -708,8 +689,8 @@ export const FriendPostCircle: React.FC<FriendPostCircleProps> = ({
cursor: canOpenFriend ? "pointer" : "default",
height: avatarSize,
left: "10%",
- maxHeight: 32,
- maxWidth: 32,
+ maxHeight: 36,
+ maxWidth: 36,
overflow: "hidden",
p: 0,
position: "absolute",
@@ -1452,43 +1433,11 @@ export const HomeScreen: React.FC<HomeScreenProps> = ({
"@media (min-width: 600px)": { maxWidth: 390 },
}}
>
- <Box
- component="header"
- sx={{
- alignItems: "center",
- background: "transparent",
- boxSizing: "border-box",
- display: "grid",
- gap: "12px",
- gridTemplateColumns: `${headerSideWidth}px minmax(0, 1fr) ${headerSideWidth}px`,
- height: headerHeight,
- color: textBase,
- maxWidth: "100%",
- pb: 2,
- position: "relative",
- pt: 1.5,
- px: 2,
- width: "100%",
- zIndex: 4,
- "&::before": {
- WebkitBackdropFilter: "blur(4px)",
- WebkitMaskImage:
- "linear-gradient(to bottom, #000 0%, transparent 100%)",
- backdropFilter: "blur(4px)",
- background: `linear-gradient(to bottom, ${spaceAppBackgroundColor}, rgba(255, 255, 255, 0.35) 75%, transparent)`,
- content: '""',
- height: "calc(100% + 28px)",
- left: 0,
- maskImage:
- "linear-gradient(to bottom, #000 0%, transparent 100%)",
- pointerEvents: "none",
- position: "absolute",
- right: 0,
- top: 0,
- zIndex: -1,
- },
- "@media (min-width: 600px)": { maxWidth: 390 },
- }}
+ <SpaceHomeHeader
+ profile={profile}
+ showUnreadIndicator={showUnreadIndicator}
+ onOpenMessages={onOpenMessages}
+ onOpenProfile={onOpenProfile}
>
<Box
ref={postInputRef}
@@ -1498,186 +1447,17 @@ export const HomeScreen: React.FC<HomeScreenProps> = ({
onChange={handlePostPhotoSelect}
sx={{ display: "none" }}
/>
- <Box
- component="button"
- type="button"
- aria-label="Open profile"
- onClick={onOpenProfile}
- sx={{
- appearance: "none",
- alignItems: "center",
- bgcolor: "transparent",
- border: 0,
- borderRadius: "50%",
- boxSizing: "border-box",
- color: green,
- cursor: onOpenProfile ? "pointer" : "default",
- display: "flex",
- height: headerActionSize,
- justifyContent: "center",
- lineHeight: 0,
- ml: "-6px",
- overflow: "hidden",
- p: 0,
- placeSelf: "center start",
- width: headerActionSize,
- }}
- >
- <Box
- sx={{
- alignItems: "center",
- bgcolor: "transparent",
- border: `2.5px solid ${headerChromeColor}`,
- borderRadius: "50%",
- boxSizing: "border-box",
- display: "flex",
- height: headerAvatarSize,
- justifyContent: "center",
- overflow: "hidden",
- p: "2.5px",
- width: headerAvatarSize,
- }}
- >
- {profile &&
- (profile.avatarUrl || !profile.avatarObjectID) ? (
- <Box
- key={profile.avatarUrl ?? "default-avatar"}
- sx={{
- ...avatarFadeSx,
- borderRadius: "50%",
- height: headerAvatarImageSize,
- overflow: "hidden",
- width: headerAvatarImageSize,
- }}
- >
- <SpaceAvatarImage src={profile.avatarUrl} />
- </Box>
- ) : (
- <Skeleton
- variant="circular"
- sx={{
- bgcolor: mediaPlaceholderColor,
- height: headerAvatarImageSize,
- transform: "none",
- width: headerAvatarImageSize,
- }}
- />
- )}
- </Box>
- </Box>
- <Box
- sx={{
- alignItems: "center",
- alignSelf: "center",
- bgcolor: headerChromeColor,
- borderRadius: "999px",
- boxSizing: "border-box",
- display: "flex",
- height: 36,
- justifyContent: "center",
- justifySelf: "center",
- lineHeight: 0,
- minWidth: 0,
- overflow: "visible",
- placeSelf: "center",
- px: "16px",
- }}
- >
- <Box
- component="img"
- alt="Space"
- src="/images/space.svg"
- sx={{
- display: "block",
- filter: "invert(1)",
- height: 18,
- width: "auto",
- }}
- />
- </Box>
- <Box
- component="button"
- type="button"
- aria-label={
- showUnreadIndicator
- ? "Open messages with unread activity"
- : "Open messages"
- }
- onClick={onOpenMessages}
- sx={{
- appearance: "none",
- alignItems: "center",
- bgcolor: "transparent",
- border: 0,
- boxSizing: "border-box",
- color: textBase,
- cursor: onOpenMessages ? "pointer" : "default",
- display: "flex",
- fontSize: 0,
- height: headerActionSize,
- justifyContent: "center",
- justifySelf: "end",
- lineHeight: 0,
- mr: "-6px",
- p: 0,
- position: "relative",
- width: headerActionSize,
- "& svg": { display: "block" },
- "&:focus-visible": {
- borderRadius: "50%",
- outline: `2px solid ${green}`,
- outlineOffset: 2,
- },
- }}
- >
- <Box
- aria-hidden
- sx={{
- alignItems: "center",
- bgcolor: headerChromeColor,
- borderRadius: "50%",
- display: "flex",
- height: headerChatCircleSize,
- justifyContent: "center",
- position: "relative",
- width: headerChatCircleSize,
- "& svg path:first-of-type": { display: "none" },
- }}
- >
- <HugeiconsIcon
- icon={BubbleChatIcon}
- size={headerIconSize}
- strokeWidth={2.5}
- />
- {showUnreadIndicator && (
- <Box
- sx={{
- bgcolor: dangerColor,
- border: `2px solid ${headerChromeColor}`,
- borderRadius: "50%",
- boxSizing: "border-box",
- height: 11,
- position: "absolute",
- right: 5.5,
- top: 6,
- width: 11,
- zIndex: 1,
- }}
- />
- )}
- </Box>
- </Box>
- </Box>
+ </SpaceHomeHeader>
<Box
sx={{
boxSizing: "border-box",
display: "flex",
flexDirection: "column",
- height: `calc(100svh - ${headerHeight}px)`,
+ height: `calc(100svh - ${spaceHomeHeaderHeight}px)`,
minWidth: 0,
pb: "calc(env(safe-area-inset-bottom) + 112px)",
px: homeHorizontalPadding,
- pt: "8px",
+ pt: `calc(env(safe-area-inset-bottom) + 112px - ${spaceHomeHeaderHeight}px)`,
width: "100%",
}}
>
diff --git a/web/apps/space/src/utils/home-circle-layout.ts b/web/apps/space/src/utils/home-circle-layout.ts
index 0633397b54..cc0edcfce3 100644
--- a/web/apps/space/src/utils/home-circle-layout.ts
+++ b/web/apps/space/src/utils/home-circle-layout.ts
@@ -6,6 +6,7 @@ interface CircleSlot {
const gridFriendCountStart = 9;
const gridColumnCount = 3;
const circleGapRatio = 0.1;
+const verticalInset = 16;
export const usesHomeCircleGrid = (count: number) =>
count >= gridFriendCountStart;
@@ -78,9 +79,10 @@ export const homeCircleGridLayout = (
const rows = Math.ceil(count / gridColumnCount);
const layout = layoutDimensions(gridColumnCount, rows);
+ const availableHeight = Math.max(0, canvasHeight - 2 * verticalInset);
const size = Math.min(
canvasWidth / layout.width,
- canvasHeight / layout.height,
+ availableHeight / layout.height,
);
return { gap: size * circleGapRatio, rows, size };
};
@@ -105,9 +107,10 @@ export const homeCirclePlacements = (
rowOffsets.push(rowOffsets[row - 1]! + 1.1);
}
const layout = layoutDimensions(columns, rows);
+ const availableHeight = Math.max(0, canvasHeight - 2 * verticalInset);
const size = Math.min(
canvasWidth / layout.width,
- canvasHeight / layout.height,
+ availableHeight / layout.height,
);
const horizontalStep = size * (1 + circleGapRatio);
const renderedWidth = size + horizontalStep * (columns - 1);