🛠️ Disable shared with me section when sharing is disabled (#323)
This commit is contained in:
@@ -22,7 +22,10 @@ import DiskUsage from '../common/disk-usage';
|
|||||||
import Actions from './actions';
|
import Actions from './actions';
|
||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
import RouterServices from '@features/router/services/router-service';
|
import RouterServices from '@features/router/services/router-service';
|
||||||
import Languages from "features/global/services/languages-service";
|
import Languages from 'features/global/services/languages-service';
|
||||||
|
import FeatureTogglesService, {
|
||||||
|
FeatureNames,
|
||||||
|
} from '@features/global/services/feature-toggles-service';
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
@@ -30,7 +33,7 @@ export default () => {
|
|||||||
const company = useRouterCompany();
|
const company = useRouterCompany();
|
||||||
const { viewId, itemId, dirId } = RouterServices.getStateFromRoute();
|
const { viewId, itemId, dirId } = RouterServices.getStateFromRoute();
|
||||||
const [parentId, setParentId] = useRecoilState(
|
const [parentId, setParentId] = useRecoilState(
|
||||||
DriveCurrentFolderAtom({ initialFolderId: viewId || 'user_'+user?.id }),
|
DriveCurrentFolderAtom({ initialFolderId: viewId || 'user_' + user?.id }),
|
||||||
);
|
);
|
||||||
const active = false;
|
const active = false;
|
||||||
const { sharedWithMe, inTrash, path } = useDriveItem(parentId);
|
const { sharedWithMe, inTrash, path } = useDriveItem(parentId);
|
||||||
@@ -40,7 +43,6 @@ export default () => {
|
|||||||
if (inTrash) folderType = 'trash';
|
if (inTrash) folderType = 'trash';
|
||||||
if (sharedWithMe) folderType = 'shared';
|
if (sharedWithMe) folderType = 'shared';
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
!itemId && !dirId && viewId && setParentId(viewId);
|
!itemId && !dirId && viewId && setParentId(viewId);
|
||||||
dirId && viewId && setParentId(dirId);
|
dirId && viewId && setParentId(dirId);
|
||||||
@@ -65,29 +67,72 @@ export default () => {
|
|||||||
<div className="mt-4" />
|
<div className="mt-4" />
|
||||||
<Title>Drive</Title>
|
<Title>Drive</Title>
|
||||||
<Button
|
<Button
|
||||||
onClick={() => {history.push(RouterServices.generateRouteFromState({companyId: company, viewId: 'user_' + user?.id, itemId: '', dirId: ''})); setParentId('user_' + user?.id)}}
|
onClick={() => {
|
||||||
|
history.push(
|
||||||
|
RouterServices.generateRouteFromState({
|
||||||
|
companyId: company,
|
||||||
|
viewId: 'user_' + user?.id,
|
||||||
|
itemId: '',
|
||||||
|
dirId: '',
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
setParentId('user_' + user?.id);
|
||||||
|
}}
|
||||||
size="lg"
|
size="lg"
|
||||||
theme="white"
|
theme="white"
|
||||||
className={'w-full mb-1 ' + (folderType === 'personal' && (viewId == '' || viewId == 'user_' + user?.id) ? activeClass : '')}
|
className={
|
||||||
|
'w-full mb-1 ' +
|
||||||
|
(folderType === 'personal' && (viewId == '' || viewId == 'user_' + user?.id)
|
||||||
|
? activeClass
|
||||||
|
: '')
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<UserIcon className="w-5 h-5 mr-4" /> {Languages.t('components.side_menu.my_drive')}
|
<UserIcon className="w-5 h-5 mr-4" /> {Languages.t('components.side_menu.my_drive')}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
onClick={() => {history.push(RouterServices.generateRouteFromState({companyId: company, viewId: "root", itemId: '', dirId: ''})); setParentId('root')}}
|
onClick={() => {
|
||||||
|
history.push(
|
||||||
|
RouterServices.generateRouteFromState({
|
||||||
|
companyId: company,
|
||||||
|
viewId: 'root',
|
||||||
|
itemId: '',
|
||||||
|
dirId: '',
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
setParentId('root');
|
||||||
|
}}
|
||||||
size="lg"
|
size="lg"
|
||||||
theme="white"
|
theme="white"
|
||||||
className={'w-full mb-1 ' + (folderType === 'home' && viewId == 'root' ? activeClass : '')}
|
className={
|
||||||
|
'w-full mb-1 ' + (folderType === 'home' && viewId == 'root' ? activeClass : '')
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<CloudIcon className="w-5 h-5 mr-4" /> {Languages.t('components.side_menu.home')}
|
<CloudIcon className="w-5 h-5 mr-4" /> {Languages.t('components.side_menu.home')}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
{FeatureTogglesService.isActiveFeatureName(FeatureNames.COMPANY_SEARCH_USERS) && (
|
||||||
onClick={() => {history.push(RouterServices.generateRouteFromState({companyId: company, viewId: "shared_with_me", itemId: '', dirId: ''})); setParentId('shared_with_me')}}
|
<Button
|
||||||
size="lg"
|
onClick={() => {
|
||||||
theme="white"
|
history.push(
|
||||||
className={'w-full mb-1 ' + (folderType === 'shared' && viewId == 'shared_with_me'? activeClass : '')}
|
RouterServices.generateRouteFromState({
|
||||||
>
|
companyId: company,
|
||||||
<UserGroupIcon className="w-5 h-5 mr-4" /> {Languages.t('components.side_menu.shared_with_me')}
|
viewId: 'shared_with_me',
|
||||||
</Button>
|
itemId: '',
|
||||||
|
dirId: '',
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
setParentId('shared_with_me');
|
||||||
|
}}
|
||||||
|
size="lg"
|
||||||
|
theme="white"
|
||||||
|
className={
|
||||||
|
'w-full mb-1 ' +
|
||||||
|
(folderType === 'shared' && viewId == 'shared_with_me' ? activeClass : '')
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<UserGroupIcon className="w-5 h-5 mr-4" />{' '}
|
||||||
|
{Languages.t('components.side_menu.shared_with_me')}
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
{false && (
|
{false && (
|
||||||
<>
|
<>
|
||||||
<Button
|
<Button
|
||||||
@@ -107,12 +152,23 @@ export default () => {
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
<Button
|
<Button
|
||||||
onClick={() =>{history.push(RouterServices.generateRouteFromState({companyId: company, viewId: 'trash_'+user?.id, itemId: '', dirId: ''}));setParentId('trash_'+user?.id)}}
|
onClick={() => {
|
||||||
|
history.push(
|
||||||
|
RouterServices.generateRouteFromState({
|
||||||
|
companyId: company,
|
||||||
|
viewId: 'trash_' + user?.id,
|
||||||
|
itemId: '',
|
||||||
|
dirId: '',
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
setParentId('trash_' + user?.id);
|
||||||
|
}}
|
||||||
size="lg"
|
size="lg"
|
||||||
theme="white"
|
theme="white"
|
||||||
className={'w-full mb-1 ' + (viewId?.includes("trash")? activeClass : '')}
|
className={'w-full mb-1 ' + (viewId?.includes('trash') ? activeClass : '')}
|
||||||
>
|
>
|
||||||
<TrashIcon className="w-5 h-5 mr-4 text-rose-500" /> {Languages.t('components.side_menu.trash')}
|
<TrashIcon className="w-5 h-5 mr-4 text-rose-500" />{' '}
|
||||||
|
{Languages.t('components.side_menu.trash')}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
{false && (
|
{false && (
|
||||||
|
|||||||
Reference in New Issue
Block a user