Skip to content

Commit

Permalink
fix: dom nesting validation warn
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorGoryany committed Sep 9, 2024
1 parent 0ae67cf commit 0a45424
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 23 deletions.
4 changes: 1 addition & 3 deletions src/components/DashboardPage/DashboardPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { useGoalPreview } from '../GoalPreview/GoalPreviewProvider';
import { useFMPMetric } from '../../utils/telemetry';
import { LoadMoreButton } from '../LoadMoreButton/LoadMoreButton';
import { ProjectListItemCollapsable } from '../ProjectListItemCollapsable/ProjectListItemCollapsable';
import { routes } from '../../hooks/router';
import { GoalTableList, mapToRenderProps } from '../GoalTableList/GoalTableList';
import { PresetModals } from '../PresetModals';
import { FiltersPanel } from '../FiltersPanel/FiltersPanel';
Expand Down Expand Up @@ -153,10 +152,9 @@ export const DashboardPage = ({ user, ssrTime, defaultPresetFallback }: External
return (
<ProjectListItemCollapsable
key={project.id}
interactive={false}
interactive
visible
project={project}
href={routes.project(project.id, view ? `view=${view}` : undefined)}
goals={children}
actionButtonView="icons"
>
Expand Down
4 changes: 3 additions & 1 deletion src/components/ProjectListItem/ProjectListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { ProjectSubscriptionButtons } from '../ProjectSubscriptionButtons/Projec
import { safeUserData } from '../../utils/getUserName';
import { participants as participantsDO } from '../../utils/domObjects';
import { routes } from '../../hooks/router';
import { useUrlFilterParams } from '../../hooks/useUrlFilterParams';

import s from './ProjectListItem.module.css';

Expand Down Expand Up @@ -38,6 +39,7 @@ export const ProjectListItem: React.FC<ProjectListItemProps & ComponentProps<typ
actionButtonView,
...attrs
}) => {
const { view } = useUrlFilterParams({});
const ownerUserGroup = useMemo(() => [owner].map(safeUserData).filter(Boolean), [owner]);
const participantUserGroup = useMemo(() => participants?.map(safeUserData).filter(Boolean), [participants]);

Expand Down Expand Up @@ -67,7 +69,7 @@ export const ProjectListItem: React.FC<ProjectListItemProps & ComponentProps<typ
view={actionButtonView}
watching={watching}
stargizersCounter={stargizers}
href={routes.project(id)}
href={routes.project(id, view ? `view=${view}` : undefined)}
/>
</TableCell>
</TableRow>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { ComponentProps, MouseEventHandler, ReactNode } from 'react';
import NextLink from 'next/link';
import { nullable } from '@taskany/bricks';
import { TreeView, TreeViewNode, Text, Link } from '@taskany/bricks/harmony';
import { TreeView, TreeViewNode, Text } from '@taskany/bricks/harmony';
import { IconServersOutline } from '@taskany/icons';

import { DashboardProjectV2 } from '../../../trpc/inferredTypes';
Expand All @@ -12,7 +11,6 @@ import { TableRowItem, TableRowItemTitle } from '../TableRowItem/TableRowItem';
import s from './ProjectListItemCollapsable.module.css';

interface ProjectListItemCollapsableProps extends Omit<ComponentProps<typeof TreeViewNode>, 'title'> {
href?: string;
project: NonNullable<Omit<DashboardProjectV2, 'children' | 'goals'>>;
parent?: NonNullable<Omit<DashboardProjectV2, 'children' | 'goals'>>;
goals?: ReactNode;
Expand All @@ -27,7 +25,6 @@ export const ProjectListItemCollapsable: React.FC<ProjectListItemCollapsableProp
parent,
children,
goals,
href,
className,
titleSize = 'l',
interactive = true,
Expand Down Expand Up @@ -73,19 +70,7 @@ export const ProjectListItemCollapsable: React.FC<ProjectListItemCollapsableProp

return (
<TreeView className={className} {...projectListItem.attr}>
<TreeViewNode
interactive={interactive}
title={nullable(
href,
(h) => (
<NextLink href={h} passHref legacyBehavior>
<Link>{projectComponent}</Link>
</NextLink>
),
projectComponent,
)}
{...props}
>
<TreeViewNode interactive={interactive} title={projectComponent} {...props}>
{goals}
{children}
</TreeViewNode>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { FilterById, GoalByIdReturnType } from '../../../trpc/inferredTypes';
import { trpc } from '../../utils/trpcClient';
import { useUrlFilterParams } from '../../hooks/useUrlFilterParams';
import { refreshInterval } from '../../utils/config';
import { routes } from '../../hooks/router';
import { GoalTableList, mapToRenderProps } from '../GoalTableList/GoalTableList';
import { ProjectListItemCollapsable } from '../ProjectListItemCollapsable/ProjectListItemCollapsable';
import { useGoalPreview } from '../GoalPreview/GoalPreviewProvider';
Expand Down Expand Up @@ -140,7 +139,6 @@ export const ProjectListItemConnected: FC<ProjectListItemConnectedProps> = ({
return (
<>
<ProjectListItemCollapsable
href={routes.project(project.id, view ? `view=${view}` : undefined)}
onClick={onProjectClickHandler}
project={project}
parent={isKanbanView ? parent : undefined}
Expand Down

0 comments on commit 0a45424

Please sign in to comment.