Skip to content

armgit / ente

Public Imported from GitHub
0

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

[photos][web] Adjust public link details layout

AswinAsokb190862b48ff
diff --git a/web/apps/photos/src/components/collections/CollectionShare.tsx b/web/apps/photos/src/components/collections/CollectionShare.tsx
index 2b9ea63aca..7632dddcb1 100644
--- a/web/apps/photos/src/components/collections/CollectionShare.tsx
+++ b/web/apps/photos/src/components/collections/CollectionShare.tsx
@@ -91,6 +91,7 @@ import React, {
useRef,
useState,
} from "react";
+import { createPortal } from "react-dom";
import { Trans } from "react-i18next";
import { z } from "zod";
@@ -1704,7 +1705,7 @@ type ManagePublicShareOptionsProps = {
variant?: "drawer";
onRootClose: () => void;
} & ModalVisibilityProps)
- | { variant: "inline" }
+ | { variant: "inline"; removeLinkContainer?: HTMLElement | null }
);
export const ManagePublicShareOptions: React.FC<
@@ -1871,6 +1872,31 @@ export const ManagePublicShareOptions: React.FC<
);
if (props.variant == "inline") {
+ const removeLinkButton = (
+ <FocusVisibleButton
+ color="critical"
+ onClick={handleRemovePublicLink}
+ sx={{
+ alignSelf: props.removeLinkContainer
+ ? "stretch"
+ : "flex-start",
+ ml: props.removeLinkContainer ? 0 : 1,
+ px: 1,
+ py: 1,
+ bgcolor: "transparent",
+ color: "critical.main",
+ fontSize: 14,
+ fontWeight: 500,
+ width: props.removeLinkContainer ? "100%" : undefined,
+ height: props.removeLinkContainer ? 52 : undefined,
+ textDecoration: "underline",
+ borderRadius: "20px",
+ "&:hover": { bgcolor: "fill.faintHover" },
+ }}
+ >
+ {t("remove_link")}
+ </FocusVisibleButton>
+ );
return (
<ThemeProvider theme={sidebarTheme}>
<Stack
@@ -1960,23 +1986,12 @@ export const ManagePublicShareOptions: React.FC<
</SidebarDrawerDepthContext.Provider>
</SidebarPanelContext.Provider>
</Box>
- <FocusVisibleButton
- color="critical"
- onClick={handleRemovePublicLink}
- sx={{
- alignSelf: "flex-start",
- ml: 1,
- px: 1,
- py: 1,
- bgcolor: "transparent",
- color: "critical.main",
- fontSize: 14,
- fontWeight: 600,
- "&:hover": { bgcolor: "fill.faintHover" },
- }}
- >
- {t("remove_link")}
- </FocusVisibleButton>
+ {props.removeLinkContainer
+ ? createPortal(
+ removeLinkButton,
+ props.removeLinkContainer,
+ )
+ : removeLinkButton}
{errorMessage && (
<Typography
variant="small"
diff --git a/web/apps/photos/src/components/gallery/PublicLinkDetails.tsx b/web/apps/photos/src/components/gallery/PublicLinkDetails.tsx
index 7ec4a78c76..b6de9fcaa3 100644
--- a/web/apps/photos/src/components/gallery/PublicLinkDetails.tsx
+++ b/web/apps/photos/src/components/gallery/PublicLinkDetails.tsx
@@ -51,6 +51,8 @@ export const PublicLinkDetails = ({
const { show: showPickCoverPhoto, props: pickCoverPhotoVisibilityProps } =
useModalVisibility();
const { customDomain } = useSettingsSnapshot();
+ const [removeLinkContainer, setRemoveLinkContainer] =
+ useState<HTMLDivElement | null>(null);
const [shareState, setShareState] = useState({
collection,
publicURL: collection.publicURLs[0],
@@ -89,6 +91,9 @@ export const PublicLinkDetails = ({
return (
<Box
sx={{
+ display: "flex",
+ flexDirection: "column",
+ containerType: "inline-size",
flex: 1,
minHeight: 0,
overflow: "auto",
@@ -126,8 +131,18 @@ export const PublicLinkDetails = ({
</Typography>
</Stack>
<Stack
- direction="row"
- sx={{ flexWrap: "wrap", gap: "40px", alignItems: "flex-start" }}
+ sx={{
+ display: "grid",
+ gridTemplateColumns: "minmax(0, 1fr)",
+ flex: 1,
+ gap: "28px",
+ alignContent: "start",
+ alignItems: "start",
+ "@container (min-width: 720px)": {
+ gridTemplateColumns: "minmax(0, 364px) minmax(0, 1fr)",
+ columnGap: "44px",
+ },
+ }}
>
<Stack sx={{ width: "100%", maxWidth: 364, gap: "14px" }}>
<Box sx={{ position: "relative" }}>
@@ -244,19 +259,15 @@ export const PublicLinkDetails = ({
>
{t("open_album")}
</FocusVisibleButton>
+ <Box ref={setRemoveLinkContainer} />
</Stack>
{collection.owner.id === user.id &&
publicURL &&
resolvedURL && (
- <Box
- sx={{
- flex: "1 1 320px",
- minWidth: 0,
- maxWidth: 520,
- }}
- >
+ <Box sx={{ minWidth: 0 }}>
<ManagePublicShareOptions
variant="inline"
+ removeLinkContainer={removeLinkContainer}
{...{
collection,
publicURL,