Compare commits

...

4 Commits

Author SHA1 Message Date
Aaryan Khandelwal
fa7a982133 dev: implement spreadsheet navigation using cmdk 2023-10-18 18:43:32 +05:30
Aaryan Khandelwal
54c7246ad3 fix: unique key for each cell 2023-10-18 18:41:36 +05:30
Aaryan Khandelwal
f82b876379 refactor: spreadsheet layout components 2023-10-18 18:39:57 +05:30
Aaryan Khandelwal
2ae71b76c5 refactor: spreadsheet column components 2023-10-18 16:19:46 +05:30
37 changed files with 203 additions and 433 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

@ -63,7 +63,7 @@ export const IssueColumn: React.FC<Props> = ({
const paddingLeft = `${nestingLevel * 54}px`; const paddingLeft = `${nestingLevel * 54}px`;
return ( return (
<div className="group flex items-center w-[28rem] text-sm h-11 sticky top-0 bg-custom-background-100 truncate border-b border-r border-custom-border-100"> <div className="group flex items-center w-[28rem] text-sm h-11 sticky top-0 bg-custom-background-100 truncate border-b border-custom-border-100">
{properties.key && ( {properties.key && (
<div <div
className="flex gap-1.5 px-4 pr-0 py-2.5 items-center min-w-[96px]" className="flex gap-1.5 px-4 pr-0 py-2.5 items-center min-w-[96px]"

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

@ -7,6 +7,7 @@ import {
ListFilter, ListFilter,
MoveRight, MoveRight,
} from "lucide-react"; } from "lucide-react";
import { Command } from "cmdk";
// hooks // hooks
import useLocalStorage from "hooks/use-local-storage"; import useLocalStorage from "hooks/use-local-storage";
// components // components
@ -165,22 +166,23 @@ 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) => { {issues?.map((issue) => (
if (property === "state") <Command.Item
return ( key={`${property}-${issue.id}`}
value={`${property}-${issue.id}`}
className="h-11 flex items-center px-4 py-2.5 border-b-[0.5px] border-custom-border-200"
>
{property === "state" ? (
<SpreadsheetStateColumn <SpreadsheetStateColumn
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)}
states={states} states={states}
/> />
); ) : property === "priority" ? (
if (property === "priority")
return (
<SpreadsheetPriorityColumn <SpreadsheetPriorityColumn
key={`${property}-${issue.id}`} key={`${property}-${issue.id}`}
disabled={disableUserActions} disabled={disableUserActions}
@ -188,10 +190,7 @@ export const SpreadsheetColumn: React.FC<Props> = (props) => {
issue={issue} issue={issue}
onChange={(data: Partial<IIssue>) => handleUpdateIssue(issue, data)} onChange={(data: Partial<IIssue>) => handleUpdateIssue(issue, data)}
/> />
); ) : property === "estimate" ? (
if (property === "estimate")
return (
<SpreadsheetEstimateColumn <SpreadsheetEstimateColumn
key={`${property}-${issue.id}`} key={`${property}-${issue.id}`}
disabled={disableUserActions} disabled={disableUserActions}
@ -199,9 +198,7 @@ export const SpreadsheetColumn: React.FC<Props> = (props) => {
issue={issue} issue={issue}
onChange={(data: Partial<IIssue>) => handleUpdateIssue(issue, data)} onChange={(data: Partial<IIssue>) => handleUpdateIssue(issue, data)}
/> />
); ) : property === "assignee" ? (
if (property === "assignee")
return (
<SpreadsheetAssigneeColumn <SpreadsheetAssigneeColumn
key={`${property}-${issue.id}`} key={`${property}-${issue.id}`}
disabled={disableUserActions} disabled={disableUserActions}
@ -210,9 +207,7 @@ export const SpreadsheetColumn: React.FC<Props> = (props) => {
members={members} members={members}
onChange={(data: Partial<IIssue>) => handleUpdateIssue(issue, data)} onChange={(data: Partial<IIssue>) => handleUpdateIssue(issue, data)}
/> />
); ) : property === "labels" ? (
if (property === "labels")
return (
<SpreadsheetLabelColumn <SpreadsheetLabelColumn
key={`${property}-${issue.id}`} key={`${property}-${issue.id}`}
disabled={disableUserActions} disabled={disableUserActions}
@ -221,9 +216,7 @@ export const SpreadsheetColumn: React.FC<Props> = (props) => {
labels={labels} labels={labels}
onChange={(data: Partial<IIssue>) => handleUpdateIssue(issue, data)} onChange={(data: Partial<IIssue>) => handleUpdateIssue(issue, data)}
/> />
); ) : property === "start_date" ? (
if (property === "start_date")
return (
<SpreadsheetStartDateColumn <SpreadsheetStartDateColumn
key={`${property}-${issue.id}`} key={`${property}-${issue.id}`}
disabled={disableUserActions} disabled={disableUserActions}
@ -231,9 +224,7 @@ export const SpreadsheetColumn: React.FC<Props> = (props) => {
issue={issue} issue={issue}
onChange={(data: Partial<IIssue>) => handleUpdateIssue(issue, data)} onChange={(data: Partial<IIssue>) => handleUpdateIssue(issue, data)}
/> />
); ) : property === "due_date" ? (
if (property === "due_date")
return (
<SpreadsheetDueDateColumn <SpreadsheetDueDateColumn
key={`${property}-${issue.id}`} key={`${property}-${issue.id}`}
disabled={disableUserActions} disabled={disableUserActions}
@ -241,26 +232,21 @@ export const SpreadsheetColumn: React.FC<Props> = (props) => {
issue={issue} issue={issue}
onChange={(data: Partial<IIssue>) => handleUpdateIssue(issue, data)} onChange={(data: Partial<IIssue>) => handleUpdateIssue(issue, data)}
/> />
); ) : property === "created_on" ? (
if (property === "created_on")
return (
<SpreadsheetCreatedOnColumn <SpreadsheetCreatedOnColumn
key={`${property}-${issue.id}`} key={`${property}-${issue.id}`}
expandedIssues={expandedIssues} expandedIssues={expandedIssues}
issue={issue} issue={issue}
/> />
); ) : property === "updated_on" ? (
if (property === "updated_on")
return (
<SpreadsheetUpdatedOnColumn <SpreadsheetUpdatedOnColumn
key={`${property}-${issue.id}`} key={`${property}-${issue.id}`}
expandedIssues={expandedIssues} expandedIssues={expandedIssues}
issue={issue} issue={issue}
/> />
); ) : null}
</Command.Item>
return null; ))}
})}
</div> </div>
</div> </div>
); );

View File

@ -2,6 +2,7 @@ import React, { useEffect, useRef, useState } from "react";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { PlusIcon } from "lucide-react"; import { PlusIcon } from "lucide-react";
import { Command } from "cmdk";
// components // components
import { import {
SpreadsheetColumnsList, SpreadsheetColumnsList,
@ -80,64 +81,74 @@ export const SpreadsheetView: React.FC<Props> = observer((props) => {
}, []); }, []);
return ( return (
<> <Command onKeyDown={(e) => console.log(e)}>
<div className="relative flex h-full w-full rounded-lg text-custom-text-200 overflow-x-auto whitespace-nowrap bg-custom-background-200"> <Command.Input
<div className="h-full w-full flex flex-col"> className="w-full border-0 border-b border-custom-border-200 bg-transparent p-4 pl-11 text-custom-text-100 placeholder:text-custom-text-400 outline-none focus:ring-0 text-sm"
<div ref={containerRef} className="flex max-h-full h-full overflow-y-auto"> placeholder="Enter"
{issues ? ( autoFocus
<> tabIndex={1}
<div className="sticky left-0 w-[28rem] z-[2]"> />
<div <Command.List>
className="relative flex flex-col h-max w-full bg-custom-background-100 z-[2]" <div className="relative flex h-full w-full rounded-lg text-custom-text-200 overflow-x-auto whitespace-nowrap bg-custom-background-200">
style={{ <div className="h-full w-full flex flex-col">
boxShadow: isScrolled ? "8px -9px 12px rgba(0, 0, 0, 0.05)" : "", <div
}} ref={containerRef}
> className="flex max-h-full h-full overflow-y-auto divide-x-[0.5px] divide-custom-border-200"
<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 && ( {issues ? (
<span className="flex items-center px-4 py-2.5 h-full w-24 flex-shrink-0">ID</span> <>
)} <div className="sticky left-0 w-[28rem] z-[2]">
<span className="flex items-center px-4 py-2.5 h-full w-full flex-grow">Issue</span> <div
className="relative flex flex-col h-max w-full bg-custom-background-100 z-[2]"
style={{
boxShadow: isScrolled ? "8px -9px 12px rgba(0, 0, 0, 0.05)" : "",
}}
>
<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 +156,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;
} }