AI store generator for ecommerce, Malaysia first. Laravel 13 + React + TypeScript.
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

dashboard.tsx 4.7KB

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