fix: spreadsheet view properties fix (#2599)

This commit is contained in:
Anmol Singh Bhatia 2023-11-02 16:01:49 +05:30 committed by GitHub
parent f6b95b8d31
commit 4512651f8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 50 additions and 19 deletions

View File

@ -21,6 +21,7 @@ export interface IIssuePropertyAssignee {
optionsClassName?: string; optionsClassName?: string;
placement?: Placement; placement?: Placement;
multiple?: true; multiple?: true;
noLabelBorder?: boolean;
} }
export const IssuePropertyAssignee: React.FC<IIssuePropertyAssignee> = observer((props) => { export const IssuePropertyAssignee: React.FC<IIssuePropertyAssignee> = observer((props) => {
@ -36,6 +37,7 @@ export const IssuePropertyAssignee: React.FC<IIssuePropertyAssignee> = observer(
optionsClassName, optionsClassName,
placement, placement,
multiple = false, multiple = false,
noLabelBorder = false,
} = props; } = props;
const { workspace: workspaceStore, project: projectStore } = useMobxStore(); const { workspace: workspaceStore, project: projectStore } = useMobxStore();
@ -91,8 +93,9 @@ export const IssuePropertyAssignee: React.FC<IIssuePropertyAssignee> = observer(
</AvatarGroup> </AvatarGroup>
) : ( ) : (
<span <span
className="flex items-center justify-between gap-1 h-full w-full text-xs px-2.5 py-1 rounded border-[0.5px] border-custom-border-300 duration-300 focus:outline-none className={`flex items-center justify-between gap-1 h-full w-full text-xs rounded duration-300 focus:outline-none ${
" noLabelBorder ? "" : " px-2.5 py-1 border border-custom-border-300"
}}`}
> >
<User2 className="h-3 w-3" /> <User2 className="h-3 w-3" />
</span> </span>

View File

@ -25,6 +25,7 @@ export interface IIssuePropertyLabels {
optionsClassName?: string; optionsClassName?: string;
placement?: Placement; placement?: Placement;
maxRender?: number; maxRender?: number;
noLabelBorder?: boolean;
} }
export const IssuePropertyLabels: React.FC<IIssuePropertyLabels> = observer((props) => { export const IssuePropertyLabels: React.FC<IIssuePropertyLabels> = observer((props) => {
@ -40,6 +41,7 @@ export const IssuePropertyLabels: React.FC<IIssuePropertyLabels> = observer((pro
optionsClassName, optionsClassName,
placement, placement,
maxRender = 2, maxRender = 2,
noLabelBorder = false,
} = props; } = props;
const { workspace: workspaceStore, project: projectStore }: RootStore = useMobxStore(); const { workspace: workspaceStore, project: projectStore }: RootStore = useMobxStore();
@ -149,7 +151,11 @@ export const IssuePropertyLabels: React.FC<IIssuePropertyLabels> = observer((pro
</div> </div>
) )
) : ( ) : (
<div className="h-full flex items-center justify-center text-xs rounded border-[0.5px] border-custom-border-300 px-2.5 py-1 hover:bg-custom-background-80"> <div
className={`h-full flex items-center justify-center text-xs rounded px-2.5 py-1 hover:bg-custom-background-80 ${
noLabelBorder ? "" : "border-[0.5px] border-custom-border-300"
}`}
>
Select labels Select labels
</div> </div>
)} )}

View File

@ -35,9 +35,9 @@ export const IssuePropertyState: React.FC<IIssuePropertyState> = observer((props
onChange, onChange,
disabled, disabled,
hideDropdownArrow = false, hideDropdownArrow = false,
className, className = "",
buttonClassName, buttonClassName = "",
optionsClassName, optionsClassName = "",
placement, placement,
} = props; } = props;
@ -110,7 +110,7 @@ export const IssuePropertyState: React.FC<IIssuePropertyState> = observer((props
<button <button
ref={setReferenceElement} ref={setReferenceElement}
type="button" type="button"
className={`flex items-center justify-between gap-1 w-full text-xs px-2.5 py-1 rounded border-[0.5px] border-custom-border-300 duration-300 focus:outline-none ${ className={`flex items-center justify-between gap-1 w-full text-xs px-2.5 py-1 rounded border-[0.5px] border-custom-border-300 ${
disabled ? "cursor-not-allowed text-custom-text-200" : "cursor-pointer hover:bg-custom-background-80" disabled ? "cursor-not-allowed text-custom-text-200" : "cursor-pointer hover:bg-custom-background-80"
} ${buttonClassName}`} } ${buttonClassName}`}
onClick={() => fetchProjectStates()} onClick={() => fetchProjectStates()}

View File

@ -26,7 +26,9 @@ export const SpreadsheetAssigneeColumn: React.FC<Props> = ({ issue, members, onC
projectId={issue.project_detail.id ?? null} projectId={issue.project_detail.id ?? null}
value={issue.assignees} value={issue.assignees}
onChange={(data) => onChange({ assignees: data })} onChange={(data) => onChange({ assignees: data })}
buttonClassName="!p-0 !rounded-none !border-0" className="h-full w-full"
buttonClassName="!shadow-none !border-0 h-full w-full px-2.5 py-1 "
noLabelBorder
hideDropdownArrow hideDropdownArrow
disabled={disabled} disabled={disabled}
multiple multiple

View File

@ -19,7 +19,9 @@ export const SpreadsheetCreatedOnColumn: React.FC<Props> = ({ issue, expandedIss
return ( return (
<> <>
<div className="text-xs">{renderLongDetailDateFormat(issue.created_at)}</div> <div className="flex items-center justify-center text-xs h-full w-full">
{renderLongDetailDateFormat(issue.created_at)}
</div>
{isExpanded && {isExpanded &&
!isLoading && !isLoading &&

View File

@ -24,6 +24,8 @@ export const SpreadsheetDueDateColumn: React.FC<Props> = ({ issue, onChange, exp
<ViewDueDateSelect <ViewDueDateSelect
issue={issue} issue={issue}
onChange={(val) => onChange({ target_date: val })} onChange={(val) => onChange({ target_date: val })}
className="!h-full !w-full max-w-full px-2.5 py-1 flex items-center"
buttonClassName="!h-full !w-full !shadow-none px-2.5"
noBorder noBorder
disabled={disabled} disabled={disabled}
/> />

View File

@ -25,6 +25,8 @@ export const SpreadsheetEstimateColumn: React.FC<Props> = (props) => {
projectId={issue.project_detail.id ?? null} projectId={issue.project_detail.id ?? null}
value={issue.estimate_point} value={issue.estimate_point}
onChange={(data) => onChange({ estimate_point: data })} onChange={(data) => onChange({ estimate_point: data })}
className="h-full w-full"
buttonClassName="h-full w-full px-2.5 py-1 !shadow-none !border-0"
hideDropdownArrow hideDropdownArrow
disabled={disabled} disabled={disabled}
/> />

View File

@ -28,8 +28,9 @@ export const SpreadsheetLabelColumn: React.FC<Props> = (props) => {
projectId={issue.project_detail.id ?? null} projectId={issue.project_detail.id ?? null}
value={issue.labels} value={issue.labels}
onChange={(data) => onChange({ labels: data })} onChange={(data) => onChange({ labels: data })}
className="h-full" className="h-full w-full"
buttonClassName="!border-0 !h-full !w-full !rounded-none" buttonClassName="!shadow-none !border-0 h-full w-full px-2.5 py-1 "
noLabelBorder
hideDropdownArrow hideDropdownArrow
maxRender={1} maxRender={1}
disabled={disabled} disabled={disabled}

View File

@ -24,8 +24,8 @@ export const SpreadsheetPriorityColumn: React.FC<Props> = ({ issue, onChange, ex
<PrioritySelect <PrioritySelect
value={issue.priority} value={issue.priority}
onChange={(data) => onChange({ priority: data })} onChange={(data) => onChange({ priority: data })}
className="h-full" className="h-full w-full"
buttonClassName="!border-0 !h-full !w-full !rounded-none px-4" buttonClassName="!shadow-none !border-0 h-full w-full px-2.5 py-1 "
showTitle showTitle
highlightUrgentPriority={false} highlightUrgentPriority={false}
hideDropdownArrow hideDropdownArrow

View File

@ -24,6 +24,8 @@ export const SpreadsheetStartDateColumn: React.FC<Props> = ({ issue, onChange, e
<ViewStartDateSelect <ViewStartDateSelect
issue={issue} issue={issue}
onChange={(val) => onChange({ start_date: val })} onChange={(val) => onChange({ start_date: val })}
className="!h-full !w-full max-w-full px-2.5 py-1 flex items-center"
buttonClassName="!h-full !w-full !shadow-none px-2.5"
noBorder noBorder
disabled={disabled} disabled={disabled}
/> />

View File

@ -28,7 +28,8 @@ export const SpreadsheetStateColumn: React.FC<Props> = (props) => {
projectId={issue.project_detail.id ?? null} projectId={issue.project_detail.id ?? null}
value={issue.state_detail} value={issue.state_detail}
onChange={(data) => onChange({ state: data.id, state_detail: data })} onChange={(data) => onChange({ state: data.id, state_detail: data })}
buttonClassName="!shadow-none !border-0" className="h-full w-full"
buttonClassName="!shadow-none !border-0 h-full w-full"
hideDropdownArrow hideDropdownArrow
disabled={disabled} disabled={disabled}
/> />

View File

@ -21,7 +21,9 @@ export const SpreadsheetUpdatedOnColumn: React.FC<Props> = (props) => {
return ( return (
<> <>
<div className="text-xs">{renderLongDetailDateFormat(issue.updated_at)}</div> <div className="flex items-center justify-center text-xs h-full w-full">
{renderLongDetailDateFormat(issue.updated_at)}
</div>
{isExpanded && {isExpanded &&
!isLoading && !isLoading &&

View File

@ -12,6 +12,8 @@ type Props = {
handleOnOpen?: () => void; handleOnOpen?: () => void;
handleOnClose?: () => void; handleOnClose?: () => void;
tooltipPosition?: "top" | "bottom"; tooltipPosition?: "top" | "bottom";
className?: string;
buttonClassName?: string;
noBorder?: boolean; noBorder?: boolean;
disabled: boolean; disabled: boolean;
}; };
@ -22,6 +24,8 @@ export const ViewDueDateSelect: React.FC<Props> = ({
handleOnOpen, handleOnOpen,
handleOnClose, handleOnClose,
tooltipPosition = "top", tooltipPosition = "top",
className = "",
buttonClassName = "",
noBorder = false, noBorder = false,
disabled, disabled,
}) => { }) => {
@ -35,7 +39,7 @@ export const ViewDueDateSelect: React.FC<Props> = ({
position={tooltipPosition} position={tooltipPosition}
> >
<div <div
className={`group flex-shrink-0 relative max-w-[6.5rem] ${ className={`group flex-shrink-0 relative max-w-[6.5rem] ${className} ${
issue.target_date === null issue.target_date === null
? "" ? ""
: issue.target_date < new Date().toISOString() : issue.target_date < new Date().toISOString()
@ -47,7 +51,7 @@ export const ViewDueDateSelect: React.FC<Props> = ({
placeholder="Due date" placeholder="Due date"
value={issue?.target_date} value={issue?.target_date}
onChange={onChange} onChange={onChange}
className={`bg-transparent ${issue?.target_date ? "w-[6.5rem]" : "w-[5rem] text-center"}`} className={`bg-transparent ${issue?.target_date ? "w-[6.5rem]" : "w-[5rem] text-center"} ${buttonClassName}`}
minDate={minDate ?? undefined} minDate={minDate ?? undefined}
noBorder={noBorder} noBorder={noBorder}
handleOnOpen={handleOnOpen} handleOnOpen={handleOnOpen}

View File

@ -12,6 +12,8 @@ type Props = {
handleOnOpen?: () => void; handleOnOpen?: () => void;
handleOnClose?: () => void; handleOnClose?: () => void;
tooltipPosition?: "top" | "bottom"; tooltipPosition?: "top" | "bottom";
className?: string;
buttonClassName?: string;
noBorder?: boolean; noBorder?: boolean;
disabled: boolean; disabled: boolean;
}; };
@ -22,6 +24,8 @@ export const ViewStartDateSelect: React.FC<Props> = ({
handleOnOpen, handleOnOpen,
handleOnClose, handleOnClose,
tooltipPosition = "top", tooltipPosition = "top",
className = "",
buttonClassName = "",
noBorder = false, noBorder = false,
disabled, disabled,
}) => { }) => {
@ -34,12 +38,12 @@ export const ViewStartDateSelect: React.FC<Props> = ({
tooltipContent={issue.start_date ? renderShortDateWithYearFormat(issue.start_date) ?? "N/A" : "N/A"} tooltipContent={issue.start_date ? renderShortDateWithYearFormat(issue.start_date) ?? "N/A" : "N/A"}
position={tooltipPosition} position={tooltipPosition}
> >
<div className="group flex-shrink-0 relative max-w-[6.5rem]"> <div className={`group flex-shrink-0 relative max-w-[6.5rem] ${className}`}>
<CustomDatePicker <CustomDatePicker
placeholder="Start date" placeholder="Start date"
value={issue?.start_date} value={issue?.start_date}
onChange={onChange} onChange={onChange}
className={`bg-inherit ${issue?.start_date ? "w-[6.5rem]" : "w-[5rem] text-center"}`} className={`bg-inherit ${issue?.start_date ? "w-[6.5rem]" : "w-[5rem] text-center"} ${buttonClassName}`}
maxDate={maxDate ?? undefined} maxDate={maxDate ?? undefined}
noBorder={noBorder} noBorder={noBorder}
handleOnOpen={handleOnOpen} handleOnOpen={handleOnOpen}