Skip to content

Commit f1ae86d

Browse files
committed
Move analytics to separate deployment
1 parent 013c892 commit f1ae86d

File tree

16 files changed

+9055
-154
lines changed

16 files changed

+9055
-154
lines changed

.github/workflows/deploy-catalog.yml

Lines changed: 0 additions & 84 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ repos:
3838
hooks:
3939
- id: typos
4040
args: []
41-
exclude: ^(catalog/public/data/repositories.json|catalog/public/data/papers\.bib|catalog/public/data/github_metrics.json|catalog/public/data/github_metrics_history.json|repositories/crisp-nam\.yaml)$
41+
exclude: ^(catalog/public/data/.*\.json|catalog/public/data/papers\.bib|catalog-analytics/public/data/.*\.json|repositories/crisp-nam\.yaml)$
4242

4343
- repo: local
4444
hooks:

catalog-analytics/app/analytics/page.tsx renamed to catalog-analytics/app/analytics-content.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,9 @@ export default function AnalyticsPage() {
129129
useEffect(() => {
130130
const loadData = async () => {
131131
try {
132-
const basePath =
133-
process.env.NEXT_PUBLIC_BASE_PATH === "true"
134-
? "/implementation-catalog"
135-
: "";
132+
// With basePath: '/analytics' in next.config.ts, use empty string for public assets
133+
// Next.js automatically serves public files at /analytics/*
134+
const basePath = "/analytics";
136135

137136
// Load historical metrics data
138137
const metricsResponse = await fetch(

catalog-analytics/app/analytics/layout.tsx

Lines changed: 0 additions & 16 deletions
This file was deleted.

catalog-analytics/app/globals.css

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,74 @@
22
@tailwind components;
33
@tailwind utilities;
44

5+
/* Vector Institute Brand Variables */
56
:root {
6-
--background: #ffffff;
7-
--foreground: #000000;
8-
/* Vector Institute Brand Colors - Primary Palette */
7+
/* Primary Colors */
98
--vector-magenta: #EB088A;
109
--vector-black: #000000;
1110
--vector-grey: #E9E8E8;
12-
/* Vector Institute Brand Colors - Secondary Palette */
11+
12+
/* Secondary Colors */
1313
--vector-cobalt: #313CFF;
1414
--vector-violet: #8A25C9;
1515
--vector-turquoise: #48C0D9;
1616
--vector-tangerine: #FF9E00;
1717
--vector-lime: #CFF933;
18+
19+
/* Light theme */
20+
--background: #ffffff;
21+
--foreground: #000000;
22+
--card-bg: rgba(255, 255, 255, 0.95);
23+
--border: #E9E8E8;
1824
}
1925

2026
@media (prefers-color-scheme: dark) {
2127
:root {
2228
--background: #0a0a0a;
23-
--foreground: #ededed;
29+
--foreground: #ffffff;
30+
--card-bg: rgba(26, 26, 26, 0.95);
31+
--border: #2a2a2a;
2432
}
2533
}
2634

2735
body {
28-
background: var(--background);
2936
color: var(--foreground);
30-
font-family: ui-sans-serif, system-ui, sans-serif;
37+
background: var(--background);
38+
font-family: 'Open Sans', system-ui, -apple-system, sans-serif;
39+
min-height: 100vh;
3140
}
3241

3342
@layer utilities {
3443
.text-balance {
3544
text-wrap: balance;
3645
}
46+
47+
/* Vector Institute gradient backgrounds */
48+
.bg-vector-gradient {
49+
background: linear-gradient(135deg, #EB088A 0%, #8A25C9 50%, #313CFF 100%);
50+
}
51+
52+
.bg-vector-gradient-subtle {
53+
background: linear-gradient(135deg,
54+
rgba(235, 8, 138, 0.1) 0%,
55+
rgba(138, 37, 201, 0.1) 50%,
56+
rgba(49, 60, 255, 0.1) 100%);
57+
}
58+
}
59+
60+
@layer components {
61+
.card {
62+
background: var(--card-bg);
63+
border: 1px solid var(--border);
64+
border-radius: 1rem;
65+
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
66+
backdrop-filter: blur(10px);
67+
}
68+
69+
.card-highlight {
70+
background: var(--card-bg);
71+
border: 2px solid var(--vector-magenta);
72+
border-radius: 1rem;
73+
box-shadow: 0 4px 6px -1px rgba(235, 8, 138, 0.2), 0 2px 4px -2px rgba(235, 8, 138, 0.2);
74+
}
3775
}

catalog-analytics/app/login/page.tsx

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,46 @@
1-
'use client';
2-
3-
import Image from 'next/image';
4-
import { LogIn } from 'lucide-react';
1+
import Link from 'next/link';
52

63
export default function LoginPage() {
7-
const handleLogin = () => {
8-
window.location.href = '/analytics/api/auth/login';
9-
};
10-
114
return (
12-
<div className="min-h-screen bg-gradient-to-br from-gray-50 via-white to-gray-100 dark:from-gray-900 dark:via-gray-900 dark:to-gray-800 flex items-center justify-center p-4">
13-
<div className="max-w-md w-full">
14-
<div className="bg-white dark:bg-gray-800 rounded-2xl shadow-xl border border-gray-200 dark:border-gray-700 p-8">
15-
<div className="text-center mb-8">
16-
<div className="inline-flex items-center justify-center w-16 h-16 rounded-full bg-gradient-to-br from-vector-magenta to-vector-cobalt mb-4">
17-
<LogIn className="w-8 h-8 text-white" />
18-
</div>
19-
<h1 className="text-2xl font-bold text-gray-900 dark:text-white mb-2">
20-
Analytics Access
21-
</h1>
22-
<p className="text-gray-600 dark:text-gray-400">
23-
Sign in to view repository analytics
24-
</p>
25-
</div>
5+
<div className="min-h-screen bg-gradient-to-br from-slate-50 to-slate-100 dark:from-slate-900 dark:to-slate-800 flex items-center justify-center p-4">
6+
{/* Vector Brand Header Accent */}
7+
<div className="fixed top-0 left-0 right-0 h-1 bg-gradient-to-r from-vector-magenta via-vector-violet to-vector-cobalt"></div>
8+
9+
<div className="card p-8 max-w-md w-full text-center animate-fade-in">
10+
<h1 className="text-4xl font-bold bg-gradient-to-r from-vector-magenta via-vector-violet to-vector-cobalt bg-clip-text text-transparent mb-4">
11+
Catalog Analytics
12+
</h1>
13+
<p className="text-slate-600 dark:text-slate-400 mb-8">
14+
Sign in with your Vector Institute Google account to access the analytics dashboard.
15+
</p>
2616

27-
<button
28-
onClick={handleLogin}
29-
className="w-full bg-gradient-to-r from-vector-magenta to-vector-cobalt hover:from-vector-magenta/90 hover:to-vector-cobalt/90 text-white font-semibold py-3 px-6 rounded-lg transition-all shadow-lg shadow-vector-magenta/25 flex items-center justify-center gap-2"
30-
>
31-
<svg className="w-5 h-5" viewBox="0 0 24 24" fill="currentColor">
32-
<path d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z" />
33-
<path d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z" />
34-
<path d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z" />
35-
<path d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z" />
17+
<Link href="/api/auth/login">
18+
<button className="w-full flex items-center justify-center gap-3 px-6 py-4 bg-white dark:bg-slate-800 text-slate-900 dark:text-white border-2 border-slate-300 dark:border-slate-600 rounded-xl hover:border-vector-magenta dark:hover:border-vector-violet hover:shadow-lg hover:shadow-vector-magenta/20 transition-all duration-200 font-semibold">
19+
<svg className="w-6 h-6" viewBox="0 0 24 24">
20+
<path
21+
fill="#4285F4"
22+
d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"
23+
/>
24+
<path
25+
fill="#34A853"
26+
d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"
27+
/>
28+
<path
29+
fill="#FBBC05"
30+
d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"
31+
/>
32+
<path
33+
fill="#EA4335"
34+
d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"
35+
/>
3636
</svg>
3737
Sign in with Google
3838
</button>
39+
</Link>
3940

40-
<p className="mt-6 text-xs text-gray-500 dark:text-gray-400 text-center">
41-
Only Vector Institute email addresses are permitted
41+
<div className="mt-8 p-4 bg-slate-100 dark:bg-slate-800 rounded-lg">
42+
<p className="text-sm text-slate-600 dark:text-slate-400">
43+
<span className="font-semibold">Note:</span> Only Vector Institute email accounts (@vectorinstitute.ai) are allowed to access this dashboard.
4244
</p>
4345
</div>
4446
</div>

catalog-analytics/app/page.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1+
import { getSession } from '@/lib/session';
12
import { redirect } from 'next/navigation';
3+
import AnalyticsContent from './analytics-content';
24

3-
export default function HomePage() {
4-
redirect('/analytics');
5+
export default async function Home() {
6+
const session = await getSession();
7+
8+
if (!session.isAuthenticated) {
9+
redirect('/login');
10+
}
11+
12+
return <AnalyticsContent />;
513
}

catalog-analytics/lib/utils.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
/**
22
* Get the full path for an asset
3-
* For Cloud Run deployment, no base path is needed
3+
* With basePath: '/analytics', assets are served at /analytics/*
44
*/
55
export function getAssetPath(path: string): string {
6-
return path.startsWith('/') ? path : `/${path}`;
6+
const basePath = '/analytics';
7+
const cleanPath = path.startsWith('/') ? path : `/${path}`;
8+
return `${basePath}${cleanPath}`;
79
}

catalog-analytics/next.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { NextConfig } from "next";
22

33
const nextConfig: NextConfig = {
44
output: "standalone",
5-
basePath: "",
5+
basePath: "/analytics",
66
trailingSlash: true,
77
};
88

0 commit comments

Comments
 (0)