Skip to content

armgit / ente

Public Imported from GitHub
0

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

[web][photos] Remove unreachable link confirmation

AswinAsokd24095cd304e
diff --git a/web/apps/photos/src/components/collections/CollectionShare.tsx b/web/apps/photos/src/components/collections/CollectionShare.tsx
index e1836f12ce..9ada74f784 100644
--- a/web/apps/photos/src/components/collections/CollectionShare.tsx
+++ b/web/apps/photos/src/components/collections/CollectionShare.tsx
@@ -2,7 +2,6 @@
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
import Avatar from "@/components/Avatar";
import type { RemotePullOpts } from "@/components/gallery";
-import { PublicLinkCreated } from "@/components/share/PublicLinkCreated";
import { PublicLinkField } from "@/components/share/PublicLinkField";
import { sidebarStyles, sidebarTheme } from "@/components/sidebar/theme";
import { usePublicLinkURL } from "@/components/utils/use-public-link-url";
@@ -1678,14 +1677,8 @@ const PublicShare: React.FC<PublicShareProps> = ({
canManage,
openManageLink,
}) => {
- const inPanel = !!useContext(SidebarPanelContext);
const { customDomain } = useSettingsSnapshot();
- const {
- show: showPublicLinkCreated,
- props: publicLinkCreatedVisibilityProps,
- } = useModalVisibility();
-
const [shareState, setShareState] = useState({
collection,
publicURL: collection.publicURLs[0],
@@ -1702,63 +1695,42 @@ const PublicShare: React.FC<PublicShareProps> = ({
canManage ? customDomain : undefined,
);
- const handleCopyLink = () => {
- if (resolvedURL) void navigator.clipboard.writeText(resolvedURL);
- };
-
- return (
- <>
- {publicURL && resolvedURL ? (
- canManage ? (
- <ManagePublicShare
- openOnMount={openManageLink}
- {...{
- onRootClose,
- collection,
- publicURL,
- setPublicURL,
- resolvedURL,
- setBlockingLoad,
- onRemotePull,
- }}
- />
- ) : (
- <ReadOnlyPublicShare resolvedURL={resolvedURL} />
- )
- ) : publicURL ? (
- <Typography role="status" color="text.muted">
- {error
- ? t("generic_error")
- : isLoading
- ? t("loading")
- : null}
- </Typography>
- ) : canManage ? (
- <EnablePublicShareOptions
- {...{ collection, onRemotePull, setPublicURL }}
- onLinkCreated={() => {
- if (inPanel) showPublicLinkCreated();
- }}
- />
- ) : null}
- <PublicLinkCreated
- {...publicLinkCreatedVisibilityProps}
- onCopyLink={handleCopyLink}
+ return publicURL && resolvedURL ? (
+ canManage ? (
+ <ManagePublicShare
+ openOnMount={openManageLink}
+ {...{
+ onRootClose,
+ collection,
+ publicURL,
+ setPublicURL,
+ resolvedURL,
+ setBlockingLoad,
+ onRemotePull,
+ }}
/>
- </>
- );
+ ) : (
+ <ReadOnlyPublicShare resolvedURL={resolvedURL} />
+ )
+ ) : publicURL ? (
+ <Typography role="status" color="text.muted">
+ {error ? t("generic_error") : isLoading ? t("loading") : null}
+ </Typography>
+ ) : canManage ? (
+ <EnablePublicShareOptions
+ {...{ collection, onRemotePull, setPublicURL }}
+ />
+ ) : null;
};
type EnablePublicShareOptionsProps = {
setPublicURL: (value: PublicURL) => void;
- onLinkCreated: () => void;
} & Pick<CollectionShareProps, "collection" | "onRemotePull">;
const EnablePublicShareOptions: React.FC<EnablePublicShareOptionsProps> = ({
collection,
onRemotePull,
setPublicURL,
- onLinkCreated,
}) => {
const [pending, setPending] = useState("");
const [errorMessage, setErrorMessage] = useState("");
@@ -1775,7 +1747,6 @@ const EnablePublicShareOptions: React.FC<EnablePublicShareOptionsProps> = ({
});
setPending("");
setPublicURL(publicURL);
- onLinkCreated();
void onRemotePull({ silent: true });
} catch (e: unknown) {
log.error("Could not create public link", e);
diff --git a/web/apps/photos/src/components/share/PublicLinkCreated.tsx b/web/apps/photos/src/components/share/PublicLinkCreated.tsx
deleted file mode 100644
index 6aa33895d3..0000000000
--- a/web/apps/photos/src/components/share/PublicLinkCreated.tsx
+++ /dev/null
@@ -1,95 +0,0 @@
-import CheckIcon from "@mui/icons-material/Check";
-import ContentCopyIcon from "@mui/icons-material/ContentCopyOutlined";
-import { Box, Dialog, Stack, Typography } from "@mui/material";
-import { FocusVisibleButton } from "ente-base/components/mui/FocusVisibleButton";
-import {
- v2CancelButtonSx,
- v2PaperSx,
- v2SubmitButtonSx,
- v2TitleSx,
-} from "ente-base/components/SingleInput.styles";
-import type { ModalVisibilityProps } from "ente-base/components/utils/modal";
-import { t } from "i18next";
-import { useId } from "react";
-
-type PublicLinkCreatedProps = ModalVisibilityProps & { onCopyLink: () => void };
-
-export const PublicLinkCreated: React.FC<PublicLinkCreatedProps> = ({
- open,
- onClose,
- onCopyLink,
-}) => {
- const titleID = useId();
- return (
- <Dialog
- {...{ open, onClose }}
- aria-labelledby={titleID}
- disablePortal
- maxWidth={false}
- slotProps={{
- backdrop: { sx: { position: "absolute" } },
- paper: {
- sx: (theme) => ({
- ...v2PaperSx(theme),
- width: "min(360px, calc(100svw - 32px))",
- maxWidth: "360px",
- }),
- },
- }}
- sx={{ position: "absolute" }}
- >
- <Stack sx={{ p: "24px", gap: "24px" }}>
- <Stack sx={{ alignItems: "center", gap: "16px" }}>
- <Box
- sx={{
- width: 48,
- height: 48,
- borderRadius: "50%",
- display: "grid",
- placeItems: "center",
- color: "#08c225",
- bgcolor: "rgba(8, 194, 37, 0.12)",
- }}
- >
- <CheckIcon sx={{ fontSize: 28 }} />
- </Box>
- <Typography
- id={titleID}
- component="h2"
- sx={{
- ...v2TitleSx,
- fontFamily: "'Outfit Variable', sans-serif",
- textAlign: "center",
- }}
- >
- {t("public_link_created")}
- </Typography>
- </Stack>
- <Stack sx={{ gap: "12px" }}>
- <FocusVisibleButton
- onClick={() => {
- onCopyLink();
- onClose();
- }}
- startIcon={<ContentCopyIcon sx={{ fontSize: 18 }} />}
- fullWidth
- sx={[v2SubmitButtonSx, { flex: "none", minHeight: 52 }]}
- >
- {t("copy_link")}
- </FocusVisibleButton>
- <FocusVisibleButton
- onClick={onClose}
- fullWidth
- sx={(theme) => ({
- ...v2CancelButtonSx(theme),
- flex: "none",
- minHeight: 52,
- })}
- >
- {t("done")}
- </FocusVisibleButton>
- </Stack>
- </Stack>
- </Dialog>
- );
-};