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
5 changes: 5 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
// Include root and application-level tsconfigs so ESLint can run type-aware rules
project: ['tsconfig.json', 'apps/dashboard/tsconfig.json', 'apps/web/tsconfig.json'],
project: ['tsconfig.json'],
tsconfigRootDir: __dirname,
sourceType: 'module',
Expand All @@ -9,6 +11,7 @@ module.exports = {
extends: ['plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'],
root: true,
env: { node: true },
// Exclude build artifacts and the dashboard runtime files
// Exclude the Next.js dashboard app entirely — it uses its own tsconfig/eslint
// and its files are not included in the root tsconfig project references.
ignorePatterns: ['.eslintrc.js', 'dist/**', 'apps/dashboard/**'],
Expand All @@ -21,6 +24,8 @@ module.exports = {
},
overrides: [
{
// Files that are intentionally outside any tsconfig — lint without type-aware rules
files: ['observability/**/*.ts', 'prisma/**/*.ts', 'env.d.ts'],
// Files outside all tsconfigs — lint without type-aware rules
files: [
'observability/**/*.ts',
Expand Down
20 changes: 18 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.node-version }}
path: dist/
retention-days: 7
# backend tsc emits to apps/backend/dist
path: apps/backend/dist/
retention-days: 14

test:
name: Tests
Expand Down Expand Up @@ -140,6 +141,10 @@ jobs:
docker-build:
name: Docker Build Check
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
node-version: [20.x, 22.x]
permissions:
contents: read
packages: read
Expand All @@ -148,6 +153,12 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Download build artifact for node ${{ matrix.node-version }}
uses: actions/download-artifact@v4
with:
name: build-${{ matrix.node-version }}
path: apps/backend/dist

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

Expand All @@ -157,6 +168,7 @@ jobs:
context: .
file: ./Dockerfile
push: false
load: true
cache-from: type=gha
cache-to: type=gha,mode=max

Expand All @@ -169,6 +181,10 @@ jobs:
steps:
- name: Check CI status
run: |
echo "needs.lint.result=${{ needs.lint.result }}"
echo "needs.build.result=${{ needs.build.result }}"
echo "needs.test.result=${{ needs.test.result }}"
echo "needs.docker-build.result=${{ needs.docker-build.result }}"
if [[ "${{ needs.lint.result }}" != "success" || \
"${{ needs.build.result }}" != "success" || \
"${{ needs.test.result }}" != "success" || \
Expand Down
3 changes: 2 additions & 1 deletion apps/backend/src/modules/governance/governance.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ export class GovernanceService {
proposalId: dto.proposalId,
voter: dto.voter,
transactionHash: dto.transactionHash,
metadata: dto.metadata || {},
// Prisma expects JSON; cast unknown to any here after validation upstream
metadata: (dto.metadata as any) || {},
},
});
return event;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ export interface GovernanceEventDto {
proposalId?: string;
voter?: string;
transactionHash: string;
metadata?: Record<string, any>;
// Use unknown to avoid eslint no-explicit-any while still allowing arbitrary metadata
metadata?: unknown;
}

export interface ProposalDto {
Expand Down
159 changes: 159 additions & 0 deletions apps/web/app/risk-trends/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
'use client';

import React, { useState } from 'react';

type HistoricalPoint = { date: string; riskScore: number };

export default function RiskTrendsDashboard() {
const [timeFilter, setTimeFilter] = useState<string>('30d');

// Mock data for charts
const historicalData: HistoricalPoint[] = [
{ date: '2023-01-01', riskScore: 85 },
{ date: '2023-02-01', riskScore: 70 },
{ date: '2023-03-01', riskScore: 65 },
{ date: '2023-04-01', riskScore: 50 },
{ date: '2023-05-01', riskScore: 55 },
{ date: '2023-06-01', riskScore: 40 },
];

return (
<div style={{ padding: '24px', fontFamily: 'system-ui, sans-serif' }}>
<h1 style={{ fontSize: '24px', fontWeight: 'bold', marginBottom: '16px' }}>
Risk Trends Dashboard
</h1>

{/* Time Filters */}
<div style={{ marginBottom: '24px', display: 'flex', alignItems: 'center', gap: '12px' }}>
<label htmlFor="timeFilter" style={{ fontWeight: '500' }}>
Time Range:{' '}
</label>
<select
id="timeFilter"
value={timeFilter}
onChange={e => setTimeFilter(e.target.value)}
style={{ padding: '8px', borderRadius: '4px', border: '1px solid #ccc' }}
>
<option value="7d">Last 7 Days</option>
<option value="30d">Last 30 Days</option>
<option value="90d">Last 90 Days</option>
<option value="1y">Last Year</option>
</select>
</div>

<div
style={{
display: 'grid',
gridTemplateColumns: 'repeat(auto-fit, minmax(300px, 1fr))',
gap: '24px',
}}
>
{/* Historical Charts */}
<div
style={{
border: '1px solid #eaeaea',
padding: '20px',
borderRadius: '8px',
backgroundColor: '#fff',
}}
>
<h2 style={{ fontSize: '18px', marginBottom: '20px' }}>Historical Risk Chart</h2>
<div style={{ height: '200px', display: 'flex', alignItems: 'flex-end', gap: '12px' }}>
{historicalData.map((data: HistoricalPoint, i: number) => (
<div
key={i}
style={{
flex: 1,
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
height: '100%',
}}
>
<div
style={{
flex: 1,
display: 'flex',
alignItems: 'flex-end',
width: '100%',
marginBottom: '8px',
}}
>
<div
style={{
width: '100%',
backgroundColor:
data.riskScore > 60
? '#ef4444'
: data.riskScore > 40
? '#eab308'
: '#22c55e',
height: `${data.riskScore}%`,
borderRadius: '4px 4px 0 0',
transition: 'height 0.3s ease',
}}
title={`Risk Score: ${data.riskScore}`}
/>
</div>
<span style={{ fontSize: '12px', color: '#666' }}>
{new Date(data.date).toLocaleString('default', { month: 'short' })}
</span>
</div>
))}
</div>
</div>

{/* Risk Comparisons */}
<div
style={{
border: '1px solid #eaeaea',
padding: '20px',
borderRadius: '8px',
backgroundColor: '#fff',
}}
>
<h2 style={{ fontSize: '18px', marginBottom: '20px' }}>Risk Comparisons</h2>
<div style={{ display: 'flex', flexDirection: 'column', gap: '16px' }}>
<div
style={{
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
paddingBottom: '12px',
borderBottom: '1px solid #f0f0f0',
}}
>
<span style={{ fontWeight: '500' }}>Engineering</span>
<div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
<span style={{ fontWeight: 'bold' }}>45</span>
<span style={{ color: '#22c55e', fontSize: '14px' }}>↓ 10%</span>
</div>
</div>
<div
style={{
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
paddingBottom: '12px',
borderBottom: '1px solid #f0f0f0',
}}
>
<span style={{ fontWeight: '500' }}>Sales</span>
<div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
<span style={{ fontWeight: 'bold' }}>72</span>
<span style={{ color: '#ef4444', fontSize: '14px' }}>↑ 5%</span>
</div>
</div>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<span style={{ fontWeight: '500' }}>Marketing</span>
<div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
<span style={{ fontWeight: 'bold' }}>30</span>
<span style={{ color: '#94a3b8', fontSize: '14px' }}>- 0%</span>
</div>
</div>
</div>
</div>
</div>
</div>
);
}
17 changes: 17 additions & 0 deletions apps/web/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"target": "ES2020",
"module": "ES2020",
"jsx": "react-jsx",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"types": ["node", "react", "react-dom"]
},
"include": ["app/**/*", "src/**/*"],
"exclude": ["node_modules", "dist"]
}
Loading