forked from github/plane
fix: bug fixes and improvement (#2992)
* chore: issue sidebar permission bug fix and not authorized page redirection added * chore: unauthorized project setting page improvement * fix: build error fix
This commit is contained in:
parent
5f880029bd
commit
1c82354a76
@ -8,6 +8,8 @@ import { renderEmoji } from "helpers/emoji.helper";
|
|||||||
// hooks
|
// hooks
|
||||||
import { useMobxStore } from "lib/mobx/store-provider";
|
import { useMobxStore } from "lib/mobx/store-provider";
|
||||||
import { observer } from "mobx-react-lite";
|
import { observer } from "mobx-react-lite";
|
||||||
|
// constants
|
||||||
|
import { EUserWorkspaceRoles } from "constants/workspace";
|
||||||
|
|
||||||
export interface IProjectSettingHeader {
|
export interface IProjectSettingHeader {
|
||||||
title: string;
|
title: string;
|
||||||
@ -18,9 +20,14 @@ export const ProjectSettingHeader: FC<IProjectSettingHeader> = observer((props)
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { workspaceSlug } = router.query;
|
const { workspaceSlug } = router.query;
|
||||||
// store
|
// store
|
||||||
const { project: projectStore } = useMobxStore();
|
const {
|
||||||
|
project: projectStore,
|
||||||
|
user: { currentProjectRole },
|
||||||
|
} = useMobxStore();
|
||||||
const { currentProjectDetails } = projectStore;
|
const { currentProjectDetails } = projectStore;
|
||||||
|
|
||||||
|
if (currentProjectRole && currentProjectRole <= EUserWorkspaceRoles.VIEWER) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="relative flex w-full flex-shrink-0 flex-row z-10 h-[3.75rem] items-center justify-between gap-x-2 gap-y-4 border-b border-custom-border-200 bg-custom-sidebar-background-100 p-4">
|
<div className="relative flex w-full flex-shrink-0 flex-row z-10 h-[3.75rem] items-center justify-between gap-x-2 gap-y-4 border-b border-custom-border-200 bg-custom-sidebar-background-100 p-4">
|
||||||
<div className="flex items-center gap-2 flex-grow w-full whitespace-nowrap overflow-ellipsis">
|
<div className="flex items-center gap-2 flex-grow w-full whitespace-nowrap overflow-ellipsis">
|
||||||
|
@ -89,7 +89,7 @@ export const SidebarLabelSelect: React.FC<Props> = observer((props) => {
|
|||||||
|
|
||||||
if (label)
|
if (label)
|
||||||
return (
|
return (
|
||||||
<span
|
<button
|
||||||
key={label.id}
|
key={label.id}
|
||||||
className="group flex cursor-pointer items-center gap-1 rounded-2xl border border-custom-border-100 px-1 py-0.5 text-xs hover:border-red-500/20 hover:bg-red-500/20"
|
className="group flex cursor-pointer items-center gap-1 rounded-2xl border border-custom-border-100 px-1 py-0.5 text-xs hover:border-red-500/20 hover:bg-red-500/20"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
@ -98,6 +98,7 @@ export const SidebarLabelSelect: React.FC<Props> = observer((props) => {
|
|||||||
labels: updatedLabels,
|
labels: updatedLabels,
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
|
disabled={uneditable}
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
className="h-2 w-2 flex-shrink-0 rounded-full"
|
className="h-2 w-2 flex-shrink-0 rounded-full"
|
||||||
@ -107,7 +108,7 @@ export const SidebarLabelSelect: React.FC<Props> = observer((props) => {
|
|||||||
/>
|
/>
|
||||||
{label.name}
|
{label.name}
|
||||||
<X className="h-2 w-2 group-hover:text-red-500" />
|
<X className="h-2 w-2 group-hover:text-red-500" />
|
||||||
</span>
|
</button>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
<IssueLabelSelect
|
<IssueLabelSelect
|
||||||
@ -209,6 +210,7 @@ export const SidebarLabelSelect: React.FC<Props> = observer((props) => {
|
|||||||
type="button"
|
type="button"
|
||||||
className="grid place-items-center rounded bg-red-500 p-2.5"
|
className="grid place-items-center rounded bg-red-500 p-2.5"
|
||||||
onClick={() => setCreateLabelForm(false)}
|
onClick={() => setCreateLabelForm(false)}
|
||||||
|
disabled={uneditable}
|
||||||
>
|
>
|
||||||
<X className="h-4 w-4 text-white" />
|
<X className="h-4 w-4 text-white" />
|
||||||
</button>
|
</button>
|
||||||
|
@ -226,7 +226,6 @@ export const ModuleDetailsSidebar: React.FC<Props> = observer((props) => {
|
|||||||
: null;
|
: null;
|
||||||
|
|
||||||
const handleEditLink = (link: ILinkDetails) => {
|
const handleEditLink = (link: ILinkDetails) => {
|
||||||
console.log("link", link);
|
|
||||||
setSelectedLinkToUpdate(link);
|
setSelectedLinkToUpdate(link);
|
||||||
setModuleLinkModal(true);
|
setModuleLinkModal(true);
|
||||||
};
|
};
|
||||||
|
@ -61,7 +61,7 @@ export const CustomDatePicker: React.FC<Props> = ({
|
|||||||
noBorder ? "" : "border border-custom-border-200"
|
noBorder ? "" : "border border-custom-border-200"
|
||||||
} w-full rounded-md caret-transparent outline-none ${className}`}
|
} w-full rounded-md caret-transparent outline-none ${className}`}
|
||||||
dateFormat="MMM dd, yyyy"
|
dateFormat="MMM dd, yyyy"
|
||||||
isClearable={isClearable}
|
isClearable={Boolean(isClearable && !disabled)}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
maxDate={maxDate}
|
maxDate={maxDate}
|
||||||
minDate={minDate}
|
minDate={minDate}
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
import { FC, ReactNode } from "react";
|
import { FC, ReactNode } from "react";
|
||||||
|
import { useRouter } from "next/router";
|
||||||
// components
|
// components
|
||||||
import { ProjectSettingsSidebar } from "./sidebar";
|
import { ProjectSettingsSidebar } from "./sidebar";
|
||||||
import { useMobxStore } from "lib/mobx/store-provider";
|
import { useMobxStore } from "lib/mobx/store-provider";
|
||||||
import { EUserWorkspaceRoles } from "constants/workspace";
|
import { EUserWorkspaceRoles } from "constants/workspace";
|
||||||
import { NotAuthorizedView } from "components/auth-screens";
|
import { NotAuthorizedView } from "components/auth-screens";
|
||||||
import { observer } from "mobx-react-lite";
|
import { observer } from "mobx-react-lite";
|
||||||
|
import { Button, LayersIcon } from "@plane/ui";
|
||||||
|
|
||||||
export interface IProjectSettingLayout {
|
export interface IProjectSettingLayout {
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
@ -13,6 +15,9 @@ export interface IProjectSettingLayout {
|
|||||||
export const ProjectSettingLayout: FC<IProjectSettingLayout> = observer((props) => {
|
export const ProjectSettingLayout: FC<IProjectSettingLayout> = observer((props) => {
|
||||||
const { children } = props;
|
const { children } = props;
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
const { workspaceSlug, projectId } = router.query;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
user: { currentProjectRole },
|
user: { currentProjectRole },
|
||||||
} = useMobxStore();
|
} = useMobxStore();
|
||||||
@ -20,7 +25,19 @@ export const ProjectSettingLayout: FC<IProjectSettingLayout> = observer((props)
|
|||||||
const restrictViewSettings = currentProjectRole && currentProjectRole <= EUserWorkspaceRoles.VIEWER;
|
const restrictViewSettings = currentProjectRole && currentProjectRole <= EUserWorkspaceRoles.VIEWER;
|
||||||
|
|
||||||
return restrictViewSettings ? (
|
return restrictViewSettings ? (
|
||||||
<NotAuthorizedView type="project" />
|
<NotAuthorizedView
|
||||||
|
type="project"
|
||||||
|
actionButton={
|
||||||
|
<Button
|
||||||
|
variant="primary"
|
||||||
|
size="md"
|
||||||
|
prependIcon={<LayersIcon />}
|
||||||
|
onClick={() => router.push(`/${workspaceSlug}/projects/${projectId}/issues`)}
|
||||||
|
>
|
||||||
|
Go to issues
|
||||||
|
</Button>
|
||||||
|
}
|
||||||
|
/>
|
||||||
) : (
|
) : (
|
||||||
<div className="flex gap-2 h-full w-full overflow-x-hidden overflow-y-scroll">
|
<div className="flex gap-2 h-full w-full overflow-x-hidden overflow-y-scroll">
|
||||||
<div className="w-80 pt-8 overflow-y-hidden flex-shrink-0">
|
<div className="w-80 pt-8 overflow-y-hidden flex-shrink-0">
|
||||||
|
Loading…
Reference in New Issue
Block a user