Merge branch 'develop' of github.com:makeplane/plane into feat/workspace_views

This commit is contained in:
Anmol Singh Bhatia 2023-09-25 12:40:03 +05:30
commit 3b8a8cdfa4
11 changed files with 45 additions and 21 deletions

View File

@ -134,6 +134,7 @@ export const SingleBoard: React.FC<Props> = ({
type={type}
index={index}
issue={issue}
projectId={issue.project_detail.id}
groupTitle={groupTitle}
editIssue={() => handleIssueAction(issue, "edit")}
makeIssueCopy={() => handleIssueAction(issue, "copy")}

View File

@ -56,6 +56,7 @@ type Props = {
provided: DraggableProvided;
snapshot: DraggableStateSnapshot;
issue: IIssue;
projectId: string;
groupTitle?: string;
index: number;
editIssue: () => void;
@ -77,6 +78,7 @@ export const SingleBoardIssue: React.FC<Props> = ({
provided,
snapshot,
issue,
projectId,
index,
editIssue,
makeIssueCopy,
@ -104,7 +106,7 @@ export const SingleBoardIssue: React.FC<Props> = ({
const { displayFilters, properties, mutateIssues } = viewProps;
const router = useRouter();
const { workspaceSlug, projectId, cycleId, moduleId } = router.query;
const { workspaceSlug, cycleId, moduleId } = router.query;
const isDraftIssue = router.pathname.includes("draft-issues");
@ -452,6 +454,7 @@ export const SingleBoardIssue: React.FC<Props> = ({
<StateSelect
value={issue.state_detail}
onChange={handleStateChange}
projectId={projectId}
hideDropdownArrow
disabled={isNotAllowed}
/>
@ -479,6 +482,7 @@ export const SingleBoardIssue: React.FC<Props> = ({
{properties.labels && issue.labels.length > 0 && (
<LabelSelect
value={issue.labels}
projectId={projectId}
onChange={handleLabelChange}
labelsDetails={issue.label_details}
hideDropdownArrow
@ -489,6 +493,7 @@ export const SingleBoardIssue: React.FC<Props> = ({
{properties.assignee && (
<MembersSelect
value={issue.assignees}
projectId={projectId}
onChange={handleAssigneeChange}
membersDetails={issue.assignee_details}
hideDropdownArrow

View File

@ -70,6 +70,7 @@ export const SingleCalendarDate: React.FC<Props> = ({
provided={provided}
snapshot={snapshot}
issue={issue}
projectId={issue.project_detail.id}
handleEditIssue={() => handleIssueAction(issue, "edit")}
handleDeleteIssue={() => handleIssueAction(issue, "delete")}
user={user}

View File

@ -41,6 +41,7 @@ type Props = {
provided: DraggableProvided;
snapshot: DraggableStateSnapshot;
issue: IIssue;
projectId: string;
user: ICurrentUserResponse | undefined;
isNotAllowed: boolean;
};
@ -52,11 +53,12 @@ export const SingleCalendarIssue: React.FC<Props> = ({
provided,
snapshot,
issue,
projectId,
user,
isNotAllowed,
}) => {
const router = useRouter();
const { workspaceSlug, projectId, cycleId, moduleId, viewId } = router.query;
const { workspaceSlug, cycleId, moduleId, viewId } = router.query;
const { setToastAlert } = useToast();
@ -310,6 +312,7 @@ export const SingleCalendarIssue: React.FC<Props> = ({
{properties.state && (
<StateSelect
value={issue.state_detail}
projectId={projectId}
onChange={handleStateChange}
hideDropdownArrow
disabled={isNotAllowed}
@ -334,6 +337,7 @@ export const SingleCalendarIssue: React.FC<Props> = ({
{properties.labels && issue.labels.length > 0 && (
<LabelSelect
value={issue.labels}
projectId={projectId}
onChange={handleLabelChange}
labelsDetails={issue.label_details}
hideDropdownArrow
@ -345,6 +349,7 @@ export const SingleCalendarIssue: React.FC<Props> = ({
{properties.assignee && (
<MembersSelect
value={issue.assignees}
projectId={projectId}
onChange={handleAssigneeChange}
membersDetails={issue.assignee_details}
hideDropdownArrow

View File

@ -51,6 +51,7 @@ import {
type Props = {
type?: string;
issue: IIssue;
projectId: string;
groupTitle?: string;
editIssue: () => void;
index: number;
@ -69,6 +70,7 @@ type Props = {
export const SingleListIssue: React.FC<Props> = ({
type,
issue,
projectId,
editIssue,
index,
makeIssueCopy,
@ -88,7 +90,7 @@ export const SingleListIssue: React.FC<Props> = ({
const [contextMenuPosition, setContextMenuPosition] = useState<React.MouseEvent | null>(null);
const router = useRouter();
const { workspaceSlug, projectId, cycleId, moduleId, userId } = router.query;
const { workspaceSlug, cycleId, moduleId, userId } = router.query;
const isArchivedIssues = router.pathname.includes("archived-issues");
const isDraftIssues = router.pathname?.split("/")?.[4] === "draft-issues";
@ -376,6 +378,7 @@ export const SingleListIssue: React.FC<Props> = ({
{properties.state && (
<StateSelect
value={issue.state_detail}
projectId={projectId}
onChange={handleStateChange}
hideDropdownArrow
disabled={isNotAllowed}
@ -400,6 +403,7 @@ export const SingleListIssue: React.FC<Props> = ({
{properties.labels && (
<LabelSelect
value={issue.labels}
projectId={projectId}
onChange={handleLabelChange}
labelsDetails={issue.label_details}
hideDropdownArrow
@ -411,6 +415,7 @@ export const SingleListIssue: React.FC<Props> = ({
{properties.assignee && (
<MembersSelect
value={issue.assignees}
projectId={projectId}
onChange={handleAssigneeChange}
membersDetails={issue.assignee_details}
hideDropdownArrow

View File

@ -250,6 +250,7 @@ export const SingleList: React.FC<Props> = ({
key={issue.id}
type={type}
issue={issue}
projectId={issue.project_detail.id}
groupTitle={groupTitle}
index={index}
editIssue={() => handleIssueAction(issue, "edit")}

View File

@ -49,6 +49,7 @@ import { renderLongDetailDateFormat } from "helpers/date-time.helper";
type Props = {
issue: IIssue;
projectId: string;
index: number;
expanded: boolean;
handleToggleExpand: (issueId: string) => void;
@ -64,6 +65,7 @@ type Props = {
export const SingleSpreadsheetIssue: React.FC<Props> = ({
issue,
projectId,
index,
expanded,
handleToggleExpand,
@ -80,7 +82,7 @@ export const SingleSpreadsheetIssue: React.FC<Props> = ({
const router = useRouter();
const { workspaceSlug, projectId, cycleId, moduleId, viewId } = router.query;
const { workspaceSlug, cycleId, moduleId, viewId } = router.query;
const { params } = useSpreadsheetIssuesView();
@ -96,7 +98,7 @@ export const SingleSpreadsheetIssue: React.FC<Props> = ({
? MODULE_ISSUES_WITH_PARAMS(moduleId.toString(), params)
: viewId
? VIEW_ISSUES(viewId.toString(), params)
: PROJECT_ISSUES_LIST_WITH_PARAMS(projectId.toString(), params);
: PROJECT_ISSUES_LIST_WITH_PARAMS(projectId, params);
if (issue.parent)
mutate<ISubIssueResponse>(
@ -136,13 +138,7 @@ export const SingleSpreadsheetIssue: React.FC<Props> = ({
);
issuesService
.patchIssue(
workspaceSlug as string,
projectId as string,
issue.id as string,
formData,
user
)
.patchIssue(workspaceSlug as string, projectId, issue.id as string, formData, user)
.then(() => {
if (issue.parent) {
mutate(SUB_ISSUES(issue.parent as string));
@ -368,6 +364,7 @@ export const SingleSpreadsheetIssue: React.FC<Props> = ({
<div className="flex items-center text-xs text-custom-text-200 text-center p-2 group-hover:bg-custom-background-80 border-custom-border-200">
<StateSelect
value={issue.state_detail}
projectId={projectId}
onChange={handleStateChange}
buttonClassName="!p-0 !rounded-none !shadow-none !border-0"
hideDropdownArrow
@ -390,6 +387,7 @@ export const SingleSpreadsheetIssue: React.FC<Props> = ({
<div className="flex items-center text-xs text-custom-text-200 text-center p-2 group-hover:bg-custom-background-80 border-custom-border-200">
<MembersSelect
value={issue.assignees}
projectId={projectId}
onChange={handleAssigneeChange}
membersDetails={issue.assignee_details}
buttonClassName="!p-0 !rounded-none !shadow-none !border-0"
@ -402,6 +400,7 @@ export const SingleSpreadsheetIssue: React.FC<Props> = ({
<div className="flex items-center text-xs text-custom-text-200 text-center p-2 group-hover:bg-custom-background-80 border-custom-border-200">
<LabelSelect
value={issue.labels}
projectId={projectId}
onChange={handleLabelChange}
labelsDetails={issue.label_details}
hideDropdownArrow

View File

@ -55,6 +55,7 @@ export const SpreadsheetIssues: React.FC<Props> = ({
<div>
<SingleSpreadsheetIssue
issue={issue}
projectId={issue.project_detail.id}
index={index}
expanded={isExpanded}
handleToggleExpand={handleToggleExpand}

View File

@ -24,6 +24,7 @@ import { PROJECT_ISSUE_LABELS } from "constants/fetch-keys";
type Props = {
value: string[];
projectId: string;
onChange: (data: any) => void;
labelsDetails: any[];
className?: string;
@ -37,6 +38,7 @@ type Props = {
export const LabelSelect: React.FC<Props> = ({
value,
projectId,
onChange,
labelsDetails,
className = "",
@ -54,15 +56,15 @@ export const LabelSelect: React.FC<Props> = ({
const [labelModal, setLabelModal] = useState(false);
const router = useRouter();
const { workspaceSlug, projectId } = router.query;
const { workspaceSlug } = router.query;
const dropdownBtn = useRef<any>(null);
const dropdownOptions = useRef<any>(null);
const { data: issueLabels } = useSWR<IIssueLabels[]>(
projectId && fetchStates ? PROJECT_ISSUE_LABELS(projectId.toString()) : null,
projectId && fetchStates ? PROJECT_ISSUE_LABELS(projectId) : null,
workspaceSlug && projectId && fetchStates
? () => issuesService.getIssueLabels(workspaceSlug as string, projectId as string)
? () => issuesService.getIssueLabels(workspaceSlug as string, projectId)
: null
);
@ -150,7 +152,7 @@ export const LabelSelect: React.FC<Props> = ({
<CreateLabelModal
isOpen={labelModal}
handleClose={() => setLabelModal(false)}
projectId={projectId.toString()}
projectId={projectId}
user={user}
/>
)}

View File

@ -18,6 +18,7 @@ import { IUser } from "types";
type Props = {
value: string | string[];
projectId: string;
onChange: (data: any) => void;
membersDetails: IUser[];
renderWorkspaceMembers?: boolean;
@ -30,6 +31,7 @@ type Props = {
export const MembersSelect: React.FC<Props> = ({
value,
projectId,
onChange,
membersDetails,
renderWorkspaceMembers = false,
@ -44,14 +46,14 @@ export const MembersSelect: React.FC<Props> = ({
const [fetchStates, setFetchStates] = useState(false);
const router = useRouter();
const { workspaceSlug, projectId } = router.query;
const { workspaceSlug } = router.query;
const dropdownBtn = useRef<any>(null);
const dropdownOptions = useRef<any>(null);
const { members } = useProjectMembers(
workspaceSlug?.toString(),
projectId?.toString(),
projectId,
fetchStates && !renderWorkspaceMembers
);

View File

@ -25,6 +25,7 @@ import { getStatesList } from "helpers/state.helper";
type Props = {
value: IState;
onChange: (data: any, states: IState[] | undefined) => void;
projectId: string;
className?: string;
buttonClassName?: string;
optionsClassName?: string;
@ -35,6 +36,7 @@ type Props = {
export const StateSelect: React.FC<Props> = ({
value,
onChange,
projectId,
className = "",
buttonClassName = "",
optionsClassName = "",
@ -50,12 +52,12 @@ export const StateSelect: React.FC<Props> = ({
const [fetchStates, setFetchStates] = useState<boolean>(false);
const router = useRouter();
const { workspaceSlug, projectId } = router.query;
const { workspaceSlug } = router.query;
const { data: stateGroups } = useSWR(
workspaceSlug && projectId && fetchStates ? STATES_LIST(projectId as string) : null,
workspaceSlug && projectId && fetchStates ? STATES_LIST(projectId) : null,
workspaceSlug && projectId && fetchStates
? () => stateService.getStates(workspaceSlug as string, projectId as string)
? () => stateService.getStates(workspaceSlug as string, projectId)
: null
);