🐛 Fix navigation for shared link view (#466)

This commit is contained in:
Montassar Ghanmy
2024-03-18 11:26:08 +01:00
committed by GitHub
parent 8494145e9d
commit 33392abfeb
4 changed files with 9 additions and 4 deletions
@@ -217,6 +217,7 @@ export default memo(
onCheck: (v: boolean) => onCheck: (v: boolean) =>
setChecked(_.pickBy({ ...checked, [child.id]: v }, _.identity)), setChecked(_.pickBy({ ...checked, [child.id]: v }, _.identity)),
onBuildContextMenu: () => onBuildContextMenu(details, child), onBuildContextMenu: () => onBuildContextMenu(details, child),
inPublicSharing,
}; };
return ( return (
isMobile ? ( isMobile ? (
@@ -345,7 +346,7 @@ export default memo(
</div> </div>
</div> </div>
) : ( ) : (
<HeaderPath path={path || []} inTrash={inTrash} setParentId={setParentId} /> <HeaderPath path={path || []} inTrash={inTrash} setParentId={setParentId} inPublicSharing={inPublicSharing} />
)} )}
<div className="grow" /> <div className="grow" />
@@ -390,7 +391,7 @@ export default memo(
onClick={() => { onClick={() => {
const route = RouterServices.generateRouteFromState({dirId: child.id}); const route = RouterServices.generateRouteFromState({dirId: child.id});
history.push(route); history.push(route);
//return setParentId(child.id); if (inPublicSharing) return setParentId(child.id);
}} }}
checked={checked[child.id] || false} checked={checked[child.id] || false}
onCheck={v => onCheck={v =>
@@ -9,6 +9,7 @@ export type DriveItemProps = {
checked: boolean; checked: boolean;
onClick?: () => void; onClick?: () => void;
onBuildContextMenu: () => Promise<any[]>; onBuildContextMenu: () => Promise<any[]>;
inPublicSharing?: boolean;
}; };
export type DriveItemOverlayProps = { export type DriveItemOverlayProps = {
@@ -32,6 +32,7 @@ export const DocumentRow = ({
checked, checked,
onClick, onClick,
onBuildContextMenu, onBuildContextMenu,
inPublicSharing,
}: DriveItemProps) => { }: DriveItemProps) => {
const history = useHistory(); const history = useHistory();
const [hover, setHover] = useState(false); const [hover, setHover] = useState(false);
@@ -59,6 +60,7 @@ export const DocumentRow = ({
const preview = () => { const preview = () => {
history.push(RouterServices.generateRouteFromState({companyId: company, itemId: item.id})); history.push(RouterServices.generateRouteFromState({companyId: company, itemId: item.id}));
if (inPublicSharing) open(item);
}; };
return ( return (
@@ -15,10 +15,12 @@ export default ({
path: livePath, path: livePath,
inTrash, inTrash,
setParentId, setParentId,
inPublicSharing,
}: { }: {
path: DriveItem[]; path: DriveItem[];
inTrash?: boolean; inTrash?: boolean;
setParentId: (id: string) => void; setParentId: (id: string) => void;
inPublicSharing?: boolean;
}) => { }) => {
const [savedPath, setSavedPath] = useState<DriveItem[]>([]); const [savedPath, setSavedPath] = useState<DriveItem[]>([]);
const history = useHistory(); const history = useHistory();
@@ -40,8 +42,7 @@ export default ({
dirId, dirId,
}), }),
); );
console.log("viewId changed now setting the parentId") if (inPublicSharing) return setParentId(dirId ? dirId : viewId);
// setParentId(dirId ? dirId : viewId);
}} }}
/> />
); );