mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-04 09:13:08 +00:00
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.
This commit is contained in:
@@ -846,15 +846,18 @@ function IssueRow({
|
|||||||
cachedValidation,
|
cachedValidation,
|
||||||
isValidating,
|
isValidating,
|
||||||
}: IssueRowProps) {
|
}: 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)
|
// Check if validation is unviewed (exists, not stale, not viewed)
|
||||||
const hasUnviewedValidation =
|
const hasUnviewedValidation =
|
||||||
cachedValidation &&
|
cachedValidation && !cachedValidation.viewedAt && !isValidationStale;
|
||||||
!cachedValidation.viewedAt &&
|
|
||||||
(() => {
|
// Check if validation has been viewed (exists and was viewed)
|
||||||
const hoursSince =
|
const hasViewedValidation = cachedValidation && cachedValidation.viewedAt && !isValidationStale;
|
||||||
(Date.now() - new Date(cachedValidation.validatedAt).getTime()) / (1000 * 60 * 60);
|
|
||||||
return hoursSince <= 24;
|
|
||||||
})();
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
@@ -927,6 +930,14 @@ function IssueRow({
|
|||||||
Analysis Ready
|
Analysis Ready
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{/* Viewed validation indicator */}
|
||||||
|
{!isValidating && hasViewedValidation && (
|
||||||
|
<span className="inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] font-medium rounded-full bg-green-500/10 text-green-500 border border-green-500/20">
|
||||||
|
<CheckCircle className="h-3 w-3" />
|
||||||
|
Validated
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user