feat: changes

This commit is contained in:
Nevo David 2024-03-09 23:16:55 +07:00
parent 6390eb502d
commit 3d27d68cc8
5 changed files with 14 additions and 17 deletions

View File

@ -1,5 +0,0 @@
import {redirect} from "next/navigation";
export default async function Page() {
return redirect('/analytics');
}

View File

@ -47,7 +47,7 @@ export const AnalyticsComponent: FC = () => {
<div className="flex flex-1 flex-col gap-[15px] min-h-[426px]">
<h2 className="text-[24px]">Stars per day</h2>
<div className="flex-1 bg-secondary">
<StarsTableComponent stars={stars.stars} />
{!!stars?.stars?.length ? <StarsTableComponent stars={stars.stars} /> : <div className="py-[24px] px-[16px]">Load your GitHub repository from settings to see analytics</div>}
</div>
</div>
</div>

View File

@ -23,10 +23,7 @@ export const LayoutSettings = ({ children }: { children: ReactNode }) => {
return await (await fetch(path)).json();
}, []);
const { data: user } = useSWR(
'/user/self',
load
);
const { data: user } = useSWR('/user/self', load);
return (
<ContextWrapper user={user}>
@ -43,7 +40,7 @@ export const LayoutSettings = ({ children }: { children: ReactNode }) => {
</div>
<div className="mt-[12px]">Gitroom</div>
</Link>
<TopMenu />
{user?.orgId ? <TopMenu /> : <div />}
<div className="flex items-center gap-[8px]">
<NotificationComponent />
<OrganizationSelector />

View File

@ -166,7 +166,6 @@ export const TeamsComponent = () => {
const remove = useCallback(
(toRemove: { user: { id: string } }) => async () => {
console.log(toRemove);
if (
!(await deleteDialog(
'Are you sure you want to remove this team member?'

View File

@ -1,7 +1,7 @@
import { NextResponse } from 'next/server';
import type { NextRequest } from 'next/server';
import { fetchBackend } from '@gitroom/helpers/utils/custom.fetch.func';
import {removeSubdomain} from "@gitroom/helpers/subdomain/subdomain.management";
import { removeSubdomain } from '@gitroom/helpers/subdomain/subdomain.management';
// This function can be marked `async` if using `await` inside
export async function middleware(request: NextRequest) {
@ -20,7 +20,8 @@ export async function middleware(request: NextRequest) {
httpOnly: true,
secure: true,
maxAge: -1,
domain: '.' + new URL(removeSubdomain(process.env.FRONTEND_URL!)).hostname,
domain:
'.' + new URL(removeSubdomain(process.env.FRONTEND_URL!)).hostname,
});
return response;
}
@ -46,7 +47,8 @@ export async function middleware(request: NextRequest) {
httpOnly: true,
secure: true,
expires: new Date(Date.now() + 15 * 60 * 1000),
domain: '.' + new URL(removeSubdomain(process.env.FRONTEND_URL!)).hostname,
domain:
'.' + new URL(removeSubdomain(process.env.FRONTEND_URL!)).hostname,
});
return redirect;
}
@ -77,15 +79,19 @@ export async function middleware(request: NextRequest) {
httpOnly: true,
secure: true,
expires: new Date(Date.now() + 15 * 60 * 1000),
domain: '.' + new URL(removeSubdomain(process.env.FRONTEND_URL!)).hostname,
domain:
'.' + new URL(removeSubdomain(process.env.FRONTEND_URL!)).hostname,
});
}
return redirect;
}
return NextResponse.next();
if (nextUrl.pathname === '/') {
return NextResponse.redirect(new URL(`/analytics`, nextUrl.href));
}
return NextResponse.next();
} catch (err) {
return NextResponse.redirect(new URL('/auth/logout', nextUrl.href));
}