ExplorerNotFound.jsx 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import React from "react";
  2. import Link from "next/link";
  3. import { FolderX } from "lucide-react";
  4. import { Button } from "@/components/ui/button";
  5. import {
  6. Card,
  7. CardHeader,
  8. CardTitle,
  9. CardDescription,
  10. CardContent,
  11. CardFooter,
  12. } from "@/components/ui/card";
  13. /**
  14. * ExplorerNotFound
  15. *
  16. * Used when the backend returns FS_NOT_FOUND for a syntactically valid route.
  17. * This can happen when the NAS structure changed after the user navigated.
  18. *
  19. * @param {{
  20. * title?: string,
  21. * description?: string,
  22. * upHref?: string|null,
  23. * branchRootHref?: string|null
  24. * }} props
  25. */
  26. export default function ExplorerNotFound({
  27. title = "Nicht gefunden",
  28. description = "Dieser Pfad existiert nicht (mehr). Bitte wählen Sie eine andere Ebene.",
  29. upHref = null,
  30. branchRootHref = null,
  31. }) {
  32. return (
  33. <Card>
  34. <CardHeader>
  35. <CardTitle className="flex items-center gap-2">
  36. <FolderX
  37. className="h-5 w-5 text-muted-foreground"
  38. aria-hidden="true"
  39. />
  40. {title}
  41. </CardTitle>
  42. <CardDescription>{description}</CardDescription>
  43. </CardHeader>
  44. <CardContent className="text-sm text-muted-foreground">
  45. Dies kann passieren, wenn Ordner auf dem NAS verschoben oder gelöscht
  46. wurden.
  47. </CardContent>
  48. <CardFooter className="flex flex-col gap-2 sm:flex-row sm:justify-end">
  49. {upHref ? (
  50. <Button variant="outline" asChild>
  51. <Link href={upHref}>Eine Ebene höher</Link>
  52. </Button>
  53. ) : null}
  54. {branchRootHref ? (
  55. <Button asChild>
  56. <Link href={branchRootHref}>Zur Niederlassung</Link>
  57. </Button>
  58. ) : null}
  59. </CardFooter>
  60. </Card>
  61. );
  62. }