mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
44f8ba407d
* auth integration fixes * auth integration fixes * auth integration fixes * auth integration fixes * dev: update user api to return fallback workspace and improve the structure of the response * dev: fix the issue keyerror and move onboarding logic to serializer method field * dev: use-user-auth hook imlemented for route access validation and build issues resolved effected by user payload * fix: global theme color fix * style: new onboarding ui , fix: use-user-auth hook implemented * fix: command palette, project invite modal and issue detail page mutation type fix * fix: onboarding redirection fix * dev: build isuue resolved * fix: use user auth hook fix * fix: sign in toast alert fix, sign out redirection fix and user theme error fix * fix: user response fix * fix: unAuthorizedStatus logic updated --------- Co-authored-by: pablohashescobar <nikhilschacko@gmail.com> Co-authored-by: gurusainath <gurusainath007@gmail.com> Co-authored-by: anmolsinghbhatia <anmolsinghbhatia@caravel.tech>
63 lines
1.9 KiB
TypeScript
63 lines
1.9 KiB
TypeScript
import React from "react";
|
|
// next
|
|
import Link from "next/link";
|
|
import Image from "next/image";
|
|
import { useRouter } from "next/router";
|
|
// layouts
|
|
import DefaultLayout from "layouts/default-layout";
|
|
// hooks
|
|
import useUser from "hooks/use-user";
|
|
// images
|
|
import ProjectNotAuthorizedImg from "public/auth/project-not-authorized.svg";
|
|
import WorkspaceNotAuthorizedImg from "public/auth/workspace-not-authorized.svg";
|
|
|
|
type Props = {
|
|
actionButton?: React.ReactNode;
|
|
type: "project" | "workspace";
|
|
};
|
|
|
|
export const NotAuthorizedView: React.FC<Props> = ({ actionButton, type }) => {
|
|
const { user } = useUser();
|
|
const { asPath: currentPath } = useRouter();
|
|
|
|
return (
|
|
<DefaultLayout>
|
|
<div className="flex h-full w-full flex-col items-center justify-center gap-y-5 bg-brand-surface-1 text-center">
|
|
<div className="h-44 w-72">
|
|
<Image
|
|
src={type === "project" ? ProjectNotAuthorizedImg : WorkspaceNotAuthorizedImg}
|
|
height="176"
|
|
width="288"
|
|
alt="ProjectSettingImg"
|
|
/>
|
|
</div>
|
|
<h1 className="text-xl font-medium text-brand-base">
|
|
Oops! You are not authorized to view this page
|
|
</h1>
|
|
|
|
<div className="w-full max-w-md text-base text-brand-secondary">
|
|
{user ? (
|
|
<p>
|
|
You have signed in as {user.email}. <br />
|
|
<Link href={`/?next=${currentPath}`}>
|
|
<a className="font-medium text-brand-base">Sign in</a>
|
|
</Link>{" "}
|
|
with different account that has access to this page.
|
|
</p>
|
|
) : (
|
|
<p>
|
|
You need to{" "}
|
|
<Link href={`/?next=${currentPath}`}>
|
|
<a className="font-medium text-brand-base">Sign in</a>
|
|
</Link>{" "}
|
|
with an account that has access to this page.
|
|
</p>
|
|
)}
|
|
</div>
|
|
|
|
{actionButton}
|
|
</div>
|
|
</DefaultLayout>
|
|
);
|
|
};
|