Skip to content

armgit / ente

Public Imported from GitHub
0

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

Update Space invite bottom sheet

Anand Baburajana31205ca3137
diff --git a/web/apps/space/src/components/ConfirmationActionSheet.tsx b/web/apps/space/src/components/ConfirmationActionSheet.tsx
index 9992c99735..a7062231b2 100644
--- a/web/apps/space/src/components/ConfirmationActionSheet.tsx
+++ b/web/apps/space/src/components/ConfirmationActionSheet.tsx
@@ -1,8 +1,9 @@
-import { Box, Dialog } from "@mui/material";
+import { Box, Dialog, useMediaQuery } from "@mui/material";
import {
SpaceActionFeedbackIcon,
type SpaceActionPhase,
} from "components/SpaceActionFeedback";
+import { SpaceBottomSheetTransition } from "components/SpaceBottomSheetTransition";
import React from "react";
const green = "#08C225";
@@ -42,6 +43,7 @@ export const ConfirmationActionSheet: React.FC<
}) => {
const titleID = React.useId();
const isDark = appearance == "dark";
+ const isBottomSheet = useMediaQuery("(max-width: 599px)");
return (
<Dialog
@@ -49,6 +51,11 @@ export const ConfirmationActionSheet: React.FC<
onClose={confirmActionPhase ? undefined : onCancel}
maxWidth={false}
aria-labelledby={titleID}
+ slots={
+ isBottomSheet
+ ? { transition: SpaceBottomSheetTransition }
+ : undefined
+ }
sx={
isDark
? {
diff --git a/web/apps/space/src/components/SpaceBottomSheetTransition.tsx b/web/apps/space/src/components/SpaceBottomSheetTransition.tsx
new file mode 100644
index 0000000000..1515f09cad
--- /dev/null
+++ b/web/apps/space/src/components/SpaceBottomSheetTransition.tsx
@@ -0,0 +1,19 @@
+import Slide from "@mui/material/Slide";
+import type { TransitionProps } from "@mui/material/transitions";
+import React, { forwardRef } from "react";
+
+const bottomSheetTransitionDurationMs = 225;
+
+export const SpaceBottomSheetTransition = forwardRef(function Transition(
+ props: TransitionProps & { children: React.ReactElement },
+ ref: React.Ref<unknown>,
+) {
+ return (
+ <Slide
+ direction="up"
+ ref={ref}
+ {...props}
+ timeout={bottomSheetTransitionDurationMs}
+ />
+ );
+});
diff --git a/web/apps/space/src/screens/FriendsScreen.tsx b/web/apps/space/src/screens/FriendsScreen.tsx
index 92eed815cb..4be6cb356d 100644
--- a/web/apps/space/src/screens/FriendsScreen.tsx
+++ b/web/apps/space/src/screens/FriendsScreen.tsx
@@ -6,12 +6,20 @@ import {
UserRemove01Icon,
} from "@hugeicons/core-free-icons";
import { HugeiconsIcon } from "@hugeicons/react";
-import { Box, Dialog, Menu, MenuItem, Skeleton } from "@mui/material";
+import {
+ Box,
+ Dialog,
+ Menu,
+ MenuItem,
+ Skeleton,
+ useMediaQuery,
+} from "@mui/material";
import { ConfirmationActionSheet } from "components/ConfirmationActionSheet";
import {
spaceActionDoneDurationMs,
type SpaceActionPhase,
} from "components/SpaceActionFeedback";
+import { SpaceBottomSheetTransition } from "components/SpaceBottomSheetTransition";
import type { FriendProfile } from "data/friends";
import React, { useState } from "react";
import { spaceTouchTargetSize } from "styles/touchTargets";
@@ -342,6 +350,7 @@ const InviteFriendsDialog: React.FC<InviteFriendsDialogProps> = ({
onShare,
}) => {
const titleID = React.useId();
+ const isBottomSheet = useMediaQuery("(max-width: 599px)");
return (
<Dialog
@@ -349,114 +358,151 @@ const InviteFriendsDialog: React.FC<InviteFriendsDialogProps> = ({
onClose={sharing ? undefined : onClose}
maxWidth={false}
aria-labelledby={titleID}
+ slots={
+ isBottomSheet
+ ? { transition: SpaceBottomSheetTransition }
+ : undefined
+ }
slotProps={{
backdrop: { sx: { backgroundColor: "rgba(0, 0, 0, 0.48)" } },
paper: {
sx: {
- bgcolor: friendsBackground,
- borderRadius: "20px",
- boxShadow: "0 18px 48px rgba(0, 0, 0, 0.18)",
+ bgcolor: "#FAFAFA",
+ borderRadius: "28px 28px 0 0",
+ bottom: 0,
+ boxShadow: "none",
boxSizing: "border-box",
- m: "16px",
- maxWidth: 342,
- p: "24px 20px 20px",
- width: "calc(100vw - 32px)",
+ left: 0,
+ m: 0,
+ maxWidth: "none",
+ p: "26px 20px calc(24px + env(safe-area-inset-bottom))",
+ position: "fixed",
+ width: "100vw",
+ "@media (min-width: 600px)": {
+ borderRadius: "20px",
+ bottom: "auto",
+ boxShadow: "0 18px 48px rgba(0, 0, 0, 0.18)",
+ left: "50%",
+ maxWidth: 342,
+ p: "24px 20px 20px",
+ top: "50%",
+ transform: "translate(-50%, -50%)",
+ width: 342,
+ },
},
},
}}
>
<Box
- component="h2"
- id={titleID}
- sx={{
- color: textBase,
- fontFamily: '"Inter Variable", Inter, sans-serif',
- fontSize: 18,
- fontWeight: 650,
- lineHeight: "24px",
- m: 0,
- textAlign: "center",
- }}
- >
- Invite friends
- </Box>
- <Box
- component="p"
sx={{
- color: textSoft,
- fontFamily: '"Inter Variable", Inter, sans-serif',
- fontSize: 14,
- fontWeight: 500,
- lineHeight: "20px",
- m: 0,
- mt: "10px",
- textAlign: "center",
- }}
- >
- Invite friends and family by sharing your private profile link.
- Only you and the people you share it with can see your posts.
- </Box>
- <Box
- sx={{
- display: "flex",
- flexDirection: "column",
- gap: "10px",
- mt: "22px",
+ maxWidth: 320,
+ mx: "auto",
+ width: "100%",
+ "@media (min-width: 600px)": { maxWidth: "none" },
}}
>
<Box
- className="green-bg"
- component="button"
- type="button"
- disabled={sharing}
- onClick={onShare}
+ component="h2"
+ id={titleID}
sx={{
- alignItems: "center",
- border: 0,
- borderRadius: "18px",
- boxShadow: "0 12px 32px rgba(0, 0, 0, 0.18)",
- color: "#FFFFFF",
- cursor: sharing ? "default" : "pointer",
- display: "flex",
- gap: "10px",
+ color: textBase,
fontFamily: '"Inter Variable", Inter, sans-serif',
fontSize: 15,
- fontWeight: 650,
- justifyContent: "center",
+ fontWeight: 600,
lineHeight: "20px",
- minHeight: 48,
- px: "16px",
- py: "10px",
- width: "100%",
- "&:disabled": { opacity: 0.7 },
- "&:focus-visible": {
- outline: "2px solid rgba(0 0 0 / 0.72)",
- outlineOffset: 2,
- },
+ m: 0,
+ px: "20px",
+ textAlign: "center",
}}
>
- <HugeiconsIcon
- icon={Share08Icon}
- size={18}
- strokeWidth={1.8}
- />
- {sharing ? "Sharing..." : "Share invite"}
+ Invite friends
+ </Box>
+ <Box
+ component="p"
+ sx={{
+ color: textSoft,
+ fontFamily: '"Inter Variable", Inter, sans-serif',
+ fontSize: 14,
+ fontWeight: 500,
+ lineHeight: "20px",
+ m: 0,
+ mt: "10px",
+ textAlign: "center",
+ }}
+ >
+ Invite friends and family by sharing your private profile
+ link. Only you and the people you share it with can see your
+ posts.
</Box>
- {errorMessage && (
+ <Box
+ sx={{
+ display: "flex",
+ flexDirection: "column",
+ gap: "10px",
+ mt: "22px",
+ }}
+ >
<Box
- role="alert"
+ className="green-bg"
+ component="button"
+ type="button"
+ disabled={sharing}
+ onClick={onShare}
sx={{
- color: dangerColor,
+ alignItems: "center",
+ border: 0,
+ borderRadius: "20px",
+ color: "#FFFFFF",
+ cursor: sharing ? "default" : "pointer",
+ display: "flex",
+ gap: "10px",
fontFamily: '"Inter Variable", Inter, sans-serif',
- fontSize: 13,
- fontWeight: 650,
- lineHeight: "18px",
- textAlign: "center",
+ fontSize: 14,
+ fontWeight: 600,
+ justifyContent: "center",
+ lineHeight: "20px",
+ height: 48,
+ px: "24px",
+ py: "14px",
+ transition: "filter 120ms ease, opacity 120ms ease",
+ width: "100%",
+ "&:active": sharing
+ ? undefined
+ : { filter: "brightness(0.96)" },
+ "&:disabled": { opacity: 1 },
+ "&:focus-visible": {
+ outline: "2px solid rgba(0 0 0 / 0.72)",
+ outlineOffset: 2,
+ },
+ "&:hover": sharing
+ ? undefined
+ : { filter: "brightness(0.98)" },
}}
>
- {errorMessage}
+ <HugeiconsIcon
+ icon={Share08Icon}
+ size={18}
+ strokeWidth={1.8}
+ />
+ {sharing ? "Sharing..." : "Share invite"}
</Box>
- )}
+ {errorMessage && (
+ <Box
+ role="alert"
+ sx={{
+ color: dangerColor,
+ fontFamily:
+ '"Inter Variable", Inter, sans-serif',
+ fontSize: 13,
+ fontWeight: 650,
+ lineHeight: "18px",
+ textAlign: "center",
+ }}
+ >
+ {errorMessage}
+ </Box>
+ )}
+ </Box>
</Box>
</Dialog>
);
@@ -702,9 +748,7 @@ export const FriendsScreen: React.FC<FriendsScreenProps> = ({
bgcolor: "transparent",
border: 0,
color: textBase,
- cursor: onShareProfileLink
- ? "pointer"
- : "default",
+ cursor: onShareProfileLink ? "pointer" : "default",
display: "flex",
height: spaceTouchTargetSize,
justifyContent: "flex-end",