Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions e2e/dashboard-widgets.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,6 @@ test.beforeEach(async ({ page }) => {
secure: false,
expires: Math.floor(Date.now() / 1000) + 60 * 60,
},
{
name: "playwright-dashboard-auth",
value: "1",
domain: "127.0.0.1",
path: "/",
httpOnly: true,
sameSite: "Lax",
secure: false,
expires: Math.floor(Date.now() / 1000) + 60 * 60,
},
]);

await page.route("**/api/auth/session", async (route) => {
Expand Down
1 change: 0 additions & 1 deletion playwright.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export default defineConfig({
NEXT_PUBLIC_SUPABASE_URL: "https://placeholder.supabase.co",
NEXT_PUBLIC_SUPABASE_ANON_KEY: "placeholder-anon-key",
SUPABASE_SERVICE_ROLE_KEY: "placeholder-service-role-key",
PLAYWRIGHT_AUTH_BYPASS: "1",
},
},
projects: [
Expand Down
3 changes: 2 additions & 1 deletion src/app/api/metrics/weekly-summary/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ export async function GET() {
items: Array<{
created_at: string;
state: string;
pull_request?: { merged_at: string | null };
}>;
};

Expand All @@ -187,7 +188,7 @@ export async function GET() {
const createdAt = new Date(item.created_at);
if (createdAt >= currentWeekStart) {
prsOpenedThisWeek++;
if (item.state === "closed") {
if (item.pull_request?.merged_at != null) {
prsMergedThisWeek++;
}
}
Expand Down
13 changes: 2 additions & 11 deletions src/app/dashboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,12 @@ import ExportButton from "@/components/ExportButton";
import Link from "next/link";
import PersonalRecords from "@/components/PersonalRecords";
import { authOptions } from "@/lib/auth";
import { cookies } from "next/headers";
import { getServerSession } from "next-auth";
import { redirect } from "next/navigation";

export default async function DashboardPage() {
const allowPlaywrightBypass =
process.env.PLAYWRIGHT_AUTH_BYPASS === "1" &&
cookies().get("playwright-dashboard-auth")?.value === "1";
const session = allowPlaywrightBypass
? null
: await getServerSession(authOptions);

if (!session && !allowPlaywrightBypass) {
redirect("/");
}
const session = await getServerSession(authOptions);
if (!session) redirect("/");

return (
<div className="min-h-screen bg-[var(--background)] p-4 md:p-8 text-[var(--foreground)] transition-colors">
Expand Down
Loading