Skip to content

armgit / ente

Public Imported from GitHub
0

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

[photos][web] Remove copy actions from Links overview

AswinAsok7ac1226dbd50
diff --git a/web/apps/photos/src/components/gallery/AlbumsOverview.tsx b/web/apps/photos/src/components/gallery/AlbumsOverview.tsx
index ea3c999c60..24bacd2e24 100644
--- a/web/apps/photos/src/components/gallery/AlbumsOverview.tsx
+++ b/web/apps/photos/src/components/gallery/AlbumsOverview.tsx
@@ -17,7 +17,6 @@ import {
useMediaQuery,
useTheme,
} from "@mui/material";
-import type { Collection } from "ente-media/collection";
import { ItemCard } from "ente-new/photos/components/Tiles";
import { UnstyledButton } from "ente-new/photos/components/UnstyledButton";
import type {
@@ -28,13 +27,11 @@ import { t } from "i18next";
import { useEffect, useRef, useState } from "react";
import AutoSizer from "react-virtualized-auto-sizer";
import { FixedSizeList, type ListChildComponentProps } from "react-window";
-import { LinkCopyChip } from "./LinkCopyChip";
interface AlbumsOverviewProps {
albums: CollectionSummary[];
title: string;
filter: AlbumFilter | "links";
- linksByID?: ReadonlyMap<number, Collection>;
searchQuery: string;
sortBy: CollectionsSortBy;
onSelectAlbum: (id: number) => void;
@@ -46,7 +43,6 @@ export const AlbumsOverview = ({
albums,
title,
filter,
- linksByID,
searchQuery,
sortBy,
onSelectAlbum,
@@ -206,7 +202,7 @@ export const AlbumsOverview = ({
style={{ overflowX: "hidden" }}
itemData={{
albums,
- linksByID,
+ isLinks,
columns,
columnGap,
tileWidth,
@@ -228,7 +224,7 @@ export const AlbumsOverview = ({
};
interface AlbumRowData {
- linksByID?: ReadonlyMap<number, Collection>;
+ isLinks: boolean;
albums: CollectionSummary[];
columns: number;
columnGap: number;
@@ -297,110 +293,101 @@ const AlbumsRow = ({
</AlbumButton>
);
const album = data.albums[itemIndex - Number(data.showCreate)]!;
- const link = data.linksByID?.get(album.id);
- const badge =
- !link && album.attributes.has("sharedIncoming")
- ? t("album_overview_received_title")
- : album.attributes.has("sharedOutgoing") ||
- album.attributes.has("sharedViaLink")
- ? t("shared_albums_label")
- : undefined;
+ const badge = album.attributes.has("sharedIncoming")
+ ? t("album_overview_received_title")
+ : album.attributes.has("sharedOutgoing") ||
+ album.attributes.has("sharedViaLink")
+ ? t("shared_albums_label")
+ : undefined;
return (
- <Box
+ <AlbumButton
key={album.id}
- sx={{ position: "relative", width: data.tileWidth }}
+ title={album.name}
+ onClick={() => data.onSelectAlbum(album.id)}
>
- <AlbumButton
- title={album.name}
- onClick={() => data.onSelectAlbum(album.id)}
+ <ItemCard
+ TileComponent={Cover}
+ coverFile={album.coverFile}
+ isScrolling={isScrolling}
>
- <ItemCard
- TileComponent={Cover}
- coverFile={album.coverFile}
- isScrolling={isScrolling}
- >
- {!link && badge && (
- <Box
- component="span"
- sx={{
- position: "absolute",
- right: 8,
- bottom: 8,
- height: 24,
- px: "8px",
- borderRadius: "8px",
- bgcolor: "rgba(0,0,0,.55)",
- color: "#fff",
- fontSize: 11,
- fontWeight: 600,
- display: "flex",
- alignItems: "center",
- backdropFilter: "blur(6px)",
- maxWidth: "calc(100% - 16px)",
- overflow: "hidden",
- whiteSpace: "nowrap",
- }}
- >
- {badge}
- </Box>
- )}
- </ItemCard>
- <Stack
- component="span"
- sx={{ width: "100%", gap: "2px" }}
- >
- <Stack
+ {!data.isLinks && badge && (
+ <Box
component="span"
- direction="row"
sx={{
+ position: "absolute",
+ right: 8,
+ bottom: 8,
+ height: 24,
+ px: "8px",
+ borderRadius: "8px",
+ bgcolor: "rgba(0,0,0,.55)",
+ color: "#fff",
+ fontSize: 11,
+ fontWeight: 600,
+ display: "flex",
alignItems: "center",
- gap: "4px",
- minWidth: 0,
+ backdropFilter: "blur(6px)",
+ maxWidth: "calc(100% - 16px)",
+ overflow: "hidden",
+ whiteSpace: "nowrap",
}}
>
- <Typography
- component="span"
- noWrap
- sx={{
- fontSize: "var(--album-name-size)",
- lineHeight: "20px",
- fontWeight: 500,
- }}
- >
- {album.name}
- </Typography>
- {(album.attributes.has("pinned") ||
- album.attributes.has(
- "shareePinned",
- )) && (
- <Box
- component={HugeiconsIcon}
- icon={PinIcon}
- size={12}
- sx={{
- flexShrink: 0,
- color: "text.faint",
- }}
- />
- )}
- </Stack>
+ {badge}
+ </Box>
+ )}
+ </ItemCard>
+ <Stack
+ component="span"
+ sx={{ width: "100%", gap: "2px" }}
+ >
+ <Stack
+ component="span"
+ direction="row"
+ sx={{
+ alignItems: "center",
+ gap: "4px",
+ minWidth: 0,
+ }}
+ >
<Typography
component="span"
+ noWrap
sx={{
- fontSize: "var(--album-count-size)",
- lineHeight: "16px",
+ fontSize: "var(--album-name-size)",
+ lineHeight: "20px",
fontWeight: 500,
- color: "text.muted",
}}
>
- {t("album_items_count", {
- count: album.fileCount,
- })}
+ {album.name}
</Typography>
+ {(album.attributes.has("pinned") ||
+ album.attributes.has("shareePinned")) && (
+ <Box
+ component={HugeiconsIcon}
+ icon={PinIcon}
+ size={12}
+ sx={{
+ flexShrink: 0,
+ color: "text.faint",
+ }}
+ />
+ )}
</Stack>
- </AlbumButton>
- {link && <LinkCopyChip collection={link} />}
- </Box>
+ <Typography
+ component="span"
+ sx={{
+ fontSize: "var(--album-count-size)",
+ lineHeight: "16px",
+ fontWeight: 500,
+ color: "text.muted",
+ }}
+ >
+ {t("album_items_count", {
+ count: album.fileCount,
+ })}
+ </Typography>
+ </Stack>
+ </AlbumButton>
);
})}
</div>
diff --git a/web/apps/photos/src/components/gallery/LinkCopyChip.tsx b/web/apps/photos/src/components/gallery/LinkCopyChip.tsx
deleted file mode 100644
index 58e8e66882..0000000000
--- a/web/apps/photos/src/components/gallery/LinkCopyChip.tsx
+++ /dev/null
@@ -1,46 +0,0 @@
-import { usePublicLinkURL } from "@/components/utils/use-public-link-url";
-import { Copy01Icon, Tick02Icon } from "@hugeicons/core-free-icons";
-import { HugeiconsIcon } from "@hugeicons/react";
-import { IconButton, Tooltip } from "@mui/material";
-import { useClipboardCopy } from "ente-base/components/utils/hooks";
-import type { Collection } from "ente-media/collection";
-import { useSettingsSnapshot } from "ente-new/photos/components/utils/use-snapshot";
-import { t } from "i18next";
-
-export const LinkCopyChip = ({ collection }: { collection: Collection }) => {
- const { customDomain } = useSettingsSnapshot();
- const { resolvedURL } = usePublicLinkURL(
- collection,
- collection.publicURLs[0],
- customDomain,
- );
- const [copied, copy] = useClipboardCopy(resolvedURL ?? "");
- const label = t(copied ? "copied" : "copy_link");
- return (
- <Tooltip title={label}>
- <span style={{ position: "absolute", top: 8, right: 8 }}>
- <IconButton
- aria-label={`${label}: ${collection.name}`}
- disabled={!resolvedURL}
- onClick={copy}
- sx={{
- width: 28,
- height: 28,
- p: 0,
- borderRadius: "50%",
- bgcolor: "#FFFFFF",
- color: "#161616",
- boxShadow: "0px 2px 6px rgba(0,0,0,0.15)",
- "&:hover": { bgcolor: "#F4F4F4" },
- }}
- >
- <HugeiconsIcon
- icon={copied ? Tick02Icon : Copy01Icon}
- size={12}
- strokeWidth={1.5}
- />
- </IconButton>
- </span>
- </Tooltip>
- );
-};
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index a107dc3108..5405edf73f 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -2326,14 +2326,6 @@ const Page: React.FC = () => {
albums={sidebarCollectionSummaries}
title={t("links")}
filter="links"
- linksByID={
- new Map(
- quickLinks.map((link) => [
- link.id,
- link,
- ]),
- )
- }
searchQuery={albumSearchQuery}
sortBy={collectionsSortBy}
onSelectAlbum={selectGalleryCollection}