Skip to content

armgit / ente

Public Imported from GitHub
0

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

[photos] Add album creation tile before Favorites

AswinAsok36e9b4bfcd0f
diff --git a/web/apps/photos/public/images/create-album/frame.svg b/web/apps/photos/public/images/create-album/frame.svg
new file mode 100644
index 0000000000..68e76981f2
--- /dev/null
+++ b/web/apps/photos/public/images/create-album/frame.svg
@@ -0,0 +1,3 @@
+<svg preserveAspectRatio="none" overflow="visible" style="display: block;" width="30.5" height="30.5" viewBox="0 0 30.5 30.5" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path id="Vector" d="M15.25 29.5C8.53249 29.5 5.17373 29.5 3.08686 27.4131C1 25.3263 1 21.9675 1 15.25C1 8.53249 1 5.17373 3.08686 3.08686C5.17373 1 8.53249 1 15.25 1C21.9675 1 25.3263 1 27.4131 3.08686C29.5 5.17373 29.5 8.53249 29.5 15.25C29.5 21.9675 29.5 25.3263 27.4131 27.4131C25.3263 29.5 21.9675 29.5 15.25 29.5Z" stroke-width="2" stroke="#666666" style="stroke:#666666;stroke:color(display-p3 0.4000 0.4000 0.4000);stroke-opacity:1;"/>
+</svg>
diff --git a/web/apps/photos/public/images/create-album/hill.svg b/web/apps/photos/public/images/create-album/hill.svg
new file mode 100644
index 0000000000..4f92c90734
--- /dev/null
+++ b/web/apps/photos/public/images/create-album/hill.svg
@@ -0,0 +1,3 @@
+<svg preserveAspectRatio="none" overflow="visible" style="display: block;" width="13.7614" height="4.78862" viewBox="0 0 13.7614 4.78862" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path id="Vector" d="M0.614878 4C3.16716 2.01002 5.91662 0.989127 8.6942 1.00009C10.2692 0.998467 11.8367 1.33245 13.3649 1.99254" stroke-width="2" stroke-linejoin="round" stroke="#666666" style="stroke:#666666;stroke:color(display-p3 0.4000 0.4000 0.4000);stroke-opacity:1;"/>
+</svg>
diff --git a/web/apps/photos/public/images/create-album/landscape.svg b/web/apps/photos/public/images/create-album/landscape.svg
new file mode 100644
index 0000000000..dd1133a176
--- /dev/null
+++ b/web/apps/photos/public/images/create-album/landscape.svg
@@ -0,0 +1,3 @@
+<svg preserveAspectRatio="none" overflow="visible" style="display: block;" width="20.5294" height="13.2682" viewBox="0 0 20.5294 13.2682" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path id="Vector" d="M19.5661 13C18.6368 9.66231 16.4678 6.67321 13.3809 4.50128C10.0525 2.15942 5.87349 0.919947 1.58959 1.00401C1.08092 1.00283 0.572683 1.01906 0.0660504 1.05259" stroke-width="2" stroke-linejoin="round" stroke="#666666" style="stroke:#666666;stroke:color(display-p3 0.4000 0.4000 0.4000);stroke-opacity:1;"/>
+</svg>
diff --git a/web/apps/photos/public/images/create-album/plus.svg b/web/apps/photos/public/images/create-album/plus.svg
new file mode 100644
index 0000000000..f27921fa94
--- /dev/null
+++ b/web/apps/photos/public/images/create-album/plus.svg
@@ -0,0 +1,5 @@
+<svg preserveAspectRatio="none" overflow="visible" style="display: block;" width="17.5" height="17.5" viewBox="0 0 17.5 17.5" fill="none" xmlns="http://www.w3.org/2000/svg">
+<g id="elements">
+<path id="Vector" d="M8.75 0.75V8.75M8.75 8.75V16.75M8.75 8.75H16.75M8.75 8.75H0.75" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" stroke="black" style="stroke:black;stroke-opacity:1;"/>
+</g>
+</svg>
diff --git a/web/apps/photos/public/images/create-album/sun.svg b/web/apps/photos/public/images/create-album/sun.svg
new file mode 100644
index 0000000000..bc55a060f0
--- /dev/null
+++ b/web/apps/photos/public/images/create-album/sun.svg
@@ -0,0 +1,3 @@
+<svg preserveAspectRatio="none" overflow="visible" style="display: block;" width="9" height="9" viewBox="0 0 9 9" fill="none" xmlns="http://www.w3.org/2000/svg">
+<circle id="Ellipse 1361" cx="4.5" cy="4.5" r="3.5" stroke="#666666" style="stroke:#666666;stroke:color(display-p3 0.4000 0.4000 0.4000);stroke-opacity:1;" stroke-width="2"/>
+</svg>
diff --git a/web/apps/photos/src/components/gallery/AlbumsOverview.tsx b/web/apps/photos/src/components/gallery/AlbumsOverview.tsx
index 0ad9a527f4..7c7c0d6e85 100644
--- a/web/apps/photos/src/components/gallery/AlbumsOverview.tsx
+++ b/web/apps/photos/src/components/gallery/AlbumsOverview.tsx
@@ -3,7 +3,6 @@ import type { RemotePullOpts } from "@/components/gallery";
import type { AlbumFilter } from "@/utils/album-filters";
import { Delete02Icon } from "@hugeicons/core-free-icons";
import { HugeiconsIcon } from "@hugeicons/react";
-import AddIcon from "@mui/icons-material/Add";
import PushPinIcon from "@mui/icons-material/PushPin";
import {
Box,
@@ -247,21 +246,23 @@ const AlbumsRow = ({
}}
>
{Array.from({ length: end - start }, (_, offset) => {
- const album = data.albums[start + offset];
- if (!album)
+ const itemIndex = start + offset;
+ if (data.showCreate && itemIndex === 0)
return (
- <AlbumButton key="create" onClick={data.onCreateAlbum}>
+ <AlbumButton
+ key="create"
+ aria-label={t("new_album")}
+ onClick={data.onCreateAlbum}
+ >
<Cover
sx={{
- border: "1.5px dashed",
- borderColor: "stroke.faint",
+ bgcolor: "fill.faint",
display: "flex",
alignItems: "center",
justifyContent: "center",
- color: "text.muted",
}}
>
- <AddIcon />
+ <CreateAlbumIcon />
</Cover>
<Typography
component="span"
@@ -269,13 +270,13 @@ const AlbumsRow = ({
fontSize: "var(--album-name-size)",
lineHeight: "20px",
fontWeight: 500,
- color: "text.muted",
}}
>
- {t("new_album")}
+ {t("add_new_album_tile")}
</Typography>
</AlbumButton>
);
+ const album = data.albums[itemIndex - Number(data.showCreate)]!;
const badge = album.attributes.has("sharedIncoming")
? t("album_overview_received_title")
: album.attributes.has("sharedOutgoing") ||
@@ -375,6 +376,54 @@ const AlbumsRow = ({
);
};
+/** The image and plus glyph from the album creation tile in the design. */
+const CreateAlbumIcon = () => (
+ <Box
+ aria-hidden
+ sx={{ position: "relative", width: 42, height: 46, flexShrink: 0 }}
+ >
+ {[
+ { name: "frame", left: 7, top: 7 },
+ { name: "sun", left: 23, top: 13 },
+ { name: "landscape", left: 8.68, top: 24.25 },
+ { name: "hill", left: 23.13, top: 27.25 },
+ ].map(({ name, left, top }) => (
+ <Box
+ key={name}
+ component="img"
+ src={`/images/create-album/${name}.svg`}
+ alt=""
+ sx={{ position: "absolute", left, top }}
+ />
+ ))}
+ <Box
+ sx={{
+ position: "absolute",
+ left: 0,
+ top: 0,
+ width: 19,
+ height: 19,
+ borderRadius: "50%",
+ bgcolor: "background.default",
+ backgroundImage: (theme) =>
+ `linear-gradient(${theme.vars.palette.fill.faint}, ${theme.vars.palette.fill.faint})`,
+ display: "grid",
+ placeItems: "center",
+ }}
+ >
+ <Box
+ sx={{
+ width: 17.5,
+ height: 17.5,
+ mask: "url(/images/create-album/plus.svg) center / contain no-repeat",
+ bgcolor: "accent.main",
+ transform: "scale(0.395833)",
+ }}
+ />
+ </Box>
+ </Box>
+);
+
const AlbumButton = styled(UnstyledButton)(({ theme }) => ({
width: "var(--album-tile-width)",
display: "flex",
@@ -383,7 +432,7 @@ const AlbumButton = styled(UnstyledButton)(({ theme }) => ({
gap: 8,
color: theme.vars.palette.text.base,
textAlign: "left",
- borderRadius: 12,
+ borderRadius: 20,
"&:hover": { opacity: 0.86 },
"&:focus-visible": {
outline: `2px solid ${theme.vars.palette.stroke.base}`,
@@ -395,7 +444,7 @@ const Cover = styled("div")({
width: "var(--album-tile-width)",
height: "var(--album-tile-width)",
flexShrink: 0,
- borderRadius: 12,
+ borderRadius: 20,
overflow: "hidden",
position: "relative",
"& > img": {
diff --git a/web/packages/base/locales/en-US/translation.json b/web/packages/base/locales/en-US/translation.json
index 31c68e203e..9d1143e7a7 100644
--- a/web/packages/base/locales/en-US/translation.json
+++ b/web/packages/base/locales/en-US/translation.json
@@ -58,6 +58,7 @@
"album_items_count_one": "{{count, number}} item",
"album_items_count_other": "{{count, number}} items",
"new_album": "New album",
+ "add_new_album_tile": "Add new",
"create_albums": "Create albums",
"album_name": "Album name",
"album_created": "Album created",