mirror of
https://github.com/makeplane/plane.git
synced 2025-12-29 00:24:56 +01:00
Merge pull request #421 from makeplane/sync/ce-ee
sync: community changes
This commit is contained in:
17
packages/types/src/publish.d.ts
vendored
17
packages/types/src/publish.d.ts
vendored
@@ -1,6 +1,6 @@
|
||||
import { IProject, IProjectLite, IWorkspaceLite } from "@plane/types";
|
||||
|
||||
export type TPublishEntityType = "project";
|
||||
export type TPublishEntityType = "project" | "page";
|
||||
|
||||
export type TProjectPublishLayouts =
|
||||
| "calendar"
|
||||
@@ -9,7 +9,7 @@ export type TProjectPublishLayouts =
|
||||
| "list"
|
||||
| "spreadsheet";
|
||||
|
||||
export type TPublishViewProps = {
|
||||
export type TProjectPublishViewProps = {
|
||||
calendar?: boolean;
|
||||
gantt?: boolean;
|
||||
kanban?: boolean;
|
||||
@@ -20,22 +20,25 @@ export type TPublishViewProps = {
|
||||
export type TProjectDetails = IProjectLite &
|
||||
Pick<IProject, "cover_image" | "logo_props" | "description">;
|
||||
|
||||
export type TPublishSettings = {
|
||||
type TPublishSettings = {
|
||||
anchor: string | undefined;
|
||||
is_comments_enabled: boolean;
|
||||
created_at: string | undefined;
|
||||
created_by: string | undefined;
|
||||
entity_identifier: string | undefined;
|
||||
entity_name: TPublishEntityType | undefined;
|
||||
id: string | undefined;
|
||||
inbox: unknown;
|
||||
is_comments_enabled: boolean;
|
||||
is_reactions_enabled: boolean;
|
||||
is_votes_enabled: boolean;
|
||||
project: string | undefined;
|
||||
project_details: TProjectDetails | undefined;
|
||||
is_reactions_enabled: boolean;
|
||||
updated_at: string | undefined;
|
||||
updated_by: string | undefined;
|
||||
view_props: TViewProps | undefined;
|
||||
is_votes_enabled: boolean;
|
||||
workspace: string | undefined;
|
||||
workspace_detail: IWorkspaceLite | undefined;
|
||||
};
|
||||
|
||||
export type TProjectPublishSettings = TPublishSettings & {
|
||||
view_props: TProjectPublishViewProps | undefined;
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { notFound, redirect } from "next/navigation";
|
||||
// types
|
||||
import { TPublishSettings } from "@plane/types";
|
||||
import { TProjectPublishSettings } from "@plane/types";
|
||||
// services
|
||||
import PublishService from "@/services/publish.service";
|
||||
|
||||
@@ -20,7 +20,7 @@ export default async function IssuesPage(props: Props) {
|
||||
const { workspaceSlug, projectId } = params;
|
||||
const { board, peekId } = searchParams;
|
||||
|
||||
let response: TPublishSettings | undefined = undefined;
|
||||
let response: TProjectPublishSettings | undefined = undefined;
|
||||
try {
|
||||
response = await publishService.fetchAnchorFromProjectDetails(workspaceSlug, projectId);
|
||||
} catch (error) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// types
|
||||
import { TPublishSettings } from "@plane/types";
|
||||
import { TProjectPublishSettings } from "@plane/types";
|
||||
// helpers
|
||||
import { API_BASE_URL } from "@/helpers/common.helper";
|
||||
// services
|
||||
@@ -10,7 +10,7 @@ class PublishService extends APIService {
|
||||
super(API_BASE_URL);
|
||||
}
|
||||
|
||||
async fetchPublishSettings(anchor: string): Promise<TPublishSettings> {
|
||||
async fetchPublishSettings(anchor: string): Promise<TProjectPublishSettings> {
|
||||
return this.get(`/api/public/anchor/${anchor}/settings/`)
|
||||
.then((response) => response?.data)
|
||||
.catch((error) => {
|
||||
@@ -18,7 +18,7 @@ class PublishService extends APIService {
|
||||
});
|
||||
}
|
||||
|
||||
async fetchAnchorFromProjectDetails(workspaceSlug: string, projectID: string): Promise<TPublishSettings> {
|
||||
async fetchAnchorFromProjectDetails(workspaceSlug: string, projectID: string): Promise<TProjectPublishSettings> {
|
||||
return this.get(`/api/public/workspaces/${workspaceSlug}/projects/${projectID}/anchor/`)
|
||||
.then((response) => response?.data)
|
||||
.catch((error) => {
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
import { observable, makeObservable, computed } from "mobx";
|
||||
// types
|
||||
import { IWorkspaceLite, TProjectDetails, TPublishEntityType, TPublishSettings, TPublishViewProps } from "@plane/types";
|
||||
import {
|
||||
IWorkspaceLite,
|
||||
TProjectDetails,
|
||||
TPublishEntityType,
|
||||
TProjectPublishSettings,
|
||||
TProjectPublishViewProps,
|
||||
} from "@plane/types";
|
||||
// store types
|
||||
import { RootStore } from "@/store/root.store";
|
||||
|
||||
export interface IPublishStore extends TPublishSettings {
|
||||
export interface IPublishStore extends TProjectPublishSettings {
|
||||
// computed
|
||||
workspaceSlug: string | undefined;
|
||||
canComment: boolean;
|
||||
@@ -27,14 +33,14 @@ export class PublishStore implements IPublishStore {
|
||||
is_reactions_enabled: boolean;
|
||||
updated_at: string | undefined;
|
||||
updated_by: string | undefined;
|
||||
view_props: TPublishViewProps | undefined;
|
||||
view_props: TProjectPublishViewProps | undefined;
|
||||
is_votes_enabled: boolean;
|
||||
workspace: string | undefined;
|
||||
workspace_detail: IWorkspaceLite | undefined;
|
||||
|
||||
constructor(
|
||||
private store: RootStore,
|
||||
publishSettings: TPublishSettings
|
||||
publishSettings: TProjectPublishSettings
|
||||
) {
|
||||
this.anchor = publishSettings.anchor;
|
||||
this.is_comments_enabled = publishSettings.is_comments_enabled;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import set from "lodash/set";
|
||||
import { makeObservable, observable, runInAction, action } from "mobx";
|
||||
// types
|
||||
import { TPublishSettings } from "@plane/types";
|
||||
import { TProjectPublishSettings } from "@plane/types";
|
||||
// services
|
||||
import PublishService from "@/services/publish.service";
|
||||
// store
|
||||
@@ -13,7 +13,7 @@ export interface IPublishListStore {
|
||||
// observables
|
||||
publishMap: Record<string, PublishStore>; // anchor => PublishStore
|
||||
// actions
|
||||
fetchPublishSettings: (pageId: string) => Promise<TPublishSettings>;
|
||||
fetchPublishSettings: (pageId: string) => Promise<TProjectPublishSettings>;
|
||||
}
|
||||
|
||||
export class PublishListStore implements IPublishListStore {
|
||||
@@ -42,7 +42,13 @@ export class PublishListStore implements IPublishListStore {
|
||||
const response = await this.publishService.fetchPublishSettings(anchor);
|
||||
runInAction(() => {
|
||||
if (response.anchor && response.view_props) {
|
||||
this.store.issueFilter.updateLayoutOptions(response?.view_props);
|
||||
this.store.issueFilter.updateLayoutOptions({
|
||||
list: !!response.view_props.list,
|
||||
kanban: !!response.view_props.kanban,
|
||||
calendar: !!response.view_props.calendar,
|
||||
gantt: !!response.view_props.gantt,
|
||||
spreadsheet: !!response.view_props.spreadsheet,
|
||||
});
|
||||
set(this.publishMap, [response.anchor], new PublishStore(this.store, response));
|
||||
}
|
||||
});
|
||||
|
||||
24
space/types/publish.d.ts
vendored
24
space/types/publish.d.ts
vendored
@@ -1,24 +0,0 @@
|
||||
import { IWorkspaceLite } from "@plane/types";
|
||||
import { TProjectDetails, TViewDetails } from "@/types/project";
|
||||
|
||||
export type TPublishEntityType = "project";
|
||||
|
||||
export type TPublishSettings = {
|
||||
anchor: string | undefined;
|
||||
is_comments_enabled: boolean;
|
||||
created_at: string | undefined;
|
||||
created_by: string | undefined;
|
||||
entity_identifier: string | undefined;
|
||||
entity_name: TPublishEntityType | undefined;
|
||||
id: string | undefined;
|
||||
inbox: unknown;
|
||||
project: string | undefined;
|
||||
project_details: TProjectDetails | undefined;
|
||||
is_reactions_enabled: boolean;
|
||||
updated_at: string | undefined;
|
||||
updated_by: string | undefined;
|
||||
view_props: TViewDetails | undefined;
|
||||
is_votes_enabled: boolean;
|
||||
workspace: string | undefined;
|
||||
workspace_detail: IWorkspaceLite | undefined;
|
||||
};
|
||||
@@ -1,4 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { observer } from "mobx-react";
|
||||
// ui
|
||||
import { Checkbox } from "@plane/ui";
|
||||
// helpers
|
||||
@@ -14,7 +16,7 @@ type Props = {
|
||||
selectionHelpers: TSelectionHelper;
|
||||
};
|
||||
|
||||
export const MultipleSelectEntityAction: React.FC<Props> = (props) => {
|
||||
export const MultipleSelectEntityAction: React.FC<Props> = observer((props) => {
|
||||
const { className, disabled = false, groupId, id, selectionHelpers } = props;
|
||||
// derived values
|
||||
const isSelected = selectionHelpers.getIsEntitySelected(id);
|
||||
@@ -36,4 +38,4 @@ export const MultipleSelectEntityAction: React.FC<Props> = (props) => {
|
||||
readOnly
|
||||
/>
|
||||
);
|
||||
};
|
||||
});
|
||||
|
||||
@@ -25,7 +25,7 @@ import { IssueBulkOperationsRoot } from "@/plane-web/components/issues";
|
||||
// plane web constants
|
||||
import { ENABLE_BULK_OPERATIONS } from "@/plane-web/constants/issue";
|
||||
// utils
|
||||
import { getGroupByColumns, isWorkspaceLevel, GroupDropLocation } from "../utils";
|
||||
import { getGroupByColumns, isWorkspaceLevel, GroupDropLocation, isSubGrouped } from "../utils";
|
||||
import { ListGroup } from "./list-group";
|
||||
import { TRenderQuickActions } from "./list-view-types";
|
||||
|
||||
@@ -119,8 +119,8 @@ export const List: React.FC<IList> = observer((props) => {
|
||||
let entities: Record<string, string[]> = {};
|
||||
|
||||
if (is_list) {
|
||||
entities = Object.assign(orderedGroups, { [groupIds[0]]: groupedIssueIds[ALL_ISSUES] });
|
||||
} else if (Array.isArray(groupedIssueIds[groupIds[0]])) {
|
||||
entities = Object.assign(orderedGroups, { [groupIds[0]]: groupedIssueIds[ALL_ISSUES] ?? [] });
|
||||
} else if (!isSubGrouped(groupedIssueIds)) {
|
||||
entities = Object.assign(orderedGroups, { ...groupedIssueIds });
|
||||
} else {
|
||||
entities = orderedGroups;
|
||||
|
||||
@@ -20,6 +20,7 @@ import {
|
||||
IIssueFilterOptions,
|
||||
IIssueFilters,
|
||||
IProjectView,
|
||||
TGroupedIssues,
|
||||
} from "@plane/types";
|
||||
// ui
|
||||
import { Avatar, CycleGroupIcon, DiceIcon, PriorityIcon, StateGroupIcon } from "@plane/ui";
|
||||
@@ -297,7 +298,8 @@ export const getDisplayPropertiesCount = (
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This Method finds the DOM element with elementId, scrolls to it and highlights the issue block
|
||||
* @param elementId
|
||||
@@ -573,3 +575,20 @@ export const getAreFiltersEqual = (
|
||||
isEqual(appliedFilters ?? {}, viewDetails?.filters ?? {}) &&
|
||||
isEqual(issueFilters?.displayFilters ?? {}, viewDetails?.display_filters ?? {}) &&
|
||||
isEqual(issueFilters?.displayProperties ?? {}, viewDetails?.display_properties ?? {});
|
||||
|
||||
/**
|
||||
* This Method returns if the the grouped values are subGrouped
|
||||
* @param groupedIssueIds
|
||||
* @returns
|
||||
*/
|
||||
export const isSubGrouped = (groupedIssueIds: TGroupedIssues) => {
|
||||
if (!groupedIssueIds || Array.isArray(groupedIssueIds)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Array.isArray(groupedIssueIds[Object.keys(groupedIssueIds)[0]])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
@@ -6,7 +6,7 @@ import { useParams } from "next/navigation";
|
||||
import { Controller, useForm } from "react-hook-form";
|
||||
import { Check, ExternalLink, Globe2 } from "lucide-react";
|
||||
// types
|
||||
import { IProject, TProjectPublishLayouts, TPublishSettings } from "@plane/types";
|
||||
import { IProject, TProjectPublishLayouts, TProjectPublishSettings } from "@plane/types";
|
||||
// ui
|
||||
import { Button, Loader, ToggleSwitch, TOAST_TYPE, setToast, CustomSelect, ModalCore, EModalWidth } from "@plane/ui";
|
||||
// helpers
|
||||
@@ -21,7 +21,7 @@ type Props = {
|
||||
onClose: () => void;
|
||||
};
|
||||
|
||||
const defaultValues: Partial<TPublishSettings> = {
|
||||
const defaultValues: Partial<TProjectPublishSettings> = {
|
||||
is_comments_enabled: false,
|
||||
is_reactions_enabled: false,
|
||||
is_votes_enabled: false,
|
||||
@@ -81,12 +81,12 @@ export const PublishProjectModal: React.FC<Props> = observer((props) => {
|
||||
}
|
||||
}, [fetchPublishSettings, isOpen, project, projectPublishSettings, workspaceSlug]);
|
||||
|
||||
const handlePublishProject = async (payload: Partial<TPublishSettings>) => {
|
||||
const handlePublishProject = async (payload: Partial<TProjectPublishSettings>) => {
|
||||
if (!workspaceSlug) return;
|
||||
await publishProject(workspaceSlug.toString(), project.id, payload);
|
||||
};
|
||||
|
||||
const handleUpdatePublishSettings = async (payload: Partial<TPublishSettings>) => {
|
||||
const handleUpdatePublishSettings = async (payload: Partial<TProjectPublishSettings>) => {
|
||||
if (!workspaceSlug || !payload.id) return;
|
||||
|
||||
await updatePublishSettings(workspaceSlug.toString(), project.id, payload.id, payload).then((res) => {
|
||||
@@ -124,7 +124,7 @@ export const PublishProjectModal: React.FC<Props> = observer((props) => {
|
||||
.map(([key, value]) => key)
|
||||
.filter((l) => VIEW_OPTIONS.find((o) => o.key === l));
|
||||
|
||||
const handleFormSubmit = async (formData: Partial<TPublishSettings>) => {
|
||||
const handleFormSubmit = async (formData: Partial<TProjectPublishSettings>) => {
|
||||
if (!selectedLayouts || selectedLayouts.length === 0) {
|
||||
setToast({
|
||||
type: TOAST_TYPE.ERROR,
|
||||
@@ -134,7 +134,7 @@ export const PublishProjectModal: React.FC<Props> = observer((props) => {
|
||||
return;
|
||||
}
|
||||
|
||||
const payload: Partial<TPublishSettings> = {
|
||||
const payload: Partial<TProjectPublishSettings> = {
|
||||
id: formData.id,
|
||||
is_comments_enabled: formData.is_comments_enabled,
|
||||
is_reactions_enabled: formData.is_reactions_enabled,
|
||||
|
||||
@@ -107,9 +107,8 @@ export const CreateUpdateStateInline: React.FC<Props> = observer((props) => {
|
||||
setToast({
|
||||
type: TOAST_TYPE.ERROR,
|
||||
title: "Error!",
|
||||
message: "State could not be created. Please try again.",
|
||||
message: error.data.error ?? "State could not be created. Please try again.",
|
||||
});
|
||||
|
||||
captureProjectStateEvent({
|
||||
eventName: STATE_CREATED,
|
||||
payload: {
|
||||
@@ -173,134 +172,139 @@ export const CreateUpdateStateInline: React.FC<Props> = observer((props) => {
|
||||
return (
|
||||
<form
|
||||
onSubmit={handleSubmit(onSubmit)}
|
||||
className="flex items-center gap-x-2 rounded-[10px] bg-custom-background-100 py-5"
|
||||
className="flex flex-col w-full rounded-[10px] bg-custom-background-100 py-5"
|
||||
>
|
||||
<div className="flex-shrink-0">
|
||||
<Popover className="relative flex h-full w-full items-center justify-center">
|
||||
{({ open }) => (
|
||||
<>
|
||||
<Popover.Button
|
||||
className={`group inline-flex items-center text-base font-medium focus:outline-none ${
|
||||
open ? "text-custom-text-100" : "text-custom-text-200"
|
||||
}`}
|
||||
>
|
||||
{watch("color") && watch("color") !== "" && (
|
||||
<span
|
||||
className="h-5 w-5 rounded"
|
||||
style={{
|
||||
backgroundColor: watch("color") ?? "black",
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</Popover.Button>
|
||||
|
||||
<Transition
|
||||
as={React.Fragment}
|
||||
enter="transition ease-out duration-200"
|
||||
enterFrom="opacity-0 translate-y-1"
|
||||
enterTo="opacity-100 translate-y-0"
|
||||
leave="transition ease-in duration-150"
|
||||
leaveFrom="opacity-100 translate-y-0"
|
||||
leaveTo="opacity-0 translate-y-1"
|
||||
>
|
||||
<Popover.Panel className="absolute left-0 top-full z-20 mt-3 w-screen max-w-xs px-2 sm:px-0">
|
||||
<Controller
|
||||
name="color"
|
||||
control={control}
|
||||
render={({ field: { value, onChange } }) => (
|
||||
<TwitterPicker color={value} onChange={(value) => onChange(value.hex)} />
|
||||
)}
|
||||
/>
|
||||
</Popover.Panel>
|
||||
</Transition>
|
||||
</>
|
||||
)}
|
||||
</Popover>
|
||||
</div>
|
||||
<Controller
|
||||
control={control}
|
||||
name="name"
|
||||
rules={{
|
||||
required: true,
|
||||
}}
|
||||
render={({ field: { value, onChange, ref } }) => (
|
||||
<Input
|
||||
id="name"
|
||||
name="name"
|
||||
type="text"
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
ref={ref}
|
||||
hasError={Boolean(errors.name)}
|
||||
placeholder="Name"
|
||||
className="w-full"
|
||||
autoFocus
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
{data && (
|
||||
<Controller
|
||||
name="group"
|
||||
control={control}
|
||||
render={({ field: { value, onChange } }) => (
|
||||
<Tooltip
|
||||
tooltipContent={groupLength === 1 ? "Cannot have an empty group." : "Choose State"}
|
||||
isMobile={isMobile}
|
||||
>
|
||||
<div>
|
||||
<CustomSelect
|
||||
disabled={groupLength === 1}
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
label={
|
||||
Object.keys(GROUP_CHOICES).find((k) => k === value.toString())
|
||||
? GROUP_CHOICES[value.toString() as keyof typeof GROUP_CHOICES]
|
||||
: "Select group"
|
||||
}
|
||||
input
|
||||
<div className="flex items-center gap-x-2 ">
|
||||
<div className="flex-shrink-0">
|
||||
<Popover className="relative flex h-full w-full items-center justify-center">
|
||||
{({ open }) => (
|
||||
<>
|
||||
<Popover.Button
|
||||
className={`group inline-flex items-center text-base font-medium focus:outline-none ${open ? "text-custom-text-100" : "text-custom-text-200"
|
||||
}`}
|
||||
>
|
||||
{Object.keys(GROUP_CHOICES).map((key) => (
|
||||
<CustomSelect.Option key={key} value={key}>
|
||||
{GROUP_CHOICES[key as keyof typeof GROUP_CHOICES]}
|
||||
</CustomSelect.Option>
|
||||
))}
|
||||
</CustomSelect>
|
||||
</div>
|
||||
</Tooltip>
|
||||
{watch("color") && watch("color") !== "" && (
|
||||
<span
|
||||
className="h-5 w-5 rounded"
|
||||
style={{
|
||||
backgroundColor: watch("color") ?? "black",
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</Popover.Button>
|
||||
<Transition
|
||||
as={React.Fragment}
|
||||
enter="transition ease-out duration-200"
|
||||
enterFrom="opacity-0 translate-y-1"
|
||||
enterTo="opacity-100 translate-y-0"
|
||||
leave="transition ease-in duration-150"
|
||||
leaveFrom="opacity-100 translate-y-0"
|
||||
leaveTo="opacity-0 translate-y-1"
|
||||
>
|
||||
<Popover.Panel className="absolute left-0 top-full z-20 mt-3 w-screen max-w-xs px-2 sm:px-0">
|
||||
<Controller
|
||||
name="color"
|
||||
control={control}
|
||||
render={({ field: { value, onChange } }) => (
|
||||
<TwitterPicker color={value} onChange={(value) => onChange(value.hex)} />
|
||||
)}
|
||||
/>
|
||||
</Popover.Panel>
|
||||
</Transition>
|
||||
</>
|
||||
)}
|
||||
</Popover>
|
||||
</div>
|
||||
<Controller
|
||||
control={control}
|
||||
name="name"
|
||||
rules={{
|
||||
required: true,
|
||||
maxLength: {
|
||||
value: 255,
|
||||
message: "State name should not exceed 255 characters",
|
||||
},
|
||||
}}
|
||||
render={({ field: { value, onChange, ref } }) => (
|
||||
<Input
|
||||
id="name"
|
||||
name="name"
|
||||
type="text"
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
ref={ref}
|
||||
hasError={Boolean(errors.name)}
|
||||
placeholder="Name"
|
||||
className="w-full"
|
||||
autoFocus
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
)}
|
||||
<Controller
|
||||
control={control}
|
||||
name="description"
|
||||
render={({ field: { value, onChange, ref } }) => (
|
||||
<Input
|
||||
id="description"
|
||||
name="description"
|
||||
type="text"
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
ref={ref}
|
||||
hasError={Boolean(errors.description)}
|
||||
placeholder="Description"
|
||||
className="w-full"
|
||||
{data && (
|
||||
<Controller
|
||||
name="group"
|
||||
control={control}
|
||||
render={({ field: { value, onChange } }) => (
|
||||
<Tooltip
|
||||
tooltipContent={groupLength === 1 ? "Cannot have an empty group." : "Choose State"}
|
||||
isMobile={isMobile}
|
||||
>
|
||||
<div>
|
||||
<CustomSelect
|
||||
disabled={groupLength === 1}
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
label={
|
||||
Object.keys(GROUP_CHOICES).find((k) => k === value.toString())
|
||||
? GROUP_CHOICES[value.toString() as keyof typeof GROUP_CHOICES]
|
||||
: "Select group"
|
||||
}
|
||||
input
|
||||
>
|
||||
{Object.keys(GROUP_CHOICES).map((key) => (
|
||||
<CustomSelect.Option key={key} value={key}>
|
||||
{GROUP_CHOICES[key as keyof typeof GROUP_CHOICES]}
|
||||
</CustomSelect.Option>
|
||||
))}
|
||||
</CustomSelect>
|
||||
</div>
|
||||
</Tooltip>
|
||||
)}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
<Button variant="neutral-primary" onClick={handleClose} size="sm">
|
||||
Cancel
|
||||
</Button>
|
||||
<Button
|
||||
variant="primary"
|
||||
type="submit"
|
||||
loading={isSubmitting}
|
||||
onClick={() => {
|
||||
setTrackElement("PROJECT_SETTINGS_STATE_PAGE");
|
||||
}}
|
||||
size="sm"
|
||||
>
|
||||
{data ? (isSubmitting ? "Updating" : "Update") : isSubmitting ? "Creating" : "Create"}
|
||||
</Button>
|
||||
<Controller
|
||||
control={control}
|
||||
name="description"
|
||||
render={({ field: { value, onChange, ref } }) => (
|
||||
<Input
|
||||
id="description"
|
||||
name="description"
|
||||
type="text"
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
ref={ref}
|
||||
hasError={Boolean(errors.description)}
|
||||
placeholder="Description"
|
||||
className="w-full"
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
<Button variant="neutral-primary" onClick={handleClose} size="sm">
|
||||
Cancel
|
||||
</Button>
|
||||
<Button
|
||||
variant="primary"
|
||||
type="submit"
|
||||
loading={isSubmitting}
|
||||
onClick={() => {
|
||||
setTrackElement("PROJECT_SETTINGS_STATE_PAGE");
|
||||
}}
|
||||
size="sm"
|
||||
>
|
||||
{data ? (isSubmitting ? "Updating" : "Update") : isSubmitting ? "Creating" : "Create"}
|
||||
</Button>
|
||||
</div>
|
||||
{errors.name?.message && <p className="p-0.5 pl-8 text-sm text-red-500">{errors.name?.message}</p>}
|
||||
</form>
|
||||
);
|
||||
});
|
||||
|
||||
@@ -35,7 +35,7 @@ export const ProjectAuthWrapper: FC<IProjectAuthWrapper> = observer((props) => {
|
||||
const {
|
||||
membership: { fetchUserProjectInfo, projectMemberInfo, hasPermissionToProject },
|
||||
} = useUser();
|
||||
const { getProjectById, fetchProjectDetails } = useProject();
|
||||
const { loader, getProjectById, fetchProjectDetails } = useProject();
|
||||
const { fetchAllCycles } = useCycle();
|
||||
const { fetchModules } = useModule();
|
||||
const { fetchViews } = useProjectView();
|
||||
@@ -116,7 +116,7 @@ export const ProjectAuthWrapper: FC<IProjectAuthWrapper> = observer((props) => {
|
||||
if (projectExists && projectId && hasPermissionToProject[projectId.toString()] === false) return <JoinProject />;
|
||||
|
||||
// check if the project info is not found.
|
||||
if (!projectExists && projectId && !!hasPermissionToProject[projectId.toString()] === false)
|
||||
if (!loader && !projectExists && projectId && !!hasPermissionToProject[projectId.toString()] === false)
|
||||
return (
|
||||
<div className="container grid h-screen place-items-center bg-custom-background-100">
|
||||
<EmptyState
|
||||
|
||||
@@ -50,7 +50,7 @@ const StoreWrapper: FC<TStoreWrapper> = observer((props) => {
|
||||
dom
|
||||
);
|
||||
} else unsetCustomCssVariables();
|
||||
}, [userProfile, userProfile?.theme, userProfile?.theme?.palette, setTheme, dom]);
|
||||
}, [userProfile, userProfile?.theme, userProfile?.theme?.palette, setTheme, dom, resolvedTheme]);
|
||||
|
||||
useEffect(() => {
|
||||
if (dom) return;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// types
|
||||
import { TPublishSettings } from "@plane/types";
|
||||
import { TProjectPublishSettings } from "@plane/types";
|
||||
// helpers
|
||||
import { API_BASE_URL } from "@/helpers/common.helper";
|
||||
// services
|
||||
@@ -10,7 +10,7 @@ export class ProjectPublishService extends APIService {
|
||||
super(API_BASE_URL);
|
||||
}
|
||||
|
||||
async fetchPublishSettings(workspaceSlug: string, projectID: string): Promise<TPublishSettings> {
|
||||
async fetchPublishSettings(workspaceSlug: string, projectID: string): Promise<TProjectPublishSettings> {
|
||||
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectID}/project-deploy-boards/`)
|
||||
.then((response) => response?.data)
|
||||
.catch((error) => {
|
||||
@@ -21,8 +21,8 @@ export class ProjectPublishService extends APIService {
|
||||
async publishProject(
|
||||
workspaceSlug: string,
|
||||
projectID: string,
|
||||
data: Partial<TPublishSettings>
|
||||
): Promise<TPublishSettings> {
|
||||
data: Partial<TProjectPublishSettings>
|
||||
): Promise<TProjectPublishSettings> {
|
||||
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectID}/project-deploy-boards/`, data)
|
||||
.then((response) => response?.data)
|
||||
.catch((error) => {
|
||||
@@ -34,8 +34,8 @@ export class ProjectPublishService extends APIService {
|
||||
workspaceSlug: string,
|
||||
projectID: string,
|
||||
project_publish_id: string,
|
||||
data: Partial<TPublishSettings>
|
||||
): Promise<TPublishSettings> {
|
||||
data: Partial<TProjectPublishSettings>
|
||||
): Promise<TProjectPublishSettings> {
|
||||
return this.patch(
|
||||
`/api/workspaces/${workspaceSlug}/projects/${projectID}/project-deploy-boards/${project_publish_id}/`,
|
||||
data
|
||||
|
||||
@@ -2,7 +2,7 @@ import set from "lodash/set";
|
||||
import unset from "lodash/unset";
|
||||
import { observable, action, makeObservable, runInAction } from "mobx";
|
||||
// types
|
||||
import { TPublishSettings } from "@plane/types";
|
||||
import { TProjectPublishSettings } from "@plane/types";
|
||||
// services
|
||||
import { ProjectPublishService } from "@/services/project";
|
||||
// store
|
||||
@@ -13,22 +13,22 @@ export interface IProjectPublishStore {
|
||||
generalLoader: boolean;
|
||||
fetchSettingsLoader: boolean;
|
||||
// observables
|
||||
publishSettingsMap: Record<string, TPublishSettings>; // projectID => TPublishSettings
|
||||
publishSettingsMap: Record<string, TProjectPublishSettings>; // projectID => TProjectPublishSettings
|
||||
// helpers
|
||||
getPublishSettingsByProjectID: (projectID: string) => TPublishSettings | undefined;
|
||||
getPublishSettingsByProjectID: (projectID: string) => TProjectPublishSettings | undefined;
|
||||
// actions
|
||||
fetchPublishSettings: (workspaceSlug: string, projectID: string) => Promise<TPublishSettings>;
|
||||
fetchPublishSettings: (workspaceSlug: string, projectID: string) => Promise<TProjectPublishSettings>;
|
||||
updatePublishSettings: (
|
||||
workspaceSlug: string,
|
||||
projectID: string,
|
||||
projectPublishId: string,
|
||||
data: Partial<TPublishSettings>
|
||||
) => Promise<TPublishSettings>;
|
||||
data: Partial<TProjectPublishSettings>
|
||||
) => Promise<TProjectPublishSettings>;
|
||||
publishProject: (
|
||||
workspaceSlug: string,
|
||||
projectID: string,
|
||||
data: Partial<TPublishSettings>
|
||||
) => Promise<TPublishSettings>;
|
||||
data: Partial<TProjectPublishSettings>
|
||||
) => Promise<TProjectPublishSettings>;
|
||||
unPublishProject: (workspaceSlug: string, projectID: string, projectPublishId: string) => Promise<void>;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ export class ProjectPublishStore implements IProjectPublishStore {
|
||||
generalLoader: boolean = false;
|
||||
fetchSettingsLoader: boolean = false;
|
||||
// observables
|
||||
publishSettingsMap: Record<string, TPublishSettings> = {};
|
||||
publishSettingsMap: Record<string, TProjectPublishSettings> = {};
|
||||
// root store
|
||||
projectRootStore: ProjectRootStore;
|
||||
// services
|
||||
@@ -65,9 +65,9 @@ export class ProjectPublishStore implements IProjectPublishStore {
|
||||
/**
|
||||
* @description returns the publish settings of a particular project
|
||||
* @param {string} projectID
|
||||
* @returns {TPublishSettings | undefined}
|
||||
* @returns {TProjectPublishSettings | undefined}
|
||||
*/
|
||||
getPublishSettingsByProjectID = (projectID: string): TPublishSettings | undefined =>
|
||||
getPublishSettingsByProjectID = (projectID: string): TProjectPublishSettings | undefined =>
|
||||
this.publishSettingsMap?.[projectID] ?? undefined;
|
||||
|
||||
/**
|
||||
@@ -103,7 +103,7 @@ export class ProjectPublishStore implements IProjectPublishStore {
|
||||
* @param data
|
||||
* @returns
|
||||
*/
|
||||
publishProject = async (workspaceSlug: string, projectID: string, data: Partial<TPublishSettings>) => {
|
||||
publishProject = async (workspaceSlug: string, projectID: string, data: Partial<TProjectPublishSettings>) => {
|
||||
try {
|
||||
runInAction(() => {
|
||||
this.generalLoader = true;
|
||||
@@ -135,7 +135,7 @@ export class ProjectPublishStore implements IProjectPublishStore {
|
||||
workspaceSlug: string,
|
||||
projectID: string,
|
||||
projectPublishId: string,
|
||||
data: Partial<TPublishSettings>
|
||||
data: Partial<TProjectPublishSettings>
|
||||
) => {
|
||||
try {
|
||||
runInAction(() => {
|
||||
|
||||
Reference in New Issue
Block a user