@windrun-huaiin/base-ui 6.0.2 → 7.0.0
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.
- package/dist/components/index.d.cts +1 -28
- package/dist/components/index.d.ts +1 -28
- package/dist/components/index.js +27 -199
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +26 -198
- package/dist/components/index.mjs.map +1 -1
- package/dist/components/server.d.cts +15 -1
- package/dist/components/server.d.ts +15 -1
- package/dist/components/server.js +86 -1
- package/dist/components/server.js.map +1 -1
- package/dist/components/server.mjs +86 -1
- package/dist/components/server.mjs.map +1 -1
- package/dist/ui/index.d.cts +0 -9
- package/dist/ui/index.d.ts +0 -9
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/components/index.ts +0 -4
- package/src/components/script/google-analytics-client.tsx +53 -0
- package/src/components/script/google-analytics-script.tsx +12 -47
- package/src/components/script/microsoft-clarity-client.tsx +21 -0
- package/src/components/script/microsoft-clarity-script.tsx +11 -17
- package/src/components/server.ts +4 -0
- package/src/ui/button.tsx +2 -0
- package/src/ui/language-button.tsx +1 -1
- package/src/components/language-detector.tsx +0 -175
@@ -6,20 +6,6 @@ interface NotFoundPageProps {
|
|
6
6
|
}
|
7
7
|
declare function NotFoundPage({ siteIcon }: NotFoundPageProps): react_jsx_runtime.JSX.Element;
|
8
8
|
|
9
|
-
type I18nConfig = {
|
10
|
-
locales: readonly string[];
|
11
|
-
detector: {
|
12
|
-
storagePrefix: string;
|
13
|
-
storageKey: string;
|
14
|
-
autoCloseTimeout: number;
|
15
|
-
expirationDays: number;
|
16
|
-
};
|
17
|
-
};
|
18
|
-
interface LanguageDetectorProps {
|
19
|
-
i18nConfig: I18nConfig;
|
20
|
-
}
|
21
|
-
declare function LanguageDetector({ i18nConfig }: LanguageDetectorProps): react_jsx_runtime.JSX.Element | null;
|
22
|
-
|
23
9
|
/**
|
24
10
|
* @license
|
25
11
|
* MIT License
|
@@ -34,17 +20,4 @@ interface LanguageSwitcherProps {
|
|
34
20
|
}
|
35
21
|
declare function LanguageSwitcher({ locales, localeLabels }: LanguageSwitcherProps): react_jsx_runtime.JSX.Element;
|
36
22
|
|
37
|
-
|
38
|
-
declare function useGoogleAnalytics(): {
|
39
|
-
trackEvent: (event: string, data?: Record<string, unknown>) => void;
|
40
|
-
};
|
41
|
-
declare global {
|
42
|
-
interface Window {
|
43
|
-
dataLayer: any[];
|
44
|
-
gtag: (...args: any[]) => void;
|
45
|
-
}
|
46
|
-
}
|
47
|
-
|
48
|
-
declare function MicrosoftClarityScript(): react_jsx_runtime.JSX.Element | null;
|
49
|
-
|
50
|
-
export { GoogleAnalyticsScript, LanguageDetector, LanguageSwitcher, MicrosoftClarityScript, NotFoundPage, useGoogleAnalytics };
|
23
|
+
export { LanguageSwitcher, NotFoundPage };
|
@@ -6,20 +6,6 @@ interface NotFoundPageProps {
|
|
6
6
|
}
|
7
7
|
declare function NotFoundPage({ siteIcon }: NotFoundPageProps): react_jsx_runtime.JSX.Element;
|
8
8
|
|
9
|
-
type I18nConfig = {
|
10
|
-
locales: readonly string[];
|
11
|
-
detector: {
|
12
|
-
storagePrefix: string;
|
13
|
-
storageKey: string;
|
14
|
-
autoCloseTimeout: number;
|
15
|
-
expirationDays: number;
|
16
|
-
};
|
17
|
-
};
|
18
|
-
interface LanguageDetectorProps {
|
19
|
-
i18nConfig: I18nConfig;
|
20
|
-
}
|
21
|
-
declare function LanguageDetector({ i18nConfig }: LanguageDetectorProps): react_jsx_runtime.JSX.Element | null;
|
22
|
-
|
23
9
|
/**
|
24
10
|
* @license
|
25
11
|
* MIT License
|
@@ -34,17 +20,4 @@ interface LanguageSwitcherProps {
|
|
34
20
|
}
|
35
21
|
declare function LanguageSwitcher({ locales, localeLabels }: LanguageSwitcherProps): react_jsx_runtime.JSX.Element;
|
36
22
|
|
37
|
-
|
38
|
-
declare function useGoogleAnalytics(): {
|
39
|
-
trackEvent: (event: string, data?: Record<string, unknown>) => void;
|
40
|
-
};
|
41
|
-
declare global {
|
42
|
-
interface Window {
|
43
|
-
dataLayer: any[];
|
44
|
-
gtag: (...args: any[]) => void;
|
45
|
-
}
|
46
|
-
}
|
47
|
-
|
48
|
-
declare function MicrosoftClarityScript(): react_jsx_runtime.JSX.Element | null;
|
49
|
-
|
50
|
-
export { GoogleAnalyticsScript, LanguageDetector, LanguageSwitcher, MicrosoftClarityScript, NotFoundPage, useGoogleAnalytics };
|
23
|
+
export { LanguageSwitcher, NotFoundPage };
|
package/dist/components/index.js
CHANGED
@@ -60,12 +60,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
60
60
|
// src/components/index.ts
|
61
61
|
var components_exports = {};
|
62
62
|
__export(components_exports, {
|
63
|
-
GoogleAnalyticsScript: () => GoogleAnalyticsScript,
|
64
|
-
LanguageDetector: () => LanguageDetector,
|
65
63
|
LanguageSwitcher: () => LanguageSwitcher,
|
66
|
-
|
67
|
-
NotFoundPage: () => NotFoundPage,
|
68
|
-
useGoogleAnalytics: () => useGoogleAnalytics
|
64
|
+
NotFoundPage: () => NotFoundPage
|
69
65
|
});
|
70
66
|
module.exports = __toCommonJS(components_exports);
|
71
67
|
|
@@ -1484,115 +1480,9 @@ function NotFoundPage({ siteIcon }) {
|
|
1484
1480
|
] });
|
1485
1481
|
}
|
1486
1482
|
|
1487
|
-
// src/components/language-detector.tsx
|
1488
|
-
var import_next_intl = require("next-intl");
|
1489
|
-
var import_navigation = require("next/navigation");
|
1490
|
-
var import_react34 = require("react");
|
1491
|
-
var import_jsx_runtime34 = require("react/jsx-runtime");
|
1492
|
-
function LanguageDetector({ i18nConfig }) {
|
1493
|
-
const [show, setShow] = (0, import_react34.useState)(false);
|
1494
|
-
const [detectedLocale, setDetectedLocale] = (0, import_react34.useState)(null);
|
1495
|
-
const currentLocale = (0, import_next_intl.useLocale)();
|
1496
|
-
const router = (0, import_navigation.useRouter)();
|
1497
|
-
const t = (0, import_next_intl.useTranslations)("languageDetection");
|
1498
|
-
const LANGUAGE_PREFERENCE_KEY = `${i18nConfig.detector.storagePrefix}-${i18nConfig.detector.storageKey}`;
|
1499
|
-
(0, import_react34.useEffect)(() => {
|
1500
|
-
const browserLang = navigator.language.split("-")[0];
|
1501
|
-
const savedPreference = localStorage.getItem(LANGUAGE_PREFERENCE_KEY);
|
1502
|
-
const preference = savedPreference ? JSON.parse(savedPreference) : null;
|
1503
|
-
const shouldShowDetector = () => {
|
1504
|
-
if (!preference) return true;
|
1505
|
-
if (preference.locale === currentLocale) return false;
|
1506
|
-
if (preference.status === "rejected" && preference.locale === browserLang) return false;
|
1507
|
-
if (preference.status === "accepted" && preference.locale === currentLocale) return false;
|
1508
|
-
const expirationMs = i18nConfig.detector.expirationDays * 24 * 60 * 60 * 1e3;
|
1509
|
-
if (Date.now() - preference.timestamp < expirationMs) return false;
|
1510
|
-
return true;
|
1511
|
-
};
|
1512
|
-
if (i18nConfig.locales.includes(browserLang) && browserLang !== currentLocale && shouldShowDetector()) {
|
1513
|
-
setDetectedLocale(browserLang);
|
1514
|
-
setShow(true);
|
1515
|
-
const timer = setTimeout(() => {
|
1516
|
-
console.log("[LanguageDetector] Auto closing after timeout");
|
1517
|
-
setShow(false);
|
1518
|
-
savePreference(browserLang, "rejected");
|
1519
|
-
}, i18nConfig.detector.autoCloseTimeout);
|
1520
|
-
return () => clearTimeout(timer);
|
1521
|
-
}
|
1522
|
-
}, [currentLocale]);
|
1523
|
-
const savePreference = (locale, status) => {
|
1524
|
-
const preference = {
|
1525
|
-
locale,
|
1526
|
-
status,
|
1527
|
-
timestamp: Date.now()
|
1528
|
-
};
|
1529
|
-
localStorage.setItem(LANGUAGE_PREFERENCE_KEY, JSON.stringify(preference));
|
1530
|
-
};
|
1531
|
-
const handleLanguageChange = () => {
|
1532
|
-
if (detectedLocale) {
|
1533
|
-
savePreference(detectedLocale, "accepted");
|
1534
|
-
const pathname = window.location.pathname;
|
1535
|
-
const newPathname = pathname.replace(`/${currentLocale}`, `/${detectedLocale}`);
|
1536
|
-
router.push(newPathname);
|
1537
|
-
setShow(false);
|
1538
|
-
}
|
1539
|
-
};
|
1540
|
-
const handleClose = () => {
|
1541
|
-
if (detectedLocale) {
|
1542
|
-
savePreference(detectedLocale, "rejected");
|
1543
|
-
}
|
1544
|
-
setShow(false);
|
1545
|
-
};
|
1546
|
-
if (!detectedLocale || !show) return null;
|
1547
|
-
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "fixed top-16 right-4 z-40 w-[420px]", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: `shadow-lg rounded-lg transition-all duration-300 ${show ? "translate-x-0 opacity-100" : "translate-x-full opacity-0"}
|
1548
|
-
bg-linear-to-r from-purple-100/95 via-white/95 to-purple-100/95 backdrop-blur-xs
|
1549
|
-
animate-gradient-x`, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "relative px-6 py-4 overflow-hidden", children: [
|
1550
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "relative z-10 flex flex-col gap-3", children: [
|
1551
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-start justify-between gap-4", children: [
|
1552
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
|
1553
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("h3", { className: "text-lg font-semibold text-gray-900", children: t("title") }),
|
1554
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("p", { className: "text-base text-gray-600", children: [
|
1555
|
-
t("description"),
|
1556
|
-
" ",
|
1557
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "text-purple-500 font-semibold", children: detectedLocale === "zh" ? "\u4E2D\u6587" : "English" }),
|
1558
|
-
"?"
|
1559
|
-
] })
|
1560
|
-
] }),
|
1561
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
1562
|
-
"button",
|
1563
|
-
{
|
1564
|
-
onClick: handleClose,
|
1565
|
-
className: "text-gray-500 hover:text-gray-700",
|
1566
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(globalLucideIcons.X, { className: "h-5 w-5" })
|
1567
|
-
}
|
1568
|
-
)
|
1569
|
-
] }),
|
1570
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center gap-3", children: [
|
1571
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
1572
|
-
"button",
|
1573
|
-
{
|
1574
|
-
onClick: handleClose,
|
1575
|
-
className: "flex-1 px-4 py-2 text-base bg-gray-100 text-gray-600 rounded-md hover:bg-gray-200",
|
1576
|
-
children: t("close")
|
1577
|
-
}
|
1578
|
-
),
|
1579
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
1580
|
-
"button",
|
1581
|
-
{
|
1582
|
-
onClick: handleLanguageChange,
|
1583
|
-
className: "flex-1 px-4 py-2 text-base bg-purple-500 text-white rounded-md hover:bg-purple-600",
|
1584
|
-
children: t("changeAction")
|
1585
|
-
}
|
1586
|
-
)
|
1587
|
-
] })
|
1588
|
-
] }),
|
1589
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "absolute inset-0 bg-linear-to-r from-transparent via-purple-200/30 to-transparent animate-shimmer" })
|
1590
|
-
] }) }) });
|
1591
|
-
}
|
1592
|
-
|
1593
1483
|
// src/components/language-switcher.tsx
|
1594
|
-
var
|
1595
|
-
var
|
1484
|
+
var import_navigation = require("next/navigation");
|
1485
|
+
var import_next_intl = require("next-intl");
|
1596
1486
|
|
1597
1487
|
// src/ui/dropdown-menu.tsx
|
1598
1488
|
var React33 = __toESM(require("react"), 1);
|
@@ -1606,12 +1496,12 @@ function cn(...inputs) {
|
|
1606
1496
|
}
|
1607
1497
|
|
1608
1498
|
// src/ui/dropdown-menu.tsx
|
1609
|
-
var
|
1499
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
1610
1500
|
var DropdownMenu = DropdownMenuPrimitive.Root;
|
1611
1501
|
var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
1612
1502
|
var DropdownMenuSubTrigger = React33.forwardRef((_a, ref) => {
|
1613
1503
|
var _b = _a, { className, inset, children } = _b, props = __objRest(_b, ["className", "inset", "children"]);
|
1614
|
-
return /* @__PURE__ */ (0,
|
1504
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
1615
1505
|
DropdownMenuPrimitive.SubTrigger,
|
1616
1506
|
__spreadProps(__spreadValues({
|
1617
1507
|
ref,
|
@@ -1623,7 +1513,7 @@ var DropdownMenuSubTrigger = React33.forwardRef((_a, ref) => {
|
|
1623
1513
|
}, props), {
|
1624
1514
|
children: [
|
1625
1515
|
children,
|
1626
|
-
/* @__PURE__ */ (0,
|
1516
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(globalLucideIcons.ChevronRight, { className: "ml-auto" })
|
1627
1517
|
]
|
1628
1518
|
})
|
1629
1519
|
);
|
@@ -1631,7 +1521,7 @@ var DropdownMenuSubTrigger = React33.forwardRef((_a, ref) => {
|
|
1631
1521
|
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
|
1632
1522
|
var DropdownMenuSubContent = React33.forwardRef((_a, ref) => {
|
1633
1523
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
1634
|
-
return /* @__PURE__ */ (0,
|
1524
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
1635
1525
|
DropdownMenuPrimitive.SubContent,
|
1636
1526
|
__spreadValues({
|
1637
1527
|
ref,
|
@@ -1645,7 +1535,7 @@ var DropdownMenuSubContent = React33.forwardRef((_a, ref) => {
|
|
1645
1535
|
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
|
1646
1536
|
var DropdownMenuContent = React33.forwardRef((_a, ref) => {
|
1647
1537
|
var _b = _a, { className, sideOffset = 4 } = _b, props = __objRest(_b, ["className", "sideOffset"]);
|
1648
|
-
return /* @__PURE__ */ (0,
|
1538
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
1649
1539
|
DropdownMenuPrimitive.Content,
|
1650
1540
|
__spreadValues({
|
1651
1541
|
ref,
|
@@ -1660,7 +1550,7 @@ var DropdownMenuContent = React33.forwardRef((_a, ref) => {
|
|
1660
1550
|
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
1661
1551
|
var DropdownMenuItem = React33.forwardRef((_a, ref) => {
|
1662
1552
|
var _b = _a, { className, inset } = _b, props = __objRest(_b, ["className", "inset"]);
|
1663
|
-
return /* @__PURE__ */ (0,
|
1553
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
1664
1554
|
DropdownMenuPrimitive.Item,
|
1665
1555
|
__spreadValues({
|
1666
1556
|
ref,
|
@@ -1675,7 +1565,7 @@ var DropdownMenuItem = React33.forwardRef((_a, ref) => {
|
|
1675
1565
|
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
1676
1566
|
var DropdownMenuCheckboxItem = React33.forwardRef((_a, ref) => {
|
1677
1567
|
var _b = _a, { className, children, checked } = _b, props = __objRest(_b, ["className", "children", "checked"]);
|
1678
|
-
return /* @__PURE__ */ (0,
|
1568
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
1679
1569
|
DropdownMenuPrimitive.CheckboxItem,
|
1680
1570
|
__spreadProps(__spreadValues({
|
1681
1571
|
ref,
|
@@ -1686,7 +1576,7 @@ var DropdownMenuCheckboxItem = React33.forwardRef((_a, ref) => {
|
|
1686
1576
|
checked
|
1687
1577
|
}, props), {
|
1688
1578
|
children: [
|
1689
|
-
/* @__PURE__ */ (0,
|
1579
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(globalLucideIcons.Check, { className: "h-4 w-4" }) }) }),
|
1690
1580
|
children
|
1691
1581
|
]
|
1692
1582
|
})
|
@@ -1695,7 +1585,7 @@ var DropdownMenuCheckboxItem = React33.forwardRef((_a, ref) => {
|
|
1695
1585
|
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
|
1696
1586
|
var DropdownMenuRadioItem = React33.forwardRef((_a, ref) => {
|
1697
1587
|
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
1698
|
-
return /* @__PURE__ */ (0,
|
1588
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
1699
1589
|
DropdownMenuPrimitive.RadioItem,
|
1700
1590
|
__spreadProps(__spreadValues({
|
1701
1591
|
ref,
|
@@ -1705,7 +1595,7 @@ var DropdownMenuRadioItem = React33.forwardRef((_a, ref) => {
|
|
1705
1595
|
)
|
1706
1596
|
}, props), {
|
1707
1597
|
children: [
|
1708
|
-
/* @__PURE__ */ (0,
|
1598
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(globalLucideIcons.Circle, { className: "h-2 w-2 fill-current" }) }) }),
|
1709
1599
|
children
|
1710
1600
|
]
|
1711
1601
|
})
|
@@ -1714,7 +1604,7 @@ var DropdownMenuRadioItem = React33.forwardRef((_a, ref) => {
|
|
1714
1604
|
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
1715
1605
|
var DropdownMenuLabel = React33.forwardRef((_a, ref) => {
|
1716
1606
|
var _b = _a, { className, inset } = _b, props = __objRest(_b, ["className", "inset"]);
|
1717
|
-
return /* @__PURE__ */ (0,
|
1607
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
1718
1608
|
DropdownMenuPrimitive.Label,
|
1719
1609
|
__spreadValues({
|
1720
1610
|
ref,
|
@@ -1729,7 +1619,7 @@ var DropdownMenuLabel = React33.forwardRef((_a, ref) => {
|
|
1729
1619
|
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
1730
1620
|
var DropdownMenuSeparator = React33.forwardRef((_a, ref) => {
|
1731
1621
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
1732
|
-
return /* @__PURE__ */ (0,
|
1622
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
1733
1623
|
DropdownMenuPrimitive.Separator,
|
1734
1624
|
__spreadValues({
|
1735
1625
|
ref,
|
@@ -1744,7 +1634,7 @@ var DropdownMenuShortcut = (_a) => {
|
|
1744
1634
|
} = _b, props = __objRest(_b, [
|
1745
1635
|
"className"
|
1746
1636
|
]);
|
1747
|
-
return /* @__PURE__ */ (0,
|
1637
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
1748
1638
|
"span",
|
1749
1639
|
__spreadValues({
|
1750
1640
|
className: cn("ml-auto text-xs tracking-widest opacity-60", className)
|
@@ -1755,11 +1645,11 @@ DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
1755
1645
|
|
1756
1646
|
// src/ui/language-button.tsx
|
1757
1647
|
var React34 = __toESM(require("react"), 1);
|
1758
|
-
var
|
1648
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
1759
1649
|
var LanguageButton = React34.forwardRef(
|
1760
1650
|
(_a, ref) => {
|
1761
1651
|
var _b = _a, { className, variant = "default", size = "default" } = _b, props = __objRest(_b, ["className", "variant", "size"]);
|
1762
|
-
return /* @__PURE__ */ (0,
|
1652
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
1763
1653
|
"button",
|
1764
1654
|
__spreadValues({
|
1765
1655
|
className: cn(
|
@@ -1782,32 +1672,32 @@ var LanguageButton = React34.forwardRef(
|
|
1782
1672
|
LanguageButton.displayName = "Button";
|
1783
1673
|
|
1784
1674
|
// src/components/language-switcher.tsx
|
1785
|
-
var
|
1675
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
1786
1676
|
function LanguageSwitcher({ locales, localeLabels }) {
|
1787
|
-
const locale = (0,
|
1788
|
-
const router = (0,
|
1789
|
-
const pathname = (0,
|
1677
|
+
const locale = (0, import_next_intl.useLocale)();
|
1678
|
+
const router = (0, import_navigation.useRouter)();
|
1679
|
+
const pathname = (0, import_navigation.usePathname)();
|
1790
1680
|
const handleLocaleChange = (newLocale) => {
|
1791
1681
|
const newPathname = pathname.replace(`/${locale}`, `/${newLocale}`);
|
1792
1682
|
router.push(newPathname);
|
1793
1683
|
};
|
1794
|
-
return /* @__PURE__ */ (0,
|
1795
|
-
/* @__PURE__ */ (0,
|
1684
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(DropdownMenu, { children: [
|
1685
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
1796
1686
|
LanguageButton,
|
1797
1687
|
{
|
1798
1688
|
variant: "ghost",
|
1799
1689
|
size: "icon",
|
1800
1690
|
className: "bg-linear-to-r from-purple-400 to-pink-600 hover:from-purple-500 hover:to-pink-700 text-white transform hover:scale-110 transition-all duration-300",
|
1801
|
-
children: /* @__PURE__ */ (0,
|
1691
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(globalLucideIcons.Globe, { className: "h-5 w-5" })
|
1802
1692
|
}
|
1803
1693
|
) }),
|
1804
|
-
/* @__PURE__ */ (0,
|
1694
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
1805
1695
|
DropdownMenuContent,
|
1806
1696
|
{
|
1807
1697
|
align: "end",
|
1808
1698
|
sideOffset: 5,
|
1809
1699
|
className: "bg-white/90 dark:bg-gray-800/90 border-purple-100 dark:border-purple-800 w-[200px] p-2 backdrop-blur-xs translate-x-[50px]",
|
1810
|
-
children: /* @__PURE__ */ (0,
|
1700
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "grid grid-cols-2 gap-1", children: locales.map((loc) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
1811
1701
|
DropdownMenuItem,
|
1812
1702
|
{
|
1813
1703
|
className: `
|
@@ -1826,68 +1716,6 @@ function LanguageSwitcher({ locales, localeLabels }) {
|
|
1826
1716
|
)
|
1827
1717
|
] });
|
1828
1718
|
}
|
1829
|
-
|
1830
|
-
// src/components/script/google-analytics-script.tsx
|
1831
|
-
var import_script = __toESM(require("next/script"), 1);
|
1832
|
-
var import_jsx_runtime38 = require("react/jsx-runtime");
|
1833
|
-
var googleAnalyticsId = process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS_ID;
|
1834
|
-
function GoogleAnalyticsScript() {
|
1835
|
-
if (process.env.NODE_ENV !== "production") {
|
1836
|
-
return null;
|
1837
|
-
}
|
1838
|
-
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
1839
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
1840
|
-
import_script.default,
|
1841
|
-
{
|
1842
|
-
strategy: "afterInteractive",
|
1843
|
-
src: `https://www.googletagmanager.com/gtag/js?id=${googleAnalyticsId}`
|
1844
|
-
}
|
1845
|
-
),
|
1846
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
1847
|
-
import_script.default,
|
1848
|
-
{
|
1849
|
-
id: "google-analytics",
|
1850
|
-
strategy: "afterInteractive",
|
1851
|
-
dangerouslySetInnerHTML: {
|
1852
|
-
__html: `
|
1853
|
-
window.dataLayer = window.dataLayer || [];
|
1854
|
-
function gtag(){dataLayer.push(arguments);}
|
1855
|
-
gtag('js', new Date());
|
1856
|
-
gtag('config', '${googleAnalyticsId}');
|
1857
|
-
`
|
1858
|
-
}
|
1859
|
-
}
|
1860
|
-
)
|
1861
|
-
] });
|
1862
|
-
}
|
1863
|
-
function useGoogleAnalytics() {
|
1864
|
-
const trackEvent = (event, data) => {
|
1865
|
-
if (typeof window === "undefined" || !window.gtag) {
|
1866
|
-
return;
|
1867
|
-
}
|
1868
|
-
window.gtag("event", event, data);
|
1869
|
-
};
|
1870
|
-
return {
|
1871
|
-
trackEvent
|
1872
|
-
};
|
1873
|
-
}
|
1874
|
-
|
1875
|
-
// src/components/script/microsoft-clarity-script.tsx
|
1876
|
-
var import_script2 = __toESM(require("next/script"), 1);
|
1877
|
-
var import_jsx_runtime39 = require("react/jsx-runtime");
|
1878
|
-
var microsoftClarityId = process.env.NEXT_PUBLIC_MICROSOFT_CLARITY_ID;
|
1879
|
-
function MicrosoftClarityScript() {
|
1880
|
-
if (process.env.NODE_ENV !== "production") {
|
1881
|
-
return null;
|
1882
|
-
}
|
1883
|
-
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_script2.default, { id: "microsoft-clarity", strategy: "afterInteractive", children: `
|
1884
|
-
(function(c,l,a,r,i,t,y){
|
1885
|
-
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
|
1886
|
-
t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
|
1887
|
-
y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
|
1888
|
-
})(window, document, "clarity", "script", "${microsoftClarityId}");
|
1889
|
-
` });
|
1890
|
-
}
|
1891
1719
|
/**
|
1892
1720
|
* @license
|
1893
1721
|
* MIT License
|