AI store generator for ecommerce, Malaysia first. Laravel 13 + React + TypeScript.
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

dashboard.tsx 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. import { Head, Link } from '@inertiajs/react';
  2. import { Plus, Store as StoreIcon } from 'lucide-react';
  3. import { Badge } from '@/components/ui/badge';
  4. import { Button } from '@/components/ui/button';
  5. import {
  6. Card,
  7. CardContent,
  8. CardDescription,
  9. CardHeader,
  10. CardTitle,
  11. } from '@/components/ui/card';
  12. import { dashboard } from '@/routes';
  13. import { create, show } from '@/routes/stores';
  14. import PlanNotice from '@/components/plan-notice';
  15. import type { Store, Usage } from '@/types';
  16. export default function Dashboard({
  17. stores,
  18. usage,
  19. }: {
  20. stores: Store[];
  21. usage: Usage;
  22. }) {
  23. return (
  24. <>
  25. <Head title="Dashboard" />
  26. <div className="flex h-full flex-1 flex-col gap-6 p-4">
  27. <PlanNotice usage={usage} />
  28. <div className="flex flex-wrap items-center justify-between gap-4">
  29. <div>
  30. <h1 className="text-xl font-semibold">Your stores</h1>
  31. <p className="text-sm text-muted-foreground">
  32. Create a store, then let AI design it for you.
  33. </p>
  34. </div>
  35. {stores.length > 0 && (
  36. <Button asChild>
  37. <Link href={create()}>
  38. <Plus />
  39. Create store
  40. </Link>
  41. </Button>
  42. )}
  43. </div>
  44. {stores.length === 0 ? (
  45. <div className="flex flex-1 flex-col items-center justify-center gap-4 rounded-xl border border-dashed p-10 text-center">
  46. <div className="flex size-12 items-center justify-center rounded-full bg-muted">
  47. <StoreIcon className="size-6 text-muted-foreground" />
  48. </div>
  49. <div>
  50. <h2 className="font-medium">No stores yet</h2>
  51. <p className="mt-1 max-w-sm text-sm text-muted-foreground">
  52. Tell us about your brand and we will set up your
  53. first online store.
  54. </p>
  55. </div>
  56. <Button asChild>
  57. <Link href={create()}>
  58. <Plus />
  59. Create your first store
  60. </Link>
  61. </Button>
  62. </div>
  63. ) : (
  64. <div className="grid gap-4 sm:grid-cols-2 xl:grid-cols-3">
  65. {stores.map((store) => (
  66. <Link
  67. key={store.id}
  68. href={show(store.slug)}
  69. className="rounded-xl focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none"
  70. >
  71. <Card className="h-full transition-colors hover:bg-accent/40">
  72. <CardHeader>
  73. <div className="flex items-start justify-between gap-3">
  74. <CardTitle className="leading-snug">
  75. {store.name}
  76. </CardTitle>
  77. <Badge
  78. variant={
  79. store.status === 'published'
  80. ? 'default'
  81. : 'secondary'
  82. }
  83. >
  84. {store.status_label}
  85. </Badge>
  86. </div>
  87. <CardDescription>
  88. {store.category_label}
  89. </CardDescription>
  90. </CardHeader>
  91. <CardContent>
  92. <p className="line-clamp-3 text-sm text-muted-foreground">
  93. {store.description}
  94. </p>
  95. </CardContent>
  96. </Card>
  97. </Link>
  98. ))}
  99. </div>
  100. )}
  101. </div>
  102. </>
  103. );
  104. }
  105. Dashboard.layout = {
  106. breadcrumbs: [
  107. {
  108. title: 'Dashboard',
  109. href: dashboard(),
  110. },
  111. ],
  112. };