Skip to content
This repository has been archived by the owner on Jan 23, 2025. It is now read-only.

Commit

Permalink
feat: hide none-folder in the move modal
Browse files Browse the repository at this point in the history
  • Loading branch information
ReidyT committed Jan 31, 2024
1 parent f08048d commit 4974f6d
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@emotion/react": "11.11.3",
"@emotion/styled": "11.11.0",
"@graasp/chatbox": "3.0.1",
"@graasp/query-client": "2.4.1",
"@graasp/query-client": "github:graasp/graasp-query-client#787-accessible-item-by-type",
"@graasp/sdk": "3.4.1",
"@graasp/translations": "1.22.1",
"@graasp/ui": "4.4.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useState } from 'react';

import { Pagination, Stack } from '@mui/material';

import { PermissionLevel } from '@graasp/sdk';
import { ItemType, PermissionLevel } from '@graasp/sdk';

import { hooks } from '@/config/queryClient';

Expand All @@ -27,7 +27,10 @@ const AccessibleNavigationTree = ({
const [page, setPage] = useState(1);
// todo: show only items with admin rights
const { data: accessibleItems } = hooks.useAccessibleItems(
{ permissions: [PermissionLevel.Write, PermissionLevel.Admin] },
{
permissions: [PermissionLevel.Write, PermissionLevel.Admin],
types: [ItemType.FOLDER],
},
{ page },
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Box } from '@mui/material';

import { ItemType } from '@graasp/sdk';

import { useBuilderTranslation } from '@/config/i18n';
import { hooks } from '@/config/queryClient';
import { BUILDER } from '@/langs/constants';
Expand All @@ -23,10 +25,14 @@ const ChildrenNavigationTree = ({
isDisabled,
}: ChildrenNavigationTreeProps): JSX.Element => {
const { t: translateBuilder } = useBuilderTranslation();
// TODO: use filter in useChildren directly in another PR
const { data: children } = hooks.useChildren(selectedNavigationItem.id);

const folders = children?.filter((item) => item.type === ItemType.FOLDER);

return (
<>
{children?.map((ele) => (
{folders?.map((ele) => (
<RowMenu
key={ele.id}
item={ele}
Expand All @@ -36,7 +42,7 @@ const ChildrenNavigationTree = ({
isDisabled={isDisabled}
/>
))}
{!children?.length && (
{!folders?.length && (
<Box sx={{ color: 'darkgrey', pt: 1 }}>
{translateBuilder(BUILDER.EMPTY_FOLDER_CHILDREN_FOR_THIS_ITEM)}
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ const RootNavigationTree = ({
// todo: to change with real recent items (most used)
const { data: recentItems } = hooks.useAccessibleItems(
// you can move into an item you have at least write permission
{ permissions: [PermissionLevel.Admin, PermissionLevel.Write] },
{
permissions: [PermissionLevel.Admin, PermissionLevel.Write],
types: [ItemType.FOLDER],
},
{ pageSize: 5 },
);
const recentFolders = recentItems?.data?.filter(
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1212,9 +1212,9 @@ __metadata:
languageName: node
linkType: hard

"@graasp/query-client@npm:2.4.1":
"@graasp/query-client@github:graasp/graasp-query-client#787-accessible-item-by-type":
version: 2.4.1
resolution: "@graasp/query-client@npm:2.4.1"
resolution: "@graasp/query-client@https://github.com/graasp/graasp-query-client.git#commit=ce003070e504bd2873baa1181ebc3f3c2c296a7e"
dependencies:
"@graasp/sdk": "npm:3.6.0"
"@graasp/translations": "npm:1.23.0"
Expand All @@ -1227,7 +1227,7 @@ __metadata:
uuid: "npm:9.0.1"
peerDependencies:
react: ^17.0.0 || ^18.0.0
checksum: 22becf7d980a618ed091b5e09de6cfd50b70af441934403fadf93afcf1cf562c983a7dd664cfbdff5f4c985d0a18f9cba285850c1909dce60ed9a2fdaa471c2d
checksum: 9af44b6fd29aa064d702c091ee881a19de772faa280fe90c764c9d46f809bd13187d8b38ff5c4a11fe2c60c7119e44a4770f5c2701897a0921efa46aaf27e60d
languageName: node
linkType: hard

Expand Down Expand Up @@ -6330,7 +6330,7 @@ __metadata:
"@emotion/react": "npm:11.11.3"
"@emotion/styled": "npm:11.11.0"
"@graasp/chatbox": "npm:3.0.1"
"@graasp/query-client": "npm:2.4.1"
"@graasp/query-client": "github:graasp/graasp-query-client#787-accessible-item-by-type"
"@graasp/sdk": "npm:3.4.1"
"@graasp/translations": "npm:1.22.1"
"@graasp/ui": "npm:4.4.0"
Expand Down

0 comments on commit 4974f6d

Please sign in to comment.