18 lines
677 B
TypeScript
18 lines
677 B
TypeScript
export type GrowthDisplayMode = 'loading' | 'content' | 'error';
|
|
|
|
export function reportDisplayMode(
|
|
status: string | undefined,
|
|
hasCurrentEvidence: boolean,
|
|
hasPreviousEvidence: boolean,
|
|
): GrowthDisplayMode {
|
|
if (hasCurrentEvidence || hasPreviousEvidence) return 'content';
|
|
if (status === 'QUEUED' || status === 'ANALYZING' || status === 'GENERATING') return 'loading';
|
|
return 'error';
|
|
}
|
|
|
|
export function refreshAvailabilityLabel(hasAISummary: boolean, nextRefreshLabel: string): string {
|
|
return hasAISummary
|
|
? `نوبت بعدی: ${nextRefreshLabel}`
|
|
: 'تا آمادهشدن توضیح هوشمند، تلاش دوباره محدود نیست.';
|
|
}
|