refactor: spreadsheet column components

This commit is contained in:
Aaryan Khandelwal 2023-10-18 16:19:46 +05:30
parent b4f32ced43
commit 2ae71b76c5
37 changed files with 259 additions and 492 deletions

View File

@ -1,32 +0,0 @@
import React from "react";
// components
import { MembersSelect } from "components/project";
// types
import { IIssue, IUserLite } from "types";
type Props = {
issue: IIssue;
onChange: (members: string[]) => void;
members: IUserLite[] | undefined;
disabled: boolean;
};
export const AssigneeColumn: React.FC<Props> = (props) => {
const { issue, onChange, members, disabled } = props;
return (
<div className="flex items-center text-sm h-11 w-full bg-custom-background-100">
<span className="flex items-center px-4 py-2.5 h-full w-full flex-shrink-0 border-r border-b border-custom-border-100">
<MembersSelect
value={issue.assignees}
onChange={onChange}
members={members ?? []}
buttonClassName="!p-0 !rounded-none !shadow-none !border-0"
hideDropdownArrow
disabled={disabled}
multiple
/>
</span>
</div>
);
};

View File

@ -1,2 +0,0 @@
export * from "./spreadsheet-assignee-column";
export * from "./assignee-column";

View File

@ -1,7 +1,7 @@
import React from "react"; import React from "react";
// components // components
import { AssigneeColumn } from "components/issues"; import { MembersSelect } from "components/project";
// hooks // hooks
import useSubIssue from "hooks/use-sub-issue"; import useSubIssue from "hooks/use-sub-issue";
// types // types
@ -21,12 +21,15 @@ export const SpreadsheetAssigneeColumn: React.FC<Props> = ({ issue, members, onC
const { subIssues, isLoading } = useSubIssue(issue.project_detail.id, issue.id, isExpanded); const { subIssues, isLoading } = useSubIssue(issue.project_detail.id, issue.id, isExpanded);
return ( return (
<div> <>
<AssigneeColumn <MembersSelect
issue={issue} value={issue.assignees}
members={members}
onChange={(data) => onChange({ assignees_list: data })} onChange={(data) => onChange({ assignees_list: data })}
members={members ?? []}
buttonClassName="!p-0 !rounded-none !shadow-none !border-0"
hideDropdownArrow
disabled={disabled} disabled={disabled}
multiple
/> />
{isExpanded && {isExpanded &&
@ -43,6 +46,6 @@ export const SpreadsheetAssigneeColumn: React.FC<Props> = ({ issue, members, onC
disabled={disabled} disabled={disabled}
/> />
))} ))}
</div> </>
); );
}; };

View File

@ -1,9 +1,9 @@
import React from "react"; import React from "react";
// components
import { CreatedOnColumn } from "components/issues";
// hooks // hooks
import useSubIssue from "hooks/use-sub-issue"; import useSubIssue from "hooks/use-sub-issue";
// helpers
import { renderLongDetailDateFormat } from "helpers/date-time.helper";
// types // types
import { IIssue } from "types"; import { IIssue } from "types";
@ -18,8 +18,8 @@ export const SpreadsheetCreatedOnColumn: React.FC<Props> = ({ issue, expandedIss
const { subIssues, isLoading } = useSubIssue(issue.project_detail.id, issue.id, isExpanded); const { subIssues, isLoading } = useSubIssue(issue.project_detail.id, issue.id, isExpanded);
return ( return (
<div> <>
<CreatedOnColumn issue={issue} /> {renderLongDetailDateFormat(issue.created_at)}
{isExpanded && {isExpanded &&
!isLoading && !isLoading &&
@ -28,6 +28,6 @@ export const SpreadsheetCreatedOnColumn: React.FC<Props> = ({ issue, expandedIss
subIssues.map((subIssue: IIssue) => ( subIssues.map((subIssue: IIssue) => (
<SpreadsheetCreatedOnColumn key={subIssue.id} issue={subIssue} expandedIssues={expandedIssues} /> <SpreadsheetCreatedOnColumn key={subIssue.id} issue={subIssue} expandedIssues={expandedIssues} />
))} ))}
</div> </>
); );
}; };

View File

@ -1,7 +1,7 @@
import React from "react"; import React from "react";
// components // components
import { DueDateColumn } from "components/issues"; import { ViewDueDateSelect } from "components/issues";
// hooks // hooks
import useSubIssue from "hooks/use-sub-issue"; import useSubIssue from "hooks/use-sub-issue";
// types // types
@ -20,8 +20,13 @@ export const SpreadsheetDueDateColumn: React.FC<Props> = ({ issue, onChange, exp
const { subIssues, isLoading } = useSubIssue(issue.project_detail.id, issue.id, isExpanded); const { subIssues, isLoading } = useSubIssue(issue.project_detail.id, issue.id, isExpanded);
return ( return (
<div> <>
<DueDateColumn issue={issue} onChange={(val) => onChange({ target_date: val })} disabled={disabled} /> <ViewDueDateSelect
issue={issue}
onChange={(val) => onChange({ target_date: val })}
noBorder
disabled={disabled}
/>
{isExpanded && {isExpanded &&
!isLoading && !isLoading &&
@ -36,6 +41,6 @@ export const SpreadsheetDueDateColumn: React.FC<Props> = ({ issue, onChange, exp
disabled={disabled} disabled={disabled}
/> />
))} ))}
</div> </>
); );
}; };

View File

@ -1,5 +1,5 @@
// components // components
import { EstimateColumn } from "components/issues"; import { ViewEstimateSelect } from "components/issues";
// hooks // hooks
import useSubIssue from "hooks/use-sub-issue"; import useSubIssue from "hooks/use-sub-issue";
// types // types
@ -20,8 +20,8 @@ export const SpreadsheetEstimateColumn: React.FC<Props> = (props) => {
const { subIssues, isLoading } = useSubIssue(issue.project_detail.id, issue.id, isExpanded); const { subIssues, isLoading } = useSubIssue(issue.project_detail.id, issue.id, isExpanded);
return ( return (
<div> <>
<EstimateColumn issue={issue} onChange={(data) => onChange({ estimate_point: data })} disabled={disabled} /> <ViewEstimateSelect issue={issue} onChange={(data) => onChange({ estimate_point: data })} disabled={disabled} />
{isExpanded && {isExpanded &&
!isLoading && !isLoading &&
@ -36,6 +36,6 @@ export const SpreadsheetEstimateColumn: React.FC<Props> = (props) => {
disabled={disabled} disabled={disabled}
/> />
))} ))}
</div> </>
); );
}; };

View File

@ -0,0 +1,11 @@
export * from "./issue";
export * from "./assignee-column";
export * from "./columns-list";
export * from "./created-on-column";
export * from "./due-date-column";
export * from "./estimate-column";
export * from "./label-column";
export * from "./priority-column";
export * from "./start-date-column";
export * from "./state-column";
export * from "./updated-on-column";

View File

@ -1,7 +1,7 @@
import React from "react"; import React from "react";
// components // components
import { LabelColumn } from "components/issues"; import { LabelSelect } from "components/project";
// hooks // hooks
import useSubIssue from "hooks/use-sub-issue"; import useSubIssue from "hooks/use-sub-issue";
// types // types
@ -23,11 +23,13 @@ export const SpreadsheetLabelColumn: React.FC<Props> = (props) => {
const { subIssues, isLoading } = useSubIssue(issue.project_detail.id, issue.id, isExpanded); const { subIssues, isLoading } = useSubIssue(issue.project_detail.id, issue.id, isExpanded);
return ( return (
<div> <>
<LabelColumn <LabelSelect
issue={issue} value={issue.labels}
onChange={(data) => onChange({ labels_list: data })} onChange={(data) => onChange({ labels_list: data })}
labels={labels} labels={labels ?? []}
hideDropdownArrow
maxRender={1}
disabled={disabled} disabled={disabled}
/> />
@ -45,6 +47,6 @@ export const SpreadsheetLabelColumn: React.FC<Props> = (props) => {
disabled={disabled} disabled={disabled}
/> />
))} ))}
</div> </>
); );
}; };

View File

@ -1,7 +1,7 @@
import React from "react"; import React from "react";
// components // components
import { PriorityColumn } from "components/issues"; import { PrioritySelect } from "components/project";
// hooks // hooks
import useSubIssue from "hooks/use-sub-issue"; import useSubIssue from "hooks/use-sub-issue";
// types // types
@ -21,7 +21,13 @@ export const SpreadsheetPriorityColumn: React.FC<Props> = ({ issue, onChange, ex
return ( return (
<div> <div>
<PriorityColumn issue={issue} onChange={(data) => onChange({ priority: data })} disabled={disabled} /> <PrioritySelect
value={issue.priority}
onChange={(data) => onChange({ priority: data })}
buttonClassName="!p-0 !rounded-none !shadow-none !border-0"
hideDropdownArrow
disabled={disabled}
/>
{isExpanded && {isExpanded &&
!isLoading && !isLoading &&

View File

@ -1,7 +1,7 @@
import React from "react"; import React from "react";
// components // components
import { StartDateColumn } from "components/issues"; import { ViewStartDateSelect } from "components/issues";
// hooks // hooks
import useSubIssue from "hooks/use-sub-issue"; import useSubIssue from "hooks/use-sub-issue";
// types // types
@ -20,8 +20,13 @@ export const SpreadsheetStartDateColumn: React.FC<Props> = ({ issue, onChange, e
const { subIssues, isLoading } = useSubIssue(issue.project_detail.id, issue.id, isExpanded); const { subIssues, isLoading } = useSubIssue(issue.project_detail.id, issue.id, isExpanded);
return ( return (
<div> <>
<StartDateColumn issue={issue} onChange={(val) => onChange({ start_date: val })} disabled={disabled} /> <ViewStartDateSelect
issue={issue}
onChange={(val) => onChange({ start_date: val })}
noBorder
disabled={disabled}
/>
{isExpanded && {isExpanded &&
!isLoading && !isLoading &&
@ -36,6 +41,6 @@ export const SpreadsheetStartDateColumn: React.FC<Props> = ({ issue, onChange, e
disabled={disabled} disabled={disabled}
/> />
))} ))}
</div> </>
); );
}; };

View File

@ -1,7 +1,7 @@
import React from "react"; import React from "react";
// components // components
import { StateColumn } from "components/issues"; import { StateSelect } from "components/states";
// hooks // hooks
import useSubIssue from "hooks/use-sub-issue"; import useSubIssue from "hooks/use-sub-issue";
// types // types
@ -23,11 +23,13 @@ export const SpreadsheetStateColumn: React.FC<Props> = (props) => {
const { subIssues, isLoading } = useSubIssue(issue.project_detail.id, issue.id, isExpanded); const { subIssues, isLoading } = useSubIssue(issue.project_detail.id, issue.id, isExpanded);
return ( return (
<div> <>
<StateColumn <StateSelect
issue={issue} value={issue.state_detail}
onChange={(data) => onChange({ state: data.id, state_detail: data })} onChange={(data) => onChange({ state: data.id, state_detail: data })}
states={states} stateGroups={states}
buttonClassName="!shadow-none !border-0"
hideDropdownArrow
disabled={disabled} disabled={disabled}
/> />
@ -45,6 +47,6 @@ export const SpreadsheetStateColumn: React.FC<Props> = (props) => {
disabled={disabled} disabled={disabled}
/> />
))} ))}
</div> </>
); );
}; };

View File

@ -1,9 +1,9 @@
import React from "react"; import React from "react";
// components
import { UpdatedOnColumn } from "components/issues";
// hooks // hooks
import useSubIssue from "hooks/use-sub-issue"; import useSubIssue from "hooks/use-sub-issue";
// helpers
import { renderLongDetailDateFormat } from "helpers/date-time.helper";
// types // types
import { IIssue } from "types"; import { IIssue } from "types";
@ -20,8 +20,8 @@ export const SpreadsheetUpdatedOnColumn: React.FC<Props> = (props) => {
const { subIssues, isLoading } = useSubIssue(issue.project_detail.id, issue.id, isExpanded); const { subIssues, isLoading } = useSubIssue(issue.project_detail.id, issue.id, isExpanded);
return ( return (
<div> <>
<UpdatedOnColumn issue={issue} /> {renderLongDetailDateFormat(issue.updated_at)}
{isExpanded && {isExpanded &&
!isLoading && !isLoading &&
@ -30,6 +30,6 @@ export const SpreadsheetUpdatedOnColumn: React.FC<Props> = (props) => {
subIssues.map((subIssue: IIssue) => ( subIssues.map((subIssue: IIssue) => (
<SpreadsheetUpdatedOnColumn key={subIssue.id} issue={subIssue} expandedIssues={expandedIssues} /> <SpreadsheetUpdatedOnColumn key={subIssue.id} issue={subIssue} expandedIssues={expandedIssues} />
))} ))}
</div> </>
); );
}; };

View File

@ -1,20 +0,0 @@
import React from "react";
// types
import { IIssue } from "types";
// helper
import { renderLongDetailDateFormat } from "helpers/date-time.helper";
type Props = {
issue: IIssue;
};
export const CreatedOnColumn: React.FC<Props> = ({ issue }) => (
<div className="flex items-center text-sm h-11 w-full bg-custom-background-100">
<span className="flex items-center px-4 py-2.5 h-full w-full flex-shrink-0 border-r border-b border-custom-border-100">
<div className="flex items-center text-xs cursor-default text-custom-text-200 text-center p-2 group-hover:bg-custom-background-80 border-custom-border-200">
{renderLongDetailDateFormat(issue.created_at)}
</div>
</span>
</div>
);

View File

@ -1,2 +0,0 @@
export * from "./spreadsheet-created-on-column";
export * from "./created-on-column";

View File

@ -1,23 +0,0 @@
import { FC } from "react";
// components
import { ViewDueDateSelect } from "components/issues";
// types
import { IIssue } from "types";
type Props = {
issue: IIssue;
onChange: (date: string | null) => void;
disabled: boolean;
};
export const DueDateColumn: FC<Props> = (props) => {
const { issue, onChange, disabled } = props;
return (
<div className="flex items-center text-sm h-11 w-full bg-custom-background-100">
<span className="flex items-center px-4 py-2.5 h-full w-full flex-shrink-0 border-r border-b border-custom-border-100">
<ViewDueDateSelect issue={issue} onChange={onChange} noBorder disabled={disabled} />
</span>
</div>
);
};

View File

@ -1,2 +0,0 @@
export * from "./spreadsheet-due-date-column";
export * from "./due-date-column";

View File

@ -1,23 +0,0 @@
import { FC } from "react";
// components
import { ViewEstimateSelect } from "components/issues";
// types
import { IIssue } from "types";
type Props = {
issue: IIssue;
onChange: (data: number) => void;
disabled: boolean;
};
export const EstimateColumn: FC<Props> = (props) => {
const { issue, onChange, disabled } = props;
return (
<div className="flex items-center text-sm h-11 w-full bg-custom-background-100">
<span className="flex items-center px-4 py-2.5 h-full w-full flex-shrink-0 border-r border-b border-custom-border-100">
<ViewEstimateSelect issue={issue} onChange={onChange} disabled={disabled} />
</span>
</div>
);
};

View File

@ -1,2 +0,0 @@
export * from "./spreadsheet-estimate-column";
export * from "./estimate-column";

View File

@ -1,15 +1,4 @@
export * from "./assignee-column"; export * from "./columns";
export * from "./created-on-column";
export * from "./due-date-column";
export * from "./estimate-column";
export * from "./issue-column";
export * from "./label-column";
export * from "./priority-column";
export * from "./roots"; export * from "./roots";
export * from "./start-date-column";
export * from "./state-column";
export * from "./updated-on-column";
export * from "./issue-column";
export * from "./spreadsheet-column"; export * from "./spreadsheet-column";
export * from "./spreadsheet-columns-list";
export * from "./spreadsheet-view"; export * from "./spreadsheet-view";

View File

@ -1,2 +0,0 @@
export * from "./spreadsheet-label-column";
export * from "./label-column";

View File

@ -1,32 +0,0 @@
import React from "react";
// components
import { LabelSelect } from "components/project";
// types
import { IIssue, IIssueLabels } from "types";
type Props = {
issue: IIssue;
onChange: (data: string[]) => void;
labels: IIssueLabels[] | undefined;
disabled: boolean;
};
export const LabelColumn: React.FC<Props> = (props) => {
const { issue, onChange, labels, disabled } = props;
return (
<div className="flex items-center text-sm h-11 w-full bg-custom-background-100">
<span className="flex items-center px-4 py-2.5 h-full w-full flex-shrink-0 border-r border-b border-custom-border-100">
<LabelSelect
value={issue.labels}
onChange={onChange}
labels={labels ?? []}
hideDropdownArrow
maxRender={1}
disabled={disabled}
/>
</span>
</div>
);
};

View File

@ -1,2 +0,0 @@
export * from "./spreadsheet-priority-column";
export * from "./priority-column";

View File

@ -1,28 +0,0 @@
// components
import { PrioritySelect } from "components/project";
// types
import { IIssue, TIssuePriorities } from "types";
type Props = {
issue: IIssue;
onChange: (data: TIssuePriorities) => void;
disabled: boolean;
};
export const PriorityColumn: React.FC<Props> = (props) => {
const { issue, onChange, disabled } = props;
return (
<div className="flex items-center text-sm h-11 w-full bg-custom-background-100">
<span className="flex items-center px-4 py-2.5 h-full w-full flex-shrink-0 border-r border-b border-custom-border-100">
<PrioritySelect
value={issue.priority}
onChange={onChange}
buttonClassName="!p-0 !rounded-none !shadow-none !border-0"
hideDropdownArrow
disabled={disabled}
/>
</span>
</div>
);
};

View File

@ -34,6 +34,7 @@ import {
} from "types"; } from "types";
// constants // constants
import { SPREADSHEET_PROPERTY_DETAILS } from "constants/spreadsheet"; import { SPREADSHEET_PROPERTY_DETAILS } from "constants/spreadsheet";
import { Command } from "cmdk";
type Props = { type Props = {
disableUserActions: boolean; disableUserActions: boolean;
@ -166,101 +167,89 @@ export const SpreadsheetColumn: React.FC<Props> = (props) => {
</CustomMenu> </CustomMenu>
</div> </div>
<div className="h-full min-w-[8rem] w-full"> <div className="h-full min-w-[8rem] w-full">
{issues?.map((issue) => { <Command.Group>
if (property === "state") <>
return ( {issues?.map((issue) => (
<SpreadsheetStateColumn <Command.Item
key={`${property}-${issue.id}`} key={`${property}-${issue.id}`}
disabled={disableUserActions} value={`${property}-${issue.id}`}
expandedIssues={expandedIssues} className="h-11 flex items-center px-4 py-2.5 border-b-[0.5px] border-custom-border-200"
issue={issue} >
onChange={(data: Partial<IIssue>) => handleUpdateIssue(issue, data)} {property === "state" ? (
states={states} <SpreadsheetStateColumn
/> disabled={disableUserActions}
); expandedIssues={expandedIssues}
issue={issue}
if (property === "priority") onChange={(data: Partial<IIssue>) => handleUpdateIssue(issue, data)}
return ( states={states}
<SpreadsheetPriorityColumn />
key={`${property}-${issue.id}`} ) : property === "priority" ? (
disabled={disableUserActions} <SpreadsheetPriorityColumn
expandedIssues={expandedIssues} key={`${property}-${issue.id}`}
issue={issue} disabled={disableUserActions}
onChange={(data: Partial<IIssue>) => handleUpdateIssue(issue, data)} expandedIssues={expandedIssues}
/> issue={issue}
); onChange={(data: Partial<IIssue>) => handleUpdateIssue(issue, data)}
/>
if (property === "estimate") ) : property === "estimate" ? (
return ( <SpreadsheetEstimateColumn
<SpreadsheetEstimateColumn key={`${property}-${issue.id}`}
key={`${property}-${issue.id}`} disabled={disableUserActions}
disabled={disableUserActions} expandedIssues={expandedIssues}
expandedIssues={expandedIssues} issue={issue}
issue={issue} onChange={(data: Partial<IIssue>) => handleUpdateIssue(issue, data)}
onChange={(data: Partial<IIssue>) => handleUpdateIssue(issue, data)} />
/> ) : property === "assignee" ? (
); <SpreadsheetAssigneeColumn
if (property === "assignee") key={`${property}-${issue.id}`}
return ( disabled={disableUserActions}
<SpreadsheetAssigneeColumn expandedIssues={expandedIssues}
key={`${property}-${issue.id}`} issue={issue}
disabled={disableUserActions} members={members}
expandedIssues={expandedIssues} onChange={(data: Partial<IIssue>) => handleUpdateIssue(issue, data)}
issue={issue} />
members={members} ) : property === "labels" ? (
onChange={(data: Partial<IIssue>) => handleUpdateIssue(issue, data)} <SpreadsheetLabelColumn
/> key={`${property}-${issue.id}`}
); disabled={disableUserActions}
if (property === "labels") expandedIssues={expandedIssues}
return ( issue={issue}
<SpreadsheetLabelColumn labels={labels}
key={`${property}-${issue.id}`} onChange={(data: Partial<IIssue>) => handleUpdateIssue(issue, data)}
disabled={disableUserActions} />
expandedIssues={expandedIssues} ) : property === "start_date" ? (
issue={issue} <SpreadsheetStartDateColumn
labels={labels} key={`${property}-${issue.id}`}
onChange={(data: Partial<IIssue>) => handleUpdateIssue(issue, data)} disabled={disableUserActions}
/> expandedIssues={expandedIssues}
); issue={issue}
if (property === "start_date") onChange={(data: Partial<IIssue>) => handleUpdateIssue(issue, data)}
return ( />
<SpreadsheetStartDateColumn ) : property === "due_date" ? (
key={`${property}-${issue.id}`} <SpreadsheetDueDateColumn
disabled={disableUserActions} key={`${property}-${issue.id}`}
expandedIssues={expandedIssues} disabled={disableUserActions}
issue={issue} expandedIssues={expandedIssues}
onChange={(data: Partial<IIssue>) => handleUpdateIssue(issue, data)} issue={issue}
/> onChange={(data: Partial<IIssue>) => handleUpdateIssue(issue, data)}
); />
if (property === "due_date") ) : property === "created_on" ? (
return ( <SpreadsheetCreatedOnColumn
<SpreadsheetDueDateColumn key={`${property}-${issue.id}`}
key={`${property}-${issue.id}`} expandedIssues={expandedIssues}
disabled={disableUserActions} issue={issue}
expandedIssues={expandedIssues} />
issue={issue} ) : property === "updated_on" ? (
onChange={(data: Partial<IIssue>) => handleUpdateIssue(issue, data)} <SpreadsheetUpdatedOnColumn
/> key={`${property}-${issue.id}`}
); expandedIssues={expandedIssues}
if (property === "created_on") issue={issue}
return ( />
<SpreadsheetCreatedOnColumn ) : null}
key={`${property}-${issue.id}`} </Command.Item>
expandedIssues={expandedIssues} ))}
issue={issue} </>
/> </Command.Group>
);
if (property === "updated_on")
return (
<SpreadsheetUpdatedOnColumn
key={`${property}-${issue.id}`}
expandedIssues={expandedIssues}
issue={issue}
/>
);
return null;
})}
</div> </div>
</div> </div>
); );

View File

@ -19,6 +19,7 @@ import {
IStateResponse, IStateResponse,
IUserLite, IUserLite,
} from "types"; } from "types";
import { Command } from "cmdk";
type Props = { type Props = {
displayProperties: IIssueDisplayProperties; displayProperties: IIssueDisplayProperties;
@ -80,64 +81,68 @@ export const SpreadsheetView: React.FC<Props> = observer((props) => {
}, []); }, []);
return ( return (
<> <Command>
<div className="relative flex h-full w-full rounded-lg text-custom-text-200 overflow-x-auto whitespace-nowrap bg-custom-background-200"> <Command.List>
<div className="h-full w-full flex flex-col"> <div className="relative flex h-full w-full rounded-lg text-custom-text-200 overflow-x-auto whitespace-nowrap bg-custom-background-200">
<div ref={containerRef} className="flex max-h-full h-full overflow-y-auto"> <div className="h-full w-full flex flex-col">
{issues ? ( <div
<> ref={containerRef}
<div className="sticky left-0 w-[28rem] z-[2]"> className="flex max-h-full h-full overflow-y-auto divide-x-[0.5px] divide-custom-border-200"
<div >
className="relative flex flex-col h-max w-full bg-custom-background-100 z-[2]" {issues ? (
style={{ <>
boxShadow: isScrolled ? "8px -9px 12px rgba(0, 0, 0, 0.05)" : "", <div className="sticky left-0 w-[28rem] z-[2]">
}} <div
> className="relative flex flex-col h-max w-full bg-custom-background-100 z-[2]"
<div className="flex items-center text-sm font-medium z-[2] h-11 w-full sticky top-0 bg-custom-background-90 border border-l-0 border-custom-border-100"> style={{
{displayProperties.key && ( boxShadow: isScrolled ? "8px -9px 12px rgba(0, 0, 0, 0.05)" : "",
<span className="flex items-center px-4 py-2.5 h-full w-24 flex-shrink-0">ID</span> }}
)} >
<span className="flex items-center px-4 py-2.5 h-full w-full flex-grow">Issue</span> <div className="flex items-center text-sm font-medium z-[2] h-11 w-full sticky top-0 bg-custom-background-90 border border-l-0 border-custom-border-100">
{displayProperties.key && (
<span className="flex items-center px-4 py-2.5 h-full w-24 flex-shrink-0">ID</span>
)}
<span className="flex items-center px-4 py-2.5 h-full w-full flex-grow">Issue</span>
</div>
{issues.map((issue: IIssue, index) => (
<SpreadsheetIssuesColumn
key={`${issue.id}_${index}`}
issue={issue}
projectId={issue.project_detail.id}
expandedIssues={expandedIssues}
setExpandedIssues={setExpandedIssues}
properties={displayProperties}
handleIssueAction={handleIssueAction}
disableUserActions={disableUserActions}
/>
))}
</div> </div>
{issues.map((issue: IIssue, index) => (
<SpreadsheetIssuesColumn
key={`${issue.id}_${index}`}
issue={issue}
projectId={issue.project_detail.id}
expandedIssues={expandedIssues}
setExpandedIssues={setExpandedIssues}
properties={displayProperties}
handleIssueAction={handleIssueAction}
disableUserActions={disableUserActions}
/>
))}
</div> </div>
<SpreadsheetColumnsList
displayFilters={displayFilters}
displayProperties={displayProperties}
disableUserActions={disableUserActions}
expandedIssues={expandedIssues}
handleDisplayFilterUpdate={handleDisplayFilterUpdate}
handleUpdateIssue={handleUpdateIssue}
issues={issues}
members={members}
labels={labels}
states={states}
/>
</>
) : (
<div className="grid place-items-center h-full w-full">
<Spinner />
</div> </div>
)}
</div>
<SpreadsheetColumnsList <div className="border-t border-custom-border-100">
displayFilters={displayFilters} <div className="mb-3 z-50 sticky bottom-0 left-0">
displayProperties={displayProperties} {/* <ListInlineCreateIssueForm
disableUserActions={disableUserActions}
expandedIssues={expandedIssues}
handleDisplayFilterUpdate={handleDisplayFilterUpdate}
handleUpdateIssue={handleUpdateIssue}
issues={issues}
members={members}
labels={labels}
states={states}
/>
</>
) : (
<div className="grid place-items-center h-full w-full">
<Spinner />
</div>
)}
</div>
<div className="border-t border-custom-border-100">
<div className="mb-3 z-50 sticky bottom-0 left-0">
{/* <ListInlineCreateIssueForm
isOpen={isInlineCreateIssueFormOpen} isOpen={isInlineCreateIssueFormOpen}
handleClose={() => setIsInlineCreateIssueFormOpen(false)} handleClose={() => setIsInlineCreateIssueFormOpen(false)}
prePopulatedData={{ prePopulatedData={{
@ -145,44 +150,45 @@ export const SpreadsheetView: React.FC<Props> = observer((props) => {
...(moduleId && { module: moduleId.toString() }), ...(moduleId && { module: moduleId.toString() }),
}} }}
/> */} /> */}
</div> </div>
{!disableUserActions && {!disableUserActions &&
!isInlineCreateIssueFormOpen && !isInlineCreateIssueFormOpen &&
(type === "issue" ? ( (type === "issue" ? (
<button <button
className="flex gap-1.5 items-center text-custom-primary-100 pl-4 py-2.5 text-sm sticky left-0 z-[1] w-full" className="flex gap-1.5 items-center text-custom-primary-100 pl-4 py-2.5 text-sm sticky left-0 z-[1] w-full"
onClick={() => setIsInlineCreateIssueFormOpen(true)} onClick={() => setIsInlineCreateIssueFormOpen(true)}
> >
<PlusIcon className="h-4 w-4" /> <PlusIcon className="h-4 w-4" />
New Issue New Issue
</button> </button>
) : ( ) : (
<CustomMenu <CustomMenu
className="sticky left-0 z-10" className="sticky left-0 z-10"
customButton={ customButton={
<button <button
className="flex gap-1.5 items-center text-custom-primary-100 pl-4 py-2.5 text-sm sticky left-0 z-[1] border-custom-border-200 w-full" className="flex gap-1.5 items-center text-custom-primary-100 pl-4 py-2.5 text-sm sticky left-0 z-[1] border-custom-border-200 w-full"
type="button" type="button"
> >
<PlusIcon className="h-4 w-4" /> <PlusIcon className="h-4 w-4" />
New Issue New Issue
</button> </button>
} }
optionsClassName="left-5 !w-36" optionsClassName="left-5 !w-36"
noBorder noBorder
> >
<CustomMenu.MenuItem onClick={() => setIsInlineCreateIssueFormOpen(true)}> <CustomMenu.MenuItem onClick={() => setIsInlineCreateIssueFormOpen(true)}>
Create new Create new
</CustomMenu.MenuItem> </CustomMenu.MenuItem>
{openIssuesListModal && ( {openIssuesListModal && (
<CustomMenu.MenuItem onClick={openIssuesListModal}>Add an existing issue</CustomMenu.MenuItem> <CustomMenu.MenuItem onClick={openIssuesListModal}>Add an existing issue</CustomMenu.MenuItem>
)} )}
</CustomMenu> </CustomMenu>
))} ))}
</div>
</div> </div>
</div> </div>
</div> </Command.List>
</> </Command>
); );
}); });

View File

@ -1,2 +0,0 @@
export * from "./spreadsheet-start-date-column";
export * from "./start-date-column";

View File

@ -1,22 +0,0 @@
import React from "react";
// components
import { ViewStartDateSelect } from "components/issues";
// types
import { IIssue } from "types";
type Props = {
issue: IIssue;
onChange: (data: string | null) => void;
disabled: boolean;
};
export const StartDateColumn: React.FC<Props> = (props) => {
const { issue, onChange, disabled } = props;
return (
<div className="flex items-center text-sm h-11 w-full bg-custom-background-100">
<span className="flex items-center px-4 py-2.5 h-full w-full flex-shrink-0 border-r border-b border-custom-border-100">
<ViewStartDateSelect issue={issue} onChange={onChange} noBorder disabled={disabled} />
</span>
</div>
);
};

View File

@ -1,2 +0,0 @@
export * from "./spreadsheet-state-column";
export * from "./state-column";

View File

@ -1,31 +0,0 @@
import React from "react";
// components
import { StateSelect } from "components/states";
// types
import { IIssue, IState, IStateResponse } from "types";
type Props = {
issue: IIssue;
onChange: (formData: IState) => void;
states: IStateResponse | undefined;
disabled: boolean;
};
export const StateColumn: React.FC<Props> = (props) => {
const { issue, onChange, states, disabled } = props;
return (
<div className="flex items-center text-sm h-11 w-full bg-custom-background-100">
<span className="flex items-center px-4 py-2.5 h-full w-full flex-shrink-0 border-r border-b border-custom-border-100">
<StateSelect
value={issue.state_detail}
onChange={onChange}
stateGroups={states}
buttonClassName="!shadow-none !border-0"
hideDropdownArrow
disabled={disabled}
/>
</span>
</div>
);
};

View File

@ -1,2 +0,0 @@
export * from "./spreadsheet-updated-on-column";
export * from "./updated-on-column";

View File

@ -1,22 +0,0 @@
// helpers
import { renderLongDetailDateFormat } from "helpers/date-time.helper";
// types
import { IIssue } from "types";
type Props = {
issue: IIssue;
};
export const UpdatedOnColumn: React.FC<Props> = (props) => {
const { issue } = props;
return (
<div className="flex items-center text-sm h-11 w-full bg-custom-background-100">
<span className="flex items-center px-4 py-2.5 h-full w-full flex-shrink-0 border-r border-b border-custom-border-100">
<div className="flex items-center text-xs cursor-default text-custom-text-200 text-center p-2 group-hover:bg-custom-background-80 border-custom-border-200">
{renderLongDetailDateFormat(issue.updated_at)}
</div>
</span>
</div>
);
};

View File

@ -39,7 +39,7 @@ export const ViewStartDateSelect: React.FC<Props> = ({
placeholder="Start date" placeholder="Start date"
value={issue?.start_date} value={issue?.start_date}
onChange={onChange} onChange={onChange}
className={`bg-transparent ${issue?.start_date ? "w-[6.5rem]" : "w-[5rem] text-center"}`} className={`bg-inherit ${issue?.start_date ? "w-[6.5rem]" : "w-[5rem] text-center"}`}
maxDate={maxDate ?? undefined} maxDate={maxDate ?? undefined}
noBorder={noBorder} noBorder={noBorder}
handleOnOpen={handleOnOpen} handleOnOpen={handleOnOpen}

View File

@ -9,13 +9,13 @@
} }
[cmdk-item] { [cmdk-item] {
display: flex; /* display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
border-radius: 0.375rem; border-radius: 0.375rem;
padding: 0.5rem; padding: 0.5rem;
font-size: 0.825rem; font-size: 0.825rem;
line-height: 1.25rem; line-height: 1.25rem; */
cursor: pointer; cursor: pointer;
} }