fix skip onboarding if no orgs/projects
This commit is contained in:
@@ -2,7 +2,6 @@ import PageLayout from '@/app/(app)/[organizationSlug]/[projectId]/page-layout';
|
||||
import { OverviewFiltersButtons } from '@/components/overview/filters/overview-filters-buttons';
|
||||
import { OverviewFiltersDrawer } from '@/components/overview/filters/overview-filters-drawer';
|
||||
import ServerLiveCounter from '@/components/overview/live-counter';
|
||||
import { OverviewLiveHistogram } from '@/components/overview/overview-live-histogram';
|
||||
import OverviewShareServer from '@/components/overview/overview-share';
|
||||
import OverviewTopDevices from '@/components/overview/overview-top-devices';
|
||||
import OverviewTopEvents from '@/components/overview/overview-top-events';
|
||||
|
||||
@@ -7,9 +7,9 @@ type Props = {
|
||||
const Page = ({ children }: Props) => {
|
||||
return (
|
||||
<>
|
||||
<div className="bg-def-200">
|
||||
<div className="bg-def-100">
|
||||
<div className="grid h-full md:grid-cols-[min(400px,40vw)_1fr]">
|
||||
<div className="to-def-200 min-h-screen border-r border-r-background bg-gradient-to-r from-background max-md:hidden">
|
||||
<div className="min-h-screen border-r border-r-background bg-gradient-to-r from-background to-def-200 max-md:hidden">
|
||||
<LiveEventsServer />
|
||||
</div>
|
||||
<div className="min-h-screen">{children}</div>
|
||||
|
||||
@@ -3,7 +3,7 @@ import { SignUp } from '@clerk/nextjs';
|
||||
export default function Page() {
|
||||
return (
|
||||
<div className="flex min-h-screen items-center justify-center p-4">
|
||||
<SignUp signInUrl="/register" />
|
||||
<SignUp signInUrl="/login" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,20 +1,44 @@
|
||||
'use client';
|
||||
|
||||
import { useEffect } from 'react';
|
||||
import { showConfirm } from '@/modals';
|
||||
import { api } from '@/trpc/client';
|
||||
import { useAuth } from '@clerk/nextjs';
|
||||
import { ChevronLastIcon } from 'lucide-react';
|
||||
import Link from 'next/link';
|
||||
import { usePathname } from 'next/navigation';
|
||||
import { usePathname, useRouter } from 'next/navigation';
|
||||
|
||||
const SkipOnboarding = () => {
|
||||
const router = useRouter();
|
||||
const pathname = usePathname();
|
||||
const res = api.onboarding.skipOnboardingCheck.useQuery();
|
||||
const auth = useAuth();
|
||||
useEffect(() => {
|
||||
res.refetch();
|
||||
}, [pathname]);
|
||||
|
||||
console.log(res.data);
|
||||
|
||||
if (!pathname.startsWith('/onboarding')) return null;
|
||||
return (
|
||||
<Link
|
||||
href="/"
|
||||
<button
|
||||
onClick={() => {
|
||||
if (res.data?.canSkip && res.data?.url) {
|
||||
router.push(res.data.url);
|
||||
} else {
|
||||
showConfirm({
|
||||
title: 'Skip onboarding?',
|
||||
text: 'Are you sure you want to skip onboarding? Since you do not have any projects, you will be logged out.',
|
||||
onConfirm() {
|
||||
auth.signOut();
|
||||
},
|
||||
});
|
||||
}
|
||||
}}
|
||||
className="flex items-center gap-2 text-sm text-muted-foreground"
|
||||
>
|
||||
Skip onboarding
|
||||
<ChevronLastIcon size={16} />
|
||||
</Link>
|
||||
</button>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user