mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
Merge pull request #32 from dakshesh14/main
This commit is contained in:
commit
5f76d8e313
@ -161,7 +161,7 @@ const ConfirmProjectDeletion: React.FC<Props> = ({ isOpen, data, onClose }) => {
|
|||||||
setConfirmDeleteMyProject(false);
|
setConfirmDeleteMyProject(false);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
name="projectName"
|
name="typeDelete"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { useRef, useState } from "react";
|
import React, { useEffect, useRef, useState } from "react";
|
||||||
// next
|
// next
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
// headless ui
|
// headless ui
|
||||||
@ -11,43 +11,54 @@ import useToast from "lib/hooks/useToast";
|
|||||||
// icons
|
// icons
|
||||||
import { ExclamationTriangleIcon } from "@heroicons/react/24/outline";
|
import { ExclamationTriangleIcon } from "@heroicons/react/24/outline";
|
||||||
// ui
|
// ui
|
||||||
import { Button } from "ui";
|
import { Button, Input } from "ui";
|
||||||
// types
|
// types
|
||||||
import type { IWorkspace } from "types";
|
import type { IWorkspace } from "types";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
isOpen: boolean;
|
isOpen: boolean;
|
||||||
setIsOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
data: IWorkspace | null;
|
||||||
|
onClose: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
const ConfirmWorkspaceDeletion: React.FC<Props> = ({ isOpen, setIsOpen }) => {
|
const ConfirmWorkspaceDeletion: React.FC<Props> = ({ isOpen, data, onClose }) => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const [isDeleteLoading, setIsDeleteLoading] = useState(false);
|
const [isDeleteLoading, setIsDeleteLoading] = useState(false);
|
||||||
|
|
||||||
const { activeWorkspace, mutateWorkspaces } = useUser();
|
const [selectedWorkspace, setSelectedWorkspace] = useState<IWorkspace | null>(null);
|
||||||
|
|
||||||
|
const [confirmProjectName, setConfirmProjectName] = useState("");
|
||||||
|
const [confirmDeleteMyProject, setConfirmDeleteMyProject] = useState(false);
|
||||||
|
|
||||||
|
const canDelete = confirmProjectName === data?.name && confirmDeleteMyProject;
|
||||||
|
|
||||||
|
const { mutateWorkspaces } = useUser();
|
||||||
|
|
||||||
const { setToastAlert } = useToast();
|
const { setToastAlert } = useToast();
|
||||||
|
|
||||||
const cancelButtonRef = useRef(null);
|
const cancelButtonRef = useRef(null);
|
||||||
|
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
setIsOpen(false);
|
onClose();
|
||||||
setIsDeleteLoading(false);
|
setIsDeleteLoading(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDeletion = async () => {
|
const handleDeletion = async () => {
|
||||||
setIsDeleteLoading(true);
|
setIsDeleteLoading(true);
|
||||||
if (!activeWorkspace) return;
|
if (!data || !canDelete) return;
|
||||||
await workspaceService
|
await workspaceService
|
||||||
.deleteWorkspace(activeWorkspace.slug)
|
.deleteWorkspace(data.slug)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
handleClose();
|
handleClose();
|
||||||
mutateWorkspaces((prevData) => {
|
mutateWorkspaces((prevData) => {
|
||||||
return (prevData ?? []).filter(
|
return (prevData ?? []).filter((workspace: IWorkspace) => workspace.slug !== data.slug);
|
||||||
(workspace: IWorkspace) => workspace.slug !== activeWorkspace.slug
|
|
||||||
);
|
|
||||||
}, false);
|
}, false);
|
||||||
|
setToastAlert({
|
||||||
|
type: "success",
|
||||||
|
message: "Workspace deleted successfully",
|
||||||
|
title: "Success",
|
||||||
|
});
|
||||||
router.push("/");
|
router.push("/");
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
@ -56,6 +67,16 @@ const ConfirmWorkspaceDeletion: React.FC<Props> = ({ isOpen, setIsOpen }) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (data) setSelectedWorkspace(data);
|
||||||
|
else {
|
||||||
|
const timer = setTimeout(() => {
|
||||||
|
setSelectedWorkspace(null);
|
||||||
|
clearTimeout(timer);
|
||||||
|
}, 350);
|
||||||
|
}
|
||||||
|
}, [data]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Transition.Root show={isOpen} as={React.Fragment}>
|
<Transition.Root show={isOpen} as={React.Fragment}>
|
||||||
<Dialog
|
<Dialog
|
||||||
@ -103,11 +124,47 @@ const ConfirmWorkspaceDeletion: React.FC<Props> = ({ isOpen, setIsOpen }) => {
|
|||||||
<div className="mt-2">
|
<div className="mt-2">
|
||||||
<p className="text-sm text-gray-500">
|
<p className="text-sm text-gray-500">
|
||||||
Are you sure you want to delete workspace - {`"`}
|
Are you sure you want to delete workspace - {`"`}
|
||||||
<span className="italic">{activeWorkspace?.name}</span>
|
<span className="italic">{data?.name}</span>
|
||||||
{`"`} ? All of the data related to the workspace will be permanently
|
{`"`} ? All of the data related to the workspace will be permanently
|
||||||
removed. This action cannot be undone.
|
removed. This action cannot be undone.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="mt-3">
|
||||||
|
<p className="text-sm">
|
||||||
|
Enter the workspace name{" "}
|
||||||
|
<span className="font-semibold">{selectedWorkspace?.name}</span> to
|
||||||
|
continue:
|
||||||
|
</p>
|
||||||
|
<Input
|
||||||
|
type="text"
|
||||||
|
placeholder="Project name"
|
||||||
|
className="mt-2"
|
||||||
|
value={confirmProjectName}
|
||||||
|
onChange={(e) => {
|
||||||
|
setConfirmProjectName(e.target.value);
|
||||||
|
}}
|
||||||
|
name="workspaceName"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="mt-3">
|
||||||
|
<p className="text-sm">
|
||||||
|
To confirm, type{" "}
|
||||||
|
<span className="font-semibold">delete my workspace</span> below:
|
||||||
|
</p>
|
||||||
|
<Input
|
||||||
|
type="text"
|
||||||
|
placeholder="Enter 'delete my workspace'"
|
||||||
|
className="mt-2"
|
||||||
|
onChange={(e) => {
|
||||||
|
if (e.target.value === "delete my workspace") {
|
||||||
|
setConfirmDeleteMyProject(true);
|
||||||
|
} else {
|
||||||
|
setConfirmDeleteMyProject(false);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
name="typeDelete"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -116,7 +173,7 @@ const ConfirmWorkspaceDeletion: React.FC<Props> = ({ isOpen, setIsOpen }) => {
|
|||||||
type="button"
|
type="button"
|
||||||
onClick={handleDeletion}
|
onClick={handleDeletion}
|
||||||
theme="danger"
|
theme="danger"
|
||||||
disabled={isDeleteLoading}
|
disabled={isDeleteLoading || !canDelete}
|
||||||
className="inline-flex sm:ml-3"
|
className="inline-flex sm:ml-3"
|
||||||
>
|
>
|
||||||
{isDeleteLoading ? "Deleting..." : "Delete"}
|
{isDeleteLoading ? "Deleting..." : "Delete"}
|
@ -15,7 +15,8 @@ export const MAGIC_LINK_SIGNIN = "/api/magic-sign-in/";
|
|||||||
export const USER_ENDPOINT = "/api/users/me/";
|
export const USER_ENDPOINT = "/api/users/me/";
|
||||||
export const CHANGE_PASSWORD = "/api/users/me/change-password/";
|
export const CHANGE_PASSWORD = "/api/users/me/change-password/";
|
||||||
export const USER_ONBOARD_ENDPOINT = "/api/users/me/onboard/";
|
export const USER_ONBOARD_ENDPOINT = "/api/users/me/onboard/";
|
||||||
export const USER_ISSUES_ENDPOINT = "/api/users/me/issues/";
|
export const USER_ISSUES_ENDPOINT = (workspaceSlug: string) =>
|
||||||
|
`/api/workspaces/${workspaceSlug}/my-issues/`;
|
||||||
export const USER_WORKSPACES = "/api/users/me/workspaces";
|
export const USER_WORKSPACES = "/api/users/me/workspaces";
|
||||||
|
|
||||||
// s3 file url
|
// s3 file url
|
||||||
@ -24,7 +25,7 @@ export const S3_URL = `/api/file-assets/`;
|
|||||||
// LIST USER INVITATIONS ---- RESPOND INVITATIONS IN BULK
|
// LIST USER INVITATIONS ---- RESPOND INVITATIONS IN BULK
|
||||||
export const USER_WORKSPACE_INVITATIONS = "/api/users/me/invitations/workspaces/";
|
export const USER_WORKSPACE_INVITATIONS = "/api/users/me/invitations/workspaces/";
|
||||||
export const USER_PROJECT_INVITATIONS = "/api/users/me/invitations/projects/";
|
export const USER_PROJECT_INVITATIONS = "/api/users/me/invitations/projects/";
|
||||||
|
export const LAST_ACTIVE_WORKSPACE_AND_PROJECTS = "/api/users/last-visited-workspace/";
|
||||||
export const USER_WORKSPACE_INVITATION = (invitationId: string) =>
|
export const USER_WORKSPACE_INVITATION = (invitationId: string) =>
|
||||||
`/api/users/me/invitations/${invitationId}/`;
|
`/api/users/me/invitations/${invitationId}/`;
|
||||||
|
|
||||||
@ -33,8 +34,6 @@ export const JOIN_WORKSPACE = (workspaceSlug: string, invitationId: string) =>
|
|||||||
export const JOIN_PROJECT = (workspaceSlug: string) =>
|
export const JOIN_PROJECT = (workspaceSlug: string) =>
|
||||||
`/api/workspaces/${workspaceSlug}/projects/join/`;
|
`/api/workspaces/${workspaceSlug}/projects/join/`;
|
||||||
|
|
||||||
export const USER_ISSUES = "/api/users/me/issues/";
|
|
||||||
|
|
||||||
// workspaces
|
// workspaces
|
||||||
export const WORKSPACES_ENDPOINT = "/api/workspaces/";
|
export const WORKSPACES_ENDPOINT = "/api/workspaces/";
|
||||||
export const WORKSPACE_DETAIL = (workspaceSlug: string) => `/api/workspaces/${workspaceSlug}/`;
|
export const WORKSPACE_DETAIL = (workspaceSlug: string) => `/api/workspaces/${workspaceSlug}/`;
|
||||||
|
@ -29,4 +29,4 @@ export const CYCLE_DETAIL = "CYCLE_DETAIL";
|
|||||||
export const STATE_LIST = (projectId: string) => `STATE_LIST_${projectId}`;
|
export const STATE_LIST = (projectId: string) => `STATE_LIST_${projectId}`;
|
||||||
export const STATE_DETAIL = "STATE_DETAIL";
|
export const STATE_DETAIL = "STATE_DETAIL";
|
||||||
|
|
||||||
export const USER_ISSUE = "USER_ISSUE";
|
export const USER_ISSUE = (workspaceSlug: string) => `USER_ISSUE_${workspaceSlug}`;
|
||||||
|
@ -16,8 +16,8 @@ class UserService extends APIService {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
async userIssues(): Promise<any> {
|
async userIssues(workspaceSlug: string): Promise<any> {
|
||||||
return this.get(USER_ISSUES_ENDPOINT)
|
return this.get(USER_ISSUES_ENDPOINT(workspaceSlug))
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
return response?.data;
|
return response?.data;
|
||||||
})
|
})
|
||||||
|
@ -11,6 +11,7 @@ import {
|
|||||||
WORKSPACE_INVITATION_DETAIL,
|
WORKSPACE_INVITATION_DETAIL,
|
||||||
USER_WORKSPACE_INVITATION,
|
USER_WORKSPACE_INVITATION,
|
||||||
USER_WORKSPACE_INVITATIONS,
|
USER_WORKSPACE_INVITATIONS,
|
||||||
|
LAST_ACTIVE_WORKSPACE_AND_PROJECTS,
|
||||||
} from "constants/api-routes";
|
} from "constants/api-routes";
|
||||||
// services
|
// services
|
||||||
import APIService from "lib/services/api.service";
|
import APIService from "lib/services/api.service";
|
||||||
@ -18,7 +19,12 @@ import APIService from "lib/services/api.service";
|
|||||||
const { NEXT_PUBLIC_API_BASE_URL } = process.env;
|
const { NEXT_PUBLIC_API_BASE_URL } = process.env;
|
||||||
|
|
||||||
// types
|
// types
|
||||||
import { IWorkspace, IWorkspaceMember, IWorkspaceMemberInvitation } from "types";
|
import {
|
||||||
|
ILastActiveWorkspaceDetails,
|
||||||
|
IWorkspace,
|
||||||
|
IWorkspaceMember,
|
||||||
|
IWorkspaceMemberInvitation,
|
||||||
|
} from "types";
|
||||||
|
|
||||||
class WorkspaceService extends APIService {
|
class WorkspaceService extends APIService {
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -97,6 +103,16 @@ class WorkspaceService extends APIService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getLastActiveWorkspaceAndProjects(): Promise<ILastActiveWorkspaceDetails> {
|
||||||
|
return this.get(LAST_ACTIVE_WORKSPACE_AND_PROJECTS)
|
||||||
|
.then((response) => {
|
||||||
|
return response?.data;
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
throw error?.response?.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
async userWorkspaceInvitations(): Promise<IWorkspaceMemberInvitation[]> {
|
async userWorkspaceInvitations(): Promise<IWorkspaceMemberInvitation[]> {
|
||||||
return this.get(USER_WORKSPACE_INVITATIONS)
|
return this.get(USER_WORKSPACE_INVITATIONS)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
@ -33,11 +33,11 @@ import { Menu, Transition } from "@headlessui/react";
|
|||||||
const MyIssues: NextPage = () => {
|
const MyIssues: NextPage = () => {
|
||||||
const [selectedWorkspace, setSelectedWorkspace] = useState<string | null>(null);
|
const [selectedWorkspace, setSelectedWorkspace] = useState<string | null>(null);
|
||||||
|
|
||||||
const { user, workspaces } = useUser();
|
const { user, workspaces, activeWorkspace } = useUser();
|
||||||
|
|
||||||
const { data: myIssues, mutate: mutateMyIssues } = useSWR<IIssue[]>(
|
const { data: myIssues, mutate: mutateMyIssues } = useSWR<IIssue[]>(
|
||||||
user ? USER_ISSUE : null,
|
user && activeWorkspace ? USER_ISSUE(activeWorkspace.slug) : null,
|
||||||
user ? () => userService.userIssues() : null
|
user && activeWorkspace ? () => userService.userIssues(activeWorkspace.slug) : null
|
||||||
);
|
);
|
||||||
|
|
||||||
const updateMyIssues = (
|
const updateMyIssues = (
|
||||||
|
@ -1,24 +1,30 @@
|
|||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
// next
|
// next
|
||||||
|
import Link from "next/link";
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import type { NextPage } from "next";
|
import type { NextPage } from "next";
|
||||||
|
// swr
|
||||||
|
import useSWR from "swr";
|
||||||
// react hook form
|
// react hook form
|
||||||
import { useForm } from "react-hook-form";
|
import { useForm } from "react-hook-form";
|
||||||
// react dropzone
|
// react dropzone
|
||||||
import Dropzone, { useDropzone } from "react-dropzone";
|
import Dropzone from "react-dropzone";
|
||||||
// hooks
|
// hooks
|
||||||
import useUser from "lib/hooks/useUser";
|
import useUser from "lib/hooks/useUser";
|
||||||
|
import useToast from "lib/hooks/useToast";
|
||||||
// hoc
|
// hoc
|
||||||
import withAuth from "lib/hoc/withAuthWrapper";
|
import withAuth from "lib/hoc/withAuthWrapper";
|
||||||
// layouts
|
// layouts
|
||||||
import AppLayout from "layouts/AppLayout";
|
import AppLayout from "layouts/AppLayout";
|
||||||
|
// constants
|
||||||
|
import { USER_ISSUE, USER_WORKSPACE_INVITATIONS } from "constants/fetch-keys";
|
||||||
// services
|
// services
|
||||||
import userService from "lib/services/user.service";
|
import userService from "lib/services/user.service";
|
||||||
import fileServices from "lib/services/file.service";
|
import fileServices from "lib/services/file.service";
|
||||||
|
import workspaceService from "lib/services/workspace.service";
|
||||||
// ui
|
// ui
|
||||||
import { BreadcrumbItem, Breadcrumbs, Button, Input, Spinner } from "ui";
|
import { BreadcrumbItem, Breadcrumbs, Button, Input, Spinner } from "ui";
|
||||||
// types
|
// icons
|
||||||
import type { IIssue, IUser, IWorkspaceMemberInvitation } from "types";
|
|
||||||
import {
|
import {
|
||||||
ChevronRightIcon,
|
ChevronRightIcon,
|
||||||
ClipboardDocumentListIcon,
|
ClipboardDocumentListIcon,
|
||||||
@ -28,11 +34,8 @@ import {
|
|||||||
UserPlusIcon,
|
UserPlusIcon,
|
||||||
XMarkIcon,
|
XMarkIcon,
|
||||||
} from "@heroicons/react/24/outline";
|
} from "@heroicons/react/24/outline";
|
||||||
import useSWR from "swr";
|
// types
|
||||||
import { USER_ISSUE, USER_WORKSPACE_INVITATIONS } from "constants/fetch-keys";
|
import type { IIssue, IUser } from "types";
|
||||||
import useToast from "lib/hooks/useToast";
|
|
||||||
import Link from "next/link";
|
|
||||||
import workspaceService from "lib/services/workspace.service";
|
|
||||||
|
|
||||||
const defaultValues: Partial<IUser> = {
|
const defaultValues: Partial<IUser> = {
|
||||||
avatar: "",
|
avatar: "",
|
||||||
@ -46,13 +49,19 @@ const Profile: NextPage = () => {
|
|||||||
const [isImageUploading, setIsImageUploading] = useState(false);
|
const [isImageUploading, setIsImageUploading] = useState(false);
|
||||||
const [isEditing, setIsEditing] = useState(false);
|
const [isEditing, setIsEditing] = useState(false);
|
||||||
|
|
||||||
const { user: myProfile, mutateUser, projects } = useUser();
|
const { user: myProfile, mutateUser, projects, activeWorkspace } = useUser();
|
||||||
|
|
||||||
const { setToastAlert } = useToast();
|
const { setToastAlert } = useToast();
|
||||||
|
|
||||||
const onSubmit = (formData: IUser) => {
|
const onSubmit = (formData: IUser) => {
|
||||||
|
const payload: Partial<IUser> = {
|
||||||
|
id: formData.id,
|
||||||
|
first_name: formData.first_name,
|
||||||
|
last_name: formData.last_name,
|
||||||
|
avatar: formData.avatar,
|
||||||
|
};
|
||||||
userService
|
userService
|
||||||
.updateUser(formData)
|
.updateUser(payload)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
mutateUser(response, false);
|
mutateUser(response, false);
|
||||||
setIsEditing(false);
|
setIsEditing(false);
|
||||||
@ -77,13 +86,12 @@ const Profile: NextPage = () => {
|
|||||||
} = useForm<IUser>({ defaultValues });
|
} = useForm<IUser>({ defaultValues });
|
||||||
|
|
||||||
const { data: myIssues } = useSWR<IIssue[]>(
|
const { data: myIssues } = useSWR<IIssue[]>(
|
||||||
myProfile ? USER_ISSUE : null,
|
myProfile && activeWorkspace ? USER_ISSUE(activeWorkspace.slug) : null,
|
||||||
myProfile ? () => userService.userIssues() : null
|
myProfile && activeWorkspace ? () => userService.userIssues(activeWorkspace.slug) : null
|
||||||
);
|
);
|
||||||
|
|
||||||
const { data: invitations } = useSWR<IWorkspaceMemberInvitation[]>(
|
const { data: invitations } = useSWR(USER_WORKSPACE_INVITATIONS, () =>
|
||||||
USER_WORKSPACE_INVITATIONS,
|
workspaceService.userWorkspaceInvitations()
|
||||||
() => workspaceService.userWorkspaceInvitations()
|
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -95,7 +103,7 @@ const Profile: NextPage = () => {
|
|||||||
icon: RectangleStackIcon,
|
icon: RectangleStackIcon,
|
||||||
title: "My Issues",
|
title: "My Issues",
|
||||||
number: myIssues?.length ?? 0,
|
number: myIssues?.length ?? 0,
|
||||||
description: "View the list of issues assigned to you across the workspace.",
|
description: "View the list of issues assigned to you for this workspace.",
|
||||||
href: "/me/my-issues",
|
href: "/me/my-issues",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -128,7 +136,8 @@ const Profile: NextPage = () => {
|
|||||||
<>
|
<>
|
||||||
<div className="space-y-5">
|
<div className="space-y-5">
|
||||||
<section className="relative p-5 rounded-xl flex gap-10 bg-secondary">
|
<section className="relative p-5 rounded-xl flex gap-10 bg-secondary">
|
||||||
<div
|
<button
|
||||||
|
type="button"
|
||||||
className="absolute top-4 right-4 bg-indigo-100 hover:bg-theme hover:text-white rounded p-1 cursor-pointer duration-300"
|
className="absolute top-4 right-4 bg-indigo-100 hover:bg-theme hover:text-white rounded p-1 cursor-pointer duration-300"
|
||||||
onClick={() => setIsEditing((prevData) => !prevData)}
|
onClick={() => setIsEditing((prevData) => !prevData)}
|
||||||
>
|
>
|
||||||
@ -137,7 +146,7 @@ const Profile: NextPage = () => {
|
|||||||
) : (
|
) : (
|
||||||
<PencilIcon className="h-4 w-4" />
|
<PencilIcon className="h-4 w-4" />
|
||||||
)}
|
)}
|
||||||
</div>
|
</button>
|
||||||
<div className="flex-shrink-0">
|
<div className="flex-shrink-0">
|
||||||
<Dropzone
|
<Dropzone
|
||||||
multiple={false}
|
multiple={false}
|
||||||
@ -244,21 +253,7 @@ const Profile: NextPage = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<h4 className="text-sm text-gray-500">Email ID</h4>
|
<h4 className="text-sm text-gray-500">Email ID</h4>
|
||||||
{isEditing ? (
|
<h2>{myProfile.email}</h2>
|
||||||
<Input
|
|
||||||
id="email"
|
|
||||||
type="email"
|
|
||||||
register={register}
|
|
||||||
error={errors.email}
|
|
||||||
name="email"
|
|
||||||
validations={{
|
|
||||||
required: "Email is required",
|
|
||||||
}}
|
|
||||||
placeholder="Enter email"
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<h2>{myProfile.email}</h2>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{isEditing && (
|
{isEditing && (
|
||||||
|
@ -26,8 +26,8 @@ const Workspace: NextPage = () => {
|
|||||||
const { user, activeWorkspace, projects } = useUser();
|
const { user, activeWorkspace, projects } = useUser();
|
||||||
|
|
||||||
const { data: myIssues } = useSWR<IIssue[]>(
|
const { data: myIssues } = useSWR<IIssue[]>(
|
||||||
user ? USER_ISSUE : null,
|
user && activeWorkspace ? USER_ISSUE(activeWorkspace.slug) : null,
|
||||||
user ? () => userService.userIssues() : null
|
user && activeWorkspace ? () => userService.userIssues(activeWorkspace.slug) : null
|
||||||
);
|
);
|
||||||
|
|
||||||
const cards = [
|
const cards = [
|
||||||
|
@ -3,6 +3,8 @@ import React, { useEffect, useState } from "react";
|
|||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
// react hook form
|
// react hook form
|
||||||
import { useForm } from "react-hook-form";
|
import { useForm } from "react-hook-form";
|
||||||
|
// headless ui
|
||||||
|
import { Tab } from "@headlessui/react";
|
||||||
// react dropzone
|
// react dropzone
|
||||||
import Dropzone from "react-dropzone";
|
import Dropzone from "react-dropzone";
|
||||||
// services
|
// services
|
||||||
@ -17,13 +19,12 @@ import AppLayout from "layouts/AppLayout";
|
|||||||
import useUser from "lib/hooks/useUser";
|
import useUser from "lib/hooks/useUser";
|
||||||
import useToast from "lib/hooks/useToast";
|
import useToast from "lib/hooks/useToast";
|
||||||
// components
|
// components
|
||||||
import ConfirmWorkspaceDeletion from "components/workspace/ConfirmWorkspaceDeletion";
|
import ConfirmWorkspaceDeletion from "components/workspace/confirm-workspace-deletion";
|
||||||
// ui
|
// ui
|
||||||
import { Spinner, Button, Input, Select } from "ui";
|
import { Spinner, Button, Input, Select } from "ui";
|
||||||
import { BreadcrumbItem, Breadcrumbs } from "ui/Breadcrumbs";
|
import { BreadcrumbItem, Breadcrumbs } from "ui/Breadcrumbs";
|
||||||
// types
|
// types
|
||||||
import type { IWorkspace } from "types";
|
import type { IWorkspace } from "types";
|
||||||
import { Tab } from "@headlessui/react";
|
|
||||||
|
|
||||||
const defaultValues: Partial<IWorkspace> = {
|
const defaultValues: Partial<IWorkspace> = {
|
||||||
name: "",
|
name: "",
|
||||||
@ -90,7 +91,13 @@ const WorkspaceSettings = () => {
|
|||||||
title: "Plane - Workspace Settings",
|
title: "Plane - Workspace Settings",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ConfirmWorkspaceDeletion isOpen={isOpen} setIsOpen={setIsOpen} />
|
<ConfirmWorkspaceDeletion
|
||||||
|
isOpen={isOpen}
|
||||||
|
onClose={() => {
|
||||||
|
setIsOpen(false);
|
||||||
|
}}
|
||||||
|
data={activeWorkspace ?? null}
|
||||||
|
/>
|
||||||
<div className="space-y-5">
|
<div className="space-y-5">
|
||||||
<Breadcrumbs>
|
<Breadcrumbs>
|
||||||
<BreadcrumbItem title={`${activeWorkspace?.name ?? "Workspace"} Settings`} />
|
<BreadcrumbItem title={`${activeWorkspace?.name ?? "Workspace"} Settings`} />
|
||||||
|
5
apps/app/types/workspace.d.ts
vendored
5
apps/app/types/workspace.d.ts
vendored
@ -36,3 +36,8 @@ export interface IWorkspaceMember {
|
|||||||
created_by: string;
|
created_by: string;
|
||||||
updated_by: string;
|
updated_by: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ILastActiveWorkspaceDetails {
|
||||||
|
workspace_details: IWorkspace;
|
||||||
|
project_details: IProject[];
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user