|
| 1 | +import { type FC } from 'react' |
| 2 | +import { ExternalLink, X } from 'lucide-react' |
| 3 | +import { Card, CardContent } from '@oasisprotocol/ui-library/src/components/ui/card' |
| 4 | +import { Button } from '@oasisprotocol/ui-library/src/components/ui/button' |
| 5 | +import OasisLogoBlue from '../icons/OasisLogoBlue.svg' |
| 6 | +import { toast } from 'sonner' |
| 7 | + |
| 8 | +const SURVEY_LINK = 'https://forms.gle/hiaMTdEZ43PM72QW7' |
| 9 | + |
| 10 | +interface SurveyPopupProps { |
| 11 | + onClose: () => void |
| 12 | + isVisible: boolean |
| 13 | +} |
| 14 | + |
| 15 | +export const SurveyPopup: FC<SurveyPopupProps> = ({ onClose, isVisible }) => { |
| 16 | + // This is not the most reliable check, but simple enough opposed to hijacking the API, to count active toasts |
| 17 | + const hasActiveToasts = toast.getHistory().length > 0 |
| 18 | + |
| 19 | + if (!isVisible || hasActiveToasts) return null |
| 20 | + |
| 21 | + return ( |
| 22 | + <div className="fixed bottom-5 right-5 md:right-12.5 z-50 max-w-[calc(100vw-2.5rem)] md:max-w-none"> |
| 23 | + <Card className="w-full md:w-[420px] rounded-xl bg-background border shadow-lg animate-in slide-in-from-bottom-4 fade-in-0 duration-300"> |
| 24 | + <CardContent className="flex flex-col gap-4 md:gap-6"> |
| 25 | + <div className="flex justify-between items-start gap-4 md:gap-6 w-full"> |
| 26 | + <div className="text-primary"> |
| 27 | + <img src={OasisLogoBlue} alt="Oasis" className="h-6 md:h-auto" /> |
| 28 | + </div> |
| 29 | + <button className="opacity-70 flex-shrink-0" onClick={onClose}> |
| 30 | + <X className="h-4 w-4 text-foreground" /> |
| 31 | + </button> |
| 32 | + </div> |
| 33 | + |
| 34 | + <div className="flex flex-col gap-1.5"> |
| 35 | + <h2 className="text-2xl md:text-[30px] font-bold leading-tight md:leading-9 text-card-foreground"> |
| 36 | + Help us improve ROFL 🚀 |
| 37 | + </h2> |
| 38 | + <p className="text-sm font-normal leading-5 text-muted-foreground"> |
| 39 | + Tell us what's working (and what's not). Your feedback makes a difference. Share your thoughts |
| 40 | + and help shape what's next. |
| 41 | + </p> |
| 42 | + </div> |
| 43 | + |
| 44 | + <Button className="w-full gap-2" asChild> |
| 45 | + <a href={SURVEY_LINK} rel="noopener noreferrer" target="_blank"> |
| 46 | + Take the survey |
| 47 | + <ExternalLink className="h-4 w-4" /> |
| 48 | + </a> |
| 49 | + </Button> |
| 50 | + </CardContent> |
| 51 | + </Card> |
| 52 | + </div> |
| 53 | + ) |
| 54 | +} |
0 commit comments