🐛 Fix preview navigation (#417)
This commit is contained in:
@@ -52,9 +52,9 @@ class RouterServices extends Observable {
|
||||
clientSubPathnames: Readonly<string[]> = [
|
||||
'/client/:companyId',
|
||||
'/client/:companyId/v/:viewId',
|
||||
'/client/:companyId/preview/:itemId',
|
||||
'/client/:companyId/v/:viewId/preview/:itemId',
|
||||
'/client/:companyId/v/:viewId/d/:dirId',
|
||||
'/client/:companyId/v/:viewId/preview/:itemId',
|
||||
'/client/:companyId/v/:viewId/d/:dirId/preview/:itemId',
|
||||
'/client/:companyId/w/:workspaceId',
|
||||
'/client/:companyId/w/:workspaceId/c/:channelId',
|
||||
'/client/:companyId/w/:workspaceId/c/:channelId/t/:threadId',
|
||||
@@ -294,8 +294,8 @@ class RouterServices extends Observable {
|
||||
`${this.pathnames.CLIENT}` +
|
||||
(state.companyId ? `/${state.companyId}` : '') +
|
||||
(state.viewId ? `/v/${state.viewId}` : '') +
|
||||
(state.itemId ? `/preview/${state.itemId}` : '') +
|
||||
(state.dirId ? `/d/${state.dirId}` : '') +
|
||||
(state.itemId ? `/preview/${state.itemId}` : '') +
|
||||
(state.sharedWithMe ? `/shared-with-me` : '') +
|
||||
(state.workspaceId ? `/w/${state.workspaceId}` : '') +
|
||||
(state.channelId ? `/c/${state.channelId}` : '') +
|
||||
|
||||
@@ -58,7 +58,7 @@ export const DocumentRow = ({
|
||||
}, [itemId]);
|
||||
|
||||
const preview = () => {
|
||||
history.push(RouterServices.generateRouteFromState({companyId: company, itemId: item.id, dirId: ''}));
|
||||
history.push(RouterServices.generateRouteFromState({companyId: company, itemId: item.id}));
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -32,7 +32,6 @@ export const DrivePreview: React.FC<DrivePreviewProps> = ({ items }) => {
|
||||
const { status, isOpen, open, close, loading } = useDrivePreview();
|
||||
const [modalLoading, setModalLoading] = useState(true);
|
||||
const { loading: loadingData } = useDrivePreviewLoading();
|
||||
const { type = '' } = useDrivePreviewDisplayData();
|
||||
let animationTimeout: number = setTimeout(() => undefined);
|
||||
const handleSwitchRight = () => {
|
||||
const currentItem = status.item;
|
||||
@@ -83,12 +82,11 @@ export const DrivePreview: React.FC<DrivePreviewProps> = ({ items }) => {
|
||||
if (device != 'ios' && device != 'android') {
|
||||
close();
|
||||
history.push(
|
||||
RouterServices.generateRouteFromState({ companyId: company, viewId: '', itemId: item.id, dirId: '' }),
|
||||
RouterServices.generateRouteFromState({ companyId: company, itemId: item.id, }),
|
||||
);
|
||||
open(item);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal
|
||||
open={isOpen}
|
||||
@@ -99,7 +97,10 @@ export const DrivePreview: React.FC<DrivePreviewProps> = ({ items }) => {
|
||||
>
|
||||
<XIcon
|
||||
className="z-10 cursor-pointer absolute right-5 top-5 w-20 h-20 text-white hover:text-black rounded-full p-1 bg-gray-500 hover:bg-white bg-opacity-25"
|
||||
onClick={() => close()}
|
||||
onClick={() => {
|
||||
close();
|
||||
history.push(RouterServices.generateRouteFromState({ companyId: company, itemId: '' }));
|
||||
}}
|
||||
/>
|
||||
|
||||
<Transition
|
||||
|
||||
Reference in New Issue
Block a user