forked from 0xWheatyz/SPARC
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4696838fb8 |
@@ -34,6 +34,17 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
ruff check SPARC/ tests/
|
ruff check SPARC/ tests/
|
||||||
|
|
||||||
|
- name: Install Node.js and frontend dependencies
|
||||||
|
shell: sh
|
||||||
|
run: |
|
||||||
|
apk add --no-cache nodejs npm
|
||||||
|
cd frontend && npm ci
|
||||||
|
|
||||||
|
- name: Run TypeScript type check
|
||||||
|
shell: sh
|
||||||
|
run: |
|
||||||
|
cd frontend && npx tsc --noEmit
|
||||||
|
|
||||||
- name: Run pytest
|
- name: Run pytest
|
||||||
shell: sh
|
shell: sh
|
||||||
env:
|
env:
|
||||||
|
|||||||
Generated
+4
-4
@@ -10,7 +10,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tanstack/react-query": "^5.51.0",
|
"@tanstack/react-query": "^5.51.0",
|
||||||
"axios": "^1.7.2",
|
"axios": "^1.7.2",
|
||||||
"lucide-react": "^0.400.0",
|
"lucide-react": "^1.7.0",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
"react-dom": "^18.3.1",
|
"react-dom": "^18.3.1",
|
||||||
"react-router-dom": "^6.24.0",
|
"react-router-dom": "^6.24.0",
|
||||||
@@ -3452,9 +3452,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/lucide-react": {
|
"node_modules/lucide-react": {
|
||||||
"version": "0.400.0",
|
"version": "1.7.0",
|
||||||
"resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.400.0.tgz",
|
"resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-1.7.0.tgz",
|
||||||
"integrity": "sha512-rpp7pFHh3Xd93KHixNgB0SqThMHpYNzsGUu69UaQbSZ75Q/J3m5t6EhKyMT3m4w2WOxmJ2mY0tD3vebnXqQryQ==",
|
"integrity": "sha512-yI7BeItCLZJTXikmK4KNUGCKoGzSvbKlfCvw44bU4fXAL6v3gYS4uHD1jzsLkfwODYwI6Drw5Tu9Z5ulDe0TSg==",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
"react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
||||||
|
|||||||
@@ -7,12 +7,13 @@
|
|||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "tsc -b && vite build",
|
"build": "tsc -b && vite build",
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
|
"typecheck": "tsc --noEmit",
|
||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tanstack/react-query": "^5.51.0",
|
"@tanstack/react-query": "^5.51.0",
|
||||||
"axios": "^1.7.2",
|
"axios": "^1.7.2",
|
||||||
"lucide-react": "^0.400.0",
|
"lucide-react": "^1.7.0",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
"react-dom": "^18.3.1",
|
"react-dom": "^18.3.1",
|
||||||
"react-router-dom": "^6.24.0",
|
"react-router-dom": "^6.24.0",
|
||||||
|
|||||||
@@ -9,38 +9,15 @@ const COLORS = ['#6366f1', '#0ea5e9', '#10b981', '#f59e0b', '#ef4444', '#8b5cf6'
|
|||||||
export function AnalyticsPage() {
|
export function AnalyticsPage() {
|
||||||
const [days, setDays] = useState(30);
|
const [days, setDays] = useState(30);
|
||||||
|
|
||||||
const { data, isLoading, isError, refetch } = useQuery({
|
const { data, isLoading, isError } = useQuery({
|
||||||
queryKey: ['analytics', days],
|
queryKey: ['analytics', days],
|
||||||
queryFn: () => analyticsApi.getAnalytics(days),
|
queryFn: () => analyticsApi.getAnalytics(days),
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
return (
|
return (
|
||||||
<div className="space-y-6">
|
<div className="flex items-center justify-center min-h-[400px]">
|
||||||
<div>
|
<div className="animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-primary"></div>
|
||||||
<h2 className="text-xl font-semibold text-text-primary border-b-2 border-primary/30 pb-2 mb-2">
|
|
||||||
Analytics Dashboard
|
|
||||||
</h2>
|
|
||||||
<p className="text-text-secondary">Loading analytics data...</p>
|
|
||||||
</div>
|
|
||||||
{/* Skeleton cards */}
|
|
||||||
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
|
|
||||||
{[1, 2, 3].map((i) => (
|
|
||||||
<div key={i} className="bg-gradient-to-br from-primary/10 to-secondary/10 border border-primary/20 rounded-xl p-5 text-center animate-pulse">
|
|
||||||
<div className="h-9 w-16 bg-primary/20 rounded mx-auto mb-2" />
|
|
||||||
<div className="h-4 w-24 bg-primary/10 rounded mx-auto" />
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
{/* Skeleton charts */}
|
|
||||||
<div className="grid grid-cols-1 lg:grid-cols-2 gap-6">
|
|
||||||
{[1, 2].map((i) => (
|
|
||||||
<div key={i} className="bg-bg-card/60 border border-primary/15 rounded-2xl p-6 animate-pulse">
|
|
||||||
<div className="h-5 w-40 bg-primary/20 rounded mb-4" />
|
|
||||||
<div className="h-[300px] bg-primary/5 rounded" />
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -56,18 +33,15 @@ export function AnalyticsPage() {
|
|||||||
<div className="bg-gradient-to-br from-primary/10 to-secondary/5 border border-primary/20 rounded-xl p-6">
|
<div className="bg-gradient-to-br from-primary/10 to-secondary/5 border border-primary/20 rounded-xl p-6">
|
||||||
<div className="flex items-center gap-3 text-warning mb-2">
|
<div className="flex items-center gap-3 text-warning mb-2">
|
||||||
<Database size={24} />
|
<Database size={24} />
|
||||||
<span className="font-semibold">Unable to Load Analytics</span>
|
<span className="font-semibold">Database Not Connected</span>
|
||||||
</div>
|
</div>
|
||||||
<p className="text-text-secondary">
|
<p className="text-text-secondary">
|
||||||
Could not connect to the analytics database. Ensure PostgreSQL is running and
|
Set <code className="bg-bg-card px-2 py-1 rounded">USE_DATABASE=true</code> in your .env file to enable analytics tracking.
|
||||||
<code className="bg-bg-card px-2 py-1 rounded mx-1">DATABASE_URL</code> is configured correctly.
|
|
||||||
</p>
|
</p>
|
||||||
<button
|
</div>
|
||||||
onClick={() => refetch()}
|
<div className="flex items-center gap-2 bg-secondary/10 border border-secondary/20 text-secondary rounded-xl px-4 py-3">
|
||||||
className="mt-3 text-sm bg-primary/20 hover:bg-primary/30 text-primary font-medium px-4 py-2 rounded-lg transition-colors"
|
<AlertCircle size={18} />
|
||||||
>
|
<span>Analytics features require storing analysis results in PostgreSQL for historical tracking.</span>
|
||||||
Retry
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -114,21 +114,9 @@ export function Batch() {
|
|||||||
|
|
||||||
{/* Error */}
|
{/* Error */}
|
||||||
{mutation.isError && (
|
{mutation.isError && (
|
||||||
<div className="bg-error/10 border border-error/20 rounded-xl px-4 py-3">
|
<div className="flex items-center gap-2 bg-error/10 border border-error/20 text-error rounded-xl px-4 py-3">
|
||||||
<div className="flex items-center gap-2 text-error">
|
|
||||||
<AlertCircle size={18} />
|
<AlertCircle size={18} />
|
||||||
<span className="font-semibold">Batch analysis failed</span>
|
<span>Batch analysis failed. Please try again.</span>
|
||||||
</div>
|
|
||||||
<p className="text-text-secondary text-sm mt-1 ml-7">
|
|
||||||
{mutation.error instanceof Error ? mutation.error.message : 'An unexpected error occurred.'}
|
|
||||||
{' '}Check your connection and try again.
|
|
||||||
</p>
|
|
||||||
<button
|
|
||||||
onClick={() => mutation.reset()}
|
|
||||||
className="ml-7 mt-2 text-sm text-primary hover:text-primary-dark underline"
|
|
||||||
>
|
|
||||||
Dismiss
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user