diff --git a/app/components/CopyToClipboard.ts b/app/components/CopyToClipboard.ts index 2fcd7b49dd..5dc70b7cd4 100644 --- a/app/components/CopyToClipboard.ts +++ b/app/components/CopyToClipboard.ts @@ -15,7 +15,7 @@ function CopyToClipboard(props: Props, ref: React.Ref) { const onClick = React.useCallback( (ev: React.MouseEvent) => { - const elem = React.Children.only(children); + const childElem = React.Children.only(children); copy(text, { debug: env.ENVIRONMENT !== "production", @@ -24,8 +24,12 @@ function CopyToClipboard(props: Props, ref: React.Ref) { onCopy?.(); - if (elem && elem.props && typeof elem.props.onClick === "function") { - elem.props.onClick(ev); + if ( + childElem && + childElem.props && + typeof childElem.props.onClick === "function" + ) { + childElem.props.onClick(ev); } else { ev.preventDefault(); ev.stopPropagation(); diff --git a/app/components/DocumentExplorer.tsx b/app/components/DocumentExplorer.tsx index 9d3b3da813..b8209b5a1b 100644 --- a/app/components/DocumentExplorer.tsx +++ b/app/components/DocumentExplorer.tsx @@ -60,7 +60,7 @@ function DocumentExplorer({ onSubmit, onSelect, items, defaultValue }: Props) { if (defaultValue) { const node = items.find((item) => item.id === defaultValue); if (node) { - return ancestors(node).map((node) => node.id); + return ancestors(node).map((ancestorNode) => ancestorNode.id); } } return []; @@ -99,10 +99,10 @@ function DocumentExplorer({ onSubmit, onSelect, items, defaultValue }: Props) { }, [searchTerm]); React.useEffect(() => { - setItemRefs((itemRefs) => + setItemRefs((existingItemRefs) => map( fill(Array(items.length), 0), - (_, i) => itemRefs[i] || React.createRef() + (_, i) => existingItemRefs[i] || React.createRef() ) ); }, [items.length]); @@ -180,7 +180,7 @@ function DocumentExplorer({ onSubmit, onSelect, items, defaultValue }: Props) { ); // remove children - const newNodes = filter(nodes, (node) => !includes(descendantIds, node.id)); + const newNodes = filter(nodes, (n) => !includes(descendantIds, n.id)); const scrollOffset = calculateInitialScrollOffset(newNodes.length); setInitialScrollOffset(scrollOffset); }; diff --git a/app/components/Guide.tsx b/app/components/Guide.tsx index b872cb6f79..439dbab581 100644 --- a/app/components/Guide.tsx +++ b/app/components/Guide.tsx @@ -36,8 +36,8 @@ const Guide: React.FC = ({ return ( - {(props) => ( - + {(backdropProps) => ( + = ({ hideOnEsc hide={onRequestClose} > - {(props) => ( - + {(dialogProps) => ( + {title &&
{title}
} {children} diff --git a/app/components/List/Item.tsx b/app/components/List/Item.tsx index 3b0a58d2b2..b62e8e75f3 100644 --- a/app/components/List/Item.tsx +++ b/app/components/List/Item.tsx @@ -33,7 +33,7 @@ export type Props = Omit, "title"> & { small?: boolean; /** Whether to enable keyboard navigation */ keyboardNavigation?: boolean; - ellipsis?: boolean; + enableEllipsis?: boolean; }; const ListItem = ( @@ -46,7 +46,7 @@ const ListItem = ( border, to, keyboardNavigation, - ellipsis, + enableEllipsis, ...rest }: Props, ref: React.RefObject @@ -85,7 +85,7 @@ const ListItem = ( column={!compact} $selected={selected} > - + {title} {subtitle && ( diff --git a/app/components/Modal.tsx b/app/components/Modal.tsx index 35cf5dc995..cc55db2f42 100644 --- a/app/components/Modal.tsx +++ b/app/components/Modal.tsx @@ -69,8 +69,8 @@ const Modal: React.FC = ({ return ( - {(props) => ( - + {(backdropProps) => ( + = ({ hideOnClickOutside={!fullscreen} hide={onRequestClose} > - {(props) => + {(dialogProps) => fullscreen || isMobile ? ( = ({ marginLeft: `${depth * 12}px`, } } - {...props} + {...dialogProps} > ev.stopPropagation()} column> @@ -111,7 +111,7 @@ const Modal: React.FC = ({ ) : ( - + ev.stopPropagation()} // maxHeight needed for proper overflow behavior in Safari diff --git a/app/components/SearchPopover.tsx b/app/components/SearchPopover.tsx index 2390a7604a..5c77b86286 100644 --- a/app/components/SearchPopover.tsx +++ b/app/components/SearchPopover.tsx @@ -53,10 +53,10 @@ function SearchPopover({ shareId, className }: Props) { }, [searchResults, query, show]); const performSearch = React.useCallback( - async ({ query, ...options }) => { - if (query?.length > 0) { + async ({ query: searchQuery, ...options }) => { + if (searchQuery?.length > 0) { const response = await documents.search({ - query, + query: searchQuery, shareId, ...options, }); diff --git a/app/components/Sharing/Document/DocumentMemberList.tsx b/app/components/Sharing/Document/DocumentMemberList.tsx index ed5b667fb2..95940162fe 100644 --- a/app/components/Sharing/Document/DocumentMemberList.tsx +++ b/app/components/Sharing/Document/DocumentMemberList.tsx @@ -62,16 +62,16 @@ function DocumentMembersList({ document, invitedInSession }: Props) { ); const handleUpdateUser = React.useCallback( - async (user, permission) => { + async (userToUpdate, permission) => { try { await userMemberships.create({ documentId: document.id, - userId: user.id, + userId: userToUpdate.id, permission, }); toast.success( t(`Permissions for {{ userName }} updated`, { - userName: user.name, + userName: userToUpdate.name, }) ); } catch (err) { @@ -87,9 +87,9 @@ function DocumentMembersList({ document, invitedInSession }: Props) { () => orderBy( document.members, - (user) => - (invitedInSession.includes(user.id) ? "_" : "") + - user.name.toLocaleLowerCase(), + (memberUser) => + (invitedInSession.includes(memberUser.id) ? "_" : "") + + memberUser.name.toLocaleLowerCase(), "asc" ), [document.members, invitedInSession] diff --git a/app/components/Sharing/components/Suggestions.tsx b/app/components/Sharing/components/Suggestions.tsx index e9b67c6d9c..3029777529 100644 --- a/app/components/Sharing/components/Suggestions.tsx +++ b/app/components/Sharing/components/Suggestions.tsx @@ -67,9 +67,9 @@ export const Suggestions = observer( }); const fetchUsersByQuery = useThrottledCallback( - (query: string) => { - void users.fetchPage({ query }); - void groups.fetchPage({ query }); + (searchQuery: string) => { + void users.fetchPage({ query: searchQuery }); + void groups.fetchPage({ query: searchQuery }); }, 250, undefined, diff --git a/app/components/Sidebar/Sidebar.tsx b/app/components/Sidebar/Sidebar.tsx index 975d7c73bf..d11996e518 100644 --- a/app/components/Sidebar/Sidebar.tsx +++ b/app/components/Sidebar/Sidebar.tsx @@ -61,13 +61,13 @@ const Sidebar = React.forwardRef(function _Sidebar( // suppresses text selection event.preventDefault(); // this is simple because the sidebar is always against the left edge - const width = Math.min(event.pageX - offset, maxWidth); - const isSmallerThanCollapsePoint = width < minWidth / 2; + const newWidth = Math.min(event.pageX - offset, maxWidth); + const isSmallerThanCollapsePoint = newWidth < minWidth / 2; ui.set({ sidebarWidth: isSmallerThanCollapsePoint ? theme.sidebarCollapsedWidth - : width, + : newWidth, }); }, [ui, theme, offset, minWidth, maxWidth] diff --git a/app/components/Sidebar/components/NavLink.tsx b/app/components/Sidebar/components/NavLink.tsx index 33a23373e8..13be133471 100644 --- a/app/components/Sidebar/components/NavLink.tsx +++ b/app/components/Sidebar/components/NavLink.tsx @@ -75,7 +75,7 @@ const NavLink = ({ ); const { pathname: path } = toLocation; - const match = path + const pathMatch = path ? matchPath(currentLocation.pathname, { // Regex taken from: https://github.com/pillarjs/path-to-regexp/blob/master/index.js#L202 path: path.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1"), @@ -86,7 +86,7 @@ const NavLink = ({ const isActive = preActive ?? - !!(isActiveProp ? isActiveProp(match, currentLocation) : match); + !!(isActiveProp ? isActiveProp(pathMatch, currentLocation) : pathMatch); const className = isActive ? joinClassnames(classNameProp, activeClassName) : classNameProp; diff --git a/app/components/Sidebar/components/SharedWithMeLink.tsx b/app/components/Sidebar/components/SharedWithMeLink.tsx index e2d275aad0..054299fa32 100644 --- a/app/components/Sidebar/components/SharedWithMeLink.tsx +++ b/app/components/Sidebar/components/SharedWithMeLink.tsx @@ -86,9 +86,12 @@ function SharedWithMeLink({ membership, depth = 0 }: Props) { ); const parentRef = React.useRef(null); - const node = React.useMemo(() => document?.asNavigationNode, [document]); + const reparentableNode = React.useMemo( + () => document?.asNavigationNode, + [document] + ); const [{ isOverReparent, canDropToReparent }, dropToReparent] = - useDropToReparentDocument(node, setExpanded, parentRef); + useDropToReparentDocument(reparentableNode, setExpanded, parentRef); const { icon } = useSidebarLabelAndIcon(membership); const [{ isDragging }, draggableRef] = useDragMembership(membership); @@ -172,10 +175,10 @@ function SharedWithMeLink({ membership, depth = 0 }: Props) { - {childDocuments.map((node, index) => ( + {childDocuments.map((childNode, index) => ( 0; @@ -176,7 +176,7 @@ function StarredLink({ star }: Props) { { // Find any integrations that match this embed and inject the settings const integration: Integration | undefined = - find( - integrations.orderedData, - (integration) => integration.service === e.name - ); + find(integrations.orderedData, (i) => i.service === e.name); if (integration?.settings) { e.settings = integration.settings; diff --git a/app/hooks/useMenuHeight.ts b/app/hooks/useMenuHeight.ts index 18a4b7ea75..41970af160 100644 --- a/app/hooks/useMenuHeight.ts +++ b/app/hooks/useMenuHeight.ts @@ -23,11 +23,11 @@ const useMenuHeight = ({ React.useLayoutEffect(() => { if (visible && !isMobile) { - const maxHeight = (windowHeight / 100) * maxViewportHeight; + const calculatedMaxHeight = (windowHeight / 100) * maxViewportHeight; setMaxHeight( Math.min( - maxHeight, + calculatedMaxHeight, elementRef?.current ? windowHeight - elementRef.current.getBoundingClientRect().bottom -