|
| 1 | +'use client' |
| 2 | + |
| 3 | +import React from 'react' |
| 4 | +import { HelpCircle, ExternalLink, Mail } from 'lucide-react' |
| 5 | +import IconPopover from '@/components/common/IconPopover' |
| 6 | +import { CLS } from '@/lib/utils/styles' |
| 7 | +import { Separator } from '@/components/ui/separator' |
| 8 | + |
| 9 | +export default function HelpPopover() { |
| 10 | + const sections = [ |
| 11 | + { |
| 12 | + title: 'Help', |
| 13 | + links: [ |
| 14 | + { |
| 15 | + label: 'Read docs', |
| 16 | + url: 'https://smoosense.ai/docs', |
| 17 | + icon: <ExternalLink className="h-3 w-3" /> |
| 18 | + }, |
| 19 | + { |
| 20 | + label: 'Consult tailored solution', |
| 21 | + |
| 22 | + icon: <Mail className="h-3 w-3" /> |
| 23 | + } |
| 24 | + ] |
| 25 | + }, |
| 26 | + { |
| 27 | + title: 'GitHub', |
| 28 | + links: [ |
| 29 | + { |
| 30 | + label: 'Report bugs or feature request', |
| 31 | + url: 'https://github.com/SmooSenseAI/smoosense/issues/new', |
| 32 | + icon: <ExternalLink className="h-3 w-3" /> |
| 33 | + } |
| 34 | + ], |
| 35 | + badges: [ |
| 36 | + { |
| 37 | + alt: 'License', |
| 38 | + src: 'https://img.shields.io/github/license/SmooSenseAI/smoosense', |
| 39 | + url: 'https://github.com/SmooSenseAI/smoosense/blob/main/LICENSE' |
| 40 | + }, |
| 41 | + { |
| 42 | + alt: 'CI Status', |
| 43 | + src: 'https://github.com/SmooSenseAI/smoosense/actions/workflows/ci.yml/badge.svg', |
| 44 | + url: 'https://github.com/SmooSenseAI/smoosense/actions/workflows/ci.yml' |
| 45 | + }, |
| 46 | + { |
| 47 | + alt: 'Issues', |
| 48 | + src: 'https://img.shields.io/github/issues/SmooSenseAI/smoosense', |
| 49 | + url: 'https://github.com/SmooSenseAI/smoosense/issues' |
| 50 | + } |
| 51 | + ] |
| 52 | + }, |
| 53 | + { |
| 54 | + title: 'Try SmooSense with your data', |
| 55 | + links: [ |
| 56 | + { |
| 57 | + label: 'Get started', |
| 58 | + url: 'https://smoosense.ai/start', |
| 59 | + icon: <ExternalLink className="h-3 w-3" /> |
| 60 | + } |
| 61 | + ], |
| 62 | + badges: [ |
| 63 | + { |
| 64 | + alt: 'Latest version', |
| 65 | + src: 'https://img.shields.io/pypi/v/smoosense?label=pypi-latest', |
| 66 | + url: 'https://pypi.org/project/smoosense/' |
| 67 | + }, |
| 68 | + { |
| 69 | + alt: 'Downloads', |
| 70 | + src: 'https://static.pepy.tech/personalized-badge/smoosense?period=total&units=international_system&left_color=black&right_color=MAGENTA&left_text=downloads', |
| 71 | + url: 'https://pepy.tech/project/smoosense' |
| 72 | + } |
| 73 | + ] |
| 74 | + } |
| 75 | + ] |
| 76 | + |
| 77 | + return ( |
| 78 | + <IconPopover |
| 79 | + icon={<HelpCircle className="h-4 w-4" />} |
| 80 | + tooltip="Help & Resources" |
| 81 | + contentClassName="w-auto p-3" |
| 82 | + align="end" |
| 83 | + > |
| 84 | + <div className="min-w-[240px]"> |
| 85 | + {sections.map((section, sectionIndex) => ( |
| 86 | + <React.Fragment key={sectionIndex}> |
| 87 | + {sectionIndex > 0 && <Separator className="my-3" />} |
| 88 | + <div> |
| 89 | + <h4 className="text-sm font-semibold text-muted-foreground mb-1.5"> |
| 90 | + {section.title} |
| 91 | + </h4> |
| 92 | + {section.badges && ( |
| 93 | + <div className="flex flex-wrap gap-1.5 mb-2"> |
| 94 | + {section.badges.map((badge, badgeIndex) => ( |
| 95 | + <a |
| 96 | + key={badgeIndex} |
| 97 | + href={badge.url} |
| 98 | + target="_blank" |
| 99 | + rel="noopener noreferrer" |
| 100 | + > |
| 101 | + <img |
| 102 | + src={badge.src} |
| 103 | + alt={badge.alt} |
| 104 | + className="h-6 mx-1" |
| 105 | + /> |
| 106 | + </a> |
| 107 | + ))} |
| 108 | + </div> |
| 109 | + )} |
| 110 | + <div className="space-y-1"> |
| 111 | + {section.links.map((link, linkIndex) => ( |
| 112 | + <a |
| 113 | + key={linkIndex} |
| 114 | + href={link.url} |
| 115 | + target="_blank" |
| 116 | + rel="noopener noreferrer" |
| 117 | + className={`flex items-center justify-between gap-2 text-sm ${CLS.HYPERLINK} py-1`} |
| 118 | + > |
| 119 | + <span>{link.label}</span> |
| 120 | + {link.icon} |
| 121 | + </a> |
| 122 | + ))} |
| 123 | + </div> |
| 124 | + </div> |
| 125 | + </React.Fragment> |
| 126 | + ))} |
| 127 | + </div> |
| 128 | + </IconPopover> |
| 129 | + ) |
| 130 | +} |
0 commit comments