@windrun-huaiin/third-ui 5.11.3 → 5.11.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3034,13 +3034,16 @@ function GradientButton({
3034
3034
  }
3035
3035
 
3036
3036
  // src/main/gallery.tsx
3037
+ import { useState as useState2 } from "react";
3037
3038
  import { jsx as jsx36, jsxs as jsxs12 } from "react/jsx-runtime";
3038
3039
  function Gallery({ sectionClassName }) {
3039
3040
  const t = useTranslations("gallery");
3040
3041
  const galleryItems = t.raw("prompts");
3041
- const handleDownload = (index) => __async(null, null, function* () {
3042
+ const defaultImgUrl = t.raw("defaultImgUrl");
3043
+ const [imageErrors, setImageErrors] = useState2(/* @__PURE__ */ new Set());
3044
+ const handleDownload = (item, index) => __async(null, null, function* () {
3042
3045
  try {
3043
- const response = yield fetch(`/${index + 1}.webp`);
3046
+ const response = yield fetch(item.url);
3044
3047
  const blob = yield response.blob();
3045
3048
  const url = window.URL.createObjectURL(blob);
3046
3049
  const a = document.createElement("a");
@@ -3054,6 +3057,12 @@ function Gallery({ sectionClassName }) {
3054
3057
  console.error("Download failed:", error);
3055
3058
  }
3056
3059
  });
3060
+ const handleImageError = (index) => {
3061
+ setImageErrors((prev) => new Set(prev).add(index));
3062
+ };
3063
+ const getImageSrc = (item, index) => {
3064
+ return imageErrors.has(index) ? defaultImgUrl : item.url;
3065
+ };
3057
3066
  return /* @__PURE__ */ jsxs12("section", { id: "gallery", className: cn("container mx-auto px-4 py-20 scroll-mt-20", sectionClassName), children: [
3058
3067
  /* @__PURE__ */ jsxs12("h2", { className: "text-3xl md:text-4xl font-bold text-center mb-6", children: [
3059
3068
  t("titleL"),
@@ -3063,21 +3072,22 @@ function Gallery({ sectionClassName }) {
3063
3072
  t("titleR")
3064
3073
  ] }),
3065
3074
  /* @__PURE__ */ jsx36("p", { className: "text-center max-w-2xl mx-auto mb-16", children: t("description") }),
3066
- /* @__PURE__ */ jsx36("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6", children: galleryItems.map((_prompt, index) => /* @__PURE__ */ jsxs12("div", { className: "group relative overflow-hidden rounded-xl", children: [
3075
+ /* @__PURE__ */ jsx36("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6", children: galleryItems.map((item, index) => /* @__PURE__ */ jsxs12("div", { className: "group relative overflow-hidden rounded-xl", children: [
3067
3076
  /* @__PURE__ */ jsx36(
3068
3077
  Image,
3069
3078
  {
3070
- src: `/${index + 1}.webp`,
3071
- alt: "Reve Image AI-generated artwork",
3079
+ src: getImageSrc(item, index),
3080
+ alt: item.altMsg,
3072
3081
  width: 600,
3073
3082
  height: 600,
3074
- className: "w-full h-80 object-cover transition duration-300 group-hover:scale-105"
3083
+ className: "w-full h-80 object-cover transition duration-300 group-hover:scale-105",
3084
+ onError: () => handleImageError(index)
3075
3085
  }
3076
3086
  ),
3077
3087
  /* @__PURE__ */ jsx36("div", { className: "absolute inset-0 flex items-end justify-end p-4 opacity-0 group-hover:opacity-100 transition duration-300", children: /* @__PURE__ */ jsx36(
3078
3088
  "button",
3079
3089
  {
3080
- onClick: () => handleDownload(index),
3090
+ onClick: () => handleDownload(item, index),
3081
3091
  className: "bg-black/50 hover:bg-black/70 p-2 rounded-full text-white/80 hover:text-white transition-all duration-300",
3082
3092
  children: /* @__PURE__ */ jsx36(globalLucideIcons.Download, { className: "h-5 w-5 text-white" })
3083
3093
  }
@@ -3174,13 +3184,13 @@ function Tips({ sectionClassName }) {
3174
3184
  }
3175
3185
 
3176
3186
  // src/main/faq.tsx
3177
- import { useState as useState2 } from "react";
3187
+ import { useState as useState3 } from "react";
3178
3188
  import { useTranslations as useTranslations5 } from "next-intl";
3179
3189
  import { jsx as jsx40, jsxs as jsxs16 } from "react/jsx-runtime";
3180
3190
  function FAQ({ sectionClassName }) {
3181
3191
  const t = useTranslations5("faq");
3182
3192
  const items = t.raw("items");
3183
- const [openArr, setOpenArr] = useState2(() => items.map(() => false));
3193
+ const [openArr, setOpenArr] = useState3(() => items.map(() => false));
3184
3194
  const handleToggle = (idx) => {
3185
3195
  setOpenArr((prev) => {
3186
3196
  const next = [...prev];
@@ -3310,10 +3320,10 @@ function Footer() {
3310
3320
  }
3311
3321
 
3312
3322
  // src/main/go-to-top.tsx
3313
- import { useState as useState3, useEffect } from "react";
3323
+ import { useState as useState4, useEffect } from "react";
3314
3324
  import { Fragment as Fragment4, jsx as jsx44 } from "react/jsx-runtime";
3315
3325
  function GoToTop() {
3316
- const [isVisible, setIsVisible] = useState3(false);
3326
+ const [isVisible, setIsVisible] = useState4(false);
3317
3327
  useEffect(() => {
3318
3328
  const toggleVisibility = () => {
3319
3329
  if (window.scrollY > 300) {
@@ -3457,7 +3467,7 @@ function NProgressBar() {
3457
3467
  }
3458
3468
 
3459
3469
  // src/main/price-plan.tsx
3460
- import { useState as useState4 } from "react";
3470
+ import { useState as useState5 } from "react";
3461
3471
  import { useTranslations as useTranslations9 } from "next-intl";
3462
3472
  import { useRouter } from "next/navigation";
3463
3473
  import { Fragment as Fragment5, jsx as jsx46, jsxs as jsxs21 } from "react/jsx-runtime";
@@ -3470,8 +3480,8 @@ function PricePlan({ currency = "$", pricePlanConfig, sectionClassName }) {
3470
3480
  const billingOptions = pricePlanConfig.billingOptions;
3471
3481
  const prices = pricePlanConfig.prices;
3472
3482
  const minPlanFeaturesCount = pricePlanConfig.minPlanFeaturesCount;
3473
- const [billingKey, setBillingKey] = useState4(billingSwitch.defaultKey);
3474
- const [tooltip, setTooltip] = useState4({ show: false, content: "", x: 0, y: 0 });
3483
+ const [billingKey, setBillingKey] = useState5(billingSwitch.defaultKey);
3484
+ const [tooltip, setTooltip] = useState5({ show: false, content: "", x: 0, y: 0 });
3475
3485
  const currentBilling = billingOptions.find((opt) => opt.key === billingKey) || billingOptions[0];
3476
3486
  const currentBillingDisplay = billingSwitch.options.find((opt) => opt.key === billingKey) || billingSwitch.options[0];
3477
3487
  const maxFeaturesCount = Math.max(
@@ -3680,7 +3690,7 @@ function PricePlan({ currency = "$", pricePlanConfig, sectionClassName }) {
3680
3690
  }
3681
3691
 
3682
3692
  // src/main/ads-alert-dialog.tsx
3683
- import { useState as useState14 } from "react";
3693
+ import { useState as useState15 } from "react";
3684
3694
  import Image2 from "next/image";
3685
3695
 
3686
3696
  // ../base-ui/src/ui/alert-dialog.tsx
@@ -4588,9 +4598,9 @@ function assignRef(ref, value) {
4588
4598
  }
4589
4599
 
4590
4600
  // ../../node_modules/.pnpm/use-callback-ref@1.3.3_@types+react@19.1.2_react@19.1.0/node_modules/use-callback-ref/dist/es2015/useRef.js
4591
- import { useState as useState11 } from "react";
4601
+ import { useState as useState12 } from "react";
4592
4602
  function useCallbackRef2(initialValue, callback) {
4593
- var ref = useState11(function() {
4603
+ var ref = useState12(function() {
4594
4604
  return {
4595
4605
  // value
4596
4606
  value: initialValue,
@@ -5948,7 +5958,7 @@ function AdsAlertDialog({
5948
5958
  confirmText,
5949
5959
  onConfirm
5950
5960
  }) {
5951
- const [imgError, setImgError] = useState14(false);
5961
+ const [imgError, setImgError] = useState15(false);
5952
5962
  return /* @__PURE__ */ jsx55(AlertDialog2, { open, onOpenChange, children: /* @__PURE__ */ jsxs25(
5953
5963
  AlertDialogContent2,
5954
5964
  {
@@ -6031,12 +6041,12 @@ function AdsAlertDialog({
6031
6041
  }
6032
6042
 
6033
6043
  // src/main/x-button.tsx
6034
- import { useState as useState15, useRef as useRef12, useEffect as useEffect17 } from "react";
6044
+ import { useState as useState16, useRef as useRef12, useEffect as useEffect17 } from "react";
6035
6045
  import { Fragment as Fragment9, jsx as jsx56, jsxs as jsxs26 } from "react/jsx-runtime";
6036
6046
  function XButton(props) {
6037
6047
  var _a, _b;
6038
- const [isLoading, setIsLoading] = useState15(false);
6039
- const [menuOpen, setMenuOpen] = useState15(false);
6048
+ const [isLoading, setIsLoading] = useState16(false);
6049
+ const [menuOpen, setMenuOpen] = useState16(false);
6040
6050
  const menuRef = useRef12(null);
6041
6051
  useEffect17(() => {
6042
6052
  if (props.type === "split") {
@@ -6266,7 +6276,7 @@ function AIPromptTextarea({
6266
6276
  disabled,
6267
6277
  className: cn(
6268
6278
  "w-full p-4 bg-transparent transition-colors text-foreground placeholder-muted-foreground placeholder:text-base disabled:bg-muted disabled:cursor-not-allowed resize-none",
6269
- isEmbedded ? "border-0 hover:border-2 hover:border-purple-500 focus:border-2 focus:border-purple-500" : "border-2 border-border rounded-lg hover:border-purple-500 focus:border-purple-500",
6279
+ isEmbedded ? "border-0 hover:border-2 hover:border-purple-500 focus:outline-none focus:border-2 focus:border-purple-500" : "border-2 border-border rounded-lg hover:border-purple-500 focus:outline-none focus:border-purple-500",
6270
6280
  className
6271
6281
  ),
6272
6282
  style: { minHeight: `${minHeight}px` }