Skip to content

armgit / ente

Public Imported from GitHub
0

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

Address comments

Vishnu Mohandas87568eaefb35
diff --git a/web/apps/locker/src/components/CreateItemDialog.tsx b/web/apps/locker/src/components/CreateItemDialog.tsx
index 030a2b4035..9edc560838 100644
--- a/web/apps/locker/src/components/CreateItemDialog.tsx
+++ b/web/apps/locker/src/components/CreateItemDialog.tsx
@@ -224,7 +224,10 @@ export const CreateItemDialog: React.FC<CreateItemDialogProps> = ({
() => editItem?.collectionIDs ?? [],
[editItem],
);
- const selectedType = selectedOption as LockerItemType | null;
+ const selectedType =
+ selectedOption && selectedOption !== "file"
+ ? (selectedOption as LockerItemType)
+ : null;
const displayCollectionsRef = useRef(displayCollections);
displayCollectionsRef.current = displayCollections;
@@ -908,25 +911,23 @@ export const CreateItemDialog: React.FC<CreateItemDialogProps> = ({
}
/>
- {selectedType && !isFileMode && (
- <CollectionSelector
- collections={displayCollections}
- selectedIDs={selectedCollectionIDs}
- initialSelectedIDs={
- isEditMode ? editCollectionIDs : undefined
- }
- onToggle={(collectionID) =>
- setSelectedCollectionIDs((current) =>
- current.includes(collectionID)
- ? current.filter(
- (id) => id !== collectionID,
- )
- : [...current, collectionID],
- )
- }
- onCreateCollection={onCreateCollection}
- />
- )}
+ <CollectionSelector
+ collections={displayCollections}
+ selectedIDs={selectedCollectionIDs}
+ initialSelectedIDs={
+ isEditMode ? editCollectionIDs : undefined
+ }
+ onToggle={(collectionID) =>
+ setSelectedCollectionIDs((current) =>
+ current.includes(collectionID)
+ ? current.filter(
+ (id) => id !== collectionID,
+ )
+ : [...current, collectionID],
+ )
+ }
+ onCreateCollection={onCreateCollection}
+ />
{error && upgradeCTAType !== "fileCountLimit" && (
<Typography
diff --git a/web/apps/locker/src/components/ItemList.tsx b/web/apps/locker/src/components/ItemList.tsx
index 65e008b8a0..f0edd34a18 100644
--- a/web/apps/locker/src/components/ItemList.tsx
+++ b/web/apps/locker/src/components/ItemList.tsx
@@ -1630,12 +1630,7 @@ const SelectionActionBar: React.FC<{
onDelete,
onDone,
}) => (
- <Box
- sx={{
- px: { xs: 2, sm: 3 },
- py: { xs: 1.25, sm: 1.5 },
- }}
- >
+ <Box sx={{ px: { xs: 2, sm: 3 }, py: { xs: 1.25, sm: 1.5 } }}>
<Box
sx={(theme) => ({
maxWidth: 760,
@@ -1704,7 +1699,8 @@ const SelectionActionBar: React.FC<{
border: `1px solid ${theme.vars.palette.stroke.faint}`,
backgroundColor: theme.vars.palette.fill.faint,
"&:hover": {
- backgroundColor: theme.vars.palette.fill.faintHover,
+ backgroundColor:
+ theme.vars.palette.fill.faintHover,
},
})}
>
@@ -1726,7 +1722,8 @@ const SelectionActionBar: React.FC<{
border: `1px solid ${theme.vars.palette.stroke.faint}`,
backgroundColor: theme.vars.palette.fill.faint,
"&:hover": {
- backgroundColor: theme.vars.palette.fill.faintHover,
+ backgroundColor:
+ theme.vars.palette.fill.faintHover,
},
})}
>
@@ -1745,9 +1742,7 @@ const SelectionActionBar: React.FC<{
color: "#FFFFFF",
background:
"linear-gradient(180deg, #1674FF 0%, #0B5FE0 100%)",
- "& .MuiButton-startIcon": {
- color: "#FFFFFF",
- },
+ "& .MuiButton-startIcon": { color: "#FFFFFF" },
"&:hover": {
boxShadow: "none",
background:
@@ -1771,12 +1766,8 @@ const SelectionActionBar: React.FC<{
color: "#FFFFFF",
border: "1px solid rgba(185, 28, 28, 0.26)",
backgroundColor: "#D14343",
- "& .MuiButton-startIcon": {
- color: "#FFFFFF",
- },
- "&:hover": {
- backgroundColor: "#B93838",
- },
+ "& .MuiButton-startIcon": { color: "#FFFFFF" },
+ "&:hover": { backgroundColor: "#B93838" },
}}
>
{t("delete")}
diff --git a/web/apps/locker/src/pages/locker.tsx b/web/apps/locker/src/pages/locker.tsx
index 5ae8be72a8..b1c81409b7 100644
--- a/web/apps/locker/src/pages/locker.tsx
+++ b/web/apps/locker/src/pages/locker.tsx
@@ -589,11 +589,9 @@ export const LockerPage: React.FC = () => {
if (!masterKey || !editItem)
throw new Error("No master key or item");
if (type === "file") {
- await updateFileItem(
- editItem.id,
- String(data.name ?? ""),
- masterKey,
- );
+ const editedName =
+ typeof data.name === "string" ? data.name : "";
+ await updateFileItem(editItem.id, editedName, masterKey);
} else {
await updateInfoItem(editItem.id, type, data, masterKey);
}
@@ -1234,11 +1232,10 @@ export const LockerPage: React.FC = () => {
control={
<Checkbox
checked={
- visibleDeleteCollectionDialog?.deleteFromEverywhere ??
- false
+ visibleDeleteCollectionDialog.deleteFromEverywhere
}
disabled={
- visibleDeleteCollectionDialog?.loading
+ visibleDeleteCollectionDialog.loading
}
onChange={(event) =>
setDeleteCollectionDialog(
@@ -1352,8 +1349,9 @@ export const LockerPage: React.FC = () => {
<Snackbar
open={toast !== null}
message={toast}
+ autoHideDuration={3000}
onClose={(_event, reason) => {
- if (reason !== "clickaway") {
+ if (reason === "clickaway") {
return;
}
setToast(null);