mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-16 14:25:22 +00:00
fix nits
This commit is contained in:
parent
87efbf7d69
commit
674511a2bb
3 changed files with 39 additions and 81 deletions
|
|
@ -4,7 +4,6 @@ import { Button } from "@/components/ui/button";
|
||||||
import { ColumnDef } from "@tanstack/react-table"
|
import { ColumnDef } from "@tanstack/react-table"
|
||||||
import { resolveServerPath } from "@/app/api/(client)/client";
|
import { resolveServerPath } from "@/app/api/(client)/client";
|
||||||
import { createPathWithQueryParams } from "@/lib/utils";
|
import { createPathWithQueryParams } from "@/lib/utils";
|
||||||
import { useToast } from "@/components/hooks/use-toast";
|
|
||||||
|
|
||||||
export type InviteColumnInfo = {
|
export type InviteColumnInfo = {
|
||||||
id: string;
|
id: string;
|
||||||
|
|
@ -39,9 +38,13 @@ export const inviteTableColumns = (displayToast: (message: string) => void): Col
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
const basePath = `${window.location.origin}${resolveServerPath('/')}`;
|
const basePath = `${window.location.origin}${resolveServerPath('/')}`;
|
||||||
const url = createPathWithQueryParams(`${basePath}redeem?invite_id=${invite.id}`);
|
const url = createPathWithQueryParams(`${basePath}redeem?invite_id=${invite.id}`);
|
||||||
navigator.clipboard.writeText(url);
|
navigator.clipboard.writeText(url)
|
||||||
|
.then(() => {
|
||||||
displayToast("✅ Copied invite link");
|
displayToast("✅ Copied invite link");
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
displayToast("❌ Failed to copy invite link");
|
||||||
|
})
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ import githubLogo from "@/public/github.svg";
|
||||||
import googleLogo from "@/public/google.svg";
|
import googleLogo from "@/public/google.svg";
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { checkIfUserHasOrg } from "@/actions";
|
|
||||||
const SIGNIN_ERROR_URL = "/login";
|
const SIGNIN_ERROR_URL = "/login";
|
||||||
|
|
||||||
export default async function Login(props: {
|
export default async function Login(props: {
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,34 @@ interface RedeemPageProps {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface ErrorLayoutProps {
|
||||||
|
title: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ErrorLayout({ title }: ErrorLayoutProps) {
|
||||||
|
return (
|
||||||
|
<div className="flex flex-col justify-center items-center mt-8 mb-8 md:mt-18 w-full px-5">
|
||||||
|
<div className="max-h-44 w-auto mb-4">
|
||||||
|
<Image
|
||||||
|
src={logoDark}
|
||||||
|
className="h-18 md:h-40 w-auto hidden dark:block"
|
||||||
|
alt={"Sourcebot logo"}
|
||||||
|
priority={true}
|
||||||
|
/>
|
||||||
|
<Image
|
||||||
|
src={logoLight}
|
||||||
|
className="h-18 md:h-40 w-auto block dark:hidden"
|
||||||
|
alt={"Sourcebot logo"}
|
||||||
|
priority={true}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="flex justify-center items-center">
|
||||||
|
<h1>{title}</h1>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export default async function RedeemPage({ searchParams }: RedeemPageProps) {
|
export default async function RedeemPage({ searchParams }: RedeemPageProps) {
|
||||||
const invite_id = searchParams?.invite_id;
|
const invite_id = searchParams?.invite_id;
|
||||||
|
|
||||||
|
|
@ -28,25 +56,7 @@ export default async function RedeemPage({ searchParams }: RedeemPageProps) {
|
||||||
|
|
||||||
if (!invite) {
|
if (!invite) {
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col justify-center items-center mt-8 mb-8 md:mt-18 w-full px-5">
|
<ErrorLayout title="This invite has either expired or was revoked. Contact your organization owner." />
|
||||||
<div className="max-h-44 w-auto mb-4">
|
|
||||||
<Image
|
|
||||||
src={logoDark}
|
|
||||||
className="h-18 md:h-40 w-auto hidden dark:block"
|
|
||||||
alt={"Sourcebot logo"}
|
|
||||||
priority={true}
|
|
||||||
/>
|
|
||||||
<Image
|
|
||||||
src={logoLight}
|
|
||||||
className="h-18 md:h-40 w-auto block dark:hidden"
|
|
||||||
alt={"Sourcebot logo"}
|
|
||||||
priority={true}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className="flex justify-center items-center">
|
|
||||||
<h1>This invite has either expired or was revoked. Contact your organization owner.</h1>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -61,25 +71,7 @@ export default async function RedeemPage({ searchParams }: RedeemPageProps) {
|
||||||
if (user) {
|
if (user) {
|
||||||
if (user.email !== invite.recipientEmail) {
|
if (user.email !== invite.recipientEmail) {
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col justify-center items-center mt-8 mb-8 md:mt-18 w-full px-5">
|
<ErrorLayout title={`This invite doesn't belong to you. You're currenly signed in with ${user.email}`} />
|
||||||
<div className="max-h-44 w-auto mb-4">
|
|
||||||
<Image
|
|
||||||
src={logoDark}
|
|
||||||
className="h-18 md:h-40 w-auto hidden dark:block"
|
|
||||||
alt={"Sourcebot logo"}
|
|
||||||
priority={true}
|
|
||||||
/>
|
|
||||||
<Image
|
|
||||||
src={logoLight}
|
|
||||||
className="h-18 md:h-40 w-auto block dark:hidden"
|
|
||||||
alt={"Sourcebot logo"}
|
|
||||||
priority={true}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className="flex justify-center items-center">
|
|
||||||
<h1>This invite doesn't belong to you. You're currenly signed in with ${user.email}</h1>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
const org = await prisma.org.findUnique({
|
const org = await prisma.org.findUnique({
|
||||||
|
|
@ -88,25 +80,7 @@ export default async function RedeemPage({ searchParams }: RedeemPageProps) {
|
||||||
|
|
||||||
if (!org) {
|
if (!org) {
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col justify-center items-center mt-8 mb-8 md:mt-18 w-full px-5">
|
<ErrorLayout title="This organization wasn't found. Please contact your organization owner." />
|
||||||
<div className="max-h-44 w-auto mb-4">
|
|
||||||
<Image
|
|
||||||
src={logoDark}
|
|
||||||
className="h-18 md:h-40 w-auto hidden dark:block"
|
|
||||||
alt={"Sourcebot logo"}
|
|
||||||
priority={true}
|
|
||||||
/>
|
|
||||||
<Image
|
|
||||||
src={logoLight}
|
|
||||||
className="h-18 md:h-40 w-auto block dark:hidden"
|
|
||||||
alt={"Sourcebot logo"}
|
|
||||||
priority={true}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className="flex justify-center items-center">
|
|
||||||
<h1>This organization wasn't found. Please contact your organization owner.</h1>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -115,25 +89,7 @@ export default async function RedeemPage({ searchParams }: RedeemPageProps) {
|
||||||
const subscription = await fetchSubscription(org.domain);
|
const subscription = await fetchSubscription(org.domain);
|
||||||
if (isServiceError(subscription)) {
|
if (isServiceError(subscription)) {
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col justify-center items-center mt-8 mb-8 md:mt-18 w-full px-5">
|
<ErrorLayout title="This organization's subscription has expired. Please renew the subscription and try again." />
|
||||||
<div className="max-h-44 w-auto mb-4">
|
|
||||||
<Image
|
|
||||||
src={logoDark}
|
|
||||||
className="h-18 md:h-40 w-auto hidden dark:block"
|
|
||||||
alt={"Sourcebot logo"}
|
|
||||||
priority={true}
|
|
||||||
/>
|
|
||||||
<Image
|
|
||||||
src={logoLight}
|
|
||||||
className="h-18 md:h-40 w-auto block dark:hidden"
|
|
||||||
alt={"Sourcebot logo"}
|
|
||||||
priority={true}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className="flex justify-center items-center">
|
|
||||||
<h1>This organization's subscription has expired. Please renew the subscription and try again.</h1>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue