| 285 | /** Full at the start, emptying as the days run out. Capped under 100, where |
| 286 | * ProgressCircle swaps the ring for a check mark */ |
| 287 | const timeLeftOf = ({ createdAt, endedAt }: Campaign): number => { |
| 288 | const start = new Date(createdAt).getTime(); |
| 289 | const end = new Date(endedAt).getTime(); |
| 290 | |
| 291 | return Math.max(0, Math.min(99, ((end - Date.now()) / (end - start)) * 100)); |
| 292 | }; |
| 293 | |
| 294 | const endedStatus: Partial<Record<CampaignState, string>> = { |
| 295 | [CampaignState.Completed]: 'bg-action-share-active text-action-share-default', |