EmptyAdvisor.tsx57 lines · main
| 1 | import { TextSearch } from 'lucide-react' |
| 2 | import { Button } from 'ui' |
| 3 | |
| 4 | import type { AdvisorTab } from '@/state/advisor-state' |
| 5 | |
| 6 | interface EmptyAdvisorProps { |
| 7 | activeTab: AdvisorTab |
| 8 | hasFilters: boolean |
| 9 | onClearFilters: () => void |
| 10 | } |
| 11 | |
| 12 | export const EmptyAdvisor = ({ activeTab, hasFilters, onClearFilters }: EmptyAdvisorProps) => { |
| 13 | const getHeading = () => { |
| 14 | if (hasFilters) return 'No items found' |
| 15 | |
| 16 | switch (activeTab) { |
| 17 | case 'security': |
| 18 | return 'No security issues detected' |
| 19 | case 'performance': |
| 20 | return 'No performance issues detected' |
| 21 | case 'messages': |
| 22 | return 'No messages' |
| 23 | default: |
| 24 | return 'No issues detected' |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | const getMessage = () => { |
| 29 | if (hasFilters) return 'No advisor items match your current filters' |
| 30 | |
| 31 | switch (activeTab) { |
| 32 | case 'security': |
| 33 | return 'Congrats! There are no security issues detected for this project' |
| 34 | case 'performance': |
| 35 | return 'Congrats! There are no performance issues detected for this project' |
| 36 | case 'messages': |
| 37 | return 'Messages alert you of upcoming changes or potential issues with your project' |
| 38 | default: |
| 39 | return 'Congrats! There are no issues detected' |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | return ( |
| 44 | <div className="h-full px-6 flex flex-col items-center justify-center w-full gap-y-2"> |
| 45 | <TextSearch className="text-foreground-muted" strokeWidth={1} /> |
| 46 | <div className="flex flex-col items-center gap-y-0.5 text-center"> |
| 47 | <h3 className="heading-default">{getHeading()}</h3> |
| 48 | <p className="text-foreground-light text-sm text-balance">{getMessage()}</p> |
| 49 | </div> |
| 50 | {hasFilters && ( |
| 51 | <Button type="outline" onClick={onClearFilters}> |
| 52 | Clear filters |
| 53 | </Button> |
| 54 | )} |
| 55 | </div> |
| 56 | ) |
| 57 | } |