chore: update is_deployed key

This commit is contained in:
Aaryan Khandelwal 2024-06-06 17:38:46 +05:30
parent 3ca3561c89
commit 974d56b8ee
6 changed files with 16 additions and 16 deletions

View File

@ -32,7 +32,7 @@ export interface IProject {
estimate: string | null;
id: string;
identifier: string;
is_deployed: boolean;
anchor: string | null;
is_favorite: boolean;
is_member: boolean;
logo_props: TLogoProps;

View File

@ -15,7 +15,7 @@ import { DisplayFiltersSelection, FiltersDropdown, FilterSelection, LayoutSelect
import { EIssueFilterType, EIssuesStoreType, ISSUE_DISPLAY_FILTERS_BY_LAYOUT } from "@/constants/issue";
import { EUserProjectRoles } from "@/constants/project";
// helpers
import { SPACE_BASE_PATH, SPACE_BASE_URL } from "@/helpers/common.helper";
import { SPACE_BASE_URL } from "@/helpers/common.helper";
import { calculateTotalFilters } from "@/helpers/filter.helper";
// hooks
import {
@ -100,7 +100,7 @@ export const ProjectIssuesHeader: React.FC = observer(() => {
[workspaceSlug, projectId, updateFilters]
);
const DEPLOY_URL = SPACE_BASE_URL + SPACE_BASE_PATH;
const publishedURL = `${SPACE_BASE_URL}/issues/${currentProjectDetails?.anchor}`;
const canUserCreateIssue =
currentProjectRole && [EUserProjectRoles.ADMIN, EUserProjectRoles.MEMBER].includes(currentProjectRole);
@ -159,9 +159,9 @@ export const ProjectIssuesHeader: React.FC = observer(() => {
</Tooltip>
) : null}
</div>
{currentProjectDetails?.is_deployed && DEPLOY_URL && (
{currentProjectDetails?.anchor && (
<a
href={`${DEPLOY_URL}/${workspaceSlug}/${currentProjectDetails?.id}`}
href={publishedURL}
className="group flex items-center gap-1.5 rounded bg-custom-primary-100/10 px-2.5 py-1 text-xs font-medium text-custom-primary-100"
target="_blank"
rel="noopener noreferrer"

View File

@ -141,7 +141,7 @@ export const IssueActivity: FC<TIssueActivity> = observer((props) => {
workspaceSlug={workspaceSlug}
issueId={issueId}
activityOperations={activityOperations}
showAccessSpecifier={project.is_deployed}
showAccessSpecifier={!!project.anchor}
disabled={disabled}
/>
{!disabled && (
@ -150,7 +150,7 @@ export const IssueActivity: FC<TIssueActivity> = observer((props) => {
projectId={projectId}
workspaceSlug={workspaceSlug}
activityOperations={activityOperations}
showAccessSpecifier={project.is_deployed}
showAccessSpecifier={!!project.anchor}
/>
)}
</div>
@ -161,7 +161,7 @@ export const IssueActivity: FC<TIssueActivity> = observer((props) => {
workspaceSlug={workspaceSlug}
issueId={issueId}
activityOperations={activityOperations}
showAccessSpecifier={project.is_deployed}
showAccessSpecifier={!!project.anchor}
disabled={disabled}
/>
{!disabled && (
@ -170,7 +170,7 @@ export const IssueActivity: FC<TIssueActivity> = observer((props) => {
projectId={projectId}
workspaceSlug={workspaceSlug}
activityOperations={activityOperations}
showAccessSpecifier={project.is_deployed}
showAccessSpecifier={!!project.anchor}
/>
)}
</div>

View File

@ -143,7 +143,7 @@ export const PublishProjectModal: React.FC<Props> = observer((props) => {
view_props: formData.view_props,
};
if (formData.id && project.is_deployed) await handleUpdatePublishSettings(payload);
if (formData.id && project.anchor) await handleUpdatePublishSettings(payload);
else await handlePublishProject(payload);
};
@ -173,7 +173,7 @@ export const PublishProjectModal: React.FC<Props> = observer((props) => {
<form onSubmit={handleSubmit(handleFormSubmit)}>
<div className="flex items-center justify-between gap-2 p-5">
<h5 className="text-xl font-medium text-custom-text-200">Publish page</h5>
{project.is_deployed && (
{project.anchor && (
<Button variant="danger" onClick={() => handleUnPublishProject(watch("id") ?? "")} loading={isUnPublishing}>
{isUnPublishing ? "Unpublishing" : "Unpublish"}
</Button>
@ -190,7 +190,7 @@ export const PublishProjectModal: React.FC<Props> = observer((props) => {
</Loader>
) : (
<div className="px-5 space-y-4">
{project.is_deployed && projectPublishSettings && (
{project.anchor && projectPublishSettings && (
<>
<div className="bg-custom-background-80 border border-custom-border-300 rounded-md py-1.5 pl-4 pr-1 flex items-center justify-between gap-2">
<a
@ -309,7 +309,7 @@ export const PublishProjectModal: React.FC<Props> = observer((props) => {
<Button variant="neutral-primary" size="sm" onClick={handleClose}>
Cancel
</Button>
{project.is_deployed ? (
{project.anchor ? (
isDirty && (
<Button variant="primary" size="sm" type="submit" loading={isSubmitting}>
{isSubmitting ? "Updating" : "Update settings"}

View File

@ -396,7 +396,7 @@ export const ProjectSidebarListItem: React.FC<Props> = observer((props) => {
<div className="flex h-4 w-4 cursor-pointer items-center justify-center rounded text-custom-sidebar-text-200 transition-all duration-300 hover:bg-custom-sidebar-background-80">
<Share2 className="h-3.5 w-3.5 stroke-[1.5]" />
</div>
<div>{project.is_deployed ? "Publish settings" : "Publish"}</div>
<div>{project.anchor ? "Publish settings" : "Publish"}</div>
</div>
</CustomMenu.MenuItem>
)}

View File

@ -111,7 +111,7 @@ export class ProjectPublishStore implements IProjectPublishStore {
const response = await this.projectPublishService.publishProject(workspaceSlug, projectID, data);
runInAction(() => {
set(this.publishSettingsMap, [projectID], response);
set(this.projectRootStore.project.projectMap, [projectID, "is_deployed"], true);
set(this.projectRootStore.project.projectMap, [projectID, "anchor"], response.anchor);
this.generalLoader = false;
});
return response;
@ -175,7 +175,7 @@ export class ProjectPublishStore implements IProjectPublishStore {
const response = await this.projectPublishService.unpublishProject(workspaceSlug, projectID, projectPublishId);
runInAction(() => {
unset(this.publishSettingsMap, [projectID]);
set(this.projectRootStore.project.projectMap, [projectID, "is_deployed"], false);
set(this.projectRootStore.project.projectMap, [projectID, "anchor"], null);
this.generalLoader = false;
});
return response;