Skip to content

armgit / ente

Public Imported from GitHub
0

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

Move stuff around

vishnukvmd0db326319826
diff --git a/web/apps/locker/src/components/CollectionSidebar.tsx b/web/apps/locker/src/components/CollectionSidebar.tsx
index cff22cd5dc..a9b628a648 100644
--- a/web/apps/locker/src/components/CollectionSidebar.tsx
+++ b/web/apps/locker/src/components/CollectionSidebar.tsx
@@ -303,7 +303,23 @@ const SidebarRow: React.FC<{
<ListItemButton
selected={selected}
onClick={onClick}
- sx={{ borderRadius: 2, px: 1.25, color }}
+ sx={(theme) => ({
+ borderRadius: 2,
+ px: 1.25,
+ color,
+ border: "1px solid transparent",
+ ...(selected && {
+ color: color ?? "primary.main",
+ borderColor: theme.vars.palette.primary.main,
+ backgroundColor: "transparent",
+ }),
+ "&.Mui-selected": {
+ backgroundColor: "transparent",
+ },
+ "&.Mui-selected:hover": {
+ backgroundColor: "transparent",
+ },
+ })}
>
<ListItemIcon sx={{ minWidth: 36, color: "inherit" }}>
{icon}
diff --git a/web/apps/locker/src/components/ItemList.tsx b/web/apps/locker/src/components/ItemList.tsx
index 73f9d267a7..54d03d7b93 100644
--- a/web/apps/locker/src/components/ItemList.tsx
+++ b/web/apps/locker/src/components/ItemList.tsx
@@ -6,7 +6,6 @@ import DeleteSweepOutlinedIcon from "@mui/icons-material/DeleteSweepOutlined";
import EditOutlinedIcon from "@mui/icons-material/EditOutlined";
import FileDownloadOutlinedIcon from "@mui/icons-material/FileDownloadOutlined";
import FolderOutlinedIcon from "@mui/icons-material/FolderOutlined";
-import SearchIcon from "@mui/icons-material/Search";
import ShareOutlinedIcon from "@mui/icons-material/ShareOutlined";
import StarIcon from "@mui/icons-material/Star";
import {
@@ -18,7 +17,6 @@ import {
DialogContent,
DialogTitle,
IconButton,
- InputAdornment,
Snackbar,
Stack,
TextField,
@@ -71,6 +69,7 @@ interface ItemListProps {
onDeleteCollection?: (collectionID: number) => void;
onCreateCollection?: (name: string) => Promise<number>;
onShareCollection?: (collection: LockerCollection) => void;
+ searchTerm: string;
}
const contentMaxWidth = 560;
@@ -93,9 +92,9 @@ export const ItemList: React.FC<ItemListProps> = ({
onDeleteCollection,
onCreateCollection,
onShareCollection,
+ searchTerm,
}) => {
const currentUserID = ensureLocalUser().id;
- const [searchTerm, setSearchTerm] = useState("");
const [selectedItem, setSelectedItem] = useState<LockerItem | null>(null);
const [restoreItem, setRestoreItem] = useState<LockerItem | null>(null);
const [restoreCollectionID, setRestoreCollectionID] = useState<
@@ -597,60 +596,6 @@ export const ItemList: React.FC<ItemListProps> = ({
}),
})}
>
- <Box
- sx={{
- background:
- "linear-gradient(135deg, #1071FF 0%, #0056CC 100%)",
- px: { xs: 2, sm: 3 },
- pb: 1.75,
- pt: 0.25,
- }}
- >
- <Box sx={{ maxWidth: contentMaxWidth, mx: "auto" }}>
- <TextField
- size="small"
- placeholder={t("searchHint")}
- value={searchTerm}
- onChange={(event) =>
- setSearchTerm(event.target.value)
- }
- variant="outlined"
- fullWidth
- slotProps={{
- input: {
- startAdornment: (
- <InputAdornment position="start">
- <SearchIcon
- sx={{
- fontSize: 20,
- color: "text.faint",
- }}
- />
- </InputAdornment>
- ),
- },
- }}
- sx={{
- "& .MuiOutlinedInput-root": {
- minHeight: 48,
- borderRadius: "24px",
- backgroundColor: "background.paper",
- "& .MuiOutlinedInput-input": { py: 1.5 },
- "& fieldset": {
- borderColor: "transparent",
- },
- "&:hover fieldset": {
- borderColor: "transparent",
- },
- "&.Mui-focused fieldset": {
- borderColor: "primary.main",
- },
- },
- }}
- />
- </Box>
- </Box>
-
<Box
sx={(theme) => ({
px: { xs: 2, sm: 3 },
diff --git a/web/apps/locker/src/components/LockerNavbar.tsx b/web/apps/locker/src/components/LockerNavbar.tsx
index 0fbbbeb466..30bddd2549 100644
--- a/web/apps/locker/src/components/LockerNavbar.tsx
+++ b/web/apps/locker/src/components/LockerNavbar.tsx
@@ -1,7 +1,16 @@
import { Menu01Icon } from "@hugeicons/core-free-icons";
import { HugeiconsIcon } from "@hugeicons/react";
+import SearchIcon from "@mui/icons-material/Search";
import WarningAmberRoundedIcon from "@mui/icons-material/WarningAmberRounded";
-import { Box, IconButton, Stack, Typography } from "@mui/material";
+import {
+ Box,
+ IconButton,
+ InputAdornment,
+ Stack,
+ TextField,
+ Typography,
+} from "@mui/material";
+import { t } from "i18next";
import React from "react";
const contentMaxWidth = 560;
@@ -11,6 +20,10 @@ interface LockerNavbarProps {
onOpenSidebar: () => void;
/** True when the mobile drawer trigger should be shown. */
showMenuButton: boolean;
+ /** Current value of the Locker search query. */
+ searchTerm: string;
+ /** Update callback for the Locker search query. */
+ onSearchTermChange: (value: string) => void;
}
/**
@@ -23,6 +36,8 @@ interface LockerNavbarProps {
export const LockerNavbar: React.FC<LockerNavbarProps> = ({
onOpenSidebar,
showMenuButton,
+ searchTerm,
+ onSearchTermChange,
}) => (
<Box
sx={{
@@ -66,50 +81,102 @@ export const LockerNavbar: React.FC<LockerNavbarProps> = ({
<Box sx={{ width: 40 }} />
</Stack>
- <Stack
- direction="row"
- role="status"
- aria-live="polite"
- sx={{
- width: "100%",
- maxWidth: contentMaxWidth,
- mx: "auto",
- mt: 1,
- px: 1.5,
- py: 1,
- gap: 1,
- alignItems: "center",
- borderRadius: "12px",
- backgroundColor: "#FFE08A",
- border: "1px solid #FFD057",
- boxShadow: "0 8px 20px rgba(0, 0, 0, 0.2)",
- }}
- >
- <WarningAmberRoundedIcon
- sx={{ fontSize: 20, color: "#5C3A00", flexShrink: 0 }}
- />
- <Typography
- variant="mini"
+
+ <Box sx={{ maxWidth: contentMaxWidth, mx: "auto", mt: 0.5, pb: 1.5 }}>
+ <TextField
+ size="small"
+ placeholder={t("searchHint")}
+ value={searchTerm}
+ onChange={(event) => onSearchTermChange(event.target.value)}
+ variant="outlined"
+ fullWidth
+ slotProps={{
+ input: {
+ startAdornment: (
+ <InputAdornment position="start">
+ <SearchIcon
+ sx={{
+ fontSize: 20,
+ color: "text.faint",
+ }}
+ />
+ </InputAdornment>
+ ),
+ },
+ }}
sx={{
- px: 0.75,
- py: 0.25,
- borderRadius: "999px",
- border: "1px solid rgba(92, 58, 0, 0.3)",
- backgroundColor: "rgba(255, 255, 255, 0.45)",
- color: "#5C3A00",
- fontWeight: 800,
- letterSpacing: "0.03em",
- flexShrink: 0,
+ "& .MuiOutlinedInput-root": {
+ minHeight: 48,
+ borderRadius: "24px",
+ backgroundColor: "background.paper",
+ "& .MuiOutlinedInput-input": { py: 1.5 },
+ "& fieldset": {
+ borderColor: "transparent",
+ },
+ "&:hover fieldset": {
+ borderColor: "transparent",
+ },
+ "&.Mui-focused fieldset": {
+ borderColor: "rgba(16, 113, 255, 0.35)",
+ borderWidth: "1px",
+ },
+ "&.Mui-focused": {
+ boxShadow: "0 0 0 4px rgba(255, 255, 255, 0.12)",
+ },
+ },
}}
- >
- WARNING
- </Typography>
- <Typography
- variant="small"
- sx={{ color: "#3B2500", lineHeight: 1.4, fontWeight: 700 }}
- >
- You are using an unstable version of Locker.
- </Typography>
- </Stack>
+ />
+ </Box>
</Box>
);
+
+export const LockerUnstableToast: React.FC = () => (
+ <Stack
+ direction="row"
+ role="status"
+ aria-live="polite"
+ sx={{
+ position: "fixed",
+ left: "50%",
+ bottom: { xs: 16, sm: 24 },
+ transform: "translateX(-50%)",
+ width: "calc(100% - 32px)",
+ maxWidth: contentMaxWidth,
+ px: 1.5,
+ py: 1,
+ gap: 1,
+ alignItems: "center",
+ borderRadius: "16px",
+ backgroundColor: "#FFE08A",
+ border: "1px solid #FFD057",
+ boxShadow: "0 12px 30px rgba(0, 0, 0, 0.24)",
+ zIndex: 1400,
+ }}
+ >
+ <WarningAmberRoundedIcon
+ sx={{ fontSize: 20, color: "#5C3A00", flexShrink: 0 }}
+ />
+ <Typography
+ variant="mini"
+ sx={{
+ px: 0.75,
+ py: 0.25,
+ borderRadius: "999px",
+ border: "1px solid rgba(92, 58, 0, 0.3)",
+ backgroundColor: "rgba(255, 255, 255, 0.45)",
+ color: "#5C3A00",
+ fontWeight: 800,
+ letterSpacing: "0.03em",
+ flexShrink: 0,
+ }}
+ >
+ WARNING
+ </Typography>
+ <Typography
+ variant="small"
+ sx={{ color: "#3B2500", lineHeight: 1.4, fontWeight: 700 }}
+ >
+ You are using an unstable version of Locker.
+ </Typography>
+ </Stack>
+);
diff --git a/web/apps/locker/src/components/LockerSidebarCardButton.tsx b/web/apps/locker/src/components/LockerSidebarCardButton.tsx
index 28e80b7914..b9b7774d57 100644
--- a/web/apps/locker/src/components/LockerSidebarCardButton.tsx
+++ b/web/apps/locker/src/components/LockerSidebarCardButton.tsx
@@ -54,15 +54,13 @@ export const LockerSidebarCardButton: React.FC<
["background-color", "border-color", "color"],
{ duration: theme.transitions.duration.shorter },
),
+ border: "1px solid transparent",
...(selected && {
- backgroundColor: "fill.faintHover",
boxShadow: `inset 0 0 0 1px ${theme.vars.palette.accent.main}`,
color: "accent.main",
}),
"&:hover": {
- backgroundColor: selected
- ? "fill.faintHover"
- : "fill.faint",
+ backgroundColor: "fill.faint",
},
})}
>
diff --git a/web/apps/locker/src/pages/locker.tsx b/web/apps/locker/src/pages/locker.tsx
index 39131d5cae..2d62fe345c 100644
--- a/web/apps/locker/src/pages/locker.tsx
+++ b/web/apps/locker/src/pages/locker.tsx
@@ -3,7 +3,7 @@ import { Box, Button, Fab, Snackbar, Stack, Typography } from "@mui/material";
import { CreateItemDialog } from "components/CreateItemDialog";
import { ItemList } from "components/ItemList";
import { LockerCollectionShareDrawer } from "components/LockerCollectionShareDrawer";
-import { LockerNavbar } from "components/LockerNavbar";
+import { LockerNavbar, LockerUnstableToast } from "components/LockerNavbar";
import { LockerSidebar } from "components/LockerSidebar";
import { sessionExpiredDialogAttributes } from "ente-accounts-rs/components/utils/dialog";
import { stashRedirect } from "ente-accounts-rs/services/redirect";
@@ -121,6 +121,7 @@ const Page: React.FC = () => {
const [selectedCollectionID, setSelectedCollectionID] = useState<
number | null
>(null);
+ const [searchTerm, setSearchTerm] = useState("");
// Create/Edit dialog state
const [createDialogOpen, setCreateDialogOpen] = useState(false);
@@ -508,7 +509,10 @@ const Page: React.FC = () => {
<LockerNavbar
onOpenSidebar={() => setSidebarOpen(true)}
showMenuButton
+ searchTerm={searchTerm}
+ onSearchTermChange={setSearchTerm}
/>
+ <LockerUnstableToast />
<Box
sx={{
flex: 1,
@@ -548,7 +552,10 @@ const Page: React.FC = () => {
<LockerNavbar
onOpenSidebar={() => setSidebarOpen(true)}
showMenuButton
+ searchTerm={searchTerm}
+ onSearchTermChange={setSearchTerm}
/>
+ <LockerUnstableToast />
<Box
sx={{
flex: 1,
@@ -576,6 +583,7 @@ const Page: React.FC = () => {
onDeleteCollection={handleDeleteCollection}
onCreateCollection={handleCreateCollection}
onShareCollection={handleOpenShareCollection}
+ searchTerm={searchTerm}
/>
</Box>
<LockerSidebar