Fix TypeScript errors in experiments feature

- Add experimentMap/onOpenExperiment props to WeeklyRow component
- Export VendorDailyRow type from supabase.ts
- Fix type errors in experiments.ts (unknown[] to string[])
- Add type annotation for allAsins in App.tsx

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
Christian Vidal Wolf
2026-02-20 19:39:56 +01:00
co-authored by Qwen-Coder
parent f93d92da0b
commit a21c0d532c
5 changed files with 24 additions and 17 deletions
+9 -10
View File
@@ -7,25 +7,24 @@ interface ExperimentBadgeProps {
onClick?: (experimentId: string) => void;
}
const getStatusBadge = (status: ExperimentStatus) => {
switch (status) {
case 'active': return '🟢';
case 'planned': return '🟡';
case 'completed': return '⚪';
case 'paused': return '⏸️';
}
};
export const ExperimentBadge: React.FC<ExperimentBadgeProps> = ({ experiments, onClick }) => {
if (!experiments || experiments.length === 0) return null;
const activeExp = experiments.find(e => e.status === 'active');
const plannedExp = experiments.find(e => e.status === 'planned');
const hasPast = experiments.some(e => e.status === 'completed' || e.status === 'paused');
// Priority: active > planned > past
const displayExp = activeExp || plannedExp || experiments[0];
const getStatusBadge = (status: ExperimentStatus) => {
switch (status) {
case 'active': return '🟢';
case 'planned': return '🟡';
case 'completed': return '⚪';
case 'paused': return '⏸️';
}
};
const daysText = displayExp.days_remaining !== undefined
? displayExp.days_remaining > 0
? `${displayExp.days_remaining}d left`