[WEB-2568] chore: minor improvements related to issue identifier and issue modal. (#5723)
* [WEB-2568] chore: minor improvements related to issue identifier and issue modal. * fix: error handling for session recorder script. * chore: minor improvement
This commit is contained in:
parent
b1dccf3773
commit
c25fa594fe
10 changed files with 49 additions and 23 deletions
|
|
@ -93,7 +93,7 @@ export default function RootLayout({ children }: { children: React.ReactNode })
|
||||||
{`(function(c,l,a,r,i,t,y){
|
{`(function(c,l,a,r,i,t,y){
|
||||||
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
|
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
|
||||||
t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
|
t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
|
||||||
y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
|
y=l.getElementsByTagName(r)[0];if(y){y.parentNode.insertBefore(t,y);}
|
||||||
})(window, document, "clarity", "script", "${process.env.NEXT_PUBLIC_SESSION_RECORDER_KEY}");`}
|
})(window, document, "clarity", "script", "${process.env.NEXT_PUBLIC_SESSION_RECORDER_KEY}");`}
|
||||||
</Script>
|
</Script>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,3 @@
|
||||||
export * from "./issue-identifier";
|
export * from "./issue-identifier";
|
||||||
export * from "./issue-properties-activity";
|
export * from "./issue-properties-activity";
|
||||||
|
export * from "./issue-type-switcher";
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
import { observer } from "mobx-react";
|
||||||
|
// store hooks
|
||||||
|
import { useIssueDetail } from "@/hooks/store";
|
||||||
|
// plane web components
|
||||||
|
import { IssueIdentifier } from "@/plane-web/components/issues";
|
||||||
|
|
||||||
|
export type TIssueTypeSwitcherProps = {
|
||||||
|
issueId: string;
|
||||||
|
disabled: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const IssueTypeSwitcher: React.FC<TIssueTypeSwitcherProps> = observer((props) => {
|
||||||
|
const { issueId } = props;
|
||||||
|
// store hooks
|
||||||
|
const {
|
||||||
|
issue: { getIssueById },
|
||||||
|
} = useIssueDetail();
|
||||||
|
// derived values
|
||||||
|
const issue = getIssueById(issueId);
|
||||||
|
|
||||||
|
if (!issue || !issue.project_id) return <></>;
|
||||||
|
|
||||||
|
return <IssueIdentifier issueId={issueId} projectId={issue.project_id} size="md" />;
|
||||||
|
});
|
||||||
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
// types
|
|
||||||
import { TIssue } from "@plane/types";
|
|
||||||
// components
|
// components
|
||||||
import {
|
import {
|
||||||
IssueActivity,
|
IssueActivity,
|
||||||
|
|
@ -20,7 +18,7 @@ import { useIssueDetail, useUser } from "@/hooks/store";
|
||||||
import useReloadConfirmations from "@/hooks/use-reload-confirmation";
|
import useReloadConfirmations from "@/hooks/use-reload-confirmation";
|
||||||
import useSize from "@/hooks/use-window-size";
|
import useSize from "@/hooks/use-window-size";
|
||||||
// plane web components
|
// plane web components
|
||||||
import { IssueIdentifier } from "@/plane-web/components/issues";
|
import { IssueTypeSwitcher } from "@/plane-web/components/issues";
|
||||||
// types
|
// types
|
||||||
import { TIssueOperations } from "./root";
|
import { TIssueOperations } from "./root";
|
||||||
|
|
||||||
|
|
@ -68,8 +66,8 @@ export const IssueMainContent: React.FC<Props> = observer((props) => {
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div className="mb-2.5 flex items-center gap-4">
|
<div className="mb-2.5 flex items-center justify-between gap-4">
|
||||||
<IssueIdentifier issueId={issueId} projectId={issue.project_id} size="md" />
|
<IssueTypeSwitcher issueId={issueId} disabled={isArchived || !isEditable} />
|
||||||
<IssueUpdateStatus isSubmitting={isSubmitting} />
|
<IssueUpdateStatus isSubmitting={isSubmitting} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ export const CreateUpdateIssueModalBase: React.FC<IssuesModalProps> = observer((
|
||||||
withDraftIssueWrapper = true,
|
withDraftIssueWrapper = true,
|
||||||
storeType: issueStoreFromProps,
|
storeType: issueStoreFromProps,
|
||||||
isDraft = false,
|
isDraft = false,
|
||||||
|
fetchIssueDetails = true,
|
||||||
} = props;
|
} = props;
|
||||||
const issueStoreType = useIssueStoreType();
|
const issueStoreType = useIssueStoreType();
|
||||||
|
|
||||||
|
|
@ -68,7 +69,8 @@ export const CreateUpdateIssueModalBase: React.FC<IssuesModalProps> = observer((
|
||||||
setDescription(undefined);
|
setDescription(undefined);
|
||||||
if (!workspaceSlug) return;
|
if (!workspaceSlug) return;
|
||||||
|
|
||||||
if (!projectId || issueId === undefined) {
|
if (!projectId || issueId === undefined || !fetchIssueDetails) {
|
||||||
|
// Set description to the issue description from the props if available
|
||||||
setDescription(data?.description_html || "<p></p>");
|
setDescription(data?.description_html || "<p></p>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -146,12 +146,6 @@ export const IssueFormRoot: FC<IssueFormProps> = observer((props) => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const issueTypeId = watch("type_id");
|
const issueTypeId = watch("type_id");
|
||||||
|
|
||||||
// if data is present, set active type id to the type id of the issue
|
|
||||||
if (data && data.type_id) {
|
|
||||||
setValue("type_id", data.type_id, { shouldValidate: true });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if issue type id is present or project not available, return
|
// if issue type id is present or project not available, return
|
||||||
if (issueTypeId || !projectId) return;
|
if (issueTypeId || !projectId) return;
|
||||||
|
|
||||||
|
|
@ -284,7 +278,7 @@ export const IssueFormRoot: FC<IssueFormProps> = observer((props) => {
|
||||||
<IssueTypeSelect
|
<IssueTypeSelect
|
||||||
control={control}
|
control={control}
|
||||||
projectId={projectId}
|
projectId={projectId}
|
||||||
disabled={!!data?.id || !!data?.sourceIssueId}
|
disabled={!!data?.sourceIssueId}
|
||||||
handleFormChange={handleFormChange}
|
handleFormChange={handleFormChange}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -19,10 +19,14 @@ export interface IssuesModalProps {
|
||||||
withDraftIssueWrapper?: boolean;
|
withDraftIssueWrapper?: boolean;
|
||||||
storeType?: EIssuesStoreType;
|
storeType?: EIssuesStoreType;
|
||||||
isDraft?: boolean;
|
isDraft?: boolean;
|
||||||
|
fetchIssueDetails?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const CreateUpdateIssueModal: React.FC<IssuesModalProps> = observer((props) => (
|
export const CreateUpdateIssueModal: React.FC<IssuesModalProps> = observer(
|
||||||
<IssueModalProvider>
|
(props) =>
|
||||||
<CreateUpdateIssueModalBase {...props} />
|
props.isOpen && (
|
||||||
</IssueModalProvider>
|
<IssueModalProvider>
|
||||||
));
|
<CreateUpdateIssueModalBase {...props} />
|
||||||
|
</IssueModalProvider>
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,14 @@
|
||||||
import { FC, useEffect } from "react";
|
import { FC, useEffect } from "react";
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
// store hooks
|
// components
|
||||||
import { TIssueOperations } from "@/components/issues";
|
import { TIssueOperations } from "@/components/issues";
|
||||||
|
// store hooks
|
||||||
import { useIssueDetail, useUser } from "@/hooks/store";
|
import { useIssueDetail, useUser } from "@/hooks/store";
|
||||||
// hooks
|
// hooks
|
||||||
import useReloadConfirmations from "@/hooks/use-reload-confirmation";
|
import useReloadConfirmations from "@/hooks/use-reload-confirmation";
|
||||||
// plane web components
|
// plane web components
|
||||||
import { IssueIdentifier } from "@/plane-web/components/issues";
|
import { IssueTypeSwitcher } from "@/plane-web/components/issues";
|
||||||
// components
|
// local components
|
||||||
import { IssueDescriptionInput } from "../description-input";
|
import { IssueDescriptionInput } from "../description-input";
|
||||||
import { IssueReaction } from "../issue-detail/reactions";
|
import { IssueReaction } from "../issue-detail/reactions";
|
||||||
import { IssueTitleInput } from "../title-input";
|
import { IssueTitleInput } from "../title-input";
|
||||||
|
|
@ -56,7 +57,7 @@ export const PeekOverviewIssueDetails: FC<IPeekOverviewIssueDetails> = observer(
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<IssueIdentifier issueId={issueId} projectId={issue.project_id} size="md" />
|
<IssueTypeSwitcher issueId={issueId} disabled={isArchived || disabled} />
|
||||||
<IssueTitleInput
|
<IssueTitleInput
|
||||||
workspaceSlug={workspaceSlug}
|
workspaceSlug={workspaceSlug}
|
||||||
projectId={issue.project_id}
|
projectId={issue.project_id}
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,3 @@
|
||||||
export * from "./issue-identifier";
|
export * from "./issue-identifier";
|
||||||
export * from "./issue-properties-activity";
|
export * from "./issue-properties-activity";
|
||||||
|
export * from "./issue-type-switcher";
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
export * from "ce/components/issues/issue-details/issue-type-switcher";
|
||||||
Loading…
Add table
Add a link
Reference in a new issue