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