🔀 Merge branch 'main' into release/v1.0.5

This commit is contained in:
Eric Doughty-Papassideris
2024-11-25 13:30:27 +01:00
15 changed files with 228 additions and 30 deletions
@@ -79,7 +79,6 @@ class RouterServices extends Observable {
UUIDsToTranslate: Readonly<string[]> = [
'companyId',
'itemId',
'workspaceId',
'channelId',
'messageId',
@@ -78,7 +78,7 @@ export default memo(
: 'member';
setTdriveTabToken(tdriveTabContextToken || null);
const [ filter ] = useRecoilState(SharedWithMeFilterState);
const { viewId, dirId } = useRouteState();
const { viewId, dirId, itemId } = useRouteState();
const [sortLabel] = useRecoilState(DriveItemSort)
const [parentId, _setParentId] = useRecoilState(
DriveCurrentFolderAtom({
@@ -259,6 +259,26 @@ export default memo(
};
}, [parentId, loading]);
// Scroll to item in view
const scrollTillItemInView = itemId && itemId?.length > 0;
const scrollItemId = itemId || '';
useEffect(() => {
const itemInChildren = children.find(item => item.id === scrollItemId);
if (!loading && scrollTillItemInView && !itemInChildren) {
scrollViwer.current?.scrollTo(0, scrollViwer.current?.scrollHeight);
} else {
if (!loading && itemInChildren) {
// scroll to preview item using id for current preview routes
const element = document.getElementById(`DR-${scrollItemId}`);
element?.scrollIntoView({ behavior: 'smooth', block: 'center' });
// set it as checked to indicate it is in view
setChecked({ [scrollItemId]: true });
}
}
}, [loading, children]);
return (
<>
{viewId == 'shared-with-me' ? (
@@ -54,6 +54,7 @@ export const DocumentRow = ({
: 'hover:bg-zinc-500 hover:bg-opacity-10 ') +
(className || '')
}
id={`DR-${item.id}`}
onMouseEnter={() => setHover(true)}
onMouseLeave={() => setHover(false)}
onClick={e => {