mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
style: settings page redesigned
This commit is contained in:
parent
a2db04f9ff
commit
e0f28e5199
@ -56,7 +56,7 @@ const SingleIssue: React.FC<Props> = ({
|
|||||||
>
|
>
|
||||||
<div className="group/card relative p-2 select-none">
|
<div className="group/card relative p-2 select-none">
|
||||||
{handleDeleteIssue && (
|
{handleDeleteIssue && (
|
||||||
<div className="opacity-0 group-hover/card:opacity-100 absolute top-1 right-1 z-10">
|
<div className="opacity-0 group-hover/card:opacity-100 absolute top-1.5 right-1.5 z-10">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="h-7 w-7 p-1 grid place-items-center rounded text-red-500 bg-white hover:bg-red-50 duration-300 outline-none"
|
className="h-7 w-7 p-1 grid place-items-center rounded text-red-500 bg-white hover:bg-red-50 duration-300 outline-none"
|
||||||
|
@ -33,13 +33,15 @@ const ControlSettings: React.FC<Props> = ({ control, isSubmitting }) => {
|
|||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<section className="space-y-5">
|
<section className="space-y-8">
|
||||||
<div>
|
<div>
|
||||||
<h3 className="text-lg font-medium leading-6 text-gray-900">Control</h3>
|
<h3 className="text-3xl font-bold leading-6 text-gray-900">Control</h3>
|
||||||
<p className="mt-1 text-sm text-gray-500">Set the control for the project.</p>
|
<p className="mt-4 text-sm text-gray-500">Set the control for the project.</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex justify-between gap-3">
|
<div className="grid grid-cols-2 gap-16">
|
||||||
<div className="w-full md:w-1/2">
|
<div>
|
||||||
|
<h4 className="text-md leading-6 text-gray-900 mb-1">Project Lead</h4>
|
||||||
|
<p className="text-sm text-gray-500 mb-3">Select the project leader.</p>
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="project_lead"
|
name="project_lead"
|
||||||
@ -47,18 +49,13 @@ const ControlSettings: React.FC<Props> = ({ control, isSubmitting }) => {
|
|||||||
<Listbox value={value} onChange={onChange}>
|
<Listbox value={value} onChange={onChange}>
|
||||||
{({ open }) => (
|
{({ open }) => (
|
||||||
<>
|
<>
|
||||||
<Listbox.Label>
|
|
||||||
<div className="text-gray-500 mb-2">Project Lead</div>
|
|
||||||
</Listbox.Label>
|
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<Listbox.Button className="bg-white relative w-full border border-gray-300 rounded-md shadow-sm pl-3 pr-10 py-2 text-left cursor-default focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm">
|
<Listbox.Button className="relative w-full flex justify-between items-center gap-4 border border-gray-300 rounded-md shadow-sm p-3 text-left cursor-default focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm">
|
||||||
<span className="block truncate">
|
<span className="block truncate">
|
||||||
{people?.find((person) => person.member.id === value)?.member
|
{people?.find((person) => person.member.id === value)?.member
|
||||||
.first_name ?? "Select Lead"}
|
.first_name ?? "Select Lead"}
|
||||||
</span>
|
</span>
|
||||||
<span className="absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none">
|
<ChevronDownIcon className="h-5 w-5 text-gray-400" aria-hidden="true" />
|
||||||
<ChevronDownIcon className="h-5 w-5 text-gray-400" aria-hidden="true" />
|
|
||||||
</span>
|
|
||||||
</Listbox.Button>
|
</Listbox.Button>
|
||||||
|
|
||||||
<Transition
|
<Transition
|
||||||
@ -68,14 +65,14 @@ const ControlSettings: React.FC<Props> = ({ control, isSubmitting }) => {
|
|||||||
leaveFrom="opacity-100"
|
leaveFrom="opacity-100"
|
||||||
leaveTo="opacity-0"
|
leaveTo="opacity-0"
|
||||||
>
|
>
|
||||||
<Listbox.Options className="absolute z-10 mt-1 w-full bg-white shadow-lg max-h-60 rounded-md py-1 text-base ring-1 ring-black ring-opacity-5 overflow-auto focus:outline-none sm:text-sm">
|
<Listbox.Options className="absolute z-20 mt-1 w-full bg-white shadow-lg max-h-60 rounded-md py-1 text-base ring-1 ring-black ring-opacity-5 overflow-auto focus:outline-none sm:text-sm">
|
||||||
{people?.map((person) => (
|
{people?.map((person) => (
|
||||||
<Listbox.Option
|
<Listbox.Option
|
||||||
key={person.id}
|
key={person.id}
|
||||||
className={({ active }) =>
|
className={({ active }) =>
|
||||||
`${
|
`${
|
||||||
active ? "text-white bg-theme" : "text-gray-900"
|
active ? "bg-indigo-50" : ""
|
||||||
} cursor-default select-none relative py-2 pl-3 pr-9`
|
} text-gray-900 cursor-default select-none relative px-3 py-2`
|
||||||
}
|
}
|
||||||
value={person.member.id}
|
value={person.member.id}
|
||||||
>
|
>
|
||||||
@ -86,7 +83,9 @@ const ControlSettings: React.FC<Props> = ({ control, isSubmitting }) => {
|
|||||||
selected ? "font-semibold" : "font-normal"
|
selected ? "font-semibold" : "font-normal"
|
||||||
} block truncate`}
|
} block truncate`}
|
||||||
>
|
>
|
||||||
{person.member.first_name}
|
{person.member.first_name !== ""
|
||||||
|
? person.member.first_name
|
||||||
|
: person.member.email}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
{selected ? (
|
{selected ? (
|
||||||
@ -111,7 +110,11 @@ const ControlSettings: React.FC<Props> = ({ control, isSubmitting }) => {
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="w-full md:w-1/2">
|
<div>
|
||||||
|
<h4 className="text-md leading-6 text-gray-900 mb-1">Default Assignee</h4>
|
||||||
|
<p className="text-sm text-gray-500 mb-3">
|
||||||
|
Select the default assignee for the project.
|
||||||
|
</p>
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="default_assignee"
|
name="default_assignee"
|
||||||
@ -119,18 +122,13 @@ const ControlSettings: React.FC<Props> = ({ control, isSubmitting }) => {
|
|||||||
<Listbox value={value} onChange={onChange}>
|
<Listbox value={value} onChange={onChange}>
|
||||||
{({ open }) => (
|
{({ open }) => (
|
||||||
<>
|
<>
|
||||||
<Listbox.Label>
|
|
||||||
<div className="text-gray-500 mb-2">Default Assignee</div>
|
|
||||||
</Listbox.Label>
|
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<Listbox.Button className="bg-white relative w-full border border-gray-300 rounded-md shadow-sm pl-3 pr-10 py-2 text-left cursor-default focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm">
|
<Listbox.Button className="relative w-full flex justify-between items-center gap-4 border border-gray-300 rounded-md shadow-sm p-3 text-left cursor-default focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm">
|
||||||
<span className="block truncate">
|
<span className="block truncate">
|
||||||
{people?.find((p) => p.member.id === value)?.member.first_name ??
|
{people?.find((p) => p.member.id === value)?.member.first_name ??
|
||||||
"Select Default Assignee"}
|
"Select Default Assignee"}
|
||||||
</span>
|
</span>
|
||||||
<span className="absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none">
|
<ChevronDownIcon className="h-5 w-5 text-gray-400" aria-hidden="true" />
|
||||||
<ChevronDownIcon className="h-5 w-5 text-gray-400" aria-hidden="true" />
|
|
||||||
</span>
|
|
||||||
</Listbox.Button>
|
</Listbox.Button>
|
||||||
|
|
||||||
<Transition
|
<Transition
|
||||||
@ -140,14 +138,14 @@ const ControlSettings: React.FC<Props> = ({ control, isSubmitting }) => {
|
|||||||
leaveFrom="opacity-100"
|
leaveFrom="opacity-100"
|
||||||
leaveTo="opacity-0"
|
leaveTo="opacity-0"
|
||||||
>
|
>
|
||||||
<Listbox.Options className="absolute z-10 mt-1 w-full bg-white shadow-lg max-h-60 rounded-md py-1 text-base ring-1 ring-black ring-opacity-5 overflow-auto focus:outline-none sm:text-sm">
|
<Listbox.Options className="absolute z-20 mt-1 w-full bg-white shadow-lg max-h-60 rounded-md py-1 text-base ring-1 ring-black ring-opacity-5 overflow-auto focus:outline-none sm:text-sm">
|
||||||
{people?.map((person) => (
|
{people?.map((person) => (
|
||||||
<Listbox.Option
|
<Listbox.Option
|
||||||
key={person.id}
|
key={person.id}
|
||||||
className={({ active }) =>
|
className={({ active }) =>
|
||||||
`${
|
`${
|
||||||
active ? "text-white bg-theme" : "text-gray-900"
|
active ? "bg-indigo-50" : ""
|
||||||
} cursor-default select-none relative py-2 pl-3 pr-9`
|
} text-gray-900 cursor-default select-none relative px-3 py-2`
|
||||||
}
|
}
|
||||||
value={person.member.id}
|
value={person.member.id}
|
||||||
>
|
>
|
||||||
@ -158,7 +156,9 @@ const ControlSettings: React.FC<Props> = ({ control, isSubmitting }) => {
|
|||||||
selected ? "font-semibold" : "font-normal"
|
selected ? "font-semibold" : "font-normal"
|
||||||
} block truncate`}
|
} block truncate`}
|
||||||
>
|
>
|
||||||
{person.member.first_name}
|
{person.member.first_name !== ""
|
||||||
|
? person.member.first_name
|
||||||
|
: person.member.email}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
{selected ? (
|
{selected ? (
|
||||||
@ -184,7 +184,7 @@ const ControlSettings: React.FC<Props> = ({ control, isSubmitting }) => {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex justify-end">
|
<div>
|
||||||
<Button type="submit" disabled={isSubmitting}>
|
<Button type="submit" disabled={isSubmitting}>
|
||||||
{isSubmitting ? "Updating Project..." : "Update Project"}
|
{isSubmitting ? "Updating Project..." : "Update Project"}
|
||||||
</Button>
|
</Button>
|
||||||
|
@ -45,68 +45,70 @@ const GeneralSettings: React.FC<Props> = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<section className="space-y-5">
|
<section className="space-y-8">
|
||||||
<div>
|
<div>
|
||||||
<h3 className="text-lg font-medium leading-6 text-gray-900">General</h3>
|
<h3 className="text-3xl font-bold leading-6 text-gray-900">General</h3>
|
||||||
<p className="mt-1 text-sm text-gray-500">
|
<p className="mt-4 text-sm text-gray-500">
|
||||||
This information will be displayed to every member of the project.
|
This information will be displayed to every member of the project.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="grid grid-cols-10 gap-3 items-center">
|
<div className="grid grid-cols-2 gap-16">
|
||||||
<div className="col-span-1">
|
<div>
|
||||||
<div>
|
<h4 className="text-md leading-6 text-gray-900 mb-1">Icon & Name</h4>
|
||||||
<label htmlFor="icon" className="text-gray-500 mb-2">
|
<p className="text-sm text-gray-500 mb-3">Select an icon and a name for the project.</p>
|
||||||
Icon
|
<div className="flex gap-2">
|
||||||
</label>
|
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="icon"
|
name="icon"
|
||||||
render={({ field: { value, onChange } }) => (
|
render={({ field: { value, onChange } }) => (
|
||||||
<EmojiIconPicker
|
<EmojiIconPicker
|
||||||
label={value ? String.fromCodePoint(parseInt(value)) : "Select Icon"}
|
label={value ? String.fromCodePoint(parseInt(value)) : "Icon"}
|
||||||
value={value}
|
value={value}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
<Input
|
||||||
|
id="name"
|
||||||
|
name="name"
|
||||||
|
error={errors.name}
|
||||||
|
register={register}
|
||||||
|
placeholder="Project Name"
|
||||||
|
size="lg"
|
||||||
|
className="w-auto"
|
||||||
|
validations={{
|
||||||
|
required: "Name is required",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="col-span-5">
|
<div>
|
||||||
<Input
|
<h4 className="text-md leading-6 text-gray-900 mb-1">Description</h4>
|
||||||
id="name"
|
<p className="text-sm text-gray-500 mb-3">Give a description to the project.</p>
|
||||||
name="name"
|
<TextArea
|
||||||
error={errors.name}
|
id="description"
|
||||||
|
name="description"
|
||||||
|
error={errors.description}
|
||||||
register={register}
|
register={register}
|
||||||
placeholder="Project Name"
|
placeholder="Enter project description"
|
||||||
label="Name"
|
|
||||||
validations={{
|
validations={{
|
||||||
required: "Name is required",
|
required: "Description is required",
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="col-span-2">
|
<div>
|
||||||
<Select
|
<h4 className="text-md leading-6 text-gray-900 mb-1">Identifier</h4>
|
||||||
name="network"
|
<p className="text-sm text-gray-500 mb-3">
|
||||||
id="network"
|
Create a 1-6 characters{"'"} identifier for the project.
|
||||||
options={Object.keys(NETWORK_CHOICES).map((key) => ({
|
</p>
|
||||||
value: key,
|
|
||||||
label: NETWORK_CHOICES[key as keyof typeof NETWORK_CHOICES],
|
|
||||||
}))}
|
|
||||||
label="Network"
|
|
||||||
register={register}
|
|
||||||
validations={{
|
|
||||||
required: "Network is required",
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className="col-span-2">
|
|
||||||
<Input
|
<Input
|
||||||
id="identifier"
|
id="identifier"
|
||||||
name="identifier"
|
name="identifier"
|
||||||
error={errors.identifier}
|
error={errors.identifier}
|
||||||
register={register}
|
register={register}
|
||||||
placeholder="Enter identifier"
|
placeholder="Enter identifier"
|
||||||
label="Identifier"
|
className="w-40"
|
||||||
|
size="lg"
|
||||||
onChange={(e: any) => {
|
onChange={(e: any) => {
|
||||||
if (!activeWorkspace || !e.target.value) return;
|
if (!activeWorkspace || !e.target.value) return;
|
||||||
checkIdentifierAvailability(activeWorkspace.slug, e.target.value);
|
checkIdentifierAvailability(activeWorkspace.slug, e.target.value);
|
||||||
@ -124,21 +126,26 @@ const GeneralSettings: React.FC<Props> = ({
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<h4 className="text-md leading-6 text-gray-900 mb-1">Network</h4>
|
||||||
|
<p className="text-sm text-gray-500 mb-3">Select privacy type for the project.</p>
|
||||||
|
<Select
|
||||||
|
name="network"
|
||||||
|
id="network"
|
||||||
|
options={Object.keys(NETWORK_CHOICES).map((key) => ({
|
||||||
|
value: key,
|
||||||
|
label: NETWORK_CHOICES[key as keyof typeof NETWORK_CHOICES],
|
||||||
|
}))}
|
||||||
|
size="lg"
|
||||||
|
register={register}
|
||||||
|
validations={{
|
||||||
|
required: "Network is required",
|
||||||
|
}}
|
||||||
|
className="w-40"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<TextArea
|
|
||||||
id="description"
|
|
||||||
name="description"
|
|
||||||
error={errors.description}
|
|
||||||
register={register}
|
|
||||||
label="Description"
|
|
||||||
placeholder="Enter project description"
|
|
||||||
validations={{
|
|
||||||
required: "Description is required",
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className="flex justify-end">
|
|
||||||
<Button type="submit" disabled={isSubmitting}>
|
<Button type="submit" disabled={isSubmitting}>
|
||||||
{isSubmitting ? "Updating Project..." : "Update Project"}
|
{isSubmitting ? "Updating Project..." : "Update Project"}
|
||||||
</Button>
|
</Button>
|
||||||
|
@ -11,17 +11,11 @@ import issuesServices from "lib/services/issues.service";
|
|||||||
// hooks
|
// hooks
|
||||||
import useUser from "lib/hooks/useUser";
|
import useUser from "lib/hooks/useUser";
|
||||||
// headless ui
|
// headless ui
|
||||||
import { Popover, Transition, Menu } from "@headlessui/react";
|
import { Popover, Transition } from "@headlessui/react";
|
||||||
// ui
|
// ui
|
||||||
import { Button, CustomMenu, Input, Spinner } from "ui";
|
import { Button, Input, Spinner } from "ui";
|
||||||
// icons
|
// icons
|
||||||
import {
|
import { PlusIcon } from "@heroicons/react/24/outline";
|
||||||
ChevronDownIcon,
|
|
||||||
EllipsisHorizontalIcon,
|
|
||||||
PencilIcon,
|
|
||||||
PlusIcon,
|
|
||||||
RectangleGroupIcon,
|
|
||||||
} from "@heroicons/react/24/outline";
|
|
||||||
// types
|
// types
|
||||||
import { IIssueLabels } from "types";
|
import { IIssueLabels } from "types";
|
||||||
// fetch-keys
|
// fetch-keys
|
||||||
@ -109,11 +103,11 @@ const LabelsSettings: React.FC = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<section className="space-y-5">
|
<section className="space-y-8">
|
||||||
<div className="flex items-center justify-between">
|
<div className="md:w-2/3 flex justify-between items-center gap-2">
|
||||||
<div>
|
<div>
|
||||||
<h3 className="text-lg font-medium leading-6 text-gray-900">Labels</h3>
|
<h3 className="text-3xl font-bold leading-6 text-gray-900">Labels</h3>
|
||||||
<p className="mt-1 text-sm text-gray-500">Manage the labels of this project.</p>
|
<p className="mt-4 text-sm text-gray-500">Manage the labels of this project.</p>
|
||||||
</div>
|
</div>
|
||||||
<Button
|
<Button
|
||||||
theme="secondary"
|
theme="secondary"
|
||||||
|
@ -25,7 +25,7 @@ const defaultValues: Partial<IIssueLabels> = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const SingleLabel: React.FC<Props> = ({ label, issueLabels, editLabel, handleLabelDelete }) => {
|
const SingleLabel: React.FC<Props> = ({ label, issueLabels, editLabel, handleLabelDelete }) => {
|
||||||
const [newLabelForm, setNewLabelForm] = useState(true);
|
const [newLabelForm, setNewLabelForm] = useState(false);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
register,
|
register,
|
||||||
@ -54,7 +54,7 @@ const SingleLabel: React.FC<Props> = ({ label, issueLabels, editLabel, handleLab
|
|||||||
<h6 className="text-sm">{label.name}</h6>
|
<h6 className="text-sm">{label.name}</h6>
|
||||||
</div>
|
</div>
|
||||||
<CustomMenu ellipsis>
|
<CustomMenu ellipsis>
|
||||||
<CustomMenu.MenuItem>Convert to group</CustomMenu.MenuItem>
|
{/* <CustomMenu.MenuItem>Convert to group</CustomMenu.MenuItem> */}
|
||||||
<CustomMenu.MenuItem
|
<CustomMenu.MenuItem
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
editLabel(label);
|
editLabel(label);
|
||||||
|
261
apps/app/components/project/settings/members.tsx
Normal file
261
apps/app/components/project/settings/members.tsx
Normal file
@ -0,0 +1,261 @@
|
|||||||
|
// react
|
||||||
|
import { useState } from "react";
|
||||||
|
// next
|
||||||
|
import Image from "next/image";
|
||||||
|
import useSWR from "swr";
|
||||||
|
// services
|
||||||
|
import projectService from "lib/services/project.service";
|
||||||
|
// hooks
|
||||||
|
import useUser from "lib/hooks/useUser";
|
||||||
|
import useToast from "lib/hooks/useToast";
|
||||||
|
// components
|
||||||
|
import ConfirmProjectMemberRemove from "components/project/confirm-project-member-remove";
|
||||||
|
import SendProjectInvitationModal from "components/project/send-project-invitation-modal";
|
||||||
|
// ui
|
||||||
|
import { Button, CustomListbox, CustomMenu, Spinner } from "ui";
|
||||||
|
// fetch-keys
|
||||||
|
import { PROJECT_INVITATIONS, PROJECT_MEMBERS } from "constants/fetch-keys";
|
||||||
|
import { PlusIcon } from "@heroicons/react/24/outline";
|
||||||
|
|
||||||
|
type Props = { projectId: string };
|
||||||
|
|
||||||
|
const ROLE = {
|
||||||
|
5: "Guest",
|
||||||
|
10: "Viewer",
|
||||||
|
15: "Member",
|
||||||
|
20: "Admin",
|
||||||
|
};
|
||||||
|
|
||||||
|
const MembersSettings: React.FC<Props> = ({ projectId }) => {
|
||||||
|
const [selectedMember, setSelectedMember] = useState<string | null>(null);
|
||||||
|
const [selectedRemoveMember, setSelectedRemoveMember] = useState<string | null>(null);
|
||||||
|
const [selectedInviteRemoveMember, setSelectedInviteRemoveMember] = useState<string | null>(null);
|
||||||
|
const [inviteModal, setInviteModal] = useState(false);
|
||||||
|
|
||||||
|
const { activeWorkspace } = useUser();
|
||||||
|
|
||||||
|
const { setToastAlert } = useToast();
|
||||||
|
|
||||||
|
const { data: projectMembers, mutate: mutateMembers } = useSWR(
|
||||||
|
activeWorkspace && projectId ? PROJECT_MEMBERS(projectId as string) : null,
|
||||||
|
activeWorkspace && projectId
|
||||||
|
? () => projectService.projectMembers(activeWorkspace.slug, projectId as any)
|
||||||
|
: null,
|
||||||
|
{
|
||||||
|
onErrorRetry(err, _, __, revalidate, revalidateOpts) {
|
||||||
|
if (err?.status === 403) return;
|
||||||
|
setTimeout(() => revalidate(revalidateOpts), 5000);
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
const { data: projectInvitations, mutate: mutateInvitations } = useSWR(
|
||||||
|
activeWorkspace && projectId ? PROJECT_INVITATIONS : null,
|
||||||
|
activeWorkspace && projectId
|
||||||
|
? () => projectService.projectInvitations(activeWorkspace.slug, projectId as any)
|
||||||
|
: null
|
||||||
|
);
|
||||||
|
|
||||||
|
let members = [
|
||||||
|
...(projectMembers?.map((item: any) => ({
|
||||||
|
id: item.id,
|
||||||
|
avatar: item.member?.avatar,
|
||||||
|
first_name: item.member?.first_name,
|
||||||
|
last_name: item.member?.last_name,
|
||||||
|
email: item.member?.email,
|
||||||
|
role: item.role,
|
||||||
|
status: true,
|
||||||
|
member: true,
|
||||||
|
})) || []),
|
||||||
|
...(projectInvitations?.map((item: any) => ({
|
||||||
|
id: item.id,
|
||||||
|
avatar: item.avatar ?? "",
|
||||||
|
first_name: item.first_name ?? item.email,
|
||||||
|
last_name: item.last_name ?? "",
|
||||||
|
email: item.email,
|
||||||
|
role: item.role,
|
||||||
|
status: item.accepted,
|
||||||
|
member: false,
|
||||||
|
})) || []),
|
||||||
|
];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<ConfirmProjectMemberRemove
|
||||||
|
isOpen={Boolean(selectedRemoveMember) || Boolean(selectedInviteRemoveMember)}
|
||||||
|
onClose={() => {
|
||||||
|
setSelectedRemoveMember(null);
|
||||||
|
setSelectedInviteRemoveMember(null);
|
||||||
|
}}
|
||||||
|
data={members.find(
|
||||||
|
(item) => item.id === selectedRemoveMember || item.id === selectedInviteRemoveMember
|
||||||
|
)}
|
||||||
|
handleDelete={async () => {
|
||||||
|
if (!activeWorkspace || !projectId) return;
|
||||||
|
if (selectedRemoveMember) {
|
||||||
|
await projectService.deleteProjectMember(
|
||||||
|
activeWorkspace.slug,
|
||||||
|
projectId as string,
|
||||||
|
selectedRemoveMember
|
||||||
|
);
|
||||||
|
mutateMembers(
|
||||||
|
(prevData) => prevData?.filter((item: any) => item.id !== selectedRemoveMember),
|
||||||
|
false
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (selectedInviteRemoveMember) {
|
||||||
|
await projectService.deleteProjectInvitation(
|
||||||
|
activeWorkspace.slug,
|
||||||
|
projectId as string,
|
||||||
|
selectedInviteRemoveMember
|
||||||
|
);
|
||||||
|
mutateInvitations(
|
||||||
|
(prevData) => prevData?.filter((item: any) => item.id !== selectedInviteRemoveMember),
|
||||||
|
false
|
||||||
|
);
|
||||||
|
}
|
||||||
|
setToastAlert({
|
||||||
|
type: "success",
|
||||||
|
message: "Member removed successfully",
|
||||||
|
title: "Success",
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<SendProjectInvitationModal
|
||||||
|
isOpen={inviteModal}
|
||||||
|
setIsOpen={setInviteModal}
|
||||||
|
members={members}
|
||||||
|
/>
|
||||||
|
<section className="space-y-8">
|
||||||
|
<div>
|
||||||
|
<h3 className="text-3xl font-bold leading-6 text-gray-900">Members</h3>
|
||||||
|
<p className="mt-4 text-sm text-gray-500">Manage all the members of the project.</p>
|
||||||
|
</div>
|
||||||
|
{!projectMembers || !projectInvitations ? (
|
||||||
|
<div className="h-full w-full grid place-items-center px-4 sm:px-0">
|
||||||
|
<Spinner />
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<div className="md:w-2/3">
|
||||||
|
<div className="flex justify-between items-center gap-2">
|
||||||
|
<h4 className="text-md leading-6 text-gray-900 mb-1">Manage members</h4>
|
||||||
|
<Button
|
||||||
|
theme="secondary"
|
||||||
|
className="flex items-center gap-x-1"
|
||||||
|
onClick={() => setInviteModal(true)}
|
||||||
|
>
|
||||||
|
<PlusIcon className="h-4 w-4" />
|
||||||
|
Add Member
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
<div className="space-y-6 mt-6">
|
||||||
|
{members.length > 0
|
||||||
|
? members.map((member) => (
|
||||||
|
<div key={member.id} className="flex justify-between items-center">
|
||||||
|
<div className="flex items-center gap-x-8 gap-y-2">
|
||||||
|
<div className="h-10 w-10 p-4 flex items-center justify-center bg-gray-700 text-white rounded uppercase relative">
|
||||||
|
{member.avatar && member.avatar !== "" ? (
|
||||||
|
<Image
|
||||||
|
src={member.avatar}
|
||||||
|
alt={member.first_name}
|
||||||
|
layout="fill"
|
||||||
|
objectFit="cover"
|
||||||
|
className="rounded"
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
member.first_name.charAt(0) ?? "N"
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h4 className="text-sm">
|
||||||
|
{member.first_name} {member.last_name}
|
||||||
|
</h4>
|
||||||
|
<p className="text-xs text-gray-500">{member.email}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center gap-2 text-xs">
|
||||||
|
{selectedMember === member.id ? (
|
||||||
|
<CustomListbox
|
||||||
|
options={Object.keys(ROLE).map((key) => ({
|
||||||
|
value: key,
|
||||||
|
display: ROLE[parseInt(key) as keyof typeof ROLE],
|
||||||
|
}))}
|
||||||
|
title={ROLE[member.role as keyof typeof ROLE] ?? "Select Role"}
|
||||||
|
value={member.role}
|
||||||
|
onChange={(value) => {
|
||||||
|
if (!activeWorkspace || !projectId) return;
|
||||||
|
projectService
|
||||||
|
.updateProjectMember(
|
||||||
|
activeWorkspace.slug,
|
||||||
|
projectId as string,
|
||||||
|
member.id,
|
||||||
|
{
|
||||||
|
role: value,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.then((res) => {
|
||||||
|
setToastAlert({
|
||||||
|
type: "success",
|
||||||
|
message: "Member role updated successfully.",
|
||||||
|
title: "Success",
|
||||||
|
});
|
||||||
|
mutateMembers(
|
||||||
|
(prevData: any) =>
|
||||||
|
prevData.map((m: any) => {
|
||||||
|
return m.id === selectedMember
|
||||||
|
? { ...m, ...res, role: value }
|
||||||
|
: m;
|
||||||
|
}),
|
||||||
|
false
|
||||||
|
);
|
||||||
|
setSelectedMember(null);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
ROLE[member.role as keyof typeof ROLE] ?? "None"
|
||||||
|
)}
|
||||||
|
<CustomMenu ellipsis>
|
||||||
|
<CustomMenu.MenuItem
|
||||||
|
onClick={() => {
|
||||||
|
if (!member.member) {
|
||||||
|
setToastAlert({
|
||||||
|
type: "error",
|
||||||
|
message: "You can't edit a pending invitation.",
|
||||||
|
title: "Error",
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
setSelectedMember(member.id);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Edit
|
||||||
|
</CustomMenu.MenuItem>
|
||||||
|
<CustomMenu.MenuItem
|
||||||
|
onClick={() => {
|
||||||
|
if (member.member) {
|
||||||
|
setSelectedRemoveMember(member.id);
|
||||||
|
} else {
|
||||||
|
setSelectedInviteRemoveMember(member.id);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Remove
|
||||||
|
</CustomMenu.MenuItem>
|
||||||
|
</CustomMenu>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
))
|
||||||
|
: null}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</section>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default MembersSettings;
|
@ -7,6 +7,8 @@ import {
|
|||||||
CreateUpdateStateInline,
|
CreateUpdateStateInline,
|
||||||
} from "components/project/issues/BoardView/state/create-update-state-inline";
|
} from "components/project/issues/BoardView/state/create-update-state-inline";
|
||||||
import ConfirmStateDeletion from "components/project/issues/BoardView/state/confirm-state-delete";
|
import ConfirmStateDeletion from "components/project/issues/BoardView/state/confirm-state-delete";
|
||||||
|
// ui
|
||||||
|
import { Spinner } from "ui";
|
||||||
// icons
|
// icons
|
||||||
import { PencilSquareIcon, PlusIcon, TrashIcon } from "@heroicons/react/24/outline";
|
import { PencilSquareIcon, PlusIcon, TrashIcon } from "@heroicons/react/24/outline";
|
||||||
// constants
|
// constants
|
||||||
@ -15,7 +17,7 @@ import { addSpaceIfCamelCase, groupBy } from "constants/common";
|
|||||||
import type { IState } from "types";
|
import type { IState } from "types";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
projectId: string | string[] | undefined;
|
projectId: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
const StatesSettings: React.FC<Props> = ({ projectId }) => {
|
const StatesSettings: React.FC<Props> = ({ projectId }) => {
|
||||||
@ -37,82 +39,88 @@ const StatesSettings: React.FC<Props> = ({ projectId }) => {
|
|||||||
onClose={() => setSelectDeleteState(null)}
|
onClose={() => setSelectDeleteState(null)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<section className="space-y-5">
|
<section className="space-y-8">
|
||||||
<div>
|
<div>
|
||||||
<h3 className="text-lg font-medium leading-6 text-gray-900">State</h3>
|
<h3 className="text-3xl font-bold leading-6 text-gray-900">State</h3>
|
||||||
<p className="mt-1 text-sm text-gray-500">Manage the state of this project.</p>
|
<p className="mt-4 text-sm text-gray-500">Manage the state of this project.</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col justify-between gap-3">
|
<div className="flex flex-col justify-between gap-4">
|
||||||
{Object.keys(groupedStates).map((key) => (
|
{states ? (
|
||||||
<React.Fragment key={key}>
|
Object.keys(groupedStates).map((key) => (
|
||||||
<div className="flex justify-between w-full md:w-2/3">
|
<div key={key}>
|
||||||
<p className="font-medium capitalize">{key} states</p>
|
<div className="flex justify-between w-full md:w-2/3 mb-2">
|
||||||
<button
|
<p className="text-md leading-6 text-gray-900 capitalize">{key} states</p>
|
||||||
type="button"
|
<button
|
||||||
onClick={() => setActiveGroup(key as keyof StateGroup)}
|
type="button"
|
||||||
className="flex items-center gap-x-2 text-theme"
|
onClick={() => setActiveGroup(key as keyof StateGroup)}
|
||||||
>
|
className="flex items-center gap-x-2 text-theme"
|
||||||
<PlusIcon className="h-4 w-4 text-theme" />
|
>
|
||||||
<span>Add</span>
|
<PlusIcon className="h-4 w-4 text-theme" />
|
||||||
</button>
|
<span>Add</span>
|
||||||
</div>
|
</button>
|
||||||
<div className="md:w-2/3 space-y-1 border p-1 rounded-xl">
|
</div>
|
||||||
{key === activeGroup && (
|
<div className="md:w-2/3 space-y-1 border p-1 rounded-xl">
|
||||||
<CreateUpdateStateInline
|
{key === activeGroup && (
|
||||||
projectId={projectId as string}
|
<CreateUpdateStateInline
|
||||||
onClose={() => {
|
projectId={projectId as string}
|
||||||
setActiveGroup(null);
|
onClose={() => {
|
||||||
setSelectedState(null);
|
setActiveGroup(null);
|
||||||
}}
|
setSelectedState(null);
|
||||||
workspaceSlug={activeWorkspace?.slug}
|
}}
|
||||||
data={null}
|
workspaceSlug={activeWorkspace?.slug}
|
||||||
selectedGroup={key as keyof StateGroup}
|
data={null}
|
||||||
/>
|
selectedGroup={key as keyof StateGroup}
|
||||||
)}
|
/>
|
||||||
{groupedStates[key]?.map((state) =>
|
)}
|
||||||
state.id !== selectedState ? (
|
{groupedStates[key]?.map((state) =>
|
||||||
<div
|
state.id !== selectedState ? (
|
||||||
key={state.id}
|
<div
|
||||||
className={`bg-gray-50 p-3 flex justify-between items-center gap-2 border-b ${
|
key={state.id}
|
||||||
Boolean(activeGroup !== key) ? "last:border-0" : ""
|
className={`bg-gray-50 p-3 flex justify-between items-center gap-2 border-b ${
|
||||||
}`}
|
Boolean(activeGroup !== key) ? "last:border-0" : ""
|
||||||
>
|
}`}
|
||||||
<div className="flex items-center gap-2">
|
>
|
||||||
<div
|
<div className="flex items-center gap-2">
|
||||||
className="flex-shrink-0 h-3 w-3 rounded-full"
|
<div
|
||||||
style={{
|
className="flex-shrink-0 h-3 w-3 rounded-full"
|
||||||
backgroundColor: state.color,
|
style={{
|
||||||
|
backgroundColor: state.color,
|
||||||
|
}}
|
||||||
|
></div>
|
||||||
|
<h6 className="text-sm">{addSpaceIfCamelCase(state.name)}</h6>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<button type="button" onClick={() => setSelectDeleteState(state.id)}>
|
||||||
|
<TrashIcon className="h-4 w-4 text-red-400" />
|
||||||
|
</button>
|
||||||
|
<button type="button" onClick={() => setSelectedState(state.id)}>
|
||||||
|
<PencilSquareIcon className="h-4 w-4 text-gray-400" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<div className={`border-b last:border-b-0`} key={state.id}>
|
||||||
|
<CreateUpdateStateInline
|
||||||
|
projectId={projectId as string}
|
||||||
|
onClose={() => {
|
||||||
|
setActiveGroup(null);
|
||||||
|
setSelectedState(null);
|
||||||
}}
|
}}
|
||||||
></div>
|
workspaceSlug={activeWorkspace?.slug}
|
||||||
<h6 className="text-sm">{addSpaceIfCamelCase(state.name)}</h6>
|
data={states?.find((state) => state.id === selectedState) ?? null}
|
||||||
|
selectedGroup={key as keyof StateGroup}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-2">
|
)
|
||||||
<button type="button" onClick={() => setSelectDeleteState(state.id)}>
|
)}
|
||||||
<TrashIcon className="h-4 w-4 text-red-400" />
|
</div>
|
||||||
</button>
|
|
||||||
<button type="button" onClick={() => setSelectedState(state.id)}>
|
|
||||||
<PencilSquareIcon className="h-4 w-4 text-gray-400" />
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<div className={`border-b last:border-b-0`} key={state.id}>
|
|
||||||
<CreateUpdateStateInline
|
|
||||||
projectId={projectId as string}
|
|
||||||
onClose={() => {
|
|
||||||
setActiveGroup(null);
|
|
||||||
setSelectedState(null);
|
|
||||||
}}
|
|
||||||
workspaceSlug={activeWorkspace?.slug}
|
|
||||||
data={states?.find((state) => state.id === selectedState) ?? null}
|
|
||||||
selectedGroup={key as keyof StateGroup}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</React.Fragment>
|
))
|
||||||
))}
|
) : (
|
||||||
|
<div className="h-full w-full grid place-items-center px-4 sm:px-0">
|
||||||
|
<Spinner />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</>
|
</>
|
||||||
|
@ -35,16 +35,16 @@ const navigation = (projectId: string) => [
|
|||||||
href: `/projects/${projectId}/cycles`,
|
href: `/projects/${projectId}/cycles`,
|
||||||
icon: ArrowPathIcon,
|
icon: ArrowPathIcon,
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
name: "Modules",
|
// name: "Modules",
|
||||||
href: `/projects/${projectId}/modules`,
|
// href: `/projects/${projectId}/modules`,
|
||||||
icon: RectangleGroupIcon,
|
// icon: RectangleGroupIcon,
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
name: "Members",
|
// name: "Members",
|
||||||
href: `/projects/${projectId}/members`,
|
// href: `/projects/${projectId}/members`,
|
||||||
icon: UserGroupIcon,
|
// icon: UserGroupIcon,
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
name: "Settings",
|
name: "Settings",
|
||||||
href: `/projects/${projectId}/settings`,
|
href: `/projects/${projectId}/settings`,
|
||||||
|
@ -5,28 +5,26 @@ import type { NextPage } from "next";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
// swr
|
// swr
|
||||||
import useSWR from "swr";
|
import useSWR from "swr";
|
||||||
// headless ui
|
|
||||||
import { Menu } from "@headlessui/react";
|
|
||||||
// services
|
// services
|
||||||
import projectService from "lib/services/project.service";
|
import projectService from "lib/services/project.service";
|
||||||
// hooks
|
// hooks
|
||||||
import useUser from "lib/hooks/useUser";
|
import useUser from "lib/hooks/useUser";
|
||||||
import useToast from "lib/hooks/useToast";
|
import useToast from "lib/hooks/useToast";
|
||||||
// fetching keys
|
|
||||||
import { PROJECT_MEMBERS, PROJECT_INVITATIONS } from "constants/fetch-keys";
|
|
||||||
// hoc
|
// hoc
|
||||||
import withAuth from "lib/hoc/withAuthWrapper";
|
import withAuth from "lib/hoc/withAuthWrapper";
|
||||||
// layouts
|
// layouts
|
||||||
import AppLayout from "layouts/app-layout";
|
import AppLayout from "layouts/app-layout";
|
||||||
// components
|
// components
|
||||||
import SendProjectInvitationModal from "components/project/SendProjectInvitationModal";
|
import ConfirmProjectMemberRemove from "components/project/confirm-project-member-remove";
|
||||||
import ConfirmProjectMemberRemove from "components/project/ConfirmProjectMemberRemove";
|
import SendProjectInvitationModal from "components/project/send-project-invitation-modal";
|
||||||
|
// headless ui
|
||||||
|
import { Menu } from "@headlessui/react";
|
||||||
// ui
|
// ui
|
||||||
import { Spinner, CustomListbox } from "ui";
|
import { Spinner, CustomListbox, BreadcrumbItem, Breadcrumbs, HeaderButton } from "ui";
|
||||||
// icons
|
// icons
|
||||||
import { PlusIcon, EllipsisHorizontalIcon } from "@heroicons/react/20/solid";
|
import { PlusIcon, EllipsisHorizontalIcon } from "@heroicons/react/20/solid";
|
||||||
import HeaderButton from "ui/HeaderButton";
|
// fetch-keys
|
||||||
import { BreadcrumbItem, Breadcrumbs } from "ui/Breadcrumbs";
|
import { PROJECT_MEMBERS, PROJECT_INVITATIONS } from "constants/fetch-keys";
|
||||||
|
|
||||||
const ROLE = {
|
const ROLE = {
|
||||||
5: "Guest",
|
5: "Guest",
|
||||||
@ -63,6 +61,7 @@ const ProjectMembers: NextPage = () => {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const { data: projectInvitations, mutate: mutateInvitations } = useSWR(
|
const { data: projectInvitations, mutate: mutateInvitations } = useSWR(
|
||||||
activeWorkspace && projectId ? PROJECT_INVITATIONS : null,
|
activeWorkspace && projectId ? PROJECT_INVITATIONS : null,
|
||||||
activeWorkspace && projectId
|
activeWorkspace && projectId
|
||||||
|
@ -22,7 +22,7 @@ import useToast from "lib/hooks/useToast";
|
|||||||
// fetch keys
|
// fetch keys
|
||||||
import { PROJECT_DETAILS, PROJECTS_LIST } from "constants/fetch-keys";
|
import { PROJECT_DETAILS, PROJECTS_LIST } from "constants/fetch-keys";
|
||||||
// ui
|
// ui
|
||||||
import { Spinner } from "ui";
|
import { Button, Spinner } from "ui";
|
||||||
import { Breadcrumbs, BreadcrumbItem } from "ui/Breadcrumbs";
|
import { Breadcrumbs, BreadcrumbItem } from "ui/Breadcrumbs";
|
||||||
// types
|
// types
|
||||||
import type { IProject, IWorkspace } from "types";
|
import type { IProject, IWorkspace } from "types";
|
||||||
@ -32,6 +32,11 @@ const GeneralSettings = dynamic(() => import("components/project/settings/genera
|
|||||||
ssr: false,
|
ssr: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const MembersSettings = dynamic(() => import("components/project/settings/members"), {
|
||||||
|
loading: () => <p>Loading...</p>,
|
||||||
|
ssr: false,
|
||||||
|
});
|
||||||
|
|
||||||
const ControlSettings = dynamic(() => import("components/project/settings/control"), {
|
const ControlSettings = dynamic(() => import("components/project/settings/control"), {
|
||||||
loading: () => <p>Loading...</p>,
|
loading: () => <p>Loading...</p>,
|
||||||
ssr: false,
|
ssr: false,
|
||||||
@ -167,19 +172,16 @@ const ProjectSettings: NextPage = () => {
|
|||||||
// links={sidebarLinks}
|
// links={sidebarLinks}
|
||||||
>
|
>
|
||||||
{projectDetails ? (
|
{projectDetails ? (
|
||||||
<div className="space-y-3">
|
<div className="space-y-3 px-10">
|
||||||
<Tab.Group>
|
<Tab.Group>
|
||||||
<Tab.List className="flex items-center gap-x-4 gap-y-2 flex-wrap mb-8">
|
<Tab.List className="flex items-center gap-x-4 gap-y-2 flex-wrap mb-8">
|
||||||
{["General", "Control", "States", "Labels"].map((tab, index) => (
|
{["General", "Control", "Members", "States", "Labels"].map((tab, index) => (
|
||||||
<Tab
|
<Tab key={index}>
|
||||||
key={index}
|
{({ selected }) => (
|
||||||
className={({ selected }) =>
|
<Button theme="secondary" className={selected ? "border-theme" : ""}>
|
||||||
`px-6 py-2 border-2 border-theme hover:bg-theme hover:text-white text-xs font-medium rounded-md outline-none duration-300 ${
|
{tab}
|
||||||
selected ? "bg-theme text-white" : ""
|
</Button>
|
||||||
}`
|
)}
|
||||||
}
|
|
||||||
>
|
|
||||||
{tab}
|
|
||||||
</Tab>
|
</Tab>
|
||||||
))}
|
))}
|
||||||
</Tab.List>
|
</Tab.List>
|
||||||
@ -199,7 +201,10 @@ const ProjectSettings: NextPage = () => {
|
|||||||
</Tab.Panel>
|
</Tab.Panel>
|
||||||
</form>
|
</form>
|
||||||
<Tab.Panel>
|
<Tab.Panel>
|
||||||
<StatesSettings projectId={projectId} />
|
<MembersSettings projectId={projectId as string} />
|
||||||
|
</Tab.Panel>
|
||||||
|
<Tab.Panel>
|
||||||
|
<StatesSettings projectId={projectId as string} />
|
||||||
</Tab.Panel>
|
</Tab.Panel>
|
||||||
<Tab.Panel>
|
<Tab.Panel>
|
||||||
<LabelsSettings />
|
<LabelsSettings />
|
||||||
|
@ -33,6 +33,7 @@ const Button = React.forwardRef<HTMLButtonElement, Props>(
|
|||||||
type={type}
|
type={type}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
className={classNames(
|
className={classNames(
|
||||||
|
className,
|
||||||
"inline-flex items-center rounded justify-center font-medium",
|
"inline-flex items-center rounded justify-center font-medium",
|
||||||
theme === "primary"
|
theme === "primary"
|
||||||
? `${
|
? `${
|
||||||
@ -53,8 +54,7 @@ const Button = React.forwardRef<HTMLButtonElement, Props>(
|
|||||||
? "px-3 py-2 text-base"
|
? "px-3 py-2 text-base"
|
||||||
: size === "lg"
|
: size === "lg"
|
||||||
? "px-4 py-2 text-base"
|
? "px-4 py-2 text-base"
|
||||||
: "px-2.5 py-2 text-sm",
|
: "px-2.5 py-2 text-sm"
|
||||||
className
|
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
|
@ -13,9 +13,11 @@ const Input: React.FC<Props> = ({
|
|||||||
error,
|
error,
|
||||||
mode = "primary",
|
mode = "primary",
|
||||||
onChange,
|
onChange,
|
||||||
className,
|
className = "",
|
||||||
type,
|
type,
|
||||||
id,
|
id,
|
||||||
|
size = "rg",
|
||||||
|
fullWidth = true,
|
||||||
...rest
|
...rest
|
||||||
}) => {
|
}) => {
|
||||||
return (
|
return (
|
||||||
@ -35,14 +37,16 @@ const Input: React.FC<Props> = ({
|
|||||||
onChange && onChange(e);
|
onChange && onChange(e);
|
||||||
}}
|
}}
|
||||||
className={classNames(
|
className={classNames(
|
||||||
"mt-1 block w-full px-3 py-2 text-base focus:outline-none sm:text-sm rounded-md bg-transparent",
|
"block text-base focus:outline-none sm:text-sm rounded-md bg-transparent",
|
||||||
mode === "primary" ? "border border-gray-300 rounded-md" : "",
|
mode === "primary" ? "border border-gray-300 rounded-md" : "",
|
||||||
mode === "transparent"
|
mode === "transparent"
|
||||||
? "bg-transparent border-none transition-all ring-0 focus:ring-1 focus:ring-indigo-500 rounded"
|
? "bg-transparent border-none transition-all ring-0 focus:ring-1 focus:ring-indigo-500 rounded"
|
||||||
: "",
|
: "",
|
||||||
error ? "border-red-500" : "",
|
error ? "border-red-500" : "",
|
||||||
error && mode === "primary" ? "bg-red-100" : "",
|
error && mode === "primary" ? "bg-red-100" : "",
|
||||||
className ?? ""
|
fullWidth ? "w-full" : "",
|
||||||
|
size === "rg" ? "px-3 py-2" : size === "lg" ? "p-3" : "",
|
||||||
|
className
|
||||||
)}
|
)}
|
||||||
{...rest}
|
{...rest}
|
||||||
/>
|
/>
|
||||||
|
2
apps/app/ui/Input/types.d.ts
vendored
2
apps/app/ui/Input/types.d.ts
vendored
@ -10,4 +10,6 @@ export interface Props extends React.ComponentPropsWithoutRef<"input"> {
|
|||||||
validations?: RegisterOptions;
|
validations?: RegisterOptions;
|
||||||
error?: FieldError;
|
error?: FieldError;
|
||||||
className?: string;
|
className?: string;
|
||||||
|
size?: "rg" | "lg";
|
||||||
|
fullWidth?: boolean;
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,8 @@ const Select: React.FC<Props> = ({
|
|||||||
validations,
|
validations,
|
||||||
error,
|
error,
|
||||||
options,
|
options,
|
||||||
|
size = "rg",
|
||||||
|
fullWidth = true,
|
||||||
}) => {
|
}) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -27,7 +29,9 @@ const Select: React.FC<Props> = ({
|
|||||||
value={value}
|
value={value}
|
||||||
{...(register && register(name, validations))}
|
{...(register && register(name, validations))}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
className={`mt-1 block w-full px-3 py-2 text-base border border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md bg-transparent ${className}`}
|
className={`mt-1 block text-base border border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md bg-transparent ${
|
||||||
|
fullWidth ? "w-full" : ""
|
||||||
|
} ${size === "rg" ? "px-3 py-2" : size === "lg" ? "p-3" : ""} ${className}`}
|
||||||
>
|
>
|
||||||
{options.map((option, index) => (
|
{options.map((option, index) => (
|
||||||
<option value={option.value} key={index}>
|
<option value={option.value} key={index}>
|
||||||
|
8
apps/app/ui/Select/types.d.ts
vendored
8
apps/app/ui/Select/types.d.ts
vendored
@ -1,8 +1,4 @@
|
|||||||
import type {
|
import type { UseFormRegister, RegisterOptions, FieldError } from "react-hook-form";
|
||||||
UseFormRegister,
|
|
||||||
RegisterOptions,
|
|
||||||
FieldError,
|
|
||||||
} from "react-hook-form";
|
|
||||||
|
|
||||||
export type Props = {
|
export type Props = {
|
||||||
label?: string;
|
label?: string;
|
||||||
@ -16,4 +12,6 @@ export type Props = {
|
|||||||
error?: FieldError;
|
error?: FieldError;
|
||||||
autoComplete?: "on" | "off";
|
autoComplete?: "on" | "off";
|
||||||
options: { label: string; value: any }[];
|
options: { label: string; value: any }[];
|
||||||
|
size?: "rg" | "lg";
|
||||||
|
fullWidth?: boolean;
|
||||||
};
|
};
|
||||||
|
@ -30,7 +30,7 @@ const CustomListbox: React.FC<Props> = ({
|
|||||||
)}
|
)}
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<Listbox.Button
|
<Listbox.Button
|
||||||
className={`flex items-center gap-1 hover:bg-gray-100 relative border rounded-md shadow-sm cursor-pointer focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm duration-300 ${
|
className={`flex items-center gap-1 hover:bg-gray-100 text-xs relative border rounded-md shadow-sm cursor-pointer focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm duration-300 ${
|
||||||
width === "sm"
|
width === "sm"
|
||||||
? "w-32"
|
? "w-32"
|
||||||
: width === "md"
|
: width === "md"
|
||||||
@ -48,7 +48,7 @@ const CustomListbox: React.FC<Props> = ({
|
|||||||
${className || "px-2 py-1"}`}
|
${className || "px-2 py-1"}`}
|
||||||
>
|
>
|
||||||
{icon ?? null}
|
{icon ?? null}
|
||||||
<span className="block truncate">
|
<span className="block truncate text-xs">
|
||||||
{Array.isArray(value)
|
{Array.isArray(value)
|
||||||
? value.map((v) => options?.find((o) => o.value === v)?.display).join(", ") ||
|
? value.map((v) => options?.find((o) => o.value === v)?.display).join(", ") ||
|
||||||
`${title}`
|
`${title}`
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -39,7 +39,7 @@ const EmojiIconPicker: React.FC<Props> = ({ label, value, onChange }) => {
|
|||||||
return (
|
return (
|
||||||
<Popover className="relative" ref={ref}>
|
<Popover className="relative" ref={ref}>
|
||||||
<Popover.Button
|
<Popover.Button
|
||||||
className="bg-gray-100 px-3 py-1 rounded-full outline-none"
|
className="border border-gray-300 p-3 sm:text-sm rounded-md outline-none"
|
||||||
onClick={() => setIsOpen((prev) => !prev)}
|
onClick={() => setIsOpen((prev) => !prev)}
|
||||||
>
|
>
|
||||||
{label}
|
{label}
|
||||||
|
Loading…
Reference in New Issue
Block a user