1- import React , { useState , useEffect } from "react" ;
1+ import React , { useState } from "react" ;
22import { createFileRoute , Link } from "@tanstack/react-router" ;
33import { motion } from "motion/react" ;
44import {
@@ -11,6 +11,7 @@ import {
1111 GitFork ,
1212 CircleHelp ,
1313 ExternalLink ,
14+ CircleAlert ,
1415} from "lucide-react" ;
1516import {
1617 api ,
@@ -27,7 +28,6 @@ import {
2728 CardContent ,
2829} from "~/components/ui/card" ;
2930import { Wrapper } from "~/components/page" ;
30- import { set } from "date-fns" ;
3131
3232const loadRepositories = async ( ) => {
3333 const repositories = await api . getRepositories ( ) ;
@@ -40,28 +40,32 @@ const loadRepositories = async () => {
4040 const repoWorkflows = workflows . results . filter (
4141 ( workflow ) => workflow . repository === repo . node_id
4242 ) ;
43- const repoWorkflowsWithRuns : WorkflowWithRuns [ ] = repoWorkflows . map (
44- ( workflow ) => {
45- const workflowRunsbyWorkflow = workflowRuns . results . filter (
46- ( run ) => run . workflow === workflow . node_id
47- ) ;
48- const mostRecentRun = workflowRunsbyWorkflow . reduce (
49- ( latest , current ) => {
50- return new Date ( current . updated_at ) > new Date ( latest . updated_at )
51- ? current
52- : latest ;
53- } ,
54- workflowRunsbyWorkflow [ 0 ] || null
55- ) ;
43+ const repoWorkflowsWithRuns = repoWorkflows . map ( ( workflow ) => {
44+ const workflowRunsbyWorkflow = workflowRuns . results . filter (
45+ ( run ) => run . workflow === workflow . node_id
46+ ) ;
47+ const mostRecentRun = workflowRunsbyWorkflow . reduce ( ( latest , current ) => {
48+ return new Date ( current . updated_at ) > new Date ( latest . updated_at )
49+ ? current
50+ : latest ;
51+ } , workflowRunsbyWorkflow [ 0 ] ) as GitHubWorkflowRun | undefined ; // undefined if no runs exist
52+ if ( ! mostRecentRun ) {
5653 return {
5754 ...workflow ,
58- runs : [ mostRecentRun ] ,
55+ runs : [ ] ,
5956 } ;
6057 }
58+ return {
59+ ...workflow ,
60+ runs : [ mostRecentRun ] ,
61+ } ;
62+ } ) ;
63+ const repoWorkflowsWithRunsFiltered = repoWorkflowsWithRuns . filter (
64+ ( workflow ) => workflow . node_id !== "W_kwDOO6JGD84KA1C6" // manually excluding a specific workflow
6165 ) ;
6266 return {
6367 ...repo ,
64- workflows : repoWorkflowsWithRuns ,
68+ workflows : repoWorkflowsWithRunsFiltered ,
6569 isExpanded : false , // Initialize expanded state
6670 isLoading : false , // Initialize loading state
6771 } ;
@@ -178,8 +182,8 @@ function RepositoryCard({ repo, onToggle }: RepositoryCardProps) {
178182 const getOverallStatus = ( ) => {
179183 if ( ! repo . workflows || repo . workflows . length === 0 ) {
180184 return {
181- icon : < GitBranch className = "w-4 h-4 text-gray-400" /> ,
182- text : "No workflows for this repository " ,
185+ icon : < CircleHelp className = "w-4 h-4 text-gray-400" /> ,
186+ text : "N/A " ,
183187 } ;
184188 }
185189
@@ -189,14 +193,17 @@ function RepositoryCard({ repo, onToggle }: RepositoryCardProps) {
189193 const hasInProgress = repo . workflows . some ( ( workflow ) =>
190194 workflow . runs ?. some ( ( run ) => run . status === "in_progress" )
191195 ) ;
196+ console . log ( repo . workflows [ 0 ] . runs ) ;
192197 const allSuccess = repo . workflows . every ( ( workflow ) =>
193- workflow . runs ?. every ( ( run ) => run . conclusion === "success" )
198+ workflow . runs ?. every (
199+ ( run ) => run . conclusion === "success" || run === undefined
200+ )
194201 ) ;
195202
196203 if ( hasFailure ) {
197204 return {
198205 icon : < XCircle className = "w-4 h-4 text-red-500" /> ,
199- text : "Some failures " ,
206+ text : "Failing " ,
200207 } ;
201208 }
202209 if ( hasInProgress ) {
@@ -208,12 +215,14 @@ function RepositoryCard({ repo, onToggle }: RepositoryCardProps) {
208215 if ( allSuccess ) {
209216 return {
210217 icon : < CheckCircle className = "w-4 h-4 text-green-500" /> ,
211- text : "All passing " ,
218+ text : "Passing " ,
212219 } ;
213220 }
214221
215222 return {
216- icon : < GitBranch className = "w-4 h-4 text-gray-400" /> ,
223+ icon : (
224+ < CircleAlert className = "w-4 h-4 text-yellow-500 dark:text-yellow-400" />
225+ ) ,
217226 text : "Mixed" ,
218227 } ;
219228 } ;
@@ -278,6 +287,7 @@ function RepositoryCard({ repo, onToggle }: RepositoryCardProps) {
278287 { overallStatus . text }
279288 </ span >
280289 </ div >
290+ < div className = "border-l border-gray-300 dark:border-gray-600 h-6 mx-2" > </ div >
281291 < div className = "flex items-center gap-2" >
282292 < Link
283293 to = { repo . html_url }
@@ -316,9 +326,9 @@ function RepositoryCard({ repo, onToggle }: RepositoryCardProps) {
316326 repo . workflows . map ( ( workflow ) =>
317327 workflow . runs && workflow . runs . length > 0 ? (
318328 < div key = { workflow . id } className = "py-1" >
319- { workflow . runs . map ( ( run ) => (
329+ { workflow . runs . map ( ( run , i ) => (
320330 < div
321- key = { run . id }
331+ key = { i }
322332 className = "flex items-center justify-between p-3 bg-gray-200 dark:bg-gray-700 rounded-lg"
323333 >
324334 < div className = "flex items-center gap-3" >
@@ -406,10 +416,10 @@ function RouteComponent() {
406416 className = "py-8"
407417 >
408418 < div className = "mb-8" >
409- < h1 className = "text-3xl font-bold text-gray-900 dark:text-gray-100 mb-2" >
419+ < h1 className = "text-4xl font-bold font-serif text-gray-900 dark:text-gray-100 mb-2" >
410420 GitHub Actions Dashboard
411421 </ h1 >
412- < p className = "text-gray-600 dark:text-gray-400" >
422+ < p className = "text-lg text- gray-600 dark:text-gray-400" >
413423 Monitor workflow runs and repository status across your GitHub
414424 repositories.
415425 </ p >
0 commit comments