AI store generator for ecommerce, Malaysia first. Laravel 13 + React + TypeScript.
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

preview.tsx 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import { Head } from '@inertiajs/react';
  2. import { StorefrontRenderer } from '@/storefront/renderer';
  3. import { fontStylesheetUrl, storefrontTitlePrefix } from '@/storefront/theme';
  4. import type {
  5. FontMap,
  6. ShopInfo,
  7. StoreCart,
  8. StorePlan,
  9. StoreProduct,
  10. StorefrontView,
  11. } from '@/storefront/types';
  12. export default function PreviewStore({
  13. storeName,
  14. language,
  15. plan,
  16. fonts,
  17. baseUrl,
  18. preview,
  19. view,
  20. products,
  21. cart,
  22. shop,
  23. featuredProducts,
  24. }: {
  25. storeName: string;
  26. language: string;
  27. plan: StorePlan;
  28. fonts: FontMap;
  29. baseUrl: string;
  30. /** True in the owner's preview, false on the live store. */
  31. preview: boolean;
  32. view: StorefrontView;
  33. products: StoreProduct[];
  34. cart: StoreCart;
  35. shop: ShopInfo;
  36. featuredProducts: Record<string, StoreProduct>;
  37. }) {
  38. const fontUrl = fontStylesheetUrl(plan.theme, fonts);
  39. const page =
  40. view.type === 'page' && view.pageId !== 'home'
  41. ? plan.pages.find((candidate) => candidate.id === view.pageId)
  42. : undefined;
  43. const title =
  44. view.type === 'product'
  45. ? view.product.name
  46. : page
  47. ? `${page.title} - ${storeName}`
  48. : storeName;
  49. return (
  50. <>
  51. <Head
  52. title={
  53. preview
  54. ? `${title} (preview)`
  55. : storefrontTitlePrefix + title
  56. }
  57. >
  58. {fontUrl && <link rel="stylesheet" href={fontUrl} />}
  59. </Head>
  60. <StorefrontRenderer
  61. plan={plan}
  62. fonts={fonts}
  63. view={view}
  64. baseUrl={baseUrl}
  65. language={language}
  66. products={products}
  67. cart={cart}
  68. storeName={storeName}
  69. shop={shop}
  70. featuredProducts={featuredProducts}
  71. />
  72. </>
  73. );
  74. }