forked from 0xWheatyz/SPARC
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a4aa968434 |
@@ -169,9 +169,6 @@ async def lifespan(app: FastAPI):
|
|||||||
import logging
|
import logging
|
||||||
logging.getLogger(__name__).warning("Marked %d stale jobs as failed on startup", stale)
|
logging.getLogger(__name__).warning("Marked %d stale jobs as failed on startup", stale)
|
||||||
_db.close()
|
_db.close()
|
||||||
# Start scheduled analysis if tracked companies are configured
|
|
||||||
from SPARC.scheduler import start_scheduler
|
|
||||||
start_scheduler()
|
|
||||||
yield
|
yield
|
||||||
# Cleanup
|
# Cleanup
|
||||||
_analyzer = None
|
_analyzer = None
|
||||||
@@ -372,60 +369,6 @@ async def delete_user(
|
|||||||
return {"message": "User deleted"}
|
return {"message": "User deleted"}
|
||||||
|
|
||||||
|
|
||||||
# ============== Tracked Companies Endpoints ==============
|
|
||||||
|
|
||||||
|
|
||||||
class TrackCompanyRequest(BaseModel):
|
|
||||||
"""Request to add a company to tracking."""
|
|
||||||
|
|
||||||
company_name: str = Field(..., min_length=1, max_length=255)
|
|
||||||
|
|
||||||
|
|
||||||
@app.get("/admin/tracked", tags=["Admin"])
|
|
||||||
async def list_tracked_companies(
|
|
||||||
_: UserResponse = Depends(get_current_admin),
|
|
||||||
):
|
|
||||||
"""List all tracked companies (admin only)."""
|
|
||||||
db = get_db_client()
|
|
||||||
return db.list_tracked_companies()
|
|
||||||
|
|
||||||
|
|
||||||
@app.post("/admin/tracked", tags=["Admin"])
|
|
||||||
async def add_tracked_company(
|
|
||||||
request: TrackCompanyRequest,
|
|
||||||
_: UserResponse = Depends(get_current_admin),
|
|
||||||
):
|
|
||||||
"""Add a company to the tracked list (admin only)."""
|
|
||||||
db = get_db_client()
|
|
||||||
result = db.add_tracked_company(request.company_name)
|
|
||||||
if not result:
|
|
||||||
raise HTTPException(status_code=409, detail="Company already tracked")
|
|
||||||
return result
|
|
||||||
|
|
||||||
|
|
||||||
@app.delete("/admin/tracked/{company_name}", tags=["Admin"])
|
|
||||||
async def remove_tracked_company(
|
|
||||||
company_name: str,
|
|
||||||
_: UserResponse = Depends(get_current_admin),
|
|
||||||
):
|
|
||||||
"""Remove a company from the tracked list (admin only)."""
|
|
||||||
db = get_db_client()
|
|
||||||
removed = db.remove_tracked_company(company_name)
|
|
||||||
if not removed:
|
|
||||||
raise HTTPException(status_code=404, detail="Company not found in tracking list")
|
|
||||||
return {"message": f"Stopped tracking {company_name}"}
|
|
||||||
|
|
||||||
|
|
||||||
@app.get("/admin/alerts", tags=["Admin"])
|
|
||||||
async def list_alerts(
|
|
||||||
limit: int = Query(default=50, ge=1, le=200),
|
|
||||||
_: UserResponse = Depends(get_current_admin),
|
|
||||||
):
|
|
||||||
"""List recent alerts from scheduled analysis (admin only)."""
|
|
||||||
db = get_db_client()
|
|
||||||
return db.list_alerts(limit=limit)
|
|
||||||
|
|
||||||
|
|
||||||
# ============== Analytics Endpoint ==============
|
# ============== Analytics Endpoint ==============
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -192,35 +192,6 @@ class DatabaseClient:
|
|||||||
ON jobs(status)
|
ON jobs(status)
|
||||||
""")
|
""")
|
||||||
|
|
||||||
# Create tracked companies table for scheduled analysis
|
|
||||||
cursor.execute("""
|
|
||||||
CREATE TABLE IF NOT EXISTS tracked_companies (
|
|
||||||
id SERIAL PRIMARY KEY,
|
|
||||||
company_name VARCHAR(255) UNIQUE NOT NULL,
|
|
||||||
last_patent_count INTEGER DEFAULT 0,
|
|
||||||
last_analysis_at TIMESTAMP,
|
|
||||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
||||||
)
|
|
||||||
""")
|
|
||||||
|
|
||||||
# Create alerts table for significant changes
|
|
||||||
cursor.execute("""
|
|
||||||
CREATE TABLE IF NOT EXISTS alerts (
|
|
||||||
id SERIAL PRIMARY KEY,
|
|
||||||
company_name VARCHAR(255) NOT NULL,
|
|
||||||
alert_type VARCHAR(50) NOT NULL,
|
|
||||||
message TEXT NOT NULL,
|
|
||||||
old_value NUMERIC,
|
|
||||||
new_value NUMERIC,
|
|
||||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
||||||
)
|
|
||||||
""")
|
|
||||||
|
|
||||||
cursor.execute("""
|
|
||||||
CREATE INDEX IF NOT EXISTS idx_alerts_company
|
|
||||||
ON alerts(company_name)
|
|
||||||
""")
|
|
||||||
|
|
||||||
self.conn.commit()
|
self.conn.commit()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -832,81 +803,3 @@ class DatabaseClient:
|
|||||||
with conn.cursor() as cursor:
|
with conn.cursor() as cursor:
|
||||||
cursor.execute("SELECT COUNT(*) FROM users")
|
cursor.execute("SELECT COUNT(*) FROM users")
|
||||||
return cursor.fetchone()[0]
|
return cursor.fetchone()[0]
|
||||||
|
|
||||||
# Tracked Companies Methods
|
|
||||||
|
|
||||||
def add_tracked_company(self, company_name: str) -> Optional[Dict]:
|
|
||||||
"""Add a company to the tracking list."""
|
|
||||||
with self.get_conn() as conn:
|
|
||||||
with conn.cursor(cursor_factory=RealDictCursor) as cursor:
|
|
||||||
try:
|
|
||||||
cursor.execute(
|
|
||||||
"INSERT INTO tracked_companies (company_name) VALUES (%s) RETURNING *",
|
|
||||||
(company_name,),
|
|
||||||
)
|
|
||||||
row = cursor.fetchone()
|
|
||||||
conn.commit()
|
|
||||||
return dict(row) if row else None
|
|
||||||
except Exception:
|
|
||||||
conn.rollback()
|
|
||||||
return None
|
|
||||||
|
|
||||||
def remove_tracked_company(self, company_name: str) -> bool:
|
|
||||||
"""Remove a company from the tracking list."""
|
|
||||||
with self.get_conn() as conn:
|
|
||||||
with conn.cursor() as cursor:
|
|
||||||
cursor.execute(
|
|
||||||
"DELETE FROM tracked_companies WHERE LOWER(company_name) = LOWER(%s)",
|
|
||||||
(company_name,),
|
|
||||||
)
|
|
||||||
conn.commit()
|
|
||||||
return cursor.rowcount > 0
|
|
||||||
|
|
||||||
def list_tracked_companies(self) -> List[Dict]:
|
|
||||||
"""List all tracked companies."""
|
|
||||||
with self.get_conn() as conn:
|
|
||||||
with conn.cursor(cursor_factory=RealDictCursor) as cursor:
|
|
||||||
cursor.execute("SELECT * FROM tracked_companies ORDER BY company_name")
|
|
||||||
return [dict(row) for row in cursor.fetchall()]
|
|
||||||
|
|
||||||
def update_tracked_company(
|
|
||||||
self, company_name: str, patent_count: int
|
|
||||||
) -> None:
|
|
||||||
"""Update the last analysis stats for a tracked company."""
|
|
||||||
with self.get_conn() as conn:
|
|
||||||
with conn.cursor() as cursor:
|
|
||||||
cursor.execute(
|
|
||||||
"""UPDATE tracked_companies
|
|
||||||
SET last_patent_count = %s, last_analysis_at = CURRENT_TIMESTAMP
|
|
||||||
WHERE LOWER(company_name) = LOWER(%s)""",
|
|
||||||
(patent_count, company_name),
|
|
||||||
)
|
|
||||||
conn.commit()
|
|
||||||
|
|
||||||
def store_alert(
|
|
||||||
self,
|
|
||||||
company_name: str,
|
|
||||||
alert_type: str,
|
|
||||||
message: str,
|
|
||||||
old_value: float | None = None,
|
|
||||||
new_value: float | None = None,
|
|
||||||
) -> None:
|
|
||||||
"""Record an alert for a significant change."""
|
|
||||||
with self.get_conn() as conn:
|
|
||||||
with conn.cursor() as cursor:
|
|
||||||
cursor.execute(
|
|
||||||
"""INSERT INTO alerts (company_name, alert_type, message, old_value, new_value)
|
|
||||||
VALUES (%s, %s, %s, %s, %s)""",
|
|
||||||
(company_name, alert_type, message, old_value, new_value),
|
|
||||||
)
|
|
||||||
conn.commit()
|
|
||||||
|
|
||||||
def list_alerts(self, limit: int = 50) -> List[Dict]:
|
|
||||||
"""List recent alerts."""
|
|
||||||
with self.get_conn() as conn:
|
|
||||||
with conn.cursor(cursor_factory=RealDictCursor) as cursor:
|
|
||||||
cursor.execute(
|
|
||||||
"SELECT * FROM alerts ORDER BY created_at DESC LIMIT %s",
|
|
||||||
(limit,),
|
|
||||||
)
|
|
||||||
return [dict(row) for row in cursor.fetchall()]
|
|
||||||
|
|||||||
@@ -1,109 +0,0 @@
|
|||||||
"""Scheduled patent analysis for tracked companies.
|
|
||||||
|
|
||||||
Uses APScheduler to periodically re-analyze tracked companies and
|
|
||||||
detect significant changes in patent counts.
|
|
||||||
"""
|
|
||||||
|
|
||||||
import logging
|
|
||||||
import os
|
|
||||||
|
|
||||||
from SPARC import config
|
|
||||||
from SPARC.analyzer import CompanyAnalyzer
|
|
||||||
from SPARC.database import DatabaseClient
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
# Configurable via environment variable (in hours, default 24)
|
|
||||||
SCHEDULE_INTERVAL_HOURS = int(os.getenv("SCHEDULE_INTERVAL_HOURS", "24"))
|
|
||||||
|
|
||||||
# Patent count change threshold (percentage) to trigger an alert
|
|
||||||
CHANGE_THRESHOLD_PERCENT = int(os.getenv("CHANGE_THRESHOLD_PERCENT", "20"))
|
|
||||||
|
|
||||||
|
|
||||||
def run_scheduled_analysis() -> None:
|
|
||||||
"""Re-analyze all tracked companies and check for significant changes."""
|
|
||||||
db = DatabaseClient(config.database_url)
|
|
||||||
db.connect()
|
|
||||||
db.initialize_schema()
|
|
||||||
|
|
||||||
tracked = db.list_tracked_companies()
|
|
||||||
if not tracked:
|
|
||||||
logger.info("No tracked companies configured; skipping scheduled analysis")
|
|
||||||
return
|
|
||||||
|
|
||||||
logger.info("Running scheduled analysis for %d tracked companies", len(tracked))
|
|
||||||
|
|
||||||
analyzer = CompanyAnalyzer(db_client=db)
|
|
||||||
|
|
||||||
for company_row in tracked:
|
|
||||||
name = company_row["company_name"]
|
|
||||||
old_count = company_row.get("last_patent_count", 0) or 0
|
|
||||||
|
|
||||||
try:
|
|
||||||
result = analyzer._analyze_company_safe(name)
|
|
||||||
|
|
||||||
if result.success:
|
|
||||||
new_count = result.patent_count
|
|
||||||
|
|
||||||
# Update tracking record
|
|
||||||
db.update_tracked_company(name, new_count)
|
|
||||||
|
|
||||||
# Check for significant change
|
|
||||||
if old_count > 0:
|
|
||||||
delta_pct = abs(new_count - old_count) / old_count * 100
|
|
||||||
if delta_pct >= CHANGE_THRESHOLD_PERCENT:
|
|
||||||
direction = "increased" if new_count > old_count else "decreased"
|
|
||||||
message = (
|
|
||||||
f"Patent count for {name} {direction} by {delta_pct:.0f}% "
|
|
||||||
f"({old_count} -> {new_count})"
|
|
||||||
)
|
|
||||||
logger.warning("ALERT: %s", message)
|
|
||||||
db.store_alert(
|
|
||||||
company_name=name,
|
|
||||||
alert_type="patent_count_change",
|
|
||||||
message=message,
|
|
||||||
old_value=old_count,
|
|
||||||
new_value=new_count,
|
|
||||||
)
|
|
||||||
elif new_count > 0:
|
|
||||||
# First analysis -- record baseline
|
|
||||||
logger.info("Baseline for %s: %d patents", name, new_count)
|
|
||||||
else:
|
|
||||||
logger.warning("Scheduled analysis failed for %s: %s", name, result.error)
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
logger.error("Error analyzing tracked company %s: %s", name, e)
|
|
||||||
|
|
||||||
db.close()
|
|
||||||
logger.info("Scheduled analysis complete")
|
|
||||||
|
|
||||||
|
|
||||||
def start_scheduler() -> None:
|
|
||||||
"""Start the APScheduler background scheduler.
|
|
||||||
|
|
||||||
Safe to call at application startup. If apscheduler is not installed,
|
|
||||||
the function logs a warning and returns without starting anything.
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
from apscheduler.schedulers.background import BackgroundScheduler
|
|
||||||
except ImportError:
|
|
||||||
logger.warning(
|
|
||||||
"apscheduler not installed; scheduled analysis disabled. "
|
|
||||||
"Install with: pip install apscheduler"
|
|
||||||
)
|
|
||||||
return
|
|
||||||
|
|
||||||
scheduler = BackgroundScheduler()
|
|
||||||
scheduler.add_job(
|
|
||||||
run_scheduled_analysis,
|
|
||||||
"interval",
|
|
||||||
hours=SCHEDULE_INTERVAL_HOURS,
|
|
||||||
id="scheduled_patent_analysis",
|
|
||||||
replace_existing=True,
|
|
||||||
)
|
|
||||||
scheduler.start()
|
|
||||||
logger.info(
|
|
||||||
"Scheduled patent analysis started (every %d hours, threshold %d%%)",
|
|
||||||
SCHEDULE_INTERVAL_HOURS,
|
|
||||||
CHANGE_THRESHOLD_PERCENT,
|
|
||||||
)
|
|
||||||
@@ -7,6 +7,15 @@
|
|||||||
<title>SPARC Dashboard</title>
|
<title>SPARC Dashboard</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<script>
|
||||||
|
// Prevent FOUC: apply saved theme before first render
|
||||||
|
(function() {
|
||||||
|
var theme = localStorage.getItem('theme');
|
||||||
|
if (theme === 'dark' || (!theme && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
|
||||||
|
document.documentElement.classList.add('dark');
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
<script type="module" src="/src/main.tsx"></script>
|
<script type="module" src="/src/main.tsx"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';
|
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';
|
||||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||||
import { AuthProvider } from './context/AuthContext';
|
import { AuthProvider } from './context/AuthContext';
|
||||||
|
import { ThemeProvider } from './context/ThemeContext';
|
||||||
import { Layout } from './components/Layout';
|
import { Layout } from './components/Layout';
|
||||||
import { ProtectedRoute } from './components/ProtectedRoute';
|
import { ProtectedRoute } from './components/ProtectedRoute';
|
||||||
import { Login } from './pages/Login';
|
import { Login } from './pages/Login';
|
||||||
@@ -22,6 +23,7 @@ const queryClient = new QueryClient({
|
|||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
return (
|
return (
|
||||||
|
<ThemeProvider>
|
||||||
<QueryClientProvider client={queryClient}>
|
<QueryClientProvider client={queryClient}>
|
||||||
<AuthProvider>
|
<AuthProvider>
|
||||||
<BrowserRouter>
|
<BrowserRouter>
|
||||||
@@ -61,6 +63,7 @@ function App() {
|
|||||||
</BrowserRouter>
|
</BrowserRouter>
|
||||||
</AuthProvider>
|
</AuthProvider>
|
||||||
</QueryClientProvider>
|
</QueryClientProvider>
|
||||||
|
</ThemeProvider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import { Outlet, NavLink, useNavigate } from 'react-router-dom';
|
import { Outlet, NavLink, useNavigate } from 'react-router-dom';
|
||||||
import { useAuth } from '../context/AuthContext';
|
import { useAuth } from '../context/AuthContext';
|
||||||
import { Search, Layers, BarChart3, Info, Users, LogOut } from 'lucide-react';
|
import { useTheme } from '../context/ThemeContext';
|
||||||
|
import { Search, Layers, BarChart3, Info, Users, LogOut, Sun, Moon } from 'lucide-react';
|
||||||
|
|
||||||
export function Layout() {
|
export function Layout() {
|
||||||
const { user, isAdmin, logout } = useAuth();
|
const { user, isAdmin, logout } = useAuth();
|
||||||
|
const { theme, toggleTheme } = useTheme();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const handleLogout = () => {
|
const handleLogout = () => {
|
||||||
@@ -23,7 +25,7 @@ export function Layout() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="min-h-screen bg-gradient-to-br from-bg-dark to-indigo-950">
|
<div className="min-h-screen bg-gradient-to-br from-bg-dark to-slate-100 dark:to-indigo-950">
|
||||||
{/* Header */}
|
{/* Header */}
|
||||||
<header className="bg-bg-card/80 backdrop-blur-lg border-b border-primary/20">
|
<header className="bg-bg-card/80 backdrop-blur-lg border-b border-primary/20">
|
||||||
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
||||||
@@ -63,6 +65,13 @@ export function Layout() {
|
|||||||
|
|
||||||
{/* User menu */}
|
{/* User menu */}
|
||||||
<div className="flex items-center gap-4">
|
<div className="flex items-center gap-4">
|
||||||
|
<button
|
||||||
|
onClick={toggleTheme}
|
||||||
|
className="p-2 rounded-lg text-text-secondary hover:text-text-primary hover:bg-bg-card-hover transition-all"
|
||||||
|
aria-label={theme === 'dark' ? 'Switch to light mode' : 'Switch to dark mode'}
|
||||||
|
>
|
||||||
|
{theme === 'dark' ? <Sun size={18} /> : <Moon size={18} />}
|
||||||
|
</button>
|
||||||
<div className="text-right hidden sm:block">
|
<div className="text-right hidden sm:block">
|
||||||
<div className="text-sm font-medium text-text-primary">{user?.email}</div>
|
<div className="text-sm font-medium text-text-primary">{user?.email}</div>
|
||||||
<div className="text-xs text-text-secondary capitalize">{user?.role}</div>
|
<div className="text-xs text-text-secondary capitalize">{user?.role}</div>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export function ProtectedRoute({ children, requireAdmin = false }: ProtectedRout
|
|||||||
|
|
||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
return (
|
return (
|
||||||
<div className="min-h-screen bg-gradient-to-br from-bg-dark to-indigo-950 flex items-center justify-center">
|
<div className="min-h-screen bg-gradient-to-br from-bg-dark to-slate-100 dark:to-indigo-950 flex items-center justify-center">
|
||||||
<div className="animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-primary"></div>
|
<div className="animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-primary"></div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
import { createContext, useContext, useEffect, useState } from 'react';
|
||||||
|
|
||||||
|
type Theme = 'light' | 'dark';
|
||||||
|
|
||||||
|
interface ThemeContextType {
|
||||||
|
theme: Theme;
|
||||||
|
toggleTheme: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ThemeContext = createContext<ThemeContextType | undefined>(undefined);
|
||||||
|
|
||||||
|
function getInitialTheme(): Theme {
|
||||||
|
const stored = localStorage.getItem('theme');
|
||||||
|
if (stored === 'light' || stored === 'dark') return stored;
|
||||||
|
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
||||||
|
}
|
||||||
|
|
||||||
|
export function ThemeProvider({ children }: { children: React.ReactNode }) {
|
||||||
|
const [theme, setTheme] = useState<Theme>(getInitialTheme);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const root = document.documentElement;
|
||||||
|
if (theme === 'dark') {
|
||||||
|
root.classList.add('dark');
|
||||||
|
} else {
|
||||||
|
root.classList.remove('dark');
|
||||||
|
}
|
||||||
|
localStorage.setItem('theme', theme);
|
||||||
|
}, [theme]);
|
||||||
|
|
||||||
|
const toggleTheme = () => {
|
||||||
|
setTheme((prev) => (prev === 'dark' ? 'light' : 'dark'));
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ThemeContext.Provider value={{ theme, toggleTheme }}>
|
||||||
|
{children}
|
||||||
|
</ThemeContext.Provider>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useTheme() {
|
||||||
|
const context = useContext(ThemeContext);
|
||||||
|
if (!context) {
|
||||||
|
throw new Error('useTheme must be used within a ThemeProvider');
|
||||||
|
}
|
||||||
|
return context;
|
||||||
|
}
|
||||||
+22
-2
@@ -2,6 +2,26 @@
|
|||||||
@tailwind components;
|
@tailwind components;
|
||||||
@tailwind utilities;
|
@tailwind utilities;
|
||||||
|
|
||||||
|
/* Light mode (default) */
|
||||||
|
:root {
|
||||||
|
--color-bg-dark: #f1f5f9;
|
||||||
|
--color-bg-card: #ffffff;
|
||||||
|
--color-bg-card-hover: #e2e8f0;
|
||||||
|
--color-text-primary: #0f172a;
|
||||||
|
--color-text-secondary: #475569;
|
||||||
|
--color-border: #cbd5e1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Dark mode */
|
||||||
|
.dark {
|
||||||
|
--color-bg-dark: #0f172a;
|
||||||
|
--color-bg-card: #1e293b;
|
||||||
|
--color-bg-card-hover: #334155;
|
||||||
|
--color-text-primary: #f8fafc;
|
||||||
|
--color-text-secondary: #94a3b8;
|
||||||
|
--color-border: #334155;
|
||||||
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
@@ -15,7 +35,7 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
::-webkit-scrollbar-track {
|
::-webkit-scrollbar-track {
|
||||||
background: #1e293b;
|
background: var(--color-bg-card);
|
||||||
}
|
}
|
||||||
|
|
||||||
::-webkit-scrollbar-thumb {
|
::-webkit-scrollbar-thumb {
|
||||||
@@ -30,5 +50,5 @@ body {
|
|||||||
/* Selection */
|
/* Selection */
|
||||||
::selection {
|
::selection {
|
||||||
background: rgba(99, 102, 241, 0.3);
|
background: rgba(99, 102, 241, 0.3);
|
||||||
color: #f8fafc;
|
color: var(--color-text-primary);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export function Login() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="min-h-screen bg-gradient-to-br from-bg-dark to-indigo-950 flex items-center justify-center px-4">
|
<div className="min-h-screen bg-gradient-to-br from-bg-dark to-slate-100 dark:to-indigo-950 flex items-center justify-center px-4">
|
||||||
<div className="w-full max-w-md">
|
<div className="w-full max-w-md">
|
||||||
{/* Brand */}
|
{/* Brand */}
|
||||||
<div className="text-center mb-8">
|
<div className="text-center mb-8">
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export function Register() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="min-h-screen bg-gradient-to-br from-bg-dark to-indigo-950 flex items-center justify-center px-4">
|
<div className="min-h-screen bg-gradient-to-br from-bg-dark to-slate-100 dark:to-indigo-950 flex items-center justify-center px-4">
|
||||||
<div className="w-full max-w-md">
|
<div className="w-full max-w-md">
|
||||||
{/* Brand */}
|
{/* Brand */}
|
||||||
<div className="text-center mb-8">
|
<div className="text-center mb-8">
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ export default {
|
|||||||
"./index.html",
|
"./index.html",
|
||||||
"./src/**/*.{js,ts,jsx,tsx}",
|
"./src/**/*.{js,ts,jsx,tsx}",
|
||||||
],
|
],
|
||||||
|
darkMode: 'class',
|
||||||
theme: {
|
theme: {
|
||||||
extend: {
|
extend: {
|
||||||
colors: {
|
colors: {
|
||||||
@@ -16,15 +17,15 @@ export default {
|
|||||||
warning: '#f59e0b',
|
warning: '#f59e0b',
|
||||||
error: '#ef4444',
|
error: '#ef4444',
|
||||||
bg: {
|
bg: {
|
||||||
dark: '#0f172a',
|
dark: 'var(--color-bg-dark)',
|
||||||
card: '#1e293b',
|
card: 'var(--color-bg-card)',
|
||||||
'card-hover': '#334155',
|
'card-hover': 'var(--color-bg-card-hover)',
|
||||||
},
|
},
|
||||||
text: {
|
text: {
|
||||||
primary: '#f8fafc',
|
primary: 'var(--color-text-primary)',
|
||||||
secondary: '#94a3b8',
|
secondary: 'var(--color-text-secondary)',
|
||||||
},
|
},
|
||||||
border: '#334155',
|
border: 'var(--color-border)',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -15,4 +15,3 @@ pandas
|
|||||||
bcrypt
|
bcrypt
|
||||||
PyJWT
|
PyJWT
|
||||||
slowapi
|
slowapi
|
||||||
apscheduler
|
|
||||||
|
|||||||
Reference in New Issue
Block a user