Skip to content

Commit

Permalink
fix: router navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
Monta authored and Monta committed Mar 1, 2024
1 parent ac30657 commit 825cbac
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions tdrive/frontend/src/app/views/client/body/drive/browser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,8 @@ export default memo(
}
item={child}
onClick={() => {
const route = RouterServices.generateRouteFromState({dirId: child.id});
history.push(route);
// const route = RouterServices.generateRouteFromState({dirId: child.id});
// history.push(route);
return setParentId(child.id);
}}
checked={checked[child.id] || false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const DocumentRow = ({
console.log("DEVICE:: " + device);
if (device != "ios" && device != "android") {
history.push(RouterServices.generateRouteFromState({companyId: company, itemId: item.id, dirId: ''}));
open(item);
//open(item);
}
};

Expand Down
16 changes: 8 additions & 8 deletions tdrive/frontend/src/app/views/client/body/drive/header-path.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ export default ({
inTrash={inTrash || false}
path={path}
onClick={(viewId, dirId) => {
history.push(
/*history.push(
RouterServices.generateRouteFromState({
companyId: company,
viewId,
dirId,
}),
);
);*/
setParentId(dirId ? dirId : viewId);
}}
/>
Expand Down Expand Up @@ -128,7 +128,7 @@ const PathItem = ({
const { user } = useCurrentUser();
const { viewId } = RouterServices.getStateFromRoute();
const { access: trashAccess } = useDriveItem('trash');
const isInSharedWithMe = viewId === "shared_with_me";
const isInSharedWithMe = viewId === 'shared_with_me';
return (
<div className="flex items-center">
<a
Expand Down Expand Up @@ -185,12 +185,12 @@ const PathItem = ({

if (first) {
if (isTrash) {
return viewId?.includes('trash_')
? Languages.t('components.header_path.my_trash')
return viewId?.includes('trash_')
? Languages.t('components.header_path.my_trash')
: Languages.t('components.header_path.shared_trash');
} else {
return isInSharedWithMe
? Languages.t('components.header_path.shared_with_me')
return isInSharedWithMe
? Languages.t('components.header_path.shared_with_me')
: fileName;
}
} else {
Expand All @@ -202,7 +202,7 @@ const PathItem = ({
{item?.access_info?.public?.level && item?.access_info?.public?.level !== 'none' && (
<PublicIcon className="h-5 w-5 ml-2" />
)}
{first && !!user?.id && viewId != "shared_with_me" && (
{first && !!user?.id && viewId != 'shared_with_me' && (
<span className="ml-2 -mr-1 text-gray-700">
<ChevronDownIcon className="w-4 h-4" />
</span>
Expand Down
10 changes: 5 additions & 5 deletions tdrive/frontend/src/app/views/client/side-bar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export default () => {
if (sharedWithMe) folderType = 'shared';

useEffect(() => {
console.log('PARENT ID CHANGED: ', parentId);
!itemId && !dirId && viewId && setParentId(viewId);
dirId && viewId && setParentId(dirId);
}, [viewId, itemId, dirId]);
Expand Down Expand Up @@ -76,7 +77,7 @@ export default () => {
dirId: '',
}),
);
setParentId('user_' + user?.id);
// setParentId('user_' + user?.id);
}}
size="lg"
theme="white"
Expand All @@ -92,6 +93,7 @@ export default () => {
{FeatureTogglesService.isActiveFeatureName(FeatureNames.COMPANY_SHARED_DRIVE) && (
<Button
onClick={() => {
// setParentId('root')
history.push(
RouterServices.generateRouteFromState({
companyId: company,
Expand All @@ -100,15 +102,13 @@ export default () => {
dirId: '',
}),
);
setParentId('root');
}}
size="lg"
theme="white"
className={
'w-full mb-1 ' + (folderType === 'home' && viewId == 'root' ? activeClass : '')
}
>

<CloudIcon className="w-5 h-5 mr-4" /> {Languages.t('components.side_menu.home')}
</Button>
)}
Expand All @@ -123,7 +123,7 @@ export default () => {
dirId: '',
}),
);
setParentId('shared_with_me');
// setParentId('shared_with_me');
}}
size="lg"
theme="white"
Expand Down Expand Up @@ -164,7 +164,7 @@ export default () => {
dirId: '',
}),
);
setParentId('trash_' + user?.id);
// setParentId('trash_' + user?.id);
}}
size="lg"
theme="white"
Expand Down

0 comments on commit 825cbac

Please sign in to comment.