[WEB-1533] chore: fix alignment issues in List and Spreadsheet view (#4714)

* fix alignment issues in List and Spreadsheet view

* fix spreadsheet indentation
This commit is contained in:
rahulramesha 2024-06-06 11:03:56 +05:30 committed by GitHub
parent ca9f3f2f5a
commit b24e530816
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 33 additions and 21 deletions

View File

@ -154,7 +154,7 @@ export const IssueBlockRoot: FC<Props> = observer((props) => {
canEditProperties={canEditProperties} canEditProperties={canEditProperties}
displayProperties={displayProperties} displayProperties={displayProperties}
nestingLevel={nestingLevel + 1} nestingLevel={nestingLevel + 1}
spacingLeft={spacingLeft + (displayProperties?.key ? 12 : 0)} spacingLeft={spacingLeft + 12}
containerRef={containerRef} containerRef={containerRef}
selectionHelpers={selectionHelpers} selectionHelpers={selectionHelpers}
groupId={groupId} groupId={groupId}

View File

@ -119,6 +119,9 @@ export const IssueBlock = observer((props: IssueBlockProps) => {
} }
}; };
//TODO: add better logic. This is to have a min width for ID/Key based on the length of project identifier
const keyMinWidth = (projectIdentifier.length + 5) * 7;
return ( return (
<div <div
ref={issueRef} ref={issueRef}
@ -143,8 +146,8 @@ export const IssueBlock = observer((props: IssueBlockProps) => {
}} }}
> >
<div className="flex w-full truncate"> <div className="flex w-full truncate">
<div className="flex flex-grow items-center gap-1.5 truncate"> <div className="flex flex-grow items-center gap-0.5 truncate">
<div className="flex items-center gap-2" style={isSubIssue ? { marginLeft } : {}}> <div className="flex items-center gap-1" style={isSubIssue ? { marginLeft } : {}}>
{/* select checkbox */} {/* select checkbox */}
{projectId && canEditIssueProperties && ( {projectId && canEditIssueProperties && (
<Tooltip <Tooltip
@ -174,7 +177,10 @@ export const IssueBlock = observer((props: IssueBlockProps) => {
</Tooltip> </Tooltip>
)} )}
{displayProperties && displayProperties?.key && ( {displayProperties && displayProperties?.key && (
<div className="flex-shrink-0 text-xs font-medium text-custom-text-300"> <div
className="flex-shrink-0 text-xs font-medium text-custom-text-300 pl-2"
style={{ minWidth: `${keyMinWidth}px` }}
>
{projectIdentifier}-{issue.sequence_id} {projectIdentifier}-{issue.sequence_id}
</div> </div>
)} )}

View File

@ -108,7 +108,7 @@ export const SpreadsheetIssueRow = observer((props: Props) => {
quickActions={quickActions} quickActions={quickActions}
canEditProperties={canEditProperties} canEditProperties={canEditProperties}
nestingLevel={nestingLevel + 1} nestingLevel={nestingLevel + 1}
spacingLeft={spacingLeft + (displayProperties.key ? 12 : 28)} spacingLeft={spacingLeft + 12}
isEstimateEnabled={isEstimateEnabled} isEstimateEnabled={isEstimateEnabled}
updateIssue={updateIssue} updateIssue={updateIssue}
portalElement={portalElement} portalElement={portalElement}
@ -187,7 +187,7 @@ const IssueRowDetails = observer((props: IssueRowDetailsProps) => {
const issueDetail = issue.getIssueById(issueId); const issueDetail = issue.getIssueById(issueId);
const marginLeft = `${spacingLeft}px`; const subIssueIndentation = `${spacingLeft}px`;
useOutsideClickDetector(menuActionRef, () => setIsMenuActive(false)); useOutsideClickDetector(menuActionRef, () => setIsMenuActive(false));
@ -222,6 +222,9 @@ const IssueRowDetails = observer((props: IssueRowDetailsProps) => {
const subIssuesCount = issueDetail?.sub_issues_count ?? 0; const subIssuesCount = issueDetail?.sub_issues_count ?? 0;
const isIssueSelected = selectionHelpers.getIsEntitySelected(issueDetail.id); const isIssueSelected = selectionHelpers.getIsEntitySelected(issueDetail.id);
//TODO: add better logic. This is to have a min width for ID/Key based on the length of project identifier
const keyMinWidth = (getProjectIdentifierById(issueDetail.project_id)?.length + 5) * 7;
return ( return (
<> <>
<td <td
@ -245,7 +248,7 @@ const IssueRowDetails = observer((props: IssueRowDetailsProps) => {
)} )}
disabled={!!issueDetail?.tempId} disabled={!!issueDetail?.tempId}
> >
<div className="flex items-center gap-1 min-w-min py-2.5 pl-2"> <div className="flex items-center gap-0.5 min-w-min py-2.5 pl-2">
{/* select checkbox */} {/* select checkbox */}
{projectId && !disableUserActions && ( {projectId && !disableUserActions && (
<Tooltip <Tooltip
@ -258,7 +261,7 @@ const IssueRowDetails = observer((props: IssueRowDetailsProps) => {
} }
disabled={issueDetail.project_id === projectId} disabled={issueDetail.project_id === projectId}
> >
<div className="flex-shrink-0 grid place-items-center w-3.5"> <div className="flex-shrink-0 grid place-items-center w-3.5 mr-1">
<MultipleSelectEntityAction <MultipleSelectEntityAction
className={cn( className={cn(
"opacity-0 pointer-events-none group-hover/list-block:opacity-100 group-hover/list-block:pointer-events-auto transition-opacity", "opacity-0 pointer-events-none group-hover/list-block:opacity-100 group-hover/list-block:pointer-events-auto transition-opacity",
@ -274,8 +277,20 @@ const IssueRowDetails = observer((props: IssueRowDetailsProps) => {
</div> </div>
</Tooltip> </Tooltip>
)} )}
{/* sub issues indentation */}
<div style={nestingLevel !== 0 ? { width: subIssueIndentation } : {}} />
<WithDisplayPropertiesHOC displayProperties={displayProperties} displayPropertyKey="key">
<div className="relative flex cursor-pointer items-center text-center text-xs hover:text-custom-text-100">
<p className={`flex font-medium leading-7`} style={{ minWidth: `${keyMinWidth}px` }}>
{getProjectIdentifierById(issueDetail.project_id)}-{issueDetail.sequence_id}
</p>
</div>
</WithDisplayPropertiesHOC>
{/* sub-issues chevron */} {/* sub-issues chevron */}
<div className="grid place-items-center size-4" style={nestingLevel !== 0 ? { marginLeft } : {}}> <div className="grid place-items-center size-4">
{subIssuesCount > 0 && ( {subIssuesCount > 0 && (
<button <button
type="button" type="button"
@ -291,22 +306,14 @@ const IssueRowDetails = observer((props: IssueRowDetailsProps) => {
</button> </button>
)} )}
</div> </div>
<WithDisplayPropertiesHOC displayProperties={displayProperties} displayPropertyKey="key">
<div className="relative flex cursor-pointer items-center text-center text-xs hover:text-custom-text-100">
<p className={`flex items-center justify-center font-medium leading-7`}>
{getProjectIdentifierById(issueDetail.project_id)}-{issueDetail.sequence_id}
</p>
</div>
</WithDisplayPropertiesHOC>
</div> </div>
<div className="flex items-center gap-2 justify-between h-full w-full pr-4 truncate"> <div className="flex items-center gap-2 justify-between h-full w-full pr-4 pl-1 truncate">
<div className="w-full line-clamp-1 text-sm text-custom-text-100"> <div className="w-full line-clamp-1 text-sm text-custom-text-100">
<div className="w-full overflow-hidden"> <div className="w-full overflow-hidden">
<Tooltip tooltipContent={issueDetail.name} isMobile={isMobile}> <Tooltip tooltipContent={issueDetail.name} isMobile={isMobile}>
<div <div
className="h-full w-full cursor-pointer truncate px-4 text-left text-[0.825rem] text-custom-text-100 focus:outline-none" className="h-full w-full cursor-pointer truncate pr-4 text-left text-[0.825rem] text-custom-text-100 focus:outline-none"
tabIndex={-1} tabIndex={-1}
> >
{issueDetail.name} {issueDetail.name}

View File

@ -48,7 +48,7 @@ export const SpreadsheetHeader = observer((props: Props) => {
tabIndex={-1} tabIndex={-1}
> >
{canSelectIssues && ( {canSelectIssues && (
<div className="flex-shrink-0 flex items-center w-3.5"> <div className="flex-shrink-0 flex items-center w-3.5 mr-1">
<MultipleSelectGroupAction <MultipleSelectGroupAction
className={cn( className={cn(
"size-3.5 opacity-0 pointer-events-none group-hover/list-header:opacity-100 group-hover/list-header:pointer-events-auto !outline-none", "size-3.5 opacity-0 pointer-events-none group-hover/list-header:opacity-100 group-hover/list-header:pointer-events-auto !outline-none",
@ -61,7 +61,6 @@ export const SpreadsheetHeader = observer((props: Props) => {
/> />
</div> </div>
)} )}
<div className="size-4" />
<span className="flex h-full w-full flex-grow items-center py-2.5">Issues</span> <span className="flex h-full w-full flex-grow items-center py-2.5">Issues</span>
</th> </th>