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
2 changes: 2 additions & 0 deletions admin/.env.local.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
5 changes: 5 additions & 0 deletions admin/next.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { NextConfig } from "next";

const nextConfig: NextConfig = {};

export default nextConfig;
24 changes: 24 additions & 0 deletions admin/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "@devdocify/admin",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev --port 3100",
"build": "next build",
"start": "next start --port 3100",
"lint": "next lint"
},
"dependencies": {
"@supabase/ssr": "^0.5.2",
"@supabase/supabase-js": "^2.47.0",
"next": "^15.1.0",
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
"@types/node": "^22.0.0",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"typescript": "^5.7.0"
}
}
7 changes: 7 additions & 0 deletions admin/src/app/(auth)/login/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default function AuthLayout({
children,
}: {
children: React.ReactNode;
}) {
return <>{children}</>;
}
63 changes: 63 additions & 0 deletions admin/src/app/(auth)/login/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
"use client";

import { createClient } from "@/lib/supabase/client";
import { useRouter } from "next/navigation";
import { useState } from "react";

export default function LoginPage() {
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const [error, setError] = useState<string | null>(null);
const [loading, setLoading] = useState(false);
const router = useRouter();
const supabase = createClient();

async function handleLogin(e: React.FormEvent) {
e.preventDefault();
setLoading(true);
setError(null);

const { error } = await supabase.auth.signInWithPassword({
email,
password,
});

if (error) {
setError(error.message);
setLoading(false);
} else {
router.push("/");
router.refresh();
}
}

return (
<div className="login-container">
<div className="login-card">
<h1>DevDocify Admin</h1>
<form onSubmit={handleLogin}>
<label htmlFor="email">Email</label>
<input
id="email"
type="email"
value={email}
onChange={(e) => setEmail(e.target.value)}
required
/>
<label htmlFor="password">Password</label>
<input
id="password"
type="password"
value={password}
onChange={(e) => setPassword(e.target.value)}
required
/>
{error && <p className="error">{error}</p>}
<button type="submit" disabled={loading}>
{loading ? "Signing in..." : "Sign in"}
</button>
</form>
</div>
</div>
);
}
14 changes: 14 additions & 0 deletions admin/src/app/(dashboard)/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Sidebar } from "@/components/Sidebar";

export default function DashboardLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<div className="dashboard-layout">
<Sidebar />
<main className="main-content">{children}</main>
</div>
);
}
35 changes: 35 additions & 0 deletions admin/src/app/(dashboard)/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { createClient } from "@/lib/supabase/server";

export default async function DashboardPage() {
const supabase = await createClient();
const {
data: { user },
} = await supabase.auth.getUser();

return (
<>
<h1>Dashboard</h1>
<p style={{ color: "var(--color-text-muted)", marginBottom: "1.5rem" }}>
Welcome back, {user?.email}
</p>
<div className="stats-grid">
<div className="stat-card">
<div className="label">Portals</div>
<div className="value">2</div>
</div>
<div className="stat-card">
<div className="label">Deployments (7d)</div>
<div className="value">12</div>
</div>
<div className="stat-card">
<div className="label">Page views (7d)</div>
<div className="value">4,218</div>
</div>
<div className="stat-card">
<div className="label">Custom domains</div>
<div className="value">1</div>
</div>
</div>
</>
);
}
202 changes: 202 additions & 0 deletions admin/src/app/globals.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
:root {
--sidebar-width: 240px;
--color-bg: #fafafa;
--color-surface: #ffffff;
--color-border: #e5e7eb;
--color-text: #111827;
--color-text-muted: #6b7280;
--color-primary: #2563eb;
--color-primary-hover: #1d4ed8;
}

* {
margin: 0;
padding: 0;
box-sizing: border-box;
}

body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
color: var(--color-text);
background: var(--color-bg);
}

/* Auth pages */
.login-container {
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
}

.login-card {
background: var(--color-surface);
border: 1px solid var(--color-border);
border-radius: 8px;
padding: 2rem;
width: 100%;
max-width: 400px;
}

.login-card h1 {
font-size: 1.25rem;
margin-bottom: 1.5rem;
}

.login-card form {
display: flex;
flex-direction: column;
gap: 0.5rem;
}

.login-card label {
font-size: 0.875rem;
font-weight: 500;
margin-top: 0.5rem;
}

.login-card input {
padding: 0.5rem 0.75rem;
border: 1px solid var(--color-border);
border-radius: 6px;
font-size: 0.875rem;
}

.login-card button {
margin-top: 1rem;
padding: 0.625rem;
background: var(--color-primary);
color: white;
border: none;
border-radius: 6px;
font-size: 0.875rem;
font-weight: 500;
cursor: pointer;
}

.login-card button:hover {
background: var(--color-primary-hover);
}

.login-card button:disabled {
opacity: 0.6;
cursor: not-allowed;
}

.login-card .error {
color: #dc2626;
font-size: 0.8rem;
margin-top: 0.5rem;
}

/* Dashboard layout */
.dashboard-layout {
display: flex;
min-height: 100vh;
}

.sidebar {
width: var(--sidebar-width);
background: var(--color-surface);
border-right: 1px solid var(--color-border);
padding: 1.5rem 1rem;
display: flex;
flex-direction: column;
position: fixed;
top: 0;
left: 0;
bottom: 0;
}

.sidebar-brand {
font-size: 0.875rem;
font-weight: 600;
padding: 0 0.75rem;
margin-bottom: 1.5rem;
color: var(--color-text);
}

.sidebar nav {
display: flex;
flex-direction: column;
gap: 0.25rem;
flex: 1;
}

.sidebar nav a {
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.5rem 0.75rem;
border-radius: 6px;
text-decoration: none;
font-size: 0.875rem;
color: var(--color-text-muted);
}

.sidebar nav a:hover,
.sidebar nav a.active {
background: var(--color-bg);
color: var(--color-text);
}

.sidebar-footer {
padding-top: 1rem;
border-top: 1px solid var(--color-border);
}

.sidebar-footer button {
width: 100%;
padding: 0.5rem 0.75rem;
background: none;
border: none;
border-radius: 6px;
font-size: 0.875rem;
color: var(--color-text-muted);
cursor: pointer;
text-align: left;
}

.sidebar-footer button:hover {
background: var(--color-bg);
color: var(--color-text);
}

.main-content {
margin-left: var(--sidebar-width);
flex: 1;
padding: 2rem;
}

.main-content h1 {
font-size: 1.5rem;
margin-bottom: 1.5rem;
}

/* Dashboard cards */
.stats-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 1rem;
margin-bottom: 2rem;
}

.stat-card {
background: var(--color-surface);
border: 1px solid var(--color-border);
border-radius: 8px;
padding: 1.25rem;
}

.stat-card .label {
font-size: 0.75rem;
text-transform: uppercase;
letter-spacing: 0.05em;
color: var(--color-text-muted);
}

.stat-card .value {
font-size: 1.5rem;
font-weight: 600;
margin-top: 0.25rem;
}
19 changes: 19 additions & 0 deletions admin/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import type { Metadata } from "next";
import "./globals.css";

export const metadata: Metadata = {
title: "DevDocify Admin",
description: "Admin portal for DevDocify documentation platform",
};

export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en">
<body>{children}</body>
</html>
);
}
Loading
Loading