@@ -8,18 +8,15 @@ import { pipe } from '@/lib/tinybird'
88import { Card , CardContent , CardHeader , CardTitle } from '@/components/ui/card'
99import { TimeRange } from '@/components/time-range'
1010import MetricCard from '@/components/metric-card'
11- import { DeploymentsChart } from './deployments-chart'
12- import { DurationChart } from './duration-chart'
13- import { ProjectsChart } from './projects-chart'
14- import { GitAnalyticsChart } from './git-analytics-chart'
15-
16- interface GitData {
17- // eslint-disable-next-line @typescript-eslint/no-explicit-any
18- analytics : any [ ]
19- // eslint-disable-next-line @typescript-eslint/no-explicit-any
20- distribution : any [ ]
21- // eslint-disable-next-line @typescript-eslint/no-explicit-any
22- branches : any [ ]
11+ import { DeploymentsChart , DeploymentsData } from './deployments-chart'
12+ import { DurationChart , DurationData } from './duration-chart'
13+ import { ProjectsChart , ProjectData } from './projects-chart'
14+ import { GitAnalyticsChart , GitData } from './git-analytics-chart'
15+
16+ interface VercelMetrics {
17+ total_deployments : number
18+ success_rate : number
19+ error_rate : number
2320}
2421
2522export default function VercelDashboard ( ) {
@@ -29,21 +26,13 @@ export default function VercelDashboard() {
2926 from : addDays ( new Date ( ) , - 7 ) ,
3027 to : new Date ( )
3128 } )
32-
33- const [ isLoading , setIsLoading ] = useState ( true )
34- // eslint-disable-next-line @typescript-eslint/no-explicit-any
35- const [ metrics , setMetrics ] = useState < any > ( )
36- // eslint-disable-next-line @typescript-eslint/no-explicit-any
37- const [ deploymentsData , setDeploymentsData ] = useState < any [ ] > ( [ ] )
38- // eslint-disable-next-line @typescript-eslint/no-explicit-any
39- const [ durationData , setDurationData ] = useState < any [ ] > ( [ ] )
40- // eslint-disable-next-line @typescript-eslint/no-explicit-any
41- const [ projectsData , setProjectsData ] = useState < any [ ] > ( [ ] )
42- const [ gitData , setGitData ] = useState < GitData > ( {
43- analytics : [ ] ,
44- distribution : [ ] ,
45- branches : [ ]
46- } )
29+
30+ const [ , setIsLoading ] = useState ( true )
31+ const [ metrics , setMetrics ] = useState < VercelMetrics > ( )
32+ const [ deploymentsData , setDeploymentsData ] = useState < DeploymentsData [ ] > ( [ ] )
33+ const [ durationData , setDurationData ] = useState < DurationData [ ] > ( [ ] )
34+ const [ projectsData , setProjectsData ] = useState < ProjectData [ ] > ( [ ] )
35+ const [ gitData , setGitData ] = useState < GitData [ ] > ( [ ] )
4736
4837 useEffect ( ( ) => {
4938 async function fetchData ( ) {
@@ -63,27 +52,20 @@ export default function VercelDashboard() {
6352 durationResult ,
6453 projectsResult ,
6554 gitAnalyticsResult ,
66- gitDistributionResult ,
67- branchResult ,
55+
6856 ] = await Promise . all ( [
69- pipe ( token , 'vercel_deployment_metrics' , params ) ,
70- pipe ( token , 'vercel_deployments_over_time' , params ) ,
71- pipe ( token , 'vercel_deployment_duration' , params ) ,
72- pipe ( token , 'vercel_project_stats' , params ) ,
73- pipe ( token , 'vercel_git_analytics' , params ) ,
74- pipe ( token , 'vercel_git_distribution' , params ) ,
75- pipe ( token , 'vercel_branch_distribution' , params ) ,
57+ pipe < { data : VercelMetrics [ ] } > ( token , 'vercel_deployment_metrics' , params ) ,
58+ pipe < { data : DeploymentsData [ ] } > ( token , 'vercel_deployments_over_time' , params ) ,
59+ pipe < { data : DurationData [ ] } > ( token , 'vercel_deployment_duration' , params ) ,
60+ pipe < { data : ProjectData [ ] } > ( token , 'vercel_project_stats' , params ) ,
61+ pipe < { data : GitData [ ] } > ( token , 'vercel_git_analytics' , params )
7662 ] )
7763
7864 setMetrics ( metricsResult ?. data ?. [ 0 ] )
7965 setDeploymentsData ( deploymentsResult ?. data ?? [ ] )
8066 setDurationData ( durationResult ?. data ?? [ ] )
8167 setProjectsData ( projectsResult ?. data ?? [ ] )
82- setGitData ( {
83- analytics : gitAnalyticsResult ?. data ?? [ ] ,
84- distribution : gitDistributionResult ?. data ?? [ ] ,
85- branches : branchResult ?. data ?? [ ]
86- } )
68+ setGitData ( gitAnalyticsResult ?. data ?? [ ] )
8769 } catch ( error ) {
8870 console . error ( 'Failed to fetch data:' , error )
8971 } finally {
@@ -131,9 +113,8 @@ export default function VercelDashboard() {
131113 < CardTitle > Deployments Over Time</ CardTitle >
132114 </ CardHeader >
133115 < CardContent >
134- < DeploymentsChart
135- data = { deploymentsData }
136- isLoading = { isLoading }
116+ < DeploymentsChart
117+ data = { deploymentsData }
137118 />
138119 </ CardContent >
139120 </ Card >
@@ -155,9 +136,8 @@ export default function VercelDashboard() {
155136 < CardTitle > Top Projects</ CardTitle >
156137 </ CardHeader >
157138 < CardContent >
158- < ProjectsChart
159- data = { projectsData }
160- isLoading = { isLoading }
139+ < ProjectsChart
140+ data = { projectsData }
161141 />
162142 </ CardContent >
163143 </ Card >
@@ -167,9 +147,8 @@ export default function VercelDashboard() {
167147 < CardTitle > Git Analytics</ CardTitle >
168148 </ CardHeader >
169149 < CardContent >
170- < GitAnalyticsChart
171- data = { gitData . analytics }
172- isLoading = { isLoading }
150+ < GitAnalyticsChart
151+ data = { gitData }
173152 />
174153 </ CardContent >
175154 </ Card >
0 commit comments