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; estimate: string | null;
id: string; id: string;
identifier: string; identifier: string;
is_deployed: boolean; anchor: string | null;
is_favorite: boolean; is_favorite: boolean;
is_member: boolean; is_member: boolean;
logo_props: TLogoProps; 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 { EIssueFilterType, EIssuesStoreType, ISSUE_DISPLAY_FILTERS_BY_LAYOUT } from "@/constants/issue";
import { EUserProjectRoles } from "@/constants/project"; import { EUserProjectRoles } from "@/constants/project";
// helpers // 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"; import { calculateTotalFilters } from "@/helpers/filter.helper";
// hooks // hooks
import { import {
@ -100,7 +100,7 @@ export const ProjectIssuesHeader: React.FC = observer(() => {
[workspaceSlug, projectId, updateFilters] [workspaceSlug, projectId, updateFilters]
); );
const DEPLOY_URL = SPACE_BASE_URL + SPACE_BASE_PATH; const publishedURL = `${SPACE_BASE_URL}/issues/${currentProjectDetails?.anchor}`;
const canUserCreateIssue = const canUserCreateIssue =
currentProjectRole && [EUserProjectRoles.ADMIN, EUserProjectRoles.MEMBER].includes(currentProjectRole); currentProjectRole && [EUserProjectRoles.ADMIN, EUserProjectRoles.MEMBER].includes(currentProjectRole);
@ -159,9 +159,9 @@ export const ProjectIssuesHeader: React.FC = observer(() => {
</Tooltip> </Tooltip>
) : null} ) : null}
</div> </div>
{currentProjectDetails?.is_deployed && DEPLOY_URL && ( {currentProjectDetails?.anchor && (
<a <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" 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" target="_blank"
rel="noopener noreferrer" rel="noopener noreferrer"

View File

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

View File

@ -143,7 +143,7 @@ export const PublishProjectModal: React.FC<Props> = observer((props) => {
view_props: formData.view_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); else await handlePublishProject(payload);
}; };
@ -173,7 +173,7 @@ export const PublishProjectModal: React.FC<Props> = observer((props) => {
<form onSubmit={handleSubmit(handleFormSubmit)}> <form onSubmit={handleSubmit(handleFormSubmit)}>
<div className="flex items-center justify-between gap-2 p-5"> <div className="flex items-center justify-between gap-2 p-5">
<h5 className="text-xl font-medium text-custom-text-200">Publish page</h5> <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}> <Button variant="danger" onClick={() => handleUnPublishProject(watch("id") ?? "")} loading={isUnPublishing}>
{isUnPublishing ? "Unpublishing" : "Unpublish"} {isUnPublishing ? "Unpublishing" : "Unpublish"}
</Button> </Button>
@ -190,7 +190,7 @@ export const PublishProjectModal: React.FC<Props> = observer((props) => {
</Loader> </Loader>
) : ( ) : (
<div className="px-5 space-y-4"> <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"> <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 <a
@ -309,7 +309,7 @@ export const PublishProjectModal: React.FC<Props> = observer((props) => {
<Button variant="neutral-primary" size="sm" onClick={handleClose}> <Button variant="neutral-primary" size="sm" onClick={handleClose}>
Cancel Cancel
</Button> </Button>
{project.is_deployed ? ( {project.anchor ? (
isDirty && ( isDirty && (
<Button variant="primary" size="sm" type="submit" loading={isSubmitting}> <Button variant="primary" size="sm" type="submit" loading={isSubmitting}>
{isSubmitting ? "Updating" : "Update settings"} {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"> <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]" /> <Share2 className="h-3.5 w-3.5 stroke-[1.5]" />
</div> </div>
<div>{project.is_deployed ? "Publish settings" : "Publish"}</div> <div>{project.anchor ? "Publish settings" : "Publish"}</div>
</div> </div>
</CustomMenu.MenuItem> </CustomMenu.MenuItem>
)} )}

View File

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