Skip to content

Commit 721e61d

Browse files
committed
feat(frontend): do not show hidden collections
1 parent e83a1a3 commit 721e61d

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

apps/frontend/app/routes/_dashboard.collections.list.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ type UpdateCollectionInput = {
208208

209209
export default function Page() {
210210
const transition = useNavigation();
211+
const userDetails = useUserDetails();
211212
const collections = useUserCollections();
212213
const loaderData = useLoaderData<typeof loader>();
213214
const [toUpdateCollection, setToUpdateCollection] =
@@ -219,12 +220,15 @@ export default function Page() {
219220
if (transition.state !== "submitting") setToUpdateCollection(null);
220221
}, [transition.state]);
221222

222-
const filteredCollections = collections.filter((c) => {
223-
let shouldReturn = true;
224-
if (query)
225-
shouldReturn = c.name.toLowerCase().includes(query.toLowerCase());
226-
return shouldReturn;
227-
});
223+
const filteredCollections = collections
224+
.filter(
225+
(c) =>
226+
c.collaborators.find((c) => c.collaborator.id === userDetails.id)
227+
?.extraInformation?.isHidden !== true,
228+
)
229+
.filter((c) =>
230+
query ? c.name.toLowerCase().includes(query.toLowerCase()) : true,
231+
);
228232

229233
return (
230234
<Container size="sm">

0 commit comments

Comments
 (0)