release-notes-dialog.tsx 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. "use client";
  2. import * as React from "react";
  3. import { Bell } from "lucide-react";
  4. import { useCurrentLocale, useI18n } from "locales/client";
  5. import { formatDate } from "@/shared/lib/date";
  6. import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog";
  7. import { Button } from "@/components/ui/button";
  8. import { releaseNotes } from "../model/notes";
  9. export function ReleaseNotesDialog() {
  10. const t = useI18n();
  11. const locale = useCurrentLocale();
  12. return (
  13. <Dialog>
  14. <DialogTrigger asChild>
  15. <Button aria-label={t("release_notes.release_notes")} className="rounded-full hover:bg-slate-200" size="small" variant="ghost">
  16. <div className="tooltip tooltip-bottom" data-tip={t("commons.changelog")}>
  17. <Bell className="text-blue-500 dark:text-blue-400 h-6 w-6" />
  18. </div>
  19. </Button>
  20. </DialogTrigger>
  21. <DialogContent className="max-w-md">
  22. <DialogHeader>
  23. <DialogTitle>{t("release_notes.title")}</DialogTitle>
  24. </DialogHeader>
  25. <div className="space-y-4">
  26. {releaseNotes.map((note) => (
  27. <div className="border-b pb-2 last:border-b-0 last:pb-0 py-2" key={note.date}>
  28. <div className="text-xs text-muted-foreground">{formatDate(note.date, locale)}</div>
  29. <div className="font-semibold mb-1">{t(note.titleKey as keyof typeof t)}</div>
  30. <div className="text-sm mb-4">{t(note.contentKey as keyof typeof t)}</div>
  31. </div>
  32. ))}
  33. </div>
  34. </DialogContent>
  35. </Dialog>
  36. );
  37. }