Skip to content

armgit / ente

Public Imported from GitHub
0

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

refractor(large-files):update-logic-for-select-all

Aswin Asokb2b17a4fdf89
diff --git a/web/apps/photos/src/pages/large-files.tsx b/web/apps/photos/src/pages/large-files.tsx
index 928bf439a6..165444ebc8 100644
--- a/web/apps/photos/src/pages/large-files.tsx
+++ b/web/apps/photos/src/pages/large-files.tsx
@@ -356,6 +356,7 @@ const LargeFiles: React.FC<LargeFilesProps> = ({
</Autosizer>
<BottomBar
{...{
+ totalCount: largeFiles.length,
selectedCount,
selectedSize,
deleteProgress,
@@ -567,6 +568,7 @@ const GridItem: React.FC<GridItemProps> = memo(({ item, onToggle, onOpen }) => {
});
interface BottomBarProps {
+ totalCount: number;
selectedCount: number;
selectedSize: number;
deleteProgress: number | undefined;
@@ -576,6 +578,7 @@ interface BottomBarProps {
}
const BottomBar: React.FC<BottomBarProps> = ({
+ totalCount,
selectedCount,
selectedSize,
deleteProgress,
@@ -583,7 +586,7 @@ const BottomBar: React.FC<BottomBarProps> = ({
onSelectAll,
onDeselectAll,
}) => {
- const hasSelection = selectedCount > 0;
+ const allSelected = selectedCount === totalCount;
return (
<Stack
@@ -608,9 +611,9 @@ const BottomBar: React.FC<BottomBarProps> = ({
fontSize: { xs: "0.85rem", sm: "0.9rem" },
}}
disabled={deleteProgress !== undefined}
- onClick={hasSelection ? onDeselectAll : onSelectAll}
+ onClick={allSelected ? onDeselectAll : onSelectAll}
>
- {hasSelection ? t("deselect_all") : t("select_all")}
+ {allSelected ? t("deselect_all") : t("select_all")}
</FocusVisibleButton>
<DeleteButton
{...{
@@ -672,10 +675,13 @@ const DeleteButton: React.FC<DeleteButtonProps> = ({
/>
) : (
<Stack direction="row" sx={{ gap: 1, alignItems: "center" }}>
- <Typography>
+ <Typography sx={{ fontSize: "inherit" }}>
{t("delete_files_button", { count: selectedCount })}
</Typography>
- <Typography variant="small" fontWeight="regular">
+ <Typography
+ sx={{ fontSize: "inherit" }}
+ fontWeight="regular"
+ >
({formattedByteSize(selectedSize)})
</Typography>
</Stack>