* The first page(default) should be My Drive (#144)
This commit is contained in:
@@ -30,13 +30,16 @@ import Media from '@molecules/media';
|
|||||||
import { DriveCurrentFolderAtom } from '@views/client/body/drive/browser';
|
import { DriveCurrentFolderAtom } from '@views/client/body/drive/browser';
|
||||||
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 { useCurrentUser } from 'app/features/users/hooks/use-current-user';
|
||||||
|
|
||||||
|
|
||||||
export default (props: { driveItem: DriveItem & { user?: UserType } }) => {
|
export default (props: { driveItem: DriveItem & { user?: UserType } }) => {
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const input = useRecoilValue(SearchInputState);
|
const input = useRecoilValue(SearchInputState);
|
||||||
const currentWorkspaceId = useRouterWorkspace();
|
const currentWorkspaceId = useRouterWorkspace();
|
||||||
const companyApplications = useCompanyApplications();
|
const companyApplications = useCompanyApplications();
|
||||||
const [_, setParentId] = useRecoilState(DriveCurrentFolderAtom({ initialFolderId: 'root' }));
|
const { user } = useCurrentUser();
|
||||||
|
const [_, setParentId] = useRecoilState(DriveCurrentFolderAtom({ initialFolderId: 'user_'+user?.id }));
|
||||||
const tdriveDriveApplicationId =
|
const tdriveDriveApplicationId =
|
||||||
companyApplications.applications.find(application => {
|
companyApplications.applications.find(application => {
|
||||||
return application.identity.code === 'tdrive_drive';
|
return application.identity.code === 'tdrive_drive';
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import useRouteState from 'app/features/router/hooks/use-route-state';
|
|||||||
import { SharedWithMeFilterState } from '@features/drive/state/shared-with-me-filter';
|
import { SharedWithMeFilterState } from '@features/drive/state/shared-with-me-filter';
|
||||||
import MenusManager from '@components/menus/menus-manager.jsx';
|
import MenusManager from '@components/menus/menus-manager.jsx';
|
||||||
import Languages from 'features/global/services/languages-service';
|
import Languages from 'features/global/services/languages-service';
|
||||||
|
import { useCurrentUser } from 'app/features/users/hooks/use-current-user';
|
||||||
|
|
||||||
export const DriveCurrentFolderAtom = atomFamily<
|
export const DriveCurrentFolderAtom = atomFamily<
|
||||||
string,
|
string,
|
||||||
@@ -56,12 +57,13 @@ export default memo(
|
|||||||
tdriveTabContextToken?: string;
|
tdriveTabContextToken?: string;
|
||||||
inPublicSharing?: boolean;
|
inPublicSharing?: boolean;
|
||||||
}) => {
|
}) => {
|
||||||
|
const { user } = useCurrentUser();
|
||||||
const companyId = useRouterCompany();
|
const companyId = useRouterCompany();
|
||||||
setTdriveTabToken(tdriveTabContextToken || null);
|
setTdriveTabToken(tdriveTabContextToken || null);
|
||||||
const [filter, setFilter] = useRecoilState(SharedWithMeFilterState);
|
const [filter, setFilter] = useRecoilState(SharedWithMeFilterState);
|
||||||
|
|
||||||
const [parentId, _setParentId] = useRecoilState(
|
const [parentId, _setParentId] = useRecoilState(
|
||||||
DriveCurrentFolderAtom({ context: context, initialFolderId: initialParentId || 'root' }),
|
DriveCurrentFolderAtom({ context: context, initialFolderId: initialParentId || 'user_'+user?.id }),
|
||||||
);
|
);
|
||||||
|
|
||||||
const [loadingParentChange, setLoadingParentChange] = useState(false);
|
const [loadingParentChange, setLoadingParentChange] = useState(false);
|
||||||
@@ -105,7 +107,7 @@ export default memo(
|
|||||||
|
|
||||||
//In case we are kicked out of the current folder, we need to reset the parent id
|
//In case we are kicked out of the current folder, we need to reset the parent id
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!loading && !path?.length && !inPublicSharing && !sharedWithMe) setParentId('root');
|
if (!loading && !path?.length && !inPublicSharing && !sharedWithMe) setParentId('user_'+user?.id);
|
||||||
}, [path, loading, setParentId]);
|
}, [path, loading, setParentId]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -1,14 +1,16 @@
|
|||||||
import { Base, Title } from '@atoms/text';
|
import { Base, Title } from '@atoms/text';
|
||||||
import { useDriveItem } from '@features/drive/hooks/use-drive-item';
|
import { useDriveItem } from '@features/drive/hooks/use-drive-item';
|
||||||
import { formatBytes } from '@features/drive/utils';
|
import { formatBytes } from '@features/drive/utils';
|
||||||
|
import { useCurrentUser } from 'app/features/users/hooks/use-current-user';
|
||||||
import Languages from "features/global/services/languages-service";
|
import Languages from "features/global/services/languages-service";
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const { access, item } = useDriveItem('root');
|
const { access, item } = useDriveItem('root');
|
||||||
const { item: trash } = useDriveItem('trash');
|
const { item: trash } = useDriveItem('trash');
|
||||||
|
const { user } = useCurrentUser();
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{access !== 'read' && item?.id === 'root' && (
|
{access !== 'read' && (
|
||||||
<div className="bg-zinc-500 dark:bg-zinc-800 bg-opacity-10 rounded-md p-4 w-auto max-w-md">
|
<div className="bg-zinc-500 dark:bg-zinc-800 bg-opacity-10 rounded-md p-4 w-auto max-w-md">
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<Title>
|
<Title>
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import { ConfirmDeleteModalAtom } from '../body/drive/modals/confirm-delete';
|
|||||||
import { CreateModal, CreateModalAtom } from '../body/drive/modals/create';
|
import { CreateModal, CreateModalAtom } from '../body/drive/modals/create';
|
||||||
import { Button } from '@atoms/button/button';
|
import { Button } from '@atoms/button/button';
|
||||||
import Languages from "features/global/services/languages-service";
|
import Languages from "features/global/services/languages-service";
|
||||||
|
import { useCurrentUser } from 'app/features/users/hooks/use-current-user';
|
||||||
|
|
||||||
export const CreateModalWithUploadZones = ({ initialParentId }: { initialParentId?: string }) => {
|
export const CreateModalWithUploadZones = ({ initialParentId }: { initialParentId?: string }) => {
|
||||||
const companyId = useRouterCompany();
|
const companyId = useRouterCompany();
|
||||||
@@ -19,8 +20,9 @@ export const CreateModalWithUploadZones = ({ initialParentId }: { initialParentI
|
|||||||
const uploadFolderZoneRef = useRef<UploadZone | null>(null);
|
const uploadFolderZoneRef = useRef<UploadZone | null>(null);
|
||||||
const setCreationModalState = useSetRecoilState(CreateModalAtom);
|
const setCreationModalState = useSetRecoilState(CreateModalAtom);
|
||||||
const { uploadTree, uploadFromUrl } = useDriveUpload();
|
const { uploadTree, uploadFromUrl } = useDriveUpload();
|
||||||
|
const { user } = useCurrentUser();
|
||||||
const [parentId, _] = useRecoilState(
|
const [parentId, _] = useRecoilState(
|
||||||
DriveCurrentFolderAtom({ initialFolderId: initialParentId || 'root' }),
|
DriveCurrentFolderAtom({ initialFolderId: initialParentId || 'user_'+user?.id }),
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log("Upload Zone:: " + parentId);
|
console.log("Upload Zone:: " + parentId);
|
||||||
@@ -78,7 +80,8 @@ export const CreateModalWithUploadZones = ({ initialParentId }: { initialParentI
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const [parentId, _] = useRecoilState(DriveCurrentFolderAtom({ initialFolderId: 'root' }));
|
const { user } = useCurrentUser();
|
||||||
|
const [parentId, _] = useRecoilState(DriveCurrentFolderAtom({ initialFolderId: 'user_'+user?.id }));
|
||||||
const { access, item, inTrash } = useDriveItem(parentId);
|
const { access, item, inTrash } = useDriveItem(parentId);
|
||||||
const { children: trashChildren } = useDriveItem('trash');
|
const { children: trashChildren } = useDriveItem('trash');
|
||||||
const uploadZoneRef = useRef<UploadZone | null>(null);
|
const uploadZoneRef = useRef<UploadZone | null>(null);
|
||||||
|
|||||||
@@ -27,15 +27,15 @@ import Languages from "features/global/services/languages-service";
|
|||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
|
const { user } = useCurrentUser();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const company = useRouterCompany();
|
const company = useRouterCompany();
|
||||||
const workspace = useRouterWorkspace();
|
const workspace = useRouterWorkspace();
|
||||||
const [parentId, setParentId] = useRecoilState(
|
const [parentId, setParentId] = useRecoilState(
|
||||||
DriveCurrentFolderAtom({ initialFolderId: 'root' }),
|
DriveCurrentFolderAtom({ initialFolderId: 'user_'+user?.id }),
|
||||||
);
|
);
|
||||||
const { user } = useCurrentUser();
|
|
||||||
const active = false;
|
const active = false;
|
||||||
const { access: rootAccess } = useDriveItem('root');
|
const { access: rootAccess } = useDriveItem('user_'+user?.id);
|
||||||
const { sharedWithMe, inTrash, path } = useDriveItem(parentId);
|
const { sharedWithMe, inTrash, path } = useDriveItem(parentId);
|
||||||
const activeClass = 'bg-zinc-50 dark:bg-zinc-800 !text-blue-500';
|
const activeClass = 'bg-zinc-50 dark:bg-zinc-800 !text-blue-500';
|
||||||
let folderType = 'home';
|
let folderType = 'home';
|
||||||
|
|||||||
Reference in New Issue
Block a user