Skip to content

armgit / ente

Public Imported from GitHub
0

💚 End-to-end encrypted cloud for everything.

Refine Space friend actions and iOS navigation

Anand Baburajan19cb0d586cb3
diff --git a/web/apps/space/src/components/AppNavigation.tsx b/web/apps/space/src/components/AppNavigation.tsx
index def28548c1..9cb1e33a36 100644
--- a/web/apps/space/src/components/AppNavigation.tsx
+++ b/web/apps/space/src/components/AppNavigation.tsx
@@ -9,6 +9,7 @@ import { HugeiconsIcon } from "@hugeicons/react";
import { Box } from "@mui/material";
import { SpacePostPhotoInput } from "components/PostPhotoInput";
import log from "ente-base/log";
+import { isSpaceIOS } from "hooks/use-pwa-install-prompt";
import React from "react";
import { loadCurrentUnreadStatus } from "services/space";
import { useSpaceAppState } from "state/app-state";
@@ -80,24 +81,47 @@ export const SpaceAppLayout = ({ children }: { children: React.ReactNode }) => {
React.useEffect(() => {
if (!showNavigation) return;
+ if (isSpaceIOS())
+ layoutRef.current?.style.setProperty(
+ "--space-bottom-nav-padding",
+ "max(8px, env(safe-area-inset-bottom))",
+ );
const viewport = window.visualViewport;
if (!viewport) return;
const updateViewport = () => {
+ const activeElement = document.activeElement;
+ const isEditing =
+ activeElement instanceof HTMLInputElement ||
+ activeElement instanceof HTMLTextAreaElement ||
+ (activeElement instanceof HTMLElement &&
+ activeElement.isContentEditable);
+ const keyboardInset = isEditing
+ ? Math.max(
+ 0,
+ window.innerHeight -
+ viewport.height -
+ Math.max(0, viewport.offsetTop),
+ )
+ : 0;
layoutRef.current?.style.setProperty(
"--space-viewport-height",
`${viewport.height}px`,
);
layoutRef.current?.style.setProperty(
"--space-keyboard-inset",
- `${Math.max(0, window.innerHeight - viewport.height - viewport.offsetTop)}px`,
+ `${keyboardInset}px`,
);
};
updateViewport();
viewport.addEventListener("resize", updateViewport);
viewport.addEventListener("scroll", updateViewport);
+ document.addEventListener("focusin", updateViewport);
+ document.addEventListener("focusout", updateViewport);
return () => {
viewport.removeEventListener("resize", updateViewport);
viewport.removeEventListener("scroll", updateViewport);
+ document.removeEventListener("focusin", updateViewport);
+ document.removeEventListener("focusout", updateViewport);
};
}, [showNavigation]);
@@ -146,16 +170,16 @@ export const SpaceAppLayout = ({ children }: { children: React.ReactNode }) => {
bottom: "var(--space-keyboard-inset, 0px)",
display: "flex",
justifyContent: "space-between",
- height: "calc(60px + env(safe-area-inset-bottom))",
- pb: "env(safe-area-inset-bottom)",
+ height: "var(--space-bottom-nav-height)",
+ pb: "var(--space-bottom-nav-padding)",
left: "50%",
- maxWidth: 390,
px: "10px",
position: "fixed",
transform: "translateX(-50%)",
viewTransitionName: "space-bottom-nav",
width: "100%",
zIndex: 20,
+ "@media (min-width: 600px)": { maxWidth: 390 },
}}
>
{destinations.map(({ label, href, icon, size }) => {
diff --git a/web/apps/space/src/components/FriendOrbit.tsx b/web/apps/space/src/components/FriendOrbit.tsx
index adbf101b04..fa2585f244 100644
--- a/web/apps/space/src/components/FriendOrbit.tsx
+++ b/web/apps/space/src/components/FriendOrbit.tsx
@@ -266,7 +266,6 @@ export const FriendOrbit: React.FC<FriendOrbitProps> = ({
"& > button": {
cursor:
heldFriendID == item.id ? "grabbing" : "grab",
- ...(heldFriendID == item.id && { scale: "1.06" }),
},
"& img": { pointerEvents: "none" },
}}
diff --git a/web/apps/space/src/components/FriendQuickActionsDialog.tsx b/web/apps/space/src/components/FriendQuickActionsDialog.tsx
deleted file mode 100644
index 9f82d18881..0000000000
--- a/web/apps/space/src/components/FriendQuickActionsDialog.tsx
+++ /dev/null
@@ -1,466 +0,0 @@
-import {
- BubbleChatIcon,
- Cancel01Icon,
- HandPointingRightIcon,
- Tick02Icon,
- UserIcon,
- UserRemove01Icon,
-} from "@hugeicons/core-free-icons";
-import { HugeiconsIcon } from "@hugeicons/react";
-import { Box, Dialog, useMediaQuery } from "@mui/material";
-import {
- spaceActionDoneDurationMs,
- SpaceActionFeedbackIcon,
- type SpaceActionPhase,
-} from "components/ActionFeedback";
-import { SpaceAvatarImage } from "components/AvatarImage";
-import type { FriendProfile } from "data/friends";
-import log from "ente-base/log";
-import { useBrowserBackClose } from "hooks/use-browser-back-close";
-import React from "react";
-import {
- spaceAppBackgroundColor,
- spaceDialogBackground,
- spaceSurface,
- spaceSurfaceHover,
- spaceText,
-} from "styles/colors";
-
-const actionHeight = 40;
-const dialogPadding = 12;
-const innerRadius = actionHeight / 2;
-const dialogRadius = innerRadius + dialogPadding;
-
-interface FriendQuickActionsDialogProps {
- anchorRect: DOMRect;
- avatarUrl?: string | null;
- friend: FriendProfile;
- onClose: () => void;
- onMessage?: () => void;
- onPoke?: () => Promise<void>;
- onProfile?: () => void;
- onUnfriend?: () => void;
- requestActions?: {
- onAccept?: () => Promise<boolean>;
- onCancel: () => Promise<void>;
- };
-}
-
-export const FriendQuickActionsDialog: React.FC<
- FriendQuickActionsDialogProps
-> = ({
- anchorRect,
- avatarUrl,
- friend,
- onClose,
- onMessage,
- onPoke,
- onProfile,
- onUnfriend,
- requestActions,
-}) => {
- const [open, setOpen] = React.useState(true);
- const [pokePhase, setPokePhase] = React.useState<"busy" | "done" | null>(
- null,
- );
- const [pokeFailed, setPokeFailed] = React.useState(false);
- const [requestAction, setRequestAction] = React.useState<{
- type: "accept" | "cancel";
- phase: SpaceActionPhase;
- } | null>(null);
- const [requestFailed, setRequestFailed] = React.useState(false);
- const paperRef = React.useRef<HTMLDivElement>(null);
- const nameID = React.useId();
- const prefersReducedMotion = useMediaQuery(
- "(prefers-reduced-motion: reduce)",
- );
- const displayName = requestActions
- ? `@${friend.username}`
- : friend.fullName.trim() || friend.username;
- const { clearBrowserBackState } = useBrowserBackClose({
- open,
- onClose: () => setOpen(false),
- stateKey: "space-friend-quick-actions",
- });
-
- React.useEffect(() => {
- if (pokePhase != "done") return;
- const timeout = window.setTimeout(() => setPokePhase(null), 2100);
- return () => window.clearTimeout(timeout);
- }, [pokePhase]);
-
- React.useEffect(() => {
- if (requestAction?.phase != "done") return;
- const timeout = window.setTimeout(
- () => setOpen(false),
- spaceActionDoneDurationMs,
- );
- return () => window.clearTimeout(timeout);
- }, [requestAction?.phase]);
-
- const navigate = async (action: () => void) => {
- await clearBrowserBackState("back");
- setOpen(false);
- action();
- };
-
- const poke = async () => {
- if (!onPoke || pokePhase) return;
- setPokePhase("busy");
- setPokeFailed(false);
- try {
- await onPoke();
- setPokePhase("done");
- } catch (error) {
- log.error("Failed to send poke", error);
- setPokePhase(null);
- setPokeFailed(true);
- }
- };
-
- const updateRequest = async (
- action: "accept" | "cancel",
- handler: () => Promise<void> | Promise<boolean>,
- ) => {
- if (requestAction) return;
- setRequestAction({ type: action, phase: "busy" });
- setRequestFailed(false);
- try {
- const accepted = await handler();
- if (action == "accept" && accepted)
- setRequestAction({ type: action, phase: "done" });
- else setOpen(false);
- } catch (error) {
- log.error("Failed to update friend request", error);
- setRequestAction(null);
- setRequestFailed(true);
- }
- };
-
- const actions = [
- {
- label: "Accept request",
- text: "Accept",
- available: Boolean(requestActions?.onAccept),
- icon: Tick02Icon,
- disabled: requestAction !== null,
- busy:
- requestAction?.type == "accept" &&
- requestAction.phase == "busy",
- done:
- requestAction?.type == "accept" &&
- requestAction.phase == "done",
- doneLabel: "Request accepted",
- phase: requestAction?.type == "accept" ? requestAction.phase : null,
- onClick: () =>
- requestActions?.onAccept &&
- void updateRequest("accept", requestActions.onAccept),
- },
- {
- label: "Cancel request",
- text: requestActions?.onAccept ? "Cancel" : "Cancel request",
- busyText: "Canceling…",
- available: Boolean(requestActions),
- icon: Cancel01Icon,
- disabled: requestAction !== null,
- busy: requestAction?.type == "cancel",
- onClick: () =>
- requestActions &&
- void updateRequest("cancel", requestActions.onCancel),
- },
- {
- label: "Poke",
- available: Boolean(onPoke),
- icon: HandPointingRightIcon,
- active: pokePhase !== null,
- done: pokePhase == "done",
- doneLabel: "Poke sent",
- disabled: pokePhase !== null,
- busy: pokePhase == "busy",
- onClick: () => void poke(),
- },
- {
- label: "Message",
- available: Boolean(onMessage),
- icon: BubbleChatIcon,
- onClick: () => onMessage && void navigate(onMessage),
- },
- {
- label: "Profile",
- available: Boolean(onProfile),
- icon: UserIcon,
- onClick: () => onProfile && void navigate(onProfile),
- },
- {
- label: "Unfriend",
- available: Boolean(onUnfriend),
- icon: UserRemove01Icon,
- onClick: () => onUnfriend && void navigate(onUnfriend),
- },
- ].filter((action) => action.available);
-
- return (
- <Dialog
- open={open}
- onClose={requestAction ? undefined : () => setOpen(false)}
- aria-labelledby={nameID}
- maxWidth={false}
- transitionDuration={prefersReducedMotion ? 0 : 220}
- sx={{ "--space-dialog-backdrop": "rgba(0 0 0 / 0.64)" }}
- slotProps={{
- paper: {
- ref: paperRef,
- sx: {
- bgcolor: spaceSurface,
- border: "1px solid #383838",
- boxShadow: "0 24px 64px rgba(0, 0, 0, 0.48)",
- borderRadius: `${dialogRadius}px`,
- boxSizing: "border-box",
- display: "flex",
- flexDirection: "column",
- m: "16px",
- maxHeight: "calc(100% - 32px)",
- maxWidth: "calc(100vw - 32px)",
- overflow: "hidden",
- position: "relative",
- pt: `${dialogPadding}px`,
- top: -155,
- width: "288px",
- "@media (max-height: 720px)": { top: 0 },
- },
- },
- transition: {
- onEnter: () => {
- const paper = paperRef.current;
- if (!paper || prefersReducedMotion) return;
- const rect = paper.getBoundingClientRect();
- const x =
- anchorRect.x +
- anchorRect.width / 2 -
- (rect.x + rect.width / 2);
- const y =
- anchorRect.y +
- anchorRect.height / 2 -
- (rect.y + rect.height / 2);
- paper.animate(
- [
- {
- transform: `translate(${x}px, ${y}px) scale(${anchorRect.width / rect.width})`,
- borderRadius: "50%",
- },
- {
- transform: "none",
- borderRadius: `${dialogRadius}px`,
- },
- ],
- {
- duration: 220,
- easing: "cubic-bezier(0.2, 0.8, 0.2, 1)",
- },
- );
- },
- onExited: onClose,
- },
- }}
- >
- <Box
- sx={{
- alignSelf: "center",
- aspectRatio: "1",
- bgcolor: spaceAppBackgroundColor,
- borderRadius: `${innerRadius}px`,
- flexShrink: 0,
- overflow: "hidden",
- position: "relative",
- width: `min(calc(100% - ${dialogPadding * 2}px), calc(100svh - ${dialogPadding * 3 + actionHeight + 32}px))`,
- }}
- >
- <SpaceAvatarImage
- src={requestActions ? undefined : avatarUrl}
- />
- <Box
- aria-hidden
- sx={{
- background:
- "linear-gradient(rgba(0, 0, 0, 0.28), transparent 40%)",
- inset: 0,
- pointerEvents: "none",
- position: "absolute",
- }}
- />
- <Box
- component="h2"
- id={nameID}
- sx={{
- color: "#FFFFFF",
- display: "-webkit-box",
- fontFamily: '"Inter Variable", Inter, sans-serif',
- fontSize: 16,
- fontWeight: 700,
- left: 24,
- lineHeight: "22px",
- m: 0,
- overflow: "hidden",
- overflowWrap: "anywhere",
- position: "absolute",
- right: 24,
- textShadow: "0 1px 6px rgba(0, 0, 0, 0.35)",
- top: 24,
- WebkitBoxOrient: "vertical",
- WebkitLineClamp: 2,
- }}
- >
- {displayName}
- </Box>
- {(pokeFailed || requestFailed) && (
- <Box
- role="alert"
- sx={{
- bgcolor: "rgba(0, 0, 0, 0.7)",
- borderRadius: "12px",
- bottom: dialogPadding,
- color: "#FFFFFF",
- fontSize: 12,
- left: dialogPadding,
- lineHeight: "16px",
- p: "8px 12px",
- position: "absolute",
- right: dialogPadding,
- textAlign: "center",
- }}
- >
- {requestFailed
- ? "Couldn’t update the request. Please try again."
- : "Couldn’t send your poke. Tap Poke to retry."}
- </Box>
- )}
- </Box>
- <Box
- sx={{
- display: "grid",
- gap: "6px",
- gridTemplateColumns: `repeat(${actions.length}, minmax(0, 1fr))`,
- p: `${dialogPadding}px`,
- }}
- >
- {actions.map((action, index) => (
- <Box
- key={index}
- className={
- action.icon == Tick02Icon ? "green-bg" : undefined
- }
- component="button"
- type="button"
- disabled={action.disabled}
- aria-busy={action.busy}
- aria-label={
- action.done ? action.doneLabel : action.label
- }
- title={action.done ? action.doneLabel : action.label}
- aria-live={
- action.done !== undefined ? "polite" : undefined
- }
- onClick={action.onClick}
- sx={{
- alignItems: "center",
- appearance: "none",
- bgcolor:
- action.icon == Tick02Icon
- ? "#08C225"
- : spaceDialogBackground,
- border: 0,
- borderRadius: `${innerRadius}px`,
- color:
- action.icon == Tick02Icon
- ? "#FFFFFF"
- : action.active
- ? "color(display-p3 0.0314 0.7608 0.1451)"
- : "#D8D8D8",
- cursor: action.disabled ? "default" : "pointer",
- display: "grid",
- fontFamily: '"Inter Variable", Inter, sans-serif',
- fontSize: 14,
- fontWeight: 600,
- justifyItems: "center",
- height: actionHeight,
- minWidth: 0,
- p: "0 8px",
- ...(action.label != "Poke" && {
- transition: "background-color 120ms ease",
- "&:hover:not(:disabled)": {
- bgcolor:
- action.icon == Tick02Icon
- ? "#07A820"
- : spaceSurfaceHover,
- },
- "&:active:not(:disabled)": {
- bgcolor:
- action.icon == Tick02Icon
- ? "#078D1C"
- : spaceAppBackgroundColor,
- },
- }),
- "&:focus-visible": {
- outline: `2px solid ${spaceText}`,
- outlineOffset: 2,
- },
- }}
- >
- {action.phase ? (
- <SpaceActionFeedbackIcon phase={action.phase} />
- ) : action.text ? (
- action.busy ? (
- action.busyText
- ) : (
- action.text
- )
- ) : (
- <Box
- component="span"
- aria-hidden
- sx={{
- alignItems: "center",
- display: "flex",
- height: 24,
- justifyContent: "center",
- width: 24,
- animation: action.active
- ? "spacePokeJab 2000ms ease-in-out"
- : "none",
- "@keyframes spacePokeJab": {
- "0%, 100%": {
- transform:
- "translate(0, 0) rotate(0deg) scale(1)",
- },
- "27.5%, 52%, 73.75%": {
- transform:
- "translate(20px, -80px) rotate(-40deg) scale(3)",
- },
- "41%, 63%": {
- transform:
- "translate(36px, -94px) rotate(-40deg) scale(3)",
- },
- },
- "@media (prefers-reduced-motion: reduce)": {
- animation: "none",
- },
- ...(action.icon == BubbleChatIcon && {
- "& svg path:last-of-type": {
- display: "none",
- },
- }),
- }}
- >
- <HugeiconsIcon
- icon={action.icon}
- size={24}
- strokeWidth={2.2}
- />
- </Box>
- )}
- </Box>
- ))}
- </Box>
- </Dialog>
- );
-};
diff --git a/web/apps/space/src/components/FriendRequestSheet.tsx b/web/apps/space/src/components/FriendRequestSheet.tsx
new file mode 100644
index 0000000000..e056b9ac88
--- /dev/null
+++ b/web/apps/space/src/components/FriendRequestSheet.tsx
@@ -0,0 +1,241 @@
+import { Box, Dialog } from "@mui/material";
+import {
+ spaceActionDoneDurationMs,
+ SpaceActionFeedbackIcon,
+ type SpaceActionPhase,
+} from "components/ActionFeedback";
+import log from "ente-base/log";
+import { useBrowserBackClose } from "hooks/use-browser-back-close";
+import React from "react";
+import type { SpaceFriendRequest } from "services/space";
+import {
+ spaceControlBackgroundHover,
+ spaceDanger,
+ spaceDialogBackground,
+ spaceText,
+ spaceTextMuted,
+} from "styles/colors";
+
+const green = "#08C225";
+
+interface FriendRequestSheetProps {
+ request: SpaceFriendRequest;
+ onAccept: (requestID: number) => Promise<boolean>;
+ onDelete: (requestID: number) => Promise<void>;
+ onClose: () => void;
+}
+
+export const FriendRequestSheet: React.FC<FriendRequestSheetProps> = ({
+ request,
+ onAccept,
+ onDelete,
+ onClose,
+}) => {
+ const [open, setOpen] = React.useState(true);
+ const [action, setAction] = React.useState<{
+ type: "accept" | "delete";
+ phase: SpaceActionPhase;
+ } | null>(null);
+ const [failed, setFailed] = React.useState(false);
+ const titleID = React.useId();
+ const descriptionID = React.useId();
+ const isIncoming = request.direction == "received";
+ const dismiss = () => {
+ if (!action) setOpen(false);
+ };
+
+ useBrowserBackClose({
+ open,
+ onClose: dismiss,
+ stateKey: "space-friend-request",
+ });
+
+ React.useEffect(() => {
+ if (action?.phase != "done") return;
+ const timeout = window.setTimeout(
+ () => setOpen(false),
+ spaceActionDoneDurationMs,
+ );
+ return () => window.clearTimeout(timeout);
+ }, [action?.phase]);
+
+ const updateRequest = async (type: "accept" | "delete") => {
+ if (action) return;
+ setAction({ type, phase: "busy" });
+ setFailed(false);
+ try {
+ if (type == "accept") {
+ const accepted = await onAccept(request.requestId);
+ if (accepted) setAction({ type, phase: "done" });
+ else setOpen(false);
+ } else {
+ await onDelete(request.requestId);
+ setOpen(false);
+ }
+ } catch (error) {
+ log.error("Failed to update friend request", error);
+ setAction(null);
+ setFailed(true);
+ }
+ };
+
+ const actions = [
+ ...(isIncoming ? [{ type: "accept" as const, label: "Accept" }] : []),
+ {
+ type: "delete" as const,
+ label: isIncoming ? "Decline" : "Cancel request",
+ },
+ ];
+
+ return (
+ <Dialog
+ open={open}
+ onClose={dismiss}
+ maxWidth={false}
+ aria-labelledby={titleID}
+ aria-describedby={descriptionID}
+ sx={{ "--space-dialog-backdrop": "rgba(0 0 0 / 0.64)" }}
+ slotProps={{
+ paper: {
+ sx: {
+ bgcolor: spaceDialogBackground,
+ borderRadius: "28px 28px 0 0",
+ bottom: 0,
+ boxShadow: "none",
+ boxSizing: "border-box",
+ left: 0,
+ m: 0,
+ maxWidth: "none",
+ p: "26px 20px max(24px, env(safe-area-inset-bottom))",
+ position: "fixed",
+ width: "100vw",
+ "@media (min-width: 600px)": {
+ borderRadius: "20px",
+ bottom: "auto",
+ left: "50%",
+ maxWidth: 363,
+ top: "50%",
+ transform: "translate(-50%, -50%)",
+ width: 363,
+ },
+ },
+ },
+ transition: { onExited: onClose },
+ }}
+ >
+ <Box
+ sx={{
+ maxWidth: 320,
+ mx: "auto",
+ width: "100%",
+ "@media (min-width: 600px)": { maxWidth: "none" },
+ }}
+ >
+ <Box
+ component="h2"
+ id={titleID}
+ sx={{
+ color: spaceText,
+ fontFamily: '"Inter Variable", Inter, sans-serif',
+ fontSize: 15,
+ fontWeight: 600,
+ lineHeight: "20px",
+ m: 0,
+ overflowWrap: "anywhere",
+ px: "20px",
+ textAlign: "center",
+ }}
+ >
+ {isIncoming
+ ? `Be friends with @${request.friend.username}?`
+ : `Waiting for @${request.friend.username}`}
+ </Box>
+ <Box
+ id={descriptionID}
+ sx={{
+ color: spaceTextMuted,
+ fontFamily: '"Inter Variable", Inter, sans-serif',
+ fontSize: 13,
+ lineHeight: "18px",
+ mt: "8px",
+ overflowWrap: "anywhere",
+ px: "20px",
+ textAlign: "center",
+ }}
+ >
+ {isIncoming
+ ? "Share photos, and keep up with each other."
+ : "You’ll see their posts once they accept."}
+ </Box>
+ <Box sx={{ display: "grid", gap: "12px", mt: "20px" }}>
+ {actions.map(({ type, label }) => {
+ const phase =
+ action?.type == type ? action.phase : null;
+ return (
+ <Box
+ key={type}
+ component="button"
+ type="button"
+ className={
+ type == "accept" ? "green-bg" : undefined
+ }
+ aria-label={
+ phase == "done" ? "Request accepted" : label
+ }
+ aria-busy={phase == "busy"}
+ aria-live="polite"
+ disabled={action !== null}
+ onClick={() => void updateRequest(type)}
+ sx={{
+ alignItems: "center",
+ bgcolor:
+ type == "accept"
+ ? green
+ : spaceControlBackgroundHover,
+ border: 0,
+ borderRadius: "24px",
+ color: spaceText,
+ cursor: action ? "default" : "pointer",
+ display: "flex",
+ fontFamily:
+ '"Inter Variable", Inter, sans-serif',
+ fontSize: 14,
+ fontWeight: 600,
+ height: 48,
+ justifyContent: "center",
+ p: "0 20px",
+ "&:hover:not(:disabled)": {
+ filter: "brightness(1.08)",
+ },
+ "&:focus-visible": {
+ outline: `2px solid ${green}`,
+ outlineOffset: 2,
+ },
+ }}
+ >
+ {phase ? (
+ <SpaceActionFeedbackIcon phase={phase} />
+ ) : (
+ label
+ )}
+ </Box>
+ );
+ })}
+ </Box>
+ {failed && (
+ <Box
+ role="alert"
+ sx={{
+ color: spaceDanger,
+ fontSize: 13,
+ mt: "12px",
+ textAlign: "center",
+ }}
+ >
+ Couldn&apos;t update the request. Please try again.
+ </Box>
+ )}
+ </Box>
+ </Dialog>
+ );
+};
diff --git a/web/apps/space/src/pages/_app.tsx b/web/apps/space/src/pages/_app.tsx
index 17e272e006..f47e640884 100644
--- a/web/apps/space/src/pages/_app.tsx
+++ b/web/apps/space/src/pages/_app.tsx
@@ -119,7 +119,7 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {
>
<CustomHead
title={spacePageTitle(router.pathname)}
- viewportContent="width=device-width, initial-scale=1, maximum-scale=1"
+ viewportContent="width=device-width, initial-scale=1, maximum-scale=1, viewport-fit=cover"
>
<link
rel="preload"
diff --git a/web/apps/space/src/pages/app/friends/index.tsx b/web/apps/space/src/pages/app/friends/index.tsx
index 02f158e258..143ce35e0a 100644
--- a/web/apps/space/src/pages/app/friends/index.tsx
+++ b/web/apps/space/src/pages/app/friends/index.tsx
@@ -12,9 +12,7 @@ import {
loadCurrentFriendAvatarURL,
loadCurrentFriendRequests,
loadCurrentSpaceFriends,
- removeCurrentSpaceFriend,
requestFriendByUsername,
- sendCurrentPoke,
type SpaceFriendRequest,
} from "services/space";
import { useSpaceAppState } from "state/app-state";
@@ -120,25 +118,6 @@ const Page: React.FC = () => {
}
return status;
}}
- onPoke={async (friendID, requestID) => {
- const actorSpaceId = profile.spaceId;
- const friend = friends.find((item) => item.id == friendID);
- if (!actorSpaceId || !friend?.spaceId)
- throw new Error("Missing space.");
- await sendCurrentPoke(
- actorSpaceId,
- friend.spaceId,
- requestID,
- );
- }}
- onMessage={(friendID) => {
- const friend = friends.find(
- (candidate) => candidate.id == friendID,
- );
- if (friend?.spaceId) {
- void router.push(spaceRoutes.message(friend.spaceId));
- }
- }}
onOpenFriend={(friendID) => {
const friend = friends.find(
(candidate) =>
@@ -219,21 +198,6 @@ const Page: React.FC = () => {
),
);
}}
- onUnfriend={async (friendID) => {
- const actorSpaceId = profile.spaceId;
- if (!actorSpaceId) return;
-
- const friend = friends.find(
- (candidate) => candidate.id == friendID,
- );
- if (!friend?.spaceId) return;
-
- await removeCurrentSpaceFriend(
- actorSpaceId,
- friend.spaceId,
- );
- window.location.reload();
- }}
/>
{showFriendRequestCanceledToast && (
<SpaceFriendRequestCanceledToast
diff --git a/web/apps/space/src/pages/app/notifications.tsx b/web/apps/space/src/pages/app/notifications.tsx
index d421183c3c..82e2ac7804 100644
--- a/web/apps/space/src/pages/app/notifications.tsx
+++ b/web/apps/space/src/pages/app/notifications.tsx
@@ -48,6 +48,7 @@ import {
spaceTextMuted,
} from "styles/colors";
import { groupSpaceActivities } from "utils/activity-sections";
+import { firstNameFrom } from "utils/display";
import { isFriendRequestCanceledError } from "utils/friend-errors";
import { spacePostDeletedEvent } from "utils/post-events";
import { postQuoteErrorState } from "utils/post-quote";
@@ -87,7 +88,7 @@ const NotificationAvatar: React.FC<{
};
const actorName = (actor: SpaceNotification["actors"][number]) =>
- actor.fullName.trim() || actor.username;
+ firstNameFrom(actor.fullName.trim() || actor.username);
const NotificationRow: React.FC<{
group: SpaceNotification;
diff --git a/web/apps/space/src/screens/FriendsScreen.tsx b/web/apps/space/src/screens/FriendsScreen.tsx
index 96660722b9..eec850ab2b 100644
--- a/web/apps/space/src/screens/FriendsScreen.tsx
+++ b/web/apps/space/src/screens/FriendsScreen.tsx
@@ -1,19 +1,10 @@
-import {
- Add01Icon,
- ArrowLeft02Icon,
- UserAdd02Icon,
-} from "@hugeicons/core-free-icons";
+import { ArrowLeft02Icon, UserAdd02Icon } from "@hugeicons/core-free-icons";
import { HugeiconsIcon } from "@hugeicons/react";
import { Box, Skeleton } from "@mui/material";
-import {
- spaceActionDoneDurationMs,
- type SpaceActionPhase,
-} from "components/ActionFeedback";
import { SpaceAddFriendDialog } from "components/AddFriendDialog";
import { SpaceAvatarImage } from "components/AvatarImage";
-import { ConfirmationActionSheet } from "components/ConfirmationActionSheet";
import { FriendOrbit } from "components/FriendOrbit";
-import { FriendQuickActionsDialog } from "components/FriendQuickActionsDialog";
+import { FriendRequestSheet } from "components/FriendRequestSheet";
import { FriendStarField } from "components/FriendStarField";
import { SpaceLoadingSpinner } from "components/RouteFallback";
import { SpaceSkipLink } from "components/SkipLink";
@@ -21,12 +12,7 @@ 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,
- spaceSurfaceHover,
- spaceText,
-} from "styles/colors";
+import { spaceAppBackground, spaceSurface, spaceText } from "styles/colors";
import { spaceTouchTargetSize } from "styles/touch-targets";
const green = "#08C225";
@@ -52,19 +38,16 @@ interface FriendsScreenProps {
onDeleteFriendRequest: (requestID: number) => Promise<void>;
onLoadFriendAvatar?: (friend: FriendProfile) => Promise<string | null>;
onAddFriend: (username: string) => Promise<"friend" | "requested">;
- onMessage?: (friendID: string) => void;
- onPoke?: (friendID: string, requestID: string) => Promise<void>;
- onOpenFriend?: (friendID: string) => void;
+ onOpenFriend: (friendID: string) => void;
profileLink?: string;
username: string;
- onUnfriend?: (friendID: string) => Promise<void> | void;
}
interface FriendIdentityProps {
avatarUrl?: string | null;
friend: FriendProfile;
onLoadAvatar?: () => Promise<string | null | undefined>;
- onOpen?: (event: React.MouseEvent<HTMLButtonElement>) => void;
+ onOpen: () => void;
}
const FriendIdentity: React.FC<FriendIdentityProps> = ({
@@ -120,8 +103,7 @@ const FriendIdentity: React.FC<FriendIdentityProps> = ({
component="button"
type="button"
onClick={onOpen}
- aria-label={`Actions for ${displayName}`}
- aria-haspopup="dialog"
+ aria-label={`Open ${displayName}'s profile`}
sx={{
alignItems: "center",
bgcolor: "transparent",
@@ -136,11 +118,6 @@ const FriendIdentity: React.FC<FriendIdentityProps> = ({
textAlign: "center",
width: "100%",
position: "relative",
- transition: "scale 180ms ease",
- "&:hover": { scale: "1.06" },
- "@media (prefers-reduced-motion: reduce)": {
- transition: "none",
- },
"&:focus-visible": {
outline: `2px solid ${green}`,
outlineOffset: 2,
@@ -203,7 +180,7 @@ const orbitCircleSx = {
} as const;
interface FriendRequestCircleProps {
- onOpen: (event: React.MouseEvent<HTMLButtonElement>) => void;
+ onOpen: () => void;
request: SpaceFriendRequest;
}
@@ -212,7 +189,6 @@ const FriendRequestCircle: React.FC<FriendRequestCircleProps> = ({
request,
}) => (
<Box
- className={request.direction == "received" ? "green-bg" : undefined}
component="button"
type="button"
aria-label={`${request.direction == "received" ? "Friend request from" : "Pending friend request to"} @${request.friend.username}`}
@@ -220,29 +196,23 @@ const FriendRequestCircle: React.FC<FriendRequestCircleProps> = ({
onClick={onOpen}
sx={{
...orbitCircleSx,
- bgcolor: request.direction == "received" ? green : "#444444",
- borderColor:
- request.direction == "received"
- ? "color(display-p3 0.32 0.88 0.4)"
- : "#737373",
- boxShadow:
- request.direction == "received"
- ? "0 0 18px rgba(8, 194, 37, 0.18)"
- : orbitCircleSx.boxShadow,
- transition: "scale 180ms ease",
- "&:hover": { scale: "1.06" },
- "@media (prefers-reduced-motion: reduce)": { transition: "none" },
+ borderColor: request.direction == "received" ? green : "#737373",
}}
>
<Box
component="span"
title={`@${request.friend.username}`}
sx={{
- fontSize: 14,
- fontWeight: 600,
+ bgcolor: request.direction == "received" ? green : "#303030",
+ borderRadius: "999px",
+ color: "rgba(255, 255, 255, 0.9)",
+ fontSize: 12,
+ fontWeight: 500,
lineHeight: "18px",
maxWidth: "100%",
overflow: "hidden",
+ px: "8px",
+ py: "4px",
textOverflow: "ellipsis",
whiteSpace: "nowrap",
}}
@@ -261,38 +231,19 @@ export const FriendsScreen: React.FC<FriendsScreenProps> = ({
onBack,
onDeleteFriendRequest,
onLoadFriendAvatar,
- onMessage,
- onPoke,
onOpenFriend,
profileLink,
username,
- onUnfriend,
}) => {
const [isAddFriendOpen, setIsAddFriendOpen] = React.useState(false);
- const [selectedFriend, setSelectedFriend] = React.useState<{
- friend: FriendProfile;
- anchorRect: DOMRect;
- } | null>(null);
- const [selectedRequest, setSelectedRequest] = React.useState<{
- request: SpaceFriendRequest;
- anchorRect: DOMRect;
- } | null>(null);
- const pokeRequestIDs = React.useRef(new Map<string, string>());
- const [friendToUnfriend, setFriendToUnfriend] =
- React.useState<FriendProfile | null>(null);
- const [isUnfriendOpen, setIsUnfriendOpen] = React.useState(false);
- const [unfriendActionPhase, setUnfriendActionPhase] =
- React.useState<SpaceActionPhase | null>(null);
- const [unfriendErrorMessage, setUnfriendErrorMessage] = React.useState<
- string | null
- >(null);
+ const [selectedRequest, setSelectedRequest] =
+ React.useState<SpaceFriendRequest | null>(null);
const [loadedAvatarURLsByKey, setLoadedAvatarURLsByKey] = React.useState<
Record<string, string>
>({});
const avatarLoadsInFlightRef = React.useRef<
Map<string, Promise<string | null | undefined>>
>(new Map());
- const isUnfriendActionRunning = unfriendActionPhase != null;
const loadedAvatarURLFor = React.useCallback(
(friend: FriendProfile) =>
friend.avatarUrl ??
@@ -336,44 +287,6 @@ export const FriendsScreen: React.FC<FriendsScreenProps> = ({
[loadedAvatarURLFor, onLoadFriendAvatar],
);
- const cancelUnfriend = () => {
- if (isUnfriendActionRunning) return;
- setUnfriendErrorMessage(null);
- setIsUnfriendOpen(false);
- };
-
- const confirmUnfriend = () => {
- if (!friendToUnfriend || isUnfriendActionRunning) return;
- setUnfriendErrorMessage(null);
- setUnfriendActionPhase("busy");
- void (async () => {
- try {
- await Promise.resolve(onUnfriend?.(friendToUnfriend.id));
- setUnfriendActionPhase("done");
- } catch (error) {
- log.error("Failed to unfriend space friend", error);
- setUnfriendActionPhase(null);
- setUnfriendErrorMessage("Couldn't unfriend. Please try again.");
- }
- })();
- };
-
- React.useEffect(() => {
- if (unfriendActionPhase != "done") return;
-
- const timeoutID = window.setTimeout(() => {
- setIsUnfriendOpen(false);
- }, spaceActionDoneDurationMs);
-
- return () => window.clearTimeout(timeoutID);
- }, [unfriendActionPhase]);
-
- const handleUnfriendSheetExited = () => {
- setFriendToUnfriend(null);
- setUnfriendActionPhase(null);
- setUnfriendErrorMessage(null);
- };
-
return (
<Box
component="main"
@@ -524,7 +437,6 @@ export const FriendsScreen: React.FC<FriendsScreenProps> = ({
</Box>
) : (
<FriendOrbit
- initialOuterID="add-friend"
items={[
...friends.map((friend) => ({
id: friend.id,
@@ -537,12 +449,8 @@ export const FriendsScreen: React.FC<FriendsScreenProps> = ({
onLoadAvatar={() =>
loadFriendAvatar(friend)
}
- onOpen={(event) =>
- setSelectedFriend({
- friend,
- anchorRect:
- event.currentTarget.getBoundingClientRect(),
- })
+ onOpen={() =>
+ onOpenFriend(friend.id)
}
/>
),
@@ -553,129 +461,25 @@ export const FriendsScreen: React.FC<FriendsScreenProps> = ({
content: (
<FriendRequestCircle
request={request}
- onOpen={(event) =>
- setSelectedRequest({
- request,
- anchorRect:
- event.currentTarget.getBoundingClientRect(),
- })
+ onOpen={() =>
+ setSelectedRequest(request)
}
/>
),
})),
- {
- id: "add-friend",
- fixedSize: 64,
- content: (
- <Box
- component="button"
- type="button"
- aria-label="Add friend"
- aria-haspopup="dialog"
- aria-expanded={isAddFriendOpen}
- onClick={() =>
- setIsAddFriendOpen(true)
- }
- sx={{
- ...orbitCircleSx,
- transition: "scale 180ms ease",
- "&:hover": {
- bgcolor: spaceSurfaceHover,
- scale: "1.06",
- },
- "@media (prefers-reduced-motion: reduce)":
- { transition: "none" },
- }}
- >
- <HugeiconsIcon
- icon={Add01Icon}
- size={28}
- strokeWidth={1.8}
- />
- </Box>
- ),
- },
]}
/>
)}
</Box>
</Box>
{selectedRequest && (
- <FriendQuickActionsDialog
- anchorRect={selectedRequest.anchorRect}
- friend={selectedRequest.request.friend}
+ <FriendRequestSheet
+ request={selectedRequest}
+ onAccept={onAcceptFriendRequest}
+ onDelete={onDeleteFriendRequest}
onClose={() => setSelectedRequest(null)}
- requestActions={{
- onAccept:
- selectedRequest.request.direction == "received"
- ? () =>
- onAcceptFriendRequest(
- selectedRequest.request.requestId,
- )
- : undefined,
- onCancel: () =>
- onDeleteFriendRequest(
- selectedRequest.request.requestId,
- ),
- }}
- />
- )}
- {selectedFriend && (
- <FriendQuickActionsDialog
- anchorRect={selectedFriend.anchorRect}
- avatarUrl={loadedAvatarURLFor(selectedFriend.friend)}
- friend={selectedFriend.friend}
- onClose={() => setSelectedFriend(null)}
- onMessage={
- onMessage
- ? () => onMessage(selectedFriend.friend.id)
- : undefined
- }
- onPoke={
- onPoke
- ? async () => {
- const friendID = selectedFriend.friend.id;
- const requestID =
- pokeRequestIDs.current.get(friendID) ??
- crypto.randomUUID();
- pokeRequestIDs.current.set(
- friendID,
- requestID,
- );
- await onPoke(friendID, requestID);
- pokeRequestIDs.current.delete(friendID);
- }
- : undefined
- }
- onProfile={
- onOpenFriend
- ? () => onOpenFriend(selectedFriend.friend.id)
- : undefined
- }
- onUnfriend={
- onUnfriend
- ? () => {
- setUnfriendErrorMessage(null);
- setFriendToUnfriend(selectedFriend.friend);
- setIsUnfriendOpen(true);
- }
- : undefined
- }
/>
)}
- <ConfirmationActionSheet
- open={isUnfriendOpen}
- title={`Unfriend ${friendToUnfriend?.fullName.trim().split(/\s+/)[0] || friendToUnfriend?.username}?`}
- description="You’ll no longer see each other’s posts or message each other."
- confirmLabel="Unfriend"
- confirmActionPhase={unfriendActionPhase}
- confirmDisabled={isUnfriendActionRunning}
- errorMessage={unfriendErrorMessage}
- cancelDisabled={isUnfriendActionRunning}
- onCancel={cancelUnfriend}
- onConfirm={confirmUnfriend}
- onExited={handleUnfriendSheetExited}
- />
</Box>
);
};
diff --git a/web/apps/space/src/screens/ProfileScreen.tsx b/web/apps/space/src/screens/ProfileScreen.tsx
index 4a24e751c3..3f8d5b6a9f 100644
--- a/web/apps/space/src/screens/ProfileScreen.tsx
+++ b/web/apps/space/src/screens/ProfileScreen.tsx
@@ -3,15 +3,13 @@ import {
ArrowLeft02Icon,
BubbleChatIcon,
HandPointingRightIcon,
- MoreHorizontalIcon,
Tick02Icon,
UserRemove01Icon,
} from "@hugeicons/core-free-icons";
import { HugeiconsIcon } from "@hugeicons/react";
-import { Box, Menu, MenuItem, Skeleton } from "@mui/material";
+import { Box, Skeleton } from "@mui/material";
import {
spaceActionDoneDurationMs,
- SpaceActionFeedbackIcon,
type SpaceActionPhase,
} from "components/ActionFeedback";
import {
@@ -54,7 +52,6 @@ import { spaceDefaultCoverImagePath } from "utils/post-image";
import { viewerPhotosFromPost } from "utils/post-photos";
const green = "#08C225";
-const dangerColor = "#F63A3A";
const textBase = spaceText;
const textSoft = spaceTextMuted;
const coverForeground = "#FFFFFF";
@@ -282,8 +279,6 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({
const [deletedPostIDs, setDeletedPostIDs] = useState<Set<string>>(
() => new Set(),
);
- const [friendActionsAnchor, setFriendActionsAnchor] =
- useState<HTMLElement | null>(null);
const [pokePhase, setPokePhase] = useState<SpaceActionPhase>();
const [pokeFailed, setPokeFailed] = useState(false);
const pokeRequestID = React.useRef<string | undefined>(undefined);
@@ -312,9 +307,6 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({
const isAnonymousPublicProfile = headerVariant == "public-anonymous";
const isPublicProfile =
headerVariant == "public" || isAnonymousPublicProfile;
- const friendActionsButtonID = React.useId();
- const friendActionsMenuID = React.useId();
- const isFriendActionsOpen = Boolean(friendActionsAnchor);
const isUnfriendActionRunning = unfriendActionPhase != null;
const canManageFriend =
isFriendProfile &&
@@ -359,7 +351,6 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({
const postImageLoadRootMargin = isAnonymousPublicProfile
? publicProfilePostLoadRootMargin
: profilePostLoadRootMargin;
- const closeFriendActions = () => setFriendActionsAnchor(null);
const poke = async () => {
if (!onPokeFriend || pokePhase) return;
@@ -381,14 +372,13 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({
if (pokePhase != "done") return;
const timeoutID = window.setTimeout(() => {
- setFriendActionsAnchor(null);
- }, spaceActionDoneDurationMs);
+ setPokePhase(undefined);
+ }, 2100);
return () => window.clearTimeout(timeoutID);
}, [pokePhase]);
const requestUnfriend = () => {
- closeFriendActions();
setUnfriendErrorMessage(null);
setIsUnfriendSheetOpen(true);
};
@@ -1002,7 +992,7 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({
profile.username
)}
</Box>
- {isOwnerProfile ? (
+ {isOwnerProfile && (
<Box
component="button"
type="button"
@@ -1036,266 +1026,181 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({
>
<SpaceShareIcon strokeWidth={2.2} />
</Box>
- ) : (
- canManageFriend && (
- <Box
- component="button"
- id={friendActionsButtonID}
- type="button"
- aria-label={`Actions for ${displayName}`}
- aria-controls={
- isFriendActionsOpen
- ? friendActionsMenuID
- : undefined
- }
- aria-expanded={
- isFriendActionsOpen
- ? "true"
- : undefined
- }
- aria-haspopup="menu"
- onClick={(event) => {
- if (pokePhase == "done")
- setPokePhase(undefined);
- setFriendActionsAnchor(
- event.currentTarget,
+ )}
+ </Box>
+ {canManageFriend && (
+ <Box
+ sx={{
+ mt: "20px",
+ mx: "auto",
+ width: "100%",
+ maxWidth: 320,
+ }}
+ >
+ <Box
+ role="group"
+ aria-label="Friend actions"
+ sx={{
+ display: "grid",
+ gap: "8px",
+ gridAutoColumns: "minmax(0, 1fr)",
+ gridAutoFlow: "column",
+ position: "relative",
+ zIndex: 4,
+ }}
+ >
+ {[
+ {
+ label: "Poke",
+ icon: HandPointingRightIcon,
+ onClick: onPokeFriend
+ ? () => void poke()
+ : undefined,
+ },
+ {
+ label: "Message",
+ icon: BubbleChatIcon,
+ onClick: onMessageFriend,
+ },
+ {
+ label: "Unfriend",
+ icon: UserRemove01Icon,
+ onClick: onUnfriend
+ ? requestUnfriend
+ : undefined,
+ },
+ ]
+ .filter((action) => action.onClick)
+ .map((action) => {
+ const isPoke =
+ action.label == "Poke";
+ const active =
+ isPoke &&
+ pokePhase !== undefined;
+ const done =
+ isPoke && pokePhase == "done";
+ return (
+ <Box
+ key={action.label}
+ component="button"
+ type="button"
+ aria-label={
+ done
+ ? "Poke sent"
+ : action.label
+ }
+ aria-busy={
+ isPoke &&
+ pokePhase == "busy"
+ }
+ aria-live={
+ isPoke
+ ? "polite"
+ : undefined
+ }
+ disabled={active}
+ onClick={action.onClick}
+ sx={{
+ alignItems: "center",
+ bgcolor:
+ spaceDialogBackground,
+ border: 0,
+ borderRadius: "22px",
+ color: active
+ ? green
+ : textBase,
+ cursor: active
+ ? "default"
+ : "pointer",
+ display: "flex",
+ height: 40,
+ justifyContent:
+ "center",
+ minWidth: 0,
+ p: "0 8px",
+ "&:hover:not(:disabled)":
+ {
+ bgcolor:
+ spaceSurfaceHover,
+ },
+ "&:focus-visible": {
+ outline: `2px solid ${green}`,
+ outlineOffset: 2,
+ },
+ }}
+ >
+ <Box
+ component="span"
+ aria-hidden
+ sx={{
+ alignItems:
+ "center",
+ display: "flex",
+ flexShrink: 0,
+ height: 22,
+ justifyContent:
+ "center",
+ width: 22,
+ animation: active
+ ? "spacePokeJab 2000ms ease-in-out"
+ : "none",
+ "@keyframes spacePokeJab":
+ {
+ "0%, 100%":
+ {
+ transform:
+ "translate(0, 0) rotate(0deg) scale(1)",
+ },
+ "27.5%, 52%, 73.75%":
+ {
+ transform:
+ "translate(36px, -94px) rotate(-40deg) scale(3)",
+ },
+ "41%, 63%":
+ {
+ transform:
+ "translate(52px, -108px) rotate(-40deg) scale(3)",
+ },
+ },
+ "@media (prefers-reduced-motion: reduce)":
+ {
+ animation:
+ "none",
+ },
+ ...(action.icon ==
+ BubbleChatIcon && {
+ "& svg path:last-of-type":
+ {
+ display:
+ "none",
+ },
+ }),
+ }}
+ >
+ <HugeiconsIcon
+ icon={action.icon}
+ size={22}
+ strokeWidth={2.2}
+ />
+ </Box>
+ </Box>
);
- }}
+ })}
+ </Box>
+ {pokeFailed && (
+ <Box
+ role="alert"
sx={{
- alignItems: "center",
- bgcolor: "transparent",
- border: 0,
- color: profileIdentityColor,
- cursor: "pointer",
- display: "flex",
- gridColumn: 3,
- height: 24,
- justifyContent: "flex-start",
- justifySelf: "start",
- ml: "8px",
- p: 0,
- width: 24,
- "&:focus-visible": {
- borderRadius: "50%",
- outline: `2px solid ${green}`,
- outlineOffset: 2,
- },
+ color: textSoft,
+ fontSize: 12,
+ mt: "8px",
}}
>
- <HugeiconsIcon
- icon={MoreHorizontalIcon}
- size={24}
- strokeWidth={2}
- />
+ Couldn&apos;t send poke. Try again.
</Box>
- )
- )}
- {canManageFriend && (
- <Menu
- id={friendActionsMenuID}
- anchorEl={friendActionsAnchor}
- open={isFriendActionsOpen}
- onClose={closeFriendActions}
- anchorOrigin={{
- horizontal: "left",
- vertical: "bottom",
- }}
- transformOrigin={{
- horizontal: "left",
- vertical: "top",
- }}
- slotProps={{
- paper: {
- sx: {
- bgcolor: spaceDialogBackground,
- borderRadius: "14px",
- boxShadow:
- "0 14px 40px rgba(0, 0, 0, 0.16)",
- mt: "6px",
- minWidth: 0,
- p: "4px",
- width: "max-content",
- },
- },
- list: {
- "aria-labelledby":
- friendActionsButtonID,
- sx: { p: 0 },
- },
- }}
- >
- {onMessageFriend && (
- <MenuItem
- dense
- disableRipple
- onClick={() => {
- closeFriendActions();
- onMessageFriend();
- }}
- sx={{
- borderRadius: "10px",
- color: textBase,
- gap: "8px",
- minHeight: 36,
- px: "9px",
- py: "4px",
- whiteSpace: "nowrap",
- "&.Mui-focusVisible": {
- bgcolor:
- "rgba(255, 255, 255, 0.08)",
- },
- "&:active": {
- bgcolor:
- "rgba(255, 255, 255, 0.08)",
- },
- "&:hover": {
- bgcolor:
- "rgba(255, 255, 255, 0.08)",
- },
- }}
- >
- <HugeiconsIcon
- icon={BubbleChatIcon}
- size={18}
- strokeWidth={1.8}
- />
- <Box
- sx={{
- fontFamily:
- '"Inter Variable", Inter, sans-serif',
- fontSize: 13,
- fontWeight: 650,
- lineHeight: "18px",
- }}
- >
- Message
- </Box>
- </MenuItem>
- )}
- {onPokeFriend && (
- <MenuItem
- dense
- disableRipple
- onClick={() => void poke()}
- disabled={pokePhase !== undefined}
- sx={{
- borderRadius: "10px",
- color: textBase,
- gap: "8px",
- minHeight: 36,
- px: "9px",
- py: "4px",
- whiteSpace: "nowrap",
- "&.Mui-disabled": {
- color: textBase,
- opacity: 1,
- },
- "&.Mui-focusVisible": {
- bgcolor:
- "rgba(255, 255, 255, 0.08)",
- },
- "&:active": {
- bgcolor:
- "rgba(255, 255, 255, 0.08)",
- },
- "&:hover": {
- bgcolor:
- "rgba(255, 255, 255, 0.08)",
- },
- }}
- >
- <SpaceActionFeedbackIcon
- phase={pokePhase ?? null}
- size={18}
- idleIcon={
- <HugeiconsIcon
- icon={
- HandPointingRightIcon
- }
- size={18}
- strokeWidth={1.8}
- />
- }
- />
- <Box
- sx={{
- fontFamily:
- '"Inter Variable", Inter, sans-serif',
- fontSize: 13,
- fontWeight: 650,
- lineHeight: "18px",
- }}
- >
- {pokePhase == "done"
- ? "Poked"
- : "Poke"}
- </Box>
- </MenuItem>
- )}
- {pokeFailed && (
- <Box
- role="alert"
- sx={{
- color: textSoft,
- fontSize: 12,
- px: "9px",
- py: "4px",
- }}
- >
- Couldn&apos;t send poke. Try again.
- </Box>
- )}
- {onUnfriend && (
- <MenuItem
- dense
- disableRipple
- onClick={requestUnfriend}
- sx={{
- alignItems: "center",
- borderRadius: "10px",
- color: dangerColor,
- display: "flex",
- gap: "8px",
- minHeight: 36,
- px: "9px",
- py: "4px",
- whiteSpace: "nowrap",
- "&.Mui-focusVisible": {
- bgcolor:
- "rgba(246, 58, 58, 0.14)",
- },
- "&:active": {
- bgcolor:
- "rgba(246, 58, 58, 0.14)",
- },
- "&:hover": {
- bgcolor:
- "rgba(246, 58, 58, 0.14)",
- },
- }}
- >
- <HugeiconsIcon
- icon={UserRemove01Icon}
- size={18}
- strokeWidth={1.8}
- style={{ flexShrink: 0 }}
- />
- <Box
- sx={{
- fontFamily:
- '"Inter Variable", Inter, sans-serif',
- fontSize: 13,
- fontWeight: 650,
- lineHeight: "18px",
- }}
- >
- Unfriend
- </Box>
- </MenuItem>
- )}
- </Menu>
- )}
- </Box>
+ )}
+ </Box>
+ )}
{!isFriendProfile &&
(isStatsLoading ? (
<ProfileStatsSkeleton />
diff --git a/web/apps/space/src/styles/globals.css b/web/apps/space/src/styles/globals.css
index 2274a8b709..f134154ac3 100644
--- a/web/apps/space/src/styles/globals.css
+++ b/web/apps/space/src/styles/globals.css
@@ -8,7 +8,8 @@
}
.space-app-layout {
- --space-bottom-nav-height: calc(60px + env(safe-area-inset-bottom));
+ --space-bottom-nav-padding: env(safe-area-inset-bottom);
+ --space-bottom-nav-height: calc(60px + var(--space-bottom-nav-padding));
--space-page-height: calc(
var(--space-viewport-height, 100svh) - var(--space-bottom-nav-height)
);