Skip to content

Commit

Permalink
Merge pull request #3019 from ever-co/2991-improvement-team-member-ca…
Browse files Browse the repository at this point in the history
…rd--table-view

fix overlap on team member card| table view
  • Loading branch information
evereq authored Sep 17, 2024
2 parents 8f3fd05 + f3988ea commit 521fe7a
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 49 deletions.
63 changes: 35 additions & 28 deletions apps/web/components/ui/data-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,17 @@ function DataTable<TData, TValue>({ columns, data, footerRows, isHeader }: DataT
style={{
textAlign: index === 0 ? 'left' : 'center'
}}
className="!w-40 text-base"
className="!w-40 text-base"
key={header.id}
>
<Tooltip label={isTooltip as string} className="" enabled={!!isTooltip}>
<div className="">
{header.isPlaceholder
? null
: flexRender(
header.column.columnDef.header,
header.getContext()
)}
header.column.columnDef.header,
header.getContext()
)}
</div>
</Tooltip>
</TableHead>
Expand All @@ -98,32 +98,39 @@ function DataTable<TData, TValue>({ columns, data, footerRows, isHeader }: DataT
))}
</TableHeader>
)}
<div className="mt-8 "></div>
<div className="mt-8"></div>
<TableBody className="divide-y h-40 overflow-y-auto divide-gray-200 bg-light--theme-light dark:bg-dark--theme-light">
{table.getRowModel().rows?.length ? (
table.getRowModel().rows.map((row, i) => (
<TableRow
key={row.id}
data-state={row.getIsSelected() && 'selected'}
className={clsxm(
'my-4 hover:bg-[#00000008] dark:hover:bg-[#26272C]/40',
i == 1 && 'max-w-[615px]'
)}
>
{row.getVisibleCells().map((cell, index) => (
<TableCell
key={cell.id}
style={{
textAlign: index === 0 ? 'left' : 'center'
}}
// className="!w-36"
className="my-4 !w-fit xl:!w-fit border-r border-b border-[#00000008] border-[0.125rem] dark:border-[#26272C] "
>
{flexRender(cell.column.columnDef.cell, cell.getContext())}
</TableCell>
))}
</TableRow>
))
table.getRowModel().rows.map((row, i) => {
return (
<TableRow
key={row.id}
data-state={row.getIsSelected() && 'selected'}
className={clsxm(
'my-4 hover:bg-[#00000008] dark:hover:bg-[#26272C]/40',
i == 1 && 'max-w-[615px]'
)}
>
{row.getVisibleCells().map((cell, index) => {
return (
<TableCell
key={cell.id}
style={{
textAlign: index === 0 ? 'left' : 'center',
width: index === 4 ? '2rem' : '13rem'
}}
// className="!w-36"
className={clsxm(
'my-4 border-r border-b border-[#00000008] border-[0.125rem] dark:border-[#26272C]'
)}
>
{flexRender(cell.column.columnDef.cell, cell.getContext())}
</TableCell>
);
})}
</TableRow>
);
})
) : (
<TableRow>
<TableCell colSpan={columns.length} className="h-24 text-center">
Expand Down
6 changes: 1 addition & 5 deletions apps/web/components/ui/table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,7 @@ TableHead.displayName = 'TableHead';

const TableCell = React.forwardRef<HTMLTableCellElement, React.TdHTMLAttributes<HTMLTableCellElement>>(
({ className, ...props }, ref) => (
<td
ref={ref}
className={clsxm('p-4 align-middle [&:has([role=checkbox])]:pr-0 !w-full', className)}
{...props}
/>
<td ref={ref} className={clsxm('p-4 align-middle [&:has([role=checkbox])]:pr-0', className)} {...props} />
)
);
TableCell.displayName = 'TableCell';
Expand Down
16 changes: 5 additions & 11 deletions apps/web/lib/features/team-member-cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export function TaskCell({ row }: { row: any }) {
edition={taskEdition}
memberInfo={memberInfo}
className={clsxm(
'flex-1 flex justify-center items-center w-full px-2',
fullWidth ? 'max-w-[40vw]' : 'max-w-[30vw]'
'flex-1 flex justify-center items-center px-2',
fullWidth ? 'max-w-[40rem]' : 'max-w-[30rem]'
)}
publicTeam={publicTeam}
/>
Expand All @@ -38,24 +38,20 @@ export function UserInfoCell({ cell }: { cell: any }) {
const publicTeam = get(cell, 'column.columnDef.meta.publicTeam', false);
const memberInfo = useTeamMemberCard(member);

return <UserInfo memberInfo={memberInfo} className="" publicTeam={publicTeam} />;
return <UserInfo memberInfo={memberInfo} className="w-fit" publicTeam={publicTeam} />;
}

export function WorkedOnTaskCell({ row }: { row: any }) {
const member = row.original as OT_Member;
const memberInfo = useTeamMemberCard(member);
const fullWidth = useRecoilValue(fullWidthState);

return (
<TaskTimes
activeAuthTask={true}
memberInfo={memberInfo}
task={memberInfo.memberTask}
isAuthUser={memberInfo.isAuthUser}
className={clsxm(
'flex flex-col justify-center items-center mx-auto',
fullWidth ? '2xl:w-[7rem] 3xl:w-[11rem]' : '2xl:w-[7rem] 3xl:w-[10rem]'
)}
className={clsxm('flex flex-col justify-center items-center mx-auto')}
/>
);
}
Expand All @@ -70,9 +66,7 @@ export function TaskEstimateInfoCell({ row }: { row: any }) {
memberInfo={memberInfo}
edition={taskEdition}
activeAuthTask={true}
className={clsxm(
'flex flex-col justify-center items-center 2xl:w-[7rem] 3xl:w-[10rem]'
)}
className={clsxm('flex flex-col justify-center items-center')}
/>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function TaskEstimateInfo({ className, activeAuthTask, showTime = true, r

return (
<div className={className}>
<div className="flex items-center flex-col gap-y-[2rem] justify-center">
<div className="flex items-center flex-col gap-y-[2rem] min-w-[3.3rem] justify-center">
{showTime && (
<div className="flex space-x-2 items-center font-normal lg:text-sm text-xs">
<span className={clsxm('text-gray-500', hasEditMode && ['hidden'])}>
Expand Down
5 changes: 2 additions & 3 deletions apps/web/lib/features/team/user-team-card/task-info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ export function TaskInfo({ className, memberInfo, edition, publicTeam, tab, dayP

<div
className={clsxm(
'h-full w-full flex flex-col items-start justify-start gap-[1.0620rem] max-h-full overflow-hidden',
className,
'!min-w-[461px] !max-w-[461px]'
'h-full min-w-[20rem] w-fit flex flex-col items-start justify-start gap-[1.0620rem] max-h-full overflow-hidden',
className
)}
>
{/* task */}
Expand Down
2 changes: 1 addition & 1 deletion apps/web/lib/features/team/user-team-card/user-info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function UserInfo({ className, memberInfo, publicTeam = false }: Props) {
return (
<Link
href={publicTeam ? '#' : `/profile/${memberInfo.memberUser?.id}?name=${fullname}`}
className={clsxm('flex items-center lg:space-x-4 space-x-2', className)}
className={clsxm('flex items-center lg:space-x-4 space-x-2 w-fit', className)}
>
<div
className={clsxm(
Expand Down

0 comments on commit 521fe7a

Please sign in to comment.