fix: create more toggle fixes in create issue modal (#3355)

* fix: create more issue bugfixes

* fix: removing all warning
This commit is contained in:
sriram veeraghanta 2024-01-11 21:01:05 +05:30
parent a679b42200
commit 7ff91fdb82
30 changed files with 119 additions and 98 deletions

View File

@ -56,6 +56,7 @@ export const CoreEditorExtensions = (
code: false, code: false,
codeBlock: false, codeBlock: false,
horizontalRule: false, horizontalRule: false,
blockquote: false,
dropcursor: { dropcursor: {
color: "rgba(var(--color-text-100))", color: "rgba(var(--color-text-100))",
width: 2, width: 2,

View File

@ -1,10 +1,9 @@
import { isAtStartOfNode } from "@tiptap/core";
import Blockquote from "@tiptap/extension-blockquote"; import Blockquote from "@tiptap/extension-blockquote";
export const CustomQuoteExtension = Blockquote.extend({ export const CustomQuoteExtension = Blockquote.extend({
addKeyboardShortcuts() { addKeyboardShortcuts() {
return { return {
Enter: ({ editor }) => { Enter: () => {
const { $from, $to, $head } = this.editor.state.selection; const { $from, $to, $head } = this.editor.state.selection;
const parent = $head.node(-1); const parent = $head.node(-1);

View File

@ -43,22 +43,23 @@ function absoluteRect(node: Element) {
} }
function nodeDOMAtCoords(coords: { x: number; y: number }) { function nodeDOMAtCoords(coords: { x: number; y: number }) {
return document.elementsFromPoint(coords.x, coords.y).find((elem: Element) => { return document
return ( .elementsFromPoint(coords.x, coords.y)
elem.parentElement?.matches?.(".ProseMirror") || .find(
elem.matches( (elem: Element) =>
[ elem.parentElement?.matches?.(".ProseMirror") ||
"li", elem.matches(
"p:not(:first-child)", [
"pre", "li",
"blockquote", "p:not(:first-child)",
"h1, h2, h3", "pre",
"[data-type=horizontalRule]", "blockquote",
".tableWrapper", "h1, h2, h3",
].join(", ") "[data-type=horizontalRule]",
) ".tableWrapper",
].join(", ")
)
); );
});
} }
function nodePosAtDOM(node: Element, view: EditorView) { function nodePosAtDOM(node: Element, view: EditorView) {

View File

@ -35,9 +35,9 @@ export const CircularProgressIndicator: React.FC<ICircularProgressIndicator> = (
width="45.2227" width="45.2227"
height="45.2227" height="45.2227"
filterUnits="userSpaceOnUse" filterUnits="userSpaceOnUse"
color-interpolation-filters="sRGB" colorInterpolationFilters="sRGB"
> >
<feFlood flood-opacity="0" result="BackgroundImageFix" /> <feFlood floodOpacity="0" result="BackgroundImageFix" />
<feGaussianBlur in="BackgroundImageFix" stdDeviation="2" /> <feGaussianBlur in="BackgroundImageFix" stdDeviation="2" />
<feComposite in2="SourceAlpha" operator="in" result="effect1_backgroundBlur_377_19141" /> <feComposite in2="SourceAlpha" operator="in" result="effect1_backgroundBlur_377_19141" />
<feBlend mode="normal" in="SourceGraphic" in2="effect1_backgroundBlur_377_19141" result="shape" /> <feBlend mode="normal" in="SourceGraphic" in2="effect1_backgroundBlur_377_19141" result="shape" />

View File

@ -1,6 +1,5 @@
import { MouseEvent } from "react"; import { MouseEvent } from "react";
import Link from "next/link"; import Link from "next/link";
import { useRouter } from "next/router";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import useSWR from "swr"; import useSWR from "swr";
// hooks // hooks
@ -69,15 +68,13 @@ interface IActiveCycleDetails {
} }
export const ActiveCycleDetails: React.FC<IActiveCycleDetails> = observer((props) => { export const ActiveCycleDetails: React.FC<IActiveCycleDetails> = observer((props) => {
// router // props
const router = useRouter();
const { workspaceSlug, projectId } = props; const { workspaceSlug, projectId } = props;
// store hooks
const { const {
issues: { issues, fetchActiveCycleIssues }, issues: { issues, fetchActiveCycleIssues },
issueMap, issueMap,
} = useIssues(EIssuesStoreType.CYCLE); } = useIssues(EIssuesStoreType.CYCLE);
// store hooks
const { const {
commandPalette: { toggleCreateCycleModal }, commandPalette: { toggleCreateCycleModal },
} = useApplication(); } = useApplication();

View File

@ -31,7 +31,12 @@ export const CyclesList: FC<ICyclesList> = observer((props) => {
<div className="flex h-full w-full justify-between"> <div className="flex h-full w-full justify-between">
<div className="flex h-full w-full flex-col overflow-y-auto"> <div className="flex h-full w-full flex-col overflow-y-auto">
{cycleIds.map((cycleId) => ( {cycleIds.map((cycleId) => (
<CyclesListItem cycleId={cycleId} workspaceSlug={workspaceSlug} projectId={projectId} /> <CyclesListItem
key={cycleId}
cycleId={cycleId}
workspaceSlug={workspaceSlug}
projectId={projectId}
/>
))} ))}
</div> </div>
<CyclePeekOverview <CyclePeekOverview

View File

@ -1,5 +1,4 @@
import { useState, useRef } from "react"; import { useState, useRef } from "react";
import { useRouter } from "next/router";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { Draggable } from "@hello-pangea/dnd"; import { Draggable } from "@hello-pangea/dnd";
import { MoreHorizontal } from "lucide-react"; import { MoreHorizontal } from "lucide-react";
@ -21,8 +20,6 @@ type Props = {
export const CalendarIssueBlocks: React.FC<Props> = observer((props) => { export const CalendarIssueBlocks: React.FC<Props> = observer((props) => {
const { issues, issueIdList, quickActions, showAllIssues = false } = props; const { issues, issueIdList, quickActions, showAllIssues = false } = props;
// router
const router = useRouter();
// hooks // hooks
const { const {
router: { workspaceSlug, projectId }, router: { workspaceSlug, projectId },

View File

@ -40,7 +40,6 @@ export const HeaderGroupByCard: FC<IHeaderGroupByCard> = observer((props) => {
handleKanbanFilters, handleKanbanFilters,
issuePayload, issuePayload,
disableIssueCreation, disableIssueCreation,
currentStore,
addIssuesToView, addIssuesToView,
} = props; } = props;
const verticalAlignPosition = sub_group_by ? false : kanbanFilters?.group_by.includes(column_id); const verticalAlignPosition = sub_group_by ? false : kanbanFilters?.group_by.includes(column_id);

View File

@ -55,7 +55,6 @@ export const KanbanGroup = (props: IKanbanGroup) => {
disableIssueCreation, disableIssueCreation,
quickAddCallback, quickAddCallback,
viewId, viewId,
groupByVisibilityToggle,
} = props; } = props;
// hooks // hooks
const projectState = useProjectState(); const projectState = useProjectState();

View File

@ -4,7 +4,7 @@ import { useForm } from "react-hook-form";
import { PlusIcon } from "lucide-react"; import { PlusIcon } from "lucide-react";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
// hooks // hooks
import { useProject, useWorkspace } from "hooks/store"; import { useProject } from "hooks/store";
import useToast from "hooks/use-toast"; import useToast from "hooks/use-toast";
import useKeypress from "hooks/use-keypress"; import useKeypress from "hooks/use-keypress";
import useOutsideClickDetector from "hooks/use-outside-click-detector"; import useOutsideClickDetector from "hooks/use-outside-click-detector";

View File

@ -67,7 +67,7 @@ export const AllIssueQuickActions: React.FC<IQuickActionProps> = (props) => {
ellipsis ellipsis
> >
<CustomMenu.MenuItem <CustomMenu.MenuItem
onClick={(e) => { onClick={() => {
handleCopyIssueLink(); handleCopyIssueLink();
}} }}
> >
@ -77,7 +77,7 @@ export const AllIssueQuickActions: React.FC<IQuickActionProps> = (props) => {
</div> </div>
</CustomMenu.MenuItem> </CustomMenu.MenuItem>
<CustomMenu.MenuItem <CustomMenu.MenuItem
onClick={(e) => { onClick={() => {
setIssueToEdit(issue); setIssueToEdit(issue);
setCreateUpdateIssueModal(true); setCreateUpdateIssueModal(true);
}} }}
@ -88,7 +88,7 @@ export const AllIssueQuickActions: React.FC<IQuickActionProps> = (props) => {
</div> </div>
</CustomMenu.MenuItem> </CustomMenu.MenuItem>
<CustomMenu.MenuItem <CustomMenu.MenuItem
onClick={(e) => { onClick={() => {
setCreateUpdateIssueModal(true); setCreateUpdateIssueModal(true);
}} }}
> >
@ -98,7 +98,7 @@ export const AllIssueQuickActions: React.FC<IQuickActionProps> = (props) => {
</div> </div>
</CustomMenu.MenuItem> </CustomMenu.MenuItem>
<CustomMenu.MenuItem <CustomMenu.MenuItem
onClick={(e) => { onClick={() => {
setDeleteIssueModal(true); setDeleteIssueModal(true);
}} }}
> >

View File

@ -48,7 +48,7 @@ export const ArchivedIssueQuickActions: React.FC<IQuickActionProps> = (props) =>
ellipsis ellipsis
> >
<CustomMenu.MenuItem <CustomMenu.MenuItem
onClick={(e) => { onClick={() => {
handleCopyIssueLink(); handleCopyIssueLink();
}} }}
> >
@ -58,7 +58,7 @@ export const ArchivedIssueQuickActions: React.FC<IQuickActionProps> = (props) =>
</div> </div>
</CustomMenu.MenuItem> </CustomMenu.MenuItem>
<CustomMenu.MenuItem <CustomMenu.MenuItem
onClick={(e) => { onClick={() => {
setDeleteIssueModal(true); setDeleteIssueModal(true);
}} }}
> >

View File

@ -67,7 +67,7 @@ export const CycleIssueQuickActions: React.FC<IQuickActionProps> = (props) => {
ellipsis ellipsis
> >
<CustomMenu.MenuItem <CustomMenu.MenuItem
onClick={(e) => { onClick={() => {
handleCopyIssueLink(); handleCopyIssueLink();
}} }}
> >
@ -77,7 +77,7 @@ export const CycleIssueQuickActions: React.FC<IQuickActionProps> = (props) => {
</div> </div>
</CustomMenu.MenuItem> </CustomMenu.MenuItem>
<CustomMenu.MenuItem <CustomMenu.MenuItem
onClick={(e) => { onClick={() => {
setIssueToEdit({ setIssueToEdit({
...issue, ...issue,
cycle: cycleId?.toString() ?? null, cycle: cycleId?.toString() ?? null,
@ -91,7 +91,7 @@ export const CycleIssueQuickActions: React.FC<IQuickActionProps> = (props) => {
</div> </div>
</CustomMenu.MenuItem> </CustomMenu.MenuItem>
<CustomMenu.MenuItem <CustomMenu.MenuItem
onClick={(e) => { onClick={() => {
handleRemoveFromView && handleRemoveFromView(); handleRemoveFromView && handleRemoveFromView();
}} }}
> >
@ -101,7 +101,7 @@ export const CycleIssueQuickActions: React.FC<IQuickActionProps> = (props) => {
</div> </div>
</CustomMenu.MenuItem> </CustomMenu.MenuItem>
<CustomMenu.MenuItem <CustomMenu.MenuItem
onClick={(e) => { onClick={() => {
setCreateUpdateIssueModal(true); setCreateUpdateIssueModal(true);
}} }}
> >
@ -111,7 +111,7 @@ export const CycleIssueQuickActions: React.FC<IQuickActionProps> = (props) => {
</div> </div>
</CustomMenu.MenuItem> </CustomMenu.MenuItem>
<CustomMenu.MenuItem <CustomMenu.MenuItem
onClick={(e) => { onClick={() => {
setDeleteIssueModal(true); setDeleteIssueModal(true);
}} }}
> >

View File

@ -67,7 +67,7 @@ export const ModuleIssueQuickActions: React.FC<IQuickActionProps> = (props) => {
ellipsis ellipsis
> >
<CustomMenu.MenuItem <CustomMenu.MenuItem
onClick={(e) => { onClick={() => {
handleCopyIssueLink(); handleCopyIssueLink();
}} }}
> >
@ -77,7 +77,7 @@ export const ModuleIssueQuickActions: React.FC<IQuickActionProps> = (props) => {
</div> </div>
</CustomMenu.MenuItem> </CustomMenu.MenuItem>
<CustomMenu.MenuItem <CustomMenu.MenuItem
onClick={(e) => { onClick={() => {
setIssueToEdit({ ...issue, module: moduleId?.toString() ?? null }); setIssueToEdit({ ...issue, module: moduleId?.toString() ?? null });
setCreateUpdateIssueModal(true); setCreateUpdateIssueModal(true);
}} }}
@ -88,7 +88,7 @@ export const ModuleIssueQuickActions: React.FC<IQuickActionProps> = (props) => {
</div> </div>
</CustomMenu.MenuItem> </CustomMenu.MenuItem>
<CustomMenu.MenuItem <CustomMenu.MenuItem
onClick={(e) => { onClick={() => {
handleRemoveFromView && handleRemoveFromView(); handleRemoveFromView && handleRemoveFromView();
}} }}
> >
@ -98,7 +98,7 @@ export const ModuleIssueQuickActions: React.FC<IQuickActionProps> = (props) => {
</div> </div>
</CustomMenu.MenuItem> </CustomMenu.MenuItem>
<CustomMenu.MenuItem <CustomMenu.MenuItem
onClick={(e) => { onClick={() => {
setCreateUpdateIssueModal(true); setCreateUpdateIssueModal(true);
}} }}
> >

View File

@ -76,7 +76,7 @@ export const ProjectIssueQuickActions: React.FC<IQuickActionProps> = (props) =>
ellipsis ellipsis
> >
<CustomMenu.MenuItem <CustomMenu.MenuItem
onClick={(e) => { onClick={() => {
handleCopyIssueLink(); handleCopyIssueLink();
}} }}
> >
@ -88,7 +88,7 @@ export const ProjectIssueQuickActions: React.FC<IQuickActionProps> = (props) =>
{isEditingAllowed && ( {isEditingAllowed && (
<> <>
<CustomMenu.MenuItem <CustomMenu.MenuItem
onClick={(e) => { onClick={() => {
setIssueToEdit(issue); setIssueToEdit(issue);
setCreateUpdateIssueModal(true); setCreateUpdateIssueModal(true);
}} }}
@ -99,7 +99,7 @@ export const ProjectIssueQuickActions: React.FC<IQuickActionProps> = (props) =>
</div> </div>
</CustomMenu.MenuItem> </CustomMenu.MenuItem>
<CustomMenu.MenuItem <CustomMenu.MenuItem
onClick={(e) => { onClick={() => {
setCreateUpdateIssueModal(true); setCreateUpdateIssueModal(true);
}} }}
> >
@ -109,7 +109,7 @@ export const ProjectIssueQuickActions: React.FC<IQuickActionProps> = (props) =>
</div> </div>
</CustomMenu.MenuItem> </CustomMenu.MenuItem>
<CustomMenu.MenuItem <CustomMenu.MenuItem
onClick={(e) => { onClick={() => {
setDeleteIssueModal(true); setDeleteIssueModal(true);
}} }}
> >

View File

@ -66,7 +66,7 @@ export const AllIssueLayoutRoot: React.FC<Props> = observer((props) => {
}; };
const issueIds = (groupedIssueIds ?? []) as TUnGroupedIssues; const issueIds = (groupedIssueIds ?? []) as TUnGroupedIssues;
const issuesArray = issueIds?.filter((id) => id && issueMap?.[id]).map((id) => issueMap?.[id]); const issuesArray = issueIds?.filter((id: string) => id && issueMap?.[id]).map((id: string) => issueMap?.[id]);
const issueActions = useMemo( const issueActions = useMemo(
() => ({ () => ({

View File

@ -1,14 +1,20 @@
import { IIssueDisplayProperties, TIssue, TIssueMap } from "@plane/types";
import { SPREADSHEET_PROPERTY_DETAILS, SPREADSHEET_PROPERTY_LIST } from "constants/spreadsheet";
import { WithDisplayPropertiesHOC } from "../properties/with-display-properties-HOC";
import { Tooltip } from "@plane/ui";
import useOutsideClickDetector from "hooks/use-outside-click-detector";
import { useIssueDetail, useProject } from "hooks/store";
import { useRef, useState } from "react"; import { useRef, useState } from "react";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import { ChevronRight, MoreHorizontal } from "lucide-react";
import { EIssueActions } from "../types";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
// icons
import { ChevronRight, MoreHorizontal } from "lucide-react";
// constants
import { SPREADSHEET_PROPERTY_DETAILS, SPREADSHEET_PROPERTY_LIST } from "constants/spreadsheet";
// components
import { WithDisplayPropertiesHOC } from "../properties/with-display-properties-HOC";
// ui
import { Tooltip } from "@plane/ui";
// hooks
import useOutsideClickDetector from "hooks/use-outside-click-detector";
import { useIssueDetail, useProject } from "hooks/store";
// types
import { IIssueDisplayProperties, TIssue } from "@plane/types";
import { EIssueActions } from "../types";
interface Props { interface Props {
displayProperties: IIssueDisplayProperties; displayProperties: IIssueDisplayProperties;

View File

@ -1,5 +1,4 @@
import { useEffect, useState, useRef } from "react"; import { useEffect, useState, useRef } from "react";
import { useRouter } from "next/router";
import { useForm } from "react-hook-form"; import { useForm } from "react-hook-form";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { PlusIcon } from "lucide-react"; import { PlusIcon } from "lucide-react";
@ -56,10 +55,6 @@ const Inputs = (props: any) => {
export const SpreadsheetQuickAddIssueForm: React.FC<Props> = observer((props) => { export const SpreadsheetQuickAddIssueForm: React.FC<Props> = observer((props) => {
const { formKey, prePopulatedData, quickAddCallback, viewId } = props; const { formKey, prePopulatedData, quickAddCallback, viewId } = props;
// router
const router = useRouter();
const { workspaceSlug, projectId } = router.query;
// store hooks // store hooks
const { currentWorkspace } = useWorkspace(); const { currentWorkspace } = useWorkspace();
const { currentProjectDetails } = useProject(); const { currentProjectDetails } = useProject();

View File

@ -1,4 +1,4 @@
import React, { useEffect, useRef, useState } from "react"; import React, { useEffect, useRef } from "react";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
// components // components
import { Spinner } from "@plane/ui"; import { Spinner } from "@plane/ui";
@ -9,7 +9,6 @@ import { EIssueActions } from "../types";
import { useProject } from "hooks/store"; import { useProject } from "hooks/store";
import { SpreadsheetHeader } from "./spreadsheet-header"; import { SpreadsheetHeader } from "./spreadsheet-header";
import { SpreadsheetIssueRow } from "./issue-row"; import { SpreadsheetIssueRow } from "./issue-row";
import { WithDisplayPropertiesHOC } from "../properties/with-display-properties-HOC";
type Props = { type Props = {
displayProperties: IIssueDisplayProperties; displayProperties: IIssueDisplayProperties;

View File

@ -14,6 +14,8 @@ import type { TIssue } from "@plane/types";
export interface DraftIssueProps { export interface DraftIssueProps {
changesMade: Partial<TIssue> | null; changesMade: Partial<TIssue> | null;
data?: Partial<TIssue>; data?: Partial<TIssue>;
isCreateMoreToggleEnabled: boolean;
onCreateMoreToggleChange: (value: boolean) => void;
onChange: (formData: Partial<TIssue> | null) => void; onChange: (formData: Partial<TIssue> | null) => void;
onClose: (saveDraftIssueInLocalStorage?: boolean) => void; onClose: (saveDraftIssueInLocalStorage?: boolean) => void;
onSubmit: (formData: Partial<TIssue>) => Promise<void>; onSubmit: (formData: Partial<TIssue>) => Promise<void>;
@ -23,7 +25,16 @@ export interface DraftIssueProps {
const issueDraftService = new IssueDraftService(); const issueDraftService = new IssueDraftService();
export const DraftIssueLayout: React.FC<DraftIssueProps> = observer((props) => { export const DraftIssueLayout: React.FC<DraftIssueProps> = observer((props) => {
const { changesMade, data, onChange, onClose, onSubmit, projectId } = props; const {
changesMade,
data,
onChange,
onClose,
onSubmit,
projectId,
isCreateMoreToggleEnabled,
onCreateMoreToggleChange,
} = props;
// states // states
const [issueDiscardModal, setIssueDiscardModal] = useState(false); const [issueDiscardModal, setIssueDiscardModal] = useState(false);
// router // router
@ -76,7 +87,15 @@ export const DraftIssueLayout: React.FC<DraftIssueProps> = observer((props) => {
onClose(false); onClose(false);
}} }}
/> />
<IssueFormRoot data={data} onChange={onChange} onClose={handleClose} onSubmit={onSubmit} projectId={projectId} /> <IssueFormRoot
isCreateMoreToggleEnabled={isCreateMoreToggleEnabled}
onCreateMoreToggleChange={onCreateMoreToggleChange}
data={data}
onChange={onChange}
onClose={handleClose}
onSubmit={onSubmit}
projectId={projectId}
/>
</> </>
); );
}); });

View File

@ -51,6 +51,8 @@ const defaultValues: Partial<TIssue> = {
export interface IssueFormProps { export interface IssueFormProps {
data?: Partial<TIssue>; data?: Partial<TIssue>;
isCreateMoreToggleEnabled: boolean;
onCreateMoreToggleChange: (value: boolean) => void;
onChange?: (formData: Partial<TIssue> | null) => void; onChange?: (formData: Partial<TIssue> | null) => void;
onClose: () => void; onClose: () => void;
onSubmit: (values: Partial<TIssue>) => Promise<void>; onSubmit: (values: Partial<TIssue>) => Promise<void>;
@ -62,14 +64,15 @@ const aiService = new AIService();
const fileService = new FileService(); const fileService = new FileService();
export const IssueFormRoot: FC<IssueFormProps> = observer((props) => { export const IssueFormRoot: FC<IssueFormProps> = observer((props) => {
const { data, onChange, onClose, onSubmit, projectId } = props; const { data, onChange, onClose, onSubmit, projectId, isCreateMoreToggleEnabled, onCreateMoreToggleChange } = props;
console.log("onCreateMoreToggleChange", typeof onCreateMoreToggleChange);
// states // states
const [labelModal, setLabelModal] = useState(false); const [labelModal, setLabelModal] = useState(false);
const [parentIssueListModalOpen, setParentIssueListModalOpen] = useState(false); const [parentIssueListModalOpen, setParentIssueListModalOpen] = useState(false);
const [selectedParentIssue, setSelectedParentIssue] = useState<ISearchIssueResponse | null>(null); const [selectedParentIssue, setSelectedParentIssue] = useState<ISearchIssueResponse | null>(null);
const [gptAssistantModal, setGptAssistantModal] = useState(false); const [gptAssistantModal, setGptAssistantModal] = useState(false);
const [iAmFeelingLucky, setIAmFeelingLucky] = useState(false); const [iAmFeelingLucky, setIAmFeelingLucky] = useState(false);
const [createMore, setCreateMore] = useState(false);
// refs // refs
const editorRef = useRef<any>(null); const editorRef = useRef<any>(null);
// router // router
@ -276,7 +279,7 @@ export const IssueFormRoot: FC<IssueFormProps> = observer((props) => {
/> />
<div className="relative"> <div className="relative">
<div className="absolute bottom-3.5 right-3.5 z-10 border-0.5 flex items-center gap-2"> <div className="absolute bottom-3.5 right-3.5 z-10 border-0.5 flex items-center gap-2">
{issueName && issueName.trim() !== "" && ( {issueName && issueName.trim() !== "" && envConfig?.has_openai_configured && (
<button <button
type="button" type="button"
className={`flex items-center gap-1 rounded px-1.5 py-1 text-xs bg-custom-background-80 ${ className={`flex items-center gap-1 rounded px-1.5 py-1 text-xs bg-custom-background-80 ${
@ -593,14 +596,14 @@ export const IssueFormRoot: FC<IssueFormProps> = observer((props) => {
<div className="-mx-5 mt-5 flex items-center justify-between gap-2 border-t border-custom-border-100 px-5 pt-5"> <div className="-mx-5 mt-5 flex items-center justify-between gap-2 border-t border-custom-border-100 px-5 pt-5">
<div <div
className="flex cursor-default items-center gap-1.5" className="flex cursor-default items-center gap-1.5"
onClick={() => setCreateMore((prevData) => !prevData)} onClick={() => onCreateMoreToggleChange(!isCreateMoreToggleEnabled)}
onKeyDown={(e) => { onKeyDown={(e) => {
if (e.key === "Enter") setCreateMore((prevData) => !prevData); if (e.key === "Enter") onCreateMoreToggleChange(!isCreateMoreToggleEnabled);
}} }}
tabIndex={16} tabIndex={16}
> >
<div className="flex cursor-pointer items-center justify-center"> <div className="flex cursor-pointer items-center justify-center">
<ToggleSwitch value={createMore} onChange={() => {}} size="sm" /> <ToggleSwitch value={isCreateMoreToggleEnabled} onChange={() => {}} size="sm" />
</div> </div>
<span className="text-xs">Create more</span> <span className="text-xs">Create more</span>
</div> </div>

View File

@ -26,6 +26,7 @@ export const CreateUpdateIssueModal: React.FC<IssuesModalProps> = observer((prop
const { data, isOpen, onClose, onSubmit, withDraftIssueWrapper = true } = props; const { data, isOpen, onClose, onSubmit, withDraftIssueWrapper = true } = props;
// states // states
const [changesMade, setChangesMade] = useState<Partial<TIssue> | null>(null); const [changesMade, setChangesMade] = useState<Partial<TIssue> | null>(null);
const [createMore, setCreateMore] = useState(false);
// router // router
const router = useRouter(); const router = useRouter();
const { workspaceSlug, projectId } = router.query; const { workspaceSlug, projectId } = router.query;
@ -45,13 +46,15 @@ export const CreateUpdateIssueModal: React.FC<IssuesModalProps> = observer((prop
// local storage // local storage
const { setValue: setLocalStorageDraftIssue } = useLocalStorage<any>("draftedIssue", {}); const { setValue: setLocalStorageDraftIssue } = useLocalStorage<any>("draftedIssue", {});
const handleCreateMoreToggleChange = (value: boolean) => {
setCreateMore(value);
};
const handleClose = (saveDraftIssueInLocalStorage?: boolean) => { const handleClose = (saveDraftIssueInLocalStorage?: boolean) => {
if (changesMade && saveDraftIssueInLocalStorage) { if (changesMade && saveDraftIssueInLocalStorage) {
const draftIssue = JSON.stringify(changesMade); const draftIssue = JSON.stringify(changesMade);
setLocalStorageDraftIssue(draftIssue); setLocalStorageDraftIssue(draftIssue);
} }
onClose(); onClose();
}; };
@ -65,7 +68,7 @@ export const CreateUpdateIssueModal: React.FC<IssuesModalProps> = observer((prop
title: "Success!", title: "Success!",
message: "Issue created successfully.", message: "Issue created successfully.",
}); });
handleClose(); !createMore && handleClose();
return res; return res;
}) })
.catch(() => { .catch(() => {
@ -169,11 +172,15 @@ export const CreateUpdateIssueModal: React.FC<IssuesModalProps> = observer((prop
onClose={handleClose} onClose={handleClose}
onSubmit={handleFormSubmit} onSubmit={handleFormSubmit}
projectId={selectedProjectId} projectId={selectedProjectId}
isCreateMoreToggleEnabled={createMore}
onCreateMoreToggleChange={handleCreateMoreToggleChange}
/> />
) : ( ) : (
<IssueFormRoot <IssueFormRoot
data={data} data={data}
onClose={() => handleClose(false)} onClose={() => handleClose(false)}
isCreateMoreToggleEnabled={createMore}
onCreateMoreToggleChange={handleCreateMoreToggleChange}
onSubmit={handleFormSubmit} onSubmit={handleFormSubmit}
projectId={selectedProjectId} projectId={selectedProjectId}
/> />

View File

@ -1,9 +1,9 @@
import { FC, useMemo } from "react"; import { FC } 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 { CalendarDays, Signal, Tag, Triangle, LayoutPanelTop } from "lucide-react"; import { CalendarDays, Signal, Tag, Triangle, LayoutPanelTop } from "lucide-react";
// hooks // hooks
import { useIssueDetail, useProject, useUser } from "hooks/store"; import { useProject, useUser } from "hooks/store";
// ui icons // ui icons
import { DiceIcon, DoubleCircleIcon, UserGroupIcon, ContrastIcon } from "@plane/ui"; import { DiceIcon, DoubleCircleIcon, UserGroupIcon, ContrastIcon } from "@plane/ui";
import { IssueLinkRoot, IssueCycleSelect, IssueModuleSelect, IssueParentSelect, IssueLabel } from "components/issues"; import { IssueLinkRoot, IssueCycleSelect, IssueModuleSelect, IssueParentSelect, IssueLabel } from "components/issues";
@ -13,7 +13,7 @@ import { CustomDatePicker } from "components/ui";
// types // types
import { TIssue, TIssuePriorities } from "@plane/types"; import { TIssue, TIssuePriorities } from "@plane/types";
// constants // constants
import { EUserProjectRoles } from "constants/project"; // import { EUserProjectRoles } from "constants/project";
interface IPeekOverviewProperties { interface IPeekOverviewProperties {
issue: TIssue; issue: TIssue;
@ -29,14 +29,13 @@ export const PeekOverviewProperties: FC<IPeekOverviewProperties> = observer((pro
const { const {
membership: { currentProjectRole }, membership: { currentProjectRole },
} = useUser(); } = useUser();
const { currentUser } = useUser();
const { getProjectById } = useProject(); const { getProjectById } = useProject();
// router // router
const router = useRouter(); const router = useRouter();
const { workspaceSlug, projectId } = router.query; const { workspaceSlug, projectId } = router.query;
const uneditable = currentProjectRole ? [5, 10].includes(currentProjectRole) : false; const uneditable = currentProjectRole ? [5, 10].includes(currentProjectRole) : false;
const isAllowed = !!currentProjectRole && currentProjectRole >= EUserProjectRoles.MEMBER; // const isAllowed = !!currentProjectRole && currentProjectRole >= EUserProjectRoles.MEMBER;
const handleState = (_state: string) => { const handleState = (_state: string) => {
issueUpdate({ ...issue, state_id: _state }); issueUpdate({ ...issue, state_id: _state });

View File

@ -2,6 +2,8 @@ import { FC, useRef, useState } from "react";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { MoveRight, MoveDiagonal, Bell, Link2, Trash2 } from "lucide-react"; import { MoveRight, MoveDiagonal, Bell, Link2, Trash2 } from "lucide-react";
// hooks // hooks
import useOutsideClickDetector from "hooks/use-outside-click-detector";
// store hooks
import { useIssueDetail, useUser } from "hooks/store"; import { useIssueDetail, useUser } from "hooks/store";
// components // components
import { import {
@ -15,8 +17,7 @@ import {
// ui // ui
import { Button, CenterPanelIcon, CustomSelect, FullScreenPanelIcon, SidePanelIcon, Spinner } from "@plane/ui"; import { Button, CenterPanelIcon, CustomSelect, FullScreenPanelIcon, SidePanelIcon, Spinner } from "@plane/ui";
// types // types
import { TIssue, IIssueLink, ILinkDetails } from "@plane/types"; import { TIssue } from "@plane/types";
import useOutsideClickDetector from "hooks/use-outside-click-detector";
interface IIssueView { interface IIssueView {
workspaceSlug: string; workspaceSlug: string;

View File

@ -98,7 +98,7 @@ export const CreateProjectModal: FC<Props> = observer((props) => {
const currentNetwork = NETWORK_CHOICES.find((n) => n.key === watch("network")); const currentNetwork = NETWORK_CHOICES.find((n) => n.key === watch("network"));
if (currentWorkspaceRole && isOpen) if (currentWorkspaceRole && isOpen)
if (currentWorkspaceRole <= EUserWorkspaceRoles.MEMBER) return <IsGuestCondition onClose={onClose} />; if (currentWorkspaceRole < EUserWorkspaceRoles.MEMBER) return <IsGuestCondition onClose={onClose} />;
const handleClose = () => { const handleClose = () => {
onClose(); onClose();

View File

@ -44,7 +44,7 @@ export const WorkspaceSidebarMenu = observer(() => {
// router // router
const router = useRouter(); const router = useRouter();
const { workspaceSlug } = router.query; const { workspaceSlug } = router.query;
// computed
const isAuthorizedUser = !!currentWorkspaceRole && currentWorkspaceRole >= EUserWorkspaceRoles.MEMBER; const isAuthorizedUser = !!currentWorkspaceRole && currentWorkspaceRole >= EUserWorkspaceRoles.MEMBER;
return ( return (
@ -76,7 +76,6 @@ export const WorkspaceSidebarMenu = observer(() => {
</Link> </Link>
); );
})} })}
<NotificationPopover /> <NotificationPopover />
</div> </div>
); );

View File

@ -47,7 +47,7 @@ export const AppProvider: FC<IAppProvider> = observer((props) => {
<InstanceLayout> <InstanceLayout>
<StoreWrapper> <StoreWrapper>
<CrispWrapper user={currentUser}> <CrispWrapper user={currentUser}>
{/* <PosthogWrapper <PosthogWrapper
user={currentUser} user={currentUser}
workspaceRole={currentWorkspaceRole} workspaceRole={currentWorkspaceRole}
projectRole={currentProjectRole} projectRole={currentProjectRole}
@ -55,8 +55,7 @@ export const AppProvider: FC<IAppProvider> = observer((props) => {
posthogHost={envConfig?.posthog_host || null} posthogHost={envConfig?.posthog_host || null}
> >
<SWRConfig value={SWR_CONFIG}>{children}</SWRConfig> <SWRConfig value={SWR_CONFIG}>{children}</SWRConfig>
</PosthogWrapper> */} </PosthogWrapper>
<SWRConfig value={SWR_CONFIG}>{children}</SWRConfig>
</CrispWrapper> </CrispWrapper>
</StoreWrapper> </StoreWrapper>
</InstanceLayout> </InstanceLayout>

View File

@ -6,7 +6,7 @@ import { Controller, useForm } from "react-hook-form";
import { Sparkle } from "lucide-react"; import { Sparkle } from "lucide-react";
import debounce from "lodash/debounce"; import debounce from "lodash/debounce";
// hooks // hooks
import { useApplication, useIssues, useUser } from "hooks/store"; import { useApplication, useUser } from "hooks/store";
import useToast from "hooks/use-toast"; import useToast from "hooks/use-toast";
import useReloadConfirmations from "hooks/use-reload-confirmation"; import useReloadConfirmations from "hooks/use-reload-confirmation";
// services // services
@ -33,7 +33,6 @@ import { IPage, TIssue } from "@plane/types";
import { PAGE_DETAILS, PROJECT_ISSUES_LIST } from "constants/fetch-keys"; import { PAGE_DETAILS, PROJECT_ISSUES_LIST } from "constants/fetch-keys";
// constants // constants
import { EUserProjectRoles } from "constants/project"; import { EUserProjectRoles } from "constants/project";
import { EIssuesStoreType } from "constants/issue";
// services // services
const fileService = new FileService(); const fileService = new FileService();
@ -50,9 +49,6 @@ const PageDetailsPage: NextPageWithLayout = observer(() => {
const router = useRouter(); const router = useRouter();
const { workspaceSlug, projectId, pageId } = router.query; const { workspaceSlug, projectId, pageId } = router.query;
// store hooks // store hooks
const {
issues: { updateIssue },
} = useIssues(EIssuesStoreType.PROJECT);
const { const {
config: { envConfig }, config: { envConfig },
} = useApplication(); } = useApplication();

View File

@ -1,4 +1,4 @@
import { useState, useEffect } from "react"; import { 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 useSWR from "swr"; import useSWR from "swr";
@ -28,7 +28,7 @@ const WebhookDetailsPage: NextPageWithLayout = observer(() => {
const { const {
membership: { currentWorkspaceRole }, membership: { currentWorkspaceRole },
} = useUser(); } = useUser();
const { currentWebhook, clearSecretKey, fetchWebhookById, updateWebhook } = useWebhook(); const { currentWebhook, fetchWebhookById, updateWebhook } = useWebhook();
// toast // toast
const { setToastAlert } = useToast(); const { setToastAlert } = useToast();

View File

@ -2795,7 +2795,7 @@
dependencies: dependencies:
"@types/react" "*" "@types/react" "*"
"@types/react@*", "@types/react@^18.2.42": "@types/react@*", "@types/react@18.2.42", "@types/react@^18.2.42":
version "18.2.42" version "18.2.42"
resolved "https://registry.yarnpkg.com/@types/react/-/react-18.2.42.tgz#6f6b11a904f6d96dda3c2920328a97011a00aba7" resolved "https://registry.yarnpkg.com/@types/react/-/react-18.2.42.tgz#6f6b11a904f6d96dda3c2920328a97011a00aba7"
integrity sha512-c1zEr96MjakLYus/wPnuWDo1/zErfdU9rNsIGmE+NV71nx88FG9Ttgo5dqorXTu/LImX2f63WBP986gJkMPNbA== integrity sha512-c1zEr96MjakLYus/wPnuWDo1/zErfdU9rNsIGmE+NV71nx88FG9Ttgo5dqorXTu/LImX2f63WBP986gJkMPNbA==