From 2c9a3c51617781529a96d8c4562d37baedbfd72f Mon Sep 17 00:00:00 2001 From: Kacper Date: Wed, 24 Dec 2025 02:12:22 +0100 Subject: [PATCH] feat: Refactor validation logic in GitHubIssuesView for improved clarity - Simplified the validation staleness check by introducing a dedicated variable for stale validation status. - Enhanced the conditions for unviewed and viewed validation indicators, improving user feedback on validation status. - Added a visual indicator for viewed validations, enhancing the user interface and experience. --- .../components/views/github-issues-view.tsx | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/apps/ui/src/components/views/github-issues-view.tsx b/apps/ui/src/components/views/github-issues-view.tsx index e92bcc6a..1624b712 100644 --- a/apps/ui/src/components/views/github-issues-view.tsx +++ b/apps/ui/src/components/views/github-issues-view.tsx @@ -846,15 +846,18 @@ function IssueRow({ cachedValidation, isValidating, }: IssueRowProps) { + // Check if validation exists and calculate staleness + const validationHoursSince = cachedValidation + ? (Date.now() - new Date(cachedValidation.validatedAt).getTime()) / (1000 * 60 * 60) + : null; + const isValidationStale = validationHoursSince !== null && validationHoursSince > 24; + // Check if validation is unviewed (exists, not stale, not viewed) const hasUnviewedValidation = - cachedValidation && - !cachedValidation.viewedAt && - (() => { - const hoursSince = - (Date.now() - new Date(cachedValidation.validatedAt).getTime()) / (1000 * 60 * 60); - return hoursSince <= 24; - })(); + cachedValidation && !cachedValidation.viewedAt && !isValidationStale; + + // Check if validation has been viewed (exists and was viewed) + const hasViewedValidation = cachedValidation && cachedValidation.viewedAt && !isValidationStale; return (
)} + + {/* Viewed validation indicator */} + {!isValidating && hasViewedValidation && ( + + + Validated + + )}