Skip to content

armgit / ente

Public Imported from GitHub
0

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

fix(ItemList):minor-behaviour-change

Aswin Asoke6c7c9366ac6
diff --git a/web/apps/locker/src/components/collections/CollectionFilters.tsx b/web/apps/locker/src/components/collections/CollectionFilters.tsx
index e7dc0b5d4f..8353800b9b 100644
--- a/web/apps/locker/src/components/collections/CollectionFilters.tsx
+++ b/web/apps/locker/src/components/collections/CollectionFilters.tsx
@@ -9,6 +9,7 @@ import React, { useCallback, useState } from "react";
import { CollectionChipFilters } from "./CollectionChipFilters";
interface CollectionFiltersProps {
+ showFilters: boolean;
orderedHomeCollections: LockerCollection[];
dropdownHomeCollections: LockerCollection[];
homeSelectedCollectionIDs: number[];
@@ -16,6 +17,7 @@ interface CollectionFiltersProps {
clearHomeCollectionSelection: () => void;
}
export function CollectionFilters({
+ showFilters,
orderedHomeCollections,
dropdownHomeCollections,
homeSelectedCollectionIDs,
@@ -35,46 +37,51 @@ export function CollectionFilters({
}, []);
return (
<>
- <Stack
- direction="row"
- sx={{
- width: "100%",
- maxWidth: lockerContentMaxWidth,
- mx: "auto",
- alignItems: "center",
- gap: 1,
- mb: 2,
- minWidth: 0,
- }}
- >
- <CollectionFilterChip
- selected={homeSelectedCollectionIDs.length > 0}
- onClick={openCollectionFilterMenu}
- />
- <Box
- key={orderedHomeCollections
- .map((collection) => collection.id)
- .join("-")}
+ {showFilters && (
+ <Stack
+ direction="row"
sx={{
- flex: 1,
+ width: "100%",
+ maxWidth: lockerContentMaxWidth,
+ mx: "auto",
+ alignItems: "center",
+ gap: 1,
+ mb: 2,
minWidth: 0,
- "@keyframes chipBarRefresh": {
- "0%": {
- opacity: 0.7,
- transform: "translateY(2px)",
- },
- "100%": { opacity: 1, transform: "translateY(0)" },
- },
- animation: "chipBarRefresh 220ms ease-out",
}}
>
- <CollectionChipFilters
- collections={orderedHomeCollections}
- selectedCollectionIDs={homeSelectedCollectionIDs}
- onToggleCollection={toggleHomeCollection}
+ <CollectionFilterChip
+ selected={homeSelectedCollectionIDs.length > 0}
+ onClick={openCollectionFilterMenu}
/>
- </Box>
- </Stack>
+ <Box
+ key={orderedHomeCollections
+ .map((collection) => collection.id)
+ .join("-")}
+ sx={{
+ flex: 1,
+ minWidth: 0,
+ "@keyframes chipBarRefresh": {
+ "0%": {
+ opacity: 0.7,
+ transform: "translateY(2px)",
+ },
+ "100%": {
+ opacity: 1,
+ transform: "translateY(0)",
+ },
+ },
+ animation: "chipBarRefresh 220ms ease-out",
+ }}
+ >
+ <CollectionChipFilters
+ collections={orderedHomeCollections}
+ selectedCollectionIDs={homeSelectedCollectionIDs}
+ onToggleCollection={toggleHomeCollection}
+ />
+ </Box>
+ </Stack>
+ )}
<Menu
anchorEl={collectionFilterAnchorEl}
open={!!collectionFilterAnchorEl}
diff --git a/web/apps/locker/src/components/items/ItemList.tsx b/web/apps/locker/src/components/items/ItemList.tsx
index fc3fb7ae0d..e276b852ff 100644
--- a/web/apps/locker/src/components/items/ItemList.tsx
+++ b/web/apps/locker/src/components/items/ItemList.tsx
@@ -496,26 +496,20 @@ export const ItemList: React.FC<ItemListProps> = ({
}),
})}
>
+ <CollectionFilters
+ showFilters={
+ isHomeView && displayCollections.length > 0
+ }
+ orderedHomeCollections={orderedHomeCollections}
+ dropdownHomeCollections={dropdownHomeCollections}
+ homeSelectedCollectionIDs={homeSelectedCollectionIDs}
+ toggleHomeCollection={toggleHomeCollection}
+ clearHomeCollectionSelection={
+ clearHomeCollectionSelection
+ }
+ />
{isHomeView && (
<>
- {displayCollections.length > 0 && (
- <CollectionFilters
- orderedHomeCollections={
- orderedHomeCollections
- }
- dropdownHomeCollections={
- dropdownHomeCollections
- }
- homeSelectedCollectionIDs={
- homeSelectedCollectionIDs
- }
- toggleHomeCollection={toggleHomeCollection}
- clearHomeCollectionSelection={
- clearHomeCollectionSelection
- }
- />
- )}
-
<ItemsSection
items={homeFilteredItems}
isTrashView={false}