@windrun-huaiin/base-ui 6.0.3 → 7.1.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 +28 -199
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +27 -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 +87 -1
- package/dist/components/server.js.map +1 -1
- package/dist/components/server.mjs +87 -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 +1 -0
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/index.mjs +1 -0
- package/dist/ui/index.mjs.map +1 -1
- package/package.json +1 -1
- 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
@@ -1,3 +1,4 @@
|
|
1
|
+
/* eslint-disable */
|
1
2
|
"use strict";
|
2
3
|
"use client";
|
3
4
|
var __create = Object.create;
|
@@ -60,12 +61,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
60
61
|
// src/components/index.ts
|
61
62
|
var components_exports = {};
|
62
63
|
__export(components_exports, {
|
63
|
-
GoogleAnalyticsScript: () => GoogleAnalyticsScript,
|
64
|
-
LanguageDetector: () => LanguageDetector,
|
65
64
|
LanguageSwitcher: () => LanguageSwitcher,
|
66
|
-
|
67
|
-
NotFoundPage: () => NotFoundPage,
|
68
|
-
useGoogleAnalytics: () => useGoogleAnalytics
|
65
|
+
NotFoundPage: () => NotFoundPage
|
69
66
|
});
|
70
67
|
module.exports = __toCommonJS(components_exports);
|
71
68
|
|
@@ -1484,115 +1481,9 @@ function NotFoundPage({ siteIcon }) {
|
|
1484
1481
|
] });
|
1485
1482
|
}
|
1486
1483
|
|
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
1484
|
// src/components/language-switcher.tsx
|
1594
|
-
var
|
1595
|
-
var
|
1485
|
+
var import_navigation = require("next/navigation");
|
1486
|
+
var import_next_intl = require("next-intl");
|
1596
1487
|
|
1597
1488
|
// src/ui/dropdown-menu.tsx
|
1598
1489
|
var React33 = __toESM(require("react"), 1);
|
@@ -1606,12 +1497,12 @@ function cn(...inputs) {
|
|
1606
1497
|
}
|
1607
1498
|
|
1608
1499
|
// src/ui/dropdown-menu.tsx
|
1609
|
-
var
|
1500
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
1610
1501
|
var DropdownMenu = DropdownMenuPrimitive.Root;
|
1611
1502
|
var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
1612
1503
|
var DropdownMenuSubTrigger = React33.forwardRef((_a, ref) => {
|
1613
1504
|
var _b = _a, { className, inset, children } = _b, props = __objRest(_b, ["className", "inset", "children"]);
|
1614
|
-
return /* @__PURE__ */ (0,
|
1505
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
1615
1506
|
DropdownMenuPrimitive.SubTrigger,
|
1616
1507
|
__spreadProps(__spreadValues({
|
1617
1508
|
ref,
|
@@ -1623,7 +1514,7 @@ var DropdownMenuSubTrigger = React33.forwardRef((_a, ref) => {
|
|
1623
1514
|
}, props), {
|
1624
1515
|
children: [
|
1625
1516
|
children,
|
1626
|
-
/* @__PURE__ */ (0,
|
1517
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(globalLucideIcons.ChevronRight, { className: "ml-auto" })
|
1627
1518
|
]
|
1628
1519
|
})
|
1629
1520
|
);
|
@@ -1631,7 +1522,7 @@ var DropdownMenuSubTrigger = React33.forwardRef((_a, ref) => {
|
|
1631
1522
|
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
|
1632
1523
|
var DropdownMenuSubContent = React33.forwardRef((_a, ref) => {
|
1633
1524
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
1634
|
-
return /* @__PURE__ */ (0,
|
1525
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
1635
1526
|
DropdownMenuPrimitive.SubContent,
|
1636
1527
|
__spreadValues({
|
1637
1528
|
ref,
|
@@ -1645,7 +1536,7 @@ var DropdownMenuSubContent = React33.forwardRef((_a, ref) => {
|
|
1645
1536
|
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
|
1646
1537
|
var DropdownMenuContent = React33.forwardRef((_a, ref) => {
|
1647
1538
|
var _b = _a, { className, sideOffset = 4 } = _b, props = __objRest(_b, ["className", "sideOffset"]);
|
1648
|
-
return /* @__PURE__ */ (0,
|
1539
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
1649
1540
|
DropdownMenuPrimitive.Content,
|
1650
1541
|
__spreadValues({
|
1651
1542
|
ref,
|
@@ -1660,7 +1551,7 @@ var DropdownMenuContent = React33.forwardRef((_a, ref) => {
|
|
1660
1551
|
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
1661
1552
|
var DropdownMenuItem = React33.forwardRef((_a, ref) => {
|
1662
1553
|
var _b = _a, { className, inset } = _b, props = __objRest(_b, ["className", "inset"]);
|
1663
|
-
return /* @__PURE__ */ (0,
|
1554
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
1664
1555
|
DropdownMenuPrimitive.Item,
|
1665
1556
|
__spreadValues({
|
1666
1557
|
ref,
|
@@ -1675,7 +1566,7 @@ var DropdownMenuItem = React33.forwardRef((_a, ref) => {
|
|
1675
1566
|
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
1676
1567
|
var DropdownMenuCheckboxItem = React33.forwardRef((_a, ref) => {
|
1677
1568
|
var _b = _a, { className, children, checked } = _b, props = __objRest(_b, ["className", "children", "checked"]);
|
1678
|
-
return /* @__PURE__ */ (0,
|
1569
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
1679
1570
|
DropdownMenuPrimitive.CheckboxItem,
|
1680
1571
|
__spreadProps(__spreadValues({
|
1681
1572
|
ref,
|
@@ -1686,7 +1577,7 @@ var DropdownMenuCheckboxItem = React33.forwardRef((_a, ref) => {
|
|
1686
1577
|
checked
|
1687
1578
|
}, props), {
|
1688
1579
|
children: [
|
1689
|
-
/* @__PURE__ */ (0,
|
1580
|
+
/* @__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
1581
|
children
|
1691
1582
|
]
|
1692
1583
|
})
|
@@ -1695,7 +1586,7 @@ var DropdownMenuCheckboxItem = React33.forwardRef((_a, ref) => {
|
|
1695
1586
|
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
|
1696
1587
|
var DropdownMenuRadioItem = React33.forwardRef((_a, ref) => {
|
1697
1588
|
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
1698
|
-
return /* @__PURE__ */ (0,
|
1589
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
1699
1590
|
DropdownMenuPrimitive.RadioItem,
|
1700
1591
|
__spreadProps(__spreadValues({
|
1701
1592
|
ref,
|
@@ -1705,7 +1596,7 @@ var DropdownMenuRadioItem = React33.forwardRef((_a, ref) => {
|
|
1705
1596
|
)
|
1706
1597
|
}, props), {
|
1707
1598
|
children: [
|
1708
|
-
/* @__PURE__ */ (0,
|
1599
|
+
/* @__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
1600
|
children
|
1710
1601
|
]
|
1711
1602
|
})
|
@@ -1714,7 +1605,7 @@ var DropdownMenuRadioItem = React33.forwardRef((_a, ref) => {
|
|
1714
1605
|
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
1715
1606
|
var DropdownMenuLabel = React33.forwardRef((_a, ref) => {
|
1716
1607
|
var _b = _a, { className, inset } = _b, props = __objRest(_b, ["className", "inset"]);
|
1717
|
-
return /* @__PURE__ */ (0,
|
1608
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
1718
1609
|
DropdownMenuPrimitive.Label,
|
1719
1610
|
__spreadValues({
|
1720
1611
|
ref,
|
@@ -1729,7 +1620,7 @@ var DropdownMenuLabel = React33.forwardRef((_a, ref) => {
|
|
1729
1620
|
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
1730
1621
|
var DropdownMenuSeparator = React33.forwardRef((_a, ref) => {
|
1731
1622
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
1732
|
-
return /* @__PURE__ */ (0,
|
1623
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
1733
1624
|
DropdownMenuPrimitive.Separator,
|
1734
1625
|
__spreadValues({
|
1735
1626
|
ref,
|
@@ -1744,7 +1635,7 @@ var DropdownMenuShortcut = (_a) => {
|
|
1744
1635
|
} = _b, props = __objRest(_b, [
|
1745
1636
|
"className"
|
1746
1637
|
]);
|
1747
|
-
return /* @__PURE__ */ (0,
|
1638
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
1748
1639
|
"span",
|
1749
1640
|
__spreadValues({
|
1750
1641
|
className: cn("ml-auto text-xs tracking-widest opacity-60", className)
|
@@ -1755,11 +1646,11 @@ DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
1755
1646
|
|
1756
1647
|
// src/ui/language-button.tsx
|
1757
1648
|
var React34 = __toESM(require("react"), 1);
|
1758
|
-
var
|
1649
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
1759
1650
|
var LanguageButton = React34.forwardRef(
|
1760
1651
|
(_a, ref) => {
|
1761
1652
|
var _b = _a, { className, variant = "default", size = "default" } = _b, props = __objRest(_b, ["className", "variant", "size"]);
|
1762
|
-
return /* @__PURE__ */ (0,
|
1653
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
1763
1654
|
"button",
|
1764
1655
|
__spreadValues({
|
1765
1656
|
className: cn(
|
@@ -1782,32 +1673,32 @@ var LanguageButton = React34.forwardRef(
|
|
1782
1673
|
LanguageButton.displayName = "Button";
|
1783
1674
|
|
1784
1675
|
// src/components/language-switcher.tsx
|
1785
|
-
var
|
1676
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
1786
1677
|
function LanguageSwitcher({ locales, localeLabels }) {
|
1787
|
-
const locale = (0,
|
1788
|
-
const router = (0,
|
1789
|
-
const pathname = (0,
|
1678
|
+
const locale = (0, import_next_intl.useLocale)();
|
1679
|
+
const router = (0, import_navigation.useRouter)();
|
1680
|
+
const pathname = (0, import_navigation.usePathname)();
|
1790
1681
|
const handleLocaleChange = (newLocale) => {
|
1791
1682
|
const newPathname = pathname.replace(`/${locale}`, `/${newLocale}`);
|
1792
1683
|
router.push(newPathname);
|
1793
1684
|
};
|
1794
|
-
return /* @__PURE__ */ (0,
|
1795
|
-
/* @__PURE__ */ (0,
|
1685
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(DropdownMenu, { children: [
|
1686
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
1796
1687
|
LanguageButton,
|
1797
1688
|
{
|
1798
1689
|
variant: "ghost",
|
1799
1690
|
size: "icon",
|
1800
1691
|
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,
|
1692
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(globalLucideIcons.Globe, { className: "h-5 w-5" })
|
1802
1693
|
}
|
1803
1694
|
) }),
|
1804
|
-
/* @__PURE__ */ (0,
|
1695
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
1805
1696
|
DropdownMenuContent,
|
1806
1697
|
{
|
1807
1698
|
align: "end",
|
1808
1699
|
sideOffset: 5,
|
1809
1700
|
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,
|
1701
|
+
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
1702
|
DropdownMenuItem,
|
1812
1703
|
{
|
1813
1704
|
className: `
|
@@ -1826,68 +1717,6 @@ function LanguageSwitcher({ locales, localeLabels }) {
|
|
1826
1717
|
)
|
1827
1718
|
] });
|
1828
1719
|
}
|
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
1720
|
/**
|
1892
1721
|
* @license
|
1893
1722
|
* MIT License
|