Skip to content

armgit / ente

Public Imported from GitHub
0

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

Update

vishnukvmd5e7cc20cf217
diff --git a/web/apps/locker/src/components/CollectionSidebar.tsx b/web/apps/locker/src/components/CollectionSidebar.tsx
index 8e539061a9..fa79c256c8 100644
--- a/web/apps/locker/src/components/CollectionSidebar.tsx
+++ b/web/apps/locker/src/components/CollectionSidebar.tsx
@@ -311,10 +311,19 @@ const SidebarRow: React.FC<{
...(selected && {
color: color ?? "primary.main",
borderColor: theme.vars.palette.primary.main,
- backgroundColor: "transparent",
+ backgroundColor: "rgba(16, 113, 255, 0.10)",
}),
- "&.Mui-selected": { backgroundColor: "transparent" },
- "&.Mui-selected:hover": { backgroundColor: "transparent" },
+ "&.Mui-selected": {
+ backgroundColor: "rgba(16, 113, 255, 0.10)",
+ },
+ "&.Mui-selected:hover": {
+ backgroundColor: "rgba(16, 113, 255, 0.14)",
+ },
+ "&:hover": {
+ backgroundColor: selected
+ ? "rgba(16, 113, 255, 0.14)"
+ : theme.vars.palette.fill.faint,
+ },
})}
>
<ListItemIcon sx={{ minWidth: 36, color: "inherit" }}>
diff --git a/web/apps/locker/src/components/CreateItemDialog.tsx b/web/apps/locker/src/components/CreateItemDialog.tsx
index 867b9112c8..13bcbef8d6 100644
--- a/web/apps/locker/src/components/CreateItemDialog.tsx
+++ b/web/apps/locker/src/components/CreateItemDialog.tsx
@@ -22,6 +22,7 @@ import {
lockerItemIcon,
lockerItemIconConfig,
} from "components/lockerItemIcons";
+import { lockerDialogPaperSx } from "components/lockerDialogStyles";
import { ensureLocalUser } from "ente-accounts-rs/services/user";
import { FocusVisibleButton } from "ente-base/components/mui/FocusVisibleButton";
import { LoadingButton } from "ente-base/components/mui/LoadingButton";
@@ -303,8 +304,8 @@ export const CreateItemDialog: React.FC<CreateItemDialogProps> = ({
slotProps={{
paper: {
sx: {
+ ...lockerDialogPaperSx,
maxHeight: "min(720px, 90vh)",
- borderRadius: "16px",
width: "min(100%, 520px)",
},
},
diff --git a/web/apps/locker/src/components/ItemList.tsx b/web/apps/locker/src/components/ItemList.tsx
index bf36c8e2a8..635fe310d3 100644
--- a/web/apps/locker/src/components/ItemList.tsx
+++ b/web/apps/locker/src/components/ItemList.tsx
@@ -5,6 +5,7 @@ import DeleteOutlineIcon from "@mui/icons-material/DeleteOutline";
import DeleteSweepOutlinedIcon from "@mui/icons-material/DeleteSweepOutlined";
import EditOutlinedIcon from "@mui/icons-material/EditOutlined";
import FileDownloadOutlinedIcon from "@mui/icons-material/FileDownloadOutlined";
+import FilterListRoundedIcon from "@mui/icons-material/FilterListRounded";
import FolderOutlinedIcon from "@mui/icons-material/FolderOutlined";
import ShareOutlinedIcon from "@mui/icons-material/ShareOutlined";
import StarIcon from "@mui/icons-material/Star";
@@ -17,6 +18,8 @@ import {
DialogContent,
DialogTitle,
IconButton,
+ Menu,
+ MenuItem,
Snackbar,
Stack,
TextField,
@@ -50,6 +53,7 @@ import {
import { ItemCard } from "./ItemCard";
import { ItemDetailView } from "./ItemDetailView";
import { LockerFileLinkDialog } from "./LockerFileLinkDialog";
+import { lockerDialogPaperSx } from "./lockerDialogStyles";
interface ItemListProps {
collections: LockerCollection[];
@@ -113,6 +117,8 @@ export const ItemList: React.FC<ItemListProps> = ({
const [homeSelectedCollectionIDs, setHomeSelectedCollectionIDs] = useState<
number[]
>([]);
+ const [collectionFilterAnchorEl, setCollectionFilterAnchorEl] =
+ useState<HTMLElement | null>(null);
const [selectionMode, setSelectionMode] = useState(false);
const [selectedItemIDs, setSelectedItemIDs] = useState<number[]>([]);
const [bulkDownloading, setBulkDownloading] = useState(false);
@@ -350,6 +356,15 @@ export const ItemList: React.FC<ItemListProps> = ({
const clearHomeCollectionSelection = useCallback(() => {
setHomeSelectedCollectionIDs([]);
}, []);
+ const openCollectionFilterMenu = useCallback(
+ (event: React.MouseEvent<HTMLElement>) => {
+ setCollectionFilterAnchorEl(event.currentTarget);
+ },
+ [],
+ );
+ const closeCollectionFilterMenu = useCallback(() => {
+ setCollectionFilterAnchorEl(null);
+ }, []);
const startSelectionModeForItem = useCallback((item: LockerItem) => {
setSelectionMode(true);
setSelectedItemIDs([item.id]);
@@ -626,58 +641,29 @@ export const ItemList: React.FC<ItemListProps> = ({
maxWidth: contentMaxWidth,
mx: "auto",
alignItems: "center",
- gap: 1,
+ gap: 0.75,
mt: -0.25,
mb: 1.75,
+ minWidth: 0,
}}
>
- <CollectionChipFilters
- collections={displayCollections}
- selectedCollectionIDs={
- homeSelectedCollectionIDs
- }
- onToggleCollection={
- toggleHomeCollection
+ <CollectionFilterChip
+ selected={
+ homeSelectedCollectionIDs.length > 0
}
+ onClick={openCollectionFilterMenu}
/>
- {homeSelectedCollectionIDs.length > 0 && (
- <Tooltip title={t("clearSelection")}>
- <IconButton
- size="small"
- onClick={
- clearHomeCollectionSelection
- }
- sx={(theme) => ({
- width: 32,
- height: 32,
- color: "text.muted",
- border: "1px solid rgba(255, 255, 255, 0.08)",
- backgroundColor:
- "rgba(255, 255, 255, 0.035)",
- "&:hover": {
- backgroundColor:
- "rgba(255, 255, 255, 0.065)",
- },
- ...theme.applyStyles(
- "light",
- {
- border: "1px solid rgba(17, 24, 39, 0.08)",
- backgroundColor:
- "#FFFFFF",
- "&:hover": {
- backgroundColor:
- "#FFFFFF",
- },
- },
- ),
- })}
- >
- <ClearRoundedIcon
- sx={{ fontSize: 18 }}
- />
- </IconButton>
- </Tooltip>
- )}
+ <Box sx={{ flex: 1, minWidth: 0 }}>
+ <CollectionChipFilters
+ collections={displayCollections}
+ selectedCollectionIDs={
+ homeSelectedCollectionIDs
+ }
+ onToggleCollection={
+ toggleHomeCollection
+ }
+ />
+ </Box>
</Stack>
)}
@@ -1077,6 +1063,7 @@ export const ItemList: React.FC<ItemListProps> = ({
/>
<Dialog
+ slotProps={{ paper: { sx: lockerDialogPaperSx } }}
open={restoreItem !== null}
onClose={() => setRestoreItem(null)}
fullWidth
@@ -1126,6 +1113,7 @@ export const ItemList: React.FC<ItemListProps> = ({
</Dialog>
<Dialog
+ slotProps={{ paper: { sx: lockerDialogPaperSx } }}
open={renameCollectionID !== null}
onClose={() => setRenameCollectionID(null)}
fullWidth
@@ -1160,6 +1148,7 @@ export const ItemList: React.FC<ItemListProps> = ({
</Dialog>
<Dialog
+ slotProps={{ paper: { sx: lockerDialogPaperSx } }}
open={createCollectionOpen}
onClose={() => {
if (!creatingCollection) {
@@ -1222,6 +1211,158 @@ export const ItemList: React.FC<ItemListProps> = ({
</DialogContent>
</Dialog>
+ <Menu
+ anchorEl={collectionFilterAnchorEl}
+ open={!!collectionFilterAnchorEl}
+ onClose={closeCollectionFilterMenu}
+ slotProps={{
+ paper: {
+ sx: {
+ mt: 1,
+ width: "fit-content",
+ minWidth: 0,
+ maxWidth: "calc(100vw - 32px)",
+ borderRadius: "18px",
+ overflow: "hidden",
+ },
+ },
+ }}
+ >
+ <Box
+ sx={{
+ px: 1,
+ pt: 0,
+ pb: 0,
+ width: "fit-content",
+ }}
+ >
+ {displayCollections.map((collection) => {
+ const isSelected = homeSelectedCollectionIDs.includes(
+ collection.id,
+ );
+
+ return (
+ <MenuItem
+ key={collection.id}
+ onClick={() =>
+ toggleHomeCollection(collection.id)
+ }
+ sx={(theme) => ({
+ gap: 1.25,
+ px: 1,
+ py: 1,
+ my: "6px",
+ borderRadius: "14px",
+ alignItems: "center",
+ width: "auto",
+ color: isSelected
+ ? "primary.main"
+ : "text.base",
+ backgroundColor: isSelected
+ ? "rgba(16, 113, 255, 0.10)"
+ : "transparent",
+ "&:hover": {
+ backgroundColor: isSelected
+ ? "rgba(16, 113, 255, 0.14)"
+ : theme.vars.palette.fill.faint,
+ },
+ })}
+ >
+ <CheckCircleRoundedIcon
+ sx={{
+ fontSize: 20,
+ color: isSelected
+ ? "primary.main"
+ : "text.faint",
+ opacity: isSelected ? 1 : 0.22,
+ flexShrink: 0,
+ }}
+ />
+ <Box sx={{ minWidth: 0, flex: 1 }}>
+ <Typography
+ variant="body"
+ sx={{
+ fontWeight: isSelected ? 700 : 500,
+ display: "flex",
+ alignItems: "center",
+ gap: 0.75,
+ minWidth: 0,
+ whiteSpace: "nowrap",
+ }}
+ >
+ <Box
+ component="span"
+ sx={{
+ overflow: "hidden",
+ textOverflow: "ellipsis",
+ whiteSpace: "nowrap",
+ minWidth: 0,
+ }}
+ >
+ {collection.name}
+ </Box>
+ <Box
+ component="span"
+ sx={{
+ color: "text.muted",
+ flexShrink: 0,
+ }}
+ >
+ {"Β·"}
+ </Box>
+ <Box
+ component="span"
+ sx={{
+ color: "text.muted",
+ fontWeight: 500,
+ flexShrink: 0,
+ whiteSpace: "nowrap",
+ }}
+ >
+ {new Intl.NumberFormat().format(
+ collection.items.length,
+ )}
+ </Box>
+ </Typography>
+ </Box>
+ </MenuItem>
+ );
+ })}
+ {homeSelectedCollectionIDs.length > 0 && (
+ <Box
+ sx={{
+ display: "flex",
+ justifyContent: "center",
+ pt: "12px",
+ pb: 0,
+ }}
+ >
+ <Button
+ color="secondary"
+ onClick={clearHomeCollectionSelection}
+ sx={{
+ minWidth: "auto",
+ px: 1,
+ py: 0.5,
+ backgroundColor: "transparent",
+ color: "text.muted",
+ fontSize: "0.8125rem",
+ fontWeight: 500,
+ textDecoration: "underline",
+ textUnderlineOffset: "3px",
+ "&:hover": {
+ backgroundColor: "transparent",
+ color: "text.secondary",
+ },
+ }}
+ >
+ {t("clearSelection")}
+ </Button>
+ </Box>
+ )}
+ </Box>
+ </Menu>
+
<Snackbar
open={feedbackMessage !== null}
message={feedbackMessage}
@@ -1549,7 +1690,8 @@ const CollectionGrid: React.FC<{
width: "100%",
maxWidth: contentMaxWidth,
mx: "auto",
- gap: 1.5,
+ display: "grid",
+ gap: 2,
}}
>
{collections.map((collection) => (
@@ -1623,24 +1765,35 @@ const CollectionChipFilters: React.FC<{
height: 36,
flexShrink: 0,
borderRadius: "999px",
- fontWeight: 600,
+ fontWeight: isSelected ? 700 : 600,
color: isSelected
- ? theme.vars.palette.text.base
+ ? theme.vars.palette.primary.main
: theme.vars.palette.text.base,
- backgroundColor: theme.vars.palette.fill.faint,
+ backgroundColor: isSelected
+ ? "rgba(16, 113, 255, 0.10)"
+ : theme.vars.palette.fill.faint,
border: "1px solid transparent",
boxShadow: isSelected
? `inset 0 0 0 1px ${theme.vars.palette.primary.main}`
: "none",
"& .MuiChip-label": { px: 1.5 },
"&:hover": {
- backgroundColor:
- theme.vars.palette.fill.faintHover,
+ backgroundColor: isSelected
+ ? "rgba(16, 113, 255, 0.14)"
+ : theme.vars.palette.fill.faintHover,
},
...theme.applyStyles("light", {
- backgroundColor: "#FFFFFF",
- border: "1px solid rgba(17, 24, 39, 0.06)",
- "&:hover": { backgroundColor: "#FFFFFF" },
+ backgroundColor: isSelected
+ ? "rgba(16, 113, 255, 0.10)"
+ : "#FFFFFF",
+ border: isSelected
+ ? "1px solid rgba(16, 113, 255, 0.24)"
+ : "1px solid rgba(17, 24, 39, 0.06)",
+ "&:hover": {
+ backgroundColor: isSelected
+ ? "rgba(16, 113, 255, 0.14)"
+ : "#F8FAFC",
+ },
}),
})}
/>
@@ -1650,6 +1803,57 @@ const CollectionChipFilters: React.FC<{
</Box>
);
+const CollectionFilterChip: React.FC<{
+ selected: boolean;
+ onClick: (event: React.MouseEvent<HTMLElement>) => void;
+}> = ({ selected, onClick }) => (
+ <Tooltip title={t("seeAllCollections")}>
+ <Chip
+ clickable
+ icon={<FilterListRoundedIcon sx={{ fontSize: 18 }} />}
+ onClick={onClick}
+ sx={(theme) => ({
+ height: 36,
+ flexShrink: 0,
+ borderRadius: "999px",
+ fontWeight: selected ? 700 : 600,
+ color: selected ? "primary.main" : theme.vars.palette.text.base,
+ backgroundColor: selected
+ ? "rgba(16, 113, 255, 0.10)"
+ : theme.vars.palette.fill.faint,
+ border: "1px solid transparent",
+ boxShadow: selected
+ ? `inset 0 0 0 1px ${theme.vars.palette.primary.main}`
+ : "none",
+ "& .MuiChip-icon": {
+ color: "inherit",
+ m: 0,
+ },
+ "& .MuiChip-label": { display: "none" },
+ px: 1.125,
+ "&:hover": {
+ backgroundColor: selected
+ ? "rgba(16, 113, 255, 0.14)"
+ : theme.vars.palette.fill.faintHover,
+ },
+ ...theme.applyStyles("light", {
+ backgroundColor: selected
+ ? "rgba(16, 113, 255, 0.10)"
+ : "#FFFFFF",
+ border: selected
+ ? "1px solid rgba(16, 113, 255, 0.24)"
+ : "1px solid rgba(17, 24, 39, 0.06)",
+ "&:hover": {
+ backgroundColor: selected
+ ? "rgba(16, 113, 255, 0.14)"
+ : "#F8FAFC",
+ },
+ }),
+ })}
+ />
+ </Tooltip>
+);
+
const EmptyState: React.FC<{ title: string; subtitle: string }> = ({
title,
subtitle,
@@ -1680,26 +1884,26 @@ const CollectionCard: React.FC<{
display: "flex",
alignItems: "center",
justifyContent: "space-between",
- gap: 1.5,
- px: 2,
- py: 1.5,
+ gap: 1.25,
+ px: 1.5,
+ py: 1.25,
minHeight: 84,
- borderRadius: "16px",
+ borderRadius: "18px",
backgroundColor:
collection.items.length > 0
- ? "rgba(255, 255, 255, 0.06)"
+ ? theme.vars.palette.fill.faint
: "rgba(255, 255, 255, 0.03)",
border: 1,
borderStyle: "solid",
borderColor:
collection.items.length > 0
- ? "rgba(255, 255, 255, 0.10)"
+ ? "rgba(255, 255, 255, 0.08)"
: "rgba(255, 255, 255, 0.08)",
transition: "background-color 0.15s, border-color 0.15s",
"&:hover": {
backgroundColor:
collection.items.length > 0
- ? "rgba(255, 255, 255, 0.08)"
+ ? theme.vars.palette.fill.faintHover
: "rgba(255, 255, 255, 0.05)",
borderColor: "rgba(255, 255, 255, 0.13)",
},
@@ -1724,29 +1928,40 @@ const CollectionCard: React.FC<{
>
<Box
sx={{
+ position: "relative",
display: "flex",
alignItems: "center",
justifyContent: "center",
- width: 40,
- height: 40,
- borderRadius: "50%",
- backgroundColor: isImportantCollection(collection)
- ? "rgba(16, 113, 255, 0.16)"
- : "rgba(18, 36, 63, 0.96)",
- border: isImportantCollection(collection)
- ? "none"
- : "1px solid rgba(159, 193, 255, 0.12)",
+ width: 52,
+ height: 52,
flexShrink: 0,
- position: "relative",
}}
>
- {isImportantCollection(collection) ? (
- <StarIcon sx={{ fontSize: 20, color: "#1071FF" }} />
- ) : (
- <FolderOutlinedIcon
- sx={{ fontSize: 18, color: "#D6E5FF" }}
- />
- )}
+ <Box
+ sx={{
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "center",
+ width: 40,
+ height: 40,
+ m: "6px",
+ borderRadius: "12px",
+ backgroundColor: isImportantCollection(collection)
+ ? "rgba(16, 113, 255, 0.16)"
+ : "rgba(18, 36, 63, 0.96)",
+ border: isImportantCollection(collection)
+ ? "none"
+ : "1px solid rgba(159, 193, 255, 0.12)",
+ }}
+ >
+ {isImportantCollection(collection) ? (
+ <StarIcon sx={{ fontSize: 20, color: "#1071FF" }} />
+ ) : (
+ <FolderOutlinedIcon
+ sx={{ fontSize: 20, color: "#D6E5FF" }}
+ />
+ )}
+ </Box>
{collection.isShared && <SharedCollectionBadge />}
</Box>
<Box sx={{ flex: 1, minWidth: 0 }}>
@@ -1754,8 +1969,8 @@ const CollectionCard: React.FC<{
variant="body"
sx={{
minWidth: 0,
- fontWeight: "medium",
- lineHeight: 1.3,
+ fontWeight: "regular",
+ lineHeight: 1.45,
}}
noWrap
>
@@ -1773,7 +1988,7 @@ const CollectionCard: React.FC<{
</Stack>
{(onShare || onRename || onDelete) && (
<Box
- sx={{ flexShrink: 0 }}
+ sx={{ flexShrink: 0, ml: 0.25 }}
onClick={(event) => event.stopPropagation()}
>
<CollectionContextMenu
diff --git a/web/apps/locker/src/components/LockerFileLinkDialog.tsx b/web/apps/locker/src/components/LockerFileLinkDialog.tsx
index 27de144085..9225c95028 100644
--- a/web/apps/locker/src/components/LockerFileLinkDialog.tsx
+++ b/web/apps/locker/src/components/LockerFileLinkDialog.tsx
@@ -11,6 +11,7 @@ import {
Stack,
Typography,
} from "@mui/material";
+import { lockerDialogPaperSx } from "components/lockerDialogStyles";
import { t } from "i18next";
import React from "react";
@@ -44,7 +45,11 @@ export const LockerFileLinkDialog: React.FC<LockerFileLinkDialogProps> = ({
onClose={loading || deleting ? undefined : onClose}
fullWidth
maxWidth="xs"
- slotProps={{ paper: { sx: { width: "min(100%, 420px)" } } }}
+ slotProps={{
+ paper: {
+ sx: { ...lockerDialogPaperSx, width: "min(100%, 420px)" },
+ },
+ }}
>
<DialogTitle sx={{ pr: 6 }}>
{itemTitle}
diff --git a/web/apps/locker/src/components/LockerSidebarCardButton.tsx b/web/apps/locker/src/components/LockerSidebarCardButton.tsx
index fdd52881d2..3fd4a40da1 100644
--- a/web/apps/locker/src/components/LockerSidebarCardButton.tsx
+++ b/web/apps/locker/src/components/LockerSidebarCardButton.tsx
@@ -56,10 +56,25 @@ export const LockerSidebarCardButton: React.FC<
),
border: "1px solid transparent",
...(selected && {
+ backgroundColor: "rgba(16, 113, 255, 0.12)",
boxShadow: `inset 0 0 0 1px ${theme.vars.palette.accent.main}`,
color: "accent.main",
}),
- "&:hover": { backgroundColor: "fill.faint" },
+ "&:hover": {
+ backgroundColor: selected
+ ? "rgba(16, 113, 255, 0.16)"
+ : "fill.faint",
+ },
+ ...theme.applyStyles("light", {
+ ...(selected && {
+ backgroundColor: "rgba(16, 113, 255, 0.10)",
+ }),
+ "&:hover": {
+ backgroundColor: selected
+ ? "rgba(16, 113, 255, 0.14)"
+ : theme.vars.palette.fill.faint,
+ },
+ }),
})}
>
{iconNode ? (
diff --git a/web/apps/locker/src/components/lockerDialogStyles.ts b/web/apps/locker/src/components/lockerDialogStyles.ts
new file mode 100644
index 0000000000..30cc10f3e6
--- /dev/null
+++ b/web/apps/locker/src/components/lockerDialogStyles.ts
@@ -0,0 +1,3 @@
+export const lockerDialogPaperSx = {
+ borderRadius: "20px",
+};