@shipsite.dev/components 0.2.32 → 0.2.33
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locale-switcher.d.ts","sourceRoot":"","sources":["../../src/ui/locale-switcher.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"locale-switcher.d.ts","sourceRoot":"","sources":["../../src/ui/locale-switcher.tsx"],"names":[],"mappings":"AAMA,wBAAgB,cAAc,mDA0C7B"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import React from 'react';
|
|
4
|
+
import { usePathname } from 'next/navigation';
|
|
4
5
|
import { useShipSite, useAlternateLinks } from '../context/ShipSiteProvider';
|
|
5
6
|
export function LocaleSwitcher() {
|
|
6
7
|
const { locale, locales } = useShipSite();
|
|
7
8
|
const alternatePathMap = useAlternateLinks();
|
|
9
|
+
const pathname = usePathname();
|
|
8
10
|
if (locales.length <= 1)
|
|
9
11
|
return null;
|
|
10
|
-
const pathname = typeof window !== 'undefined' ? window.location.pathname : '';
|
|
11
12
|
// Find the alternatePathMap entry where the current locale's path matches
|
|
12
13
|
let alternates;
|
|
13
14
|
for (const entry of Object.values(alternatePathMap)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locale-switcher.js","sourceRoot":"","sources":["../../src/ui/locale-switcher.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAE7E,MAAM,UAAU,cAAc;IAC5B,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,WAAW,EAAE,CAAC;IAC1C,MAAM,gBAAgB,GAAG,iBAAiB,EAAE,CAAC;
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AE,IAAI,EACV,SAAS,EAAC,yEAAyE,YAElF,GAAG,GACF,CACL,KAbkB,GAAG,CAcP,CAClB,CAAC;QACJ,CAAC,CAAC,GACE,CACP,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import React from 'react';
|
|
4
|
+
import { usePathname } from 'next/navigation';
|
|
4
5
|
import { useShipSite, useAlternateLinks } from '../context/ShipSiteProvider';
|
|
5
6
|
|
|
6
7
|
export function LocaleSwitcher() {
|
|
7
8
|
const { locale, locales } = useShipSite();
|
|
8
9
|
const alternatePathMap = useAlternateLinks();
|
|
10
|
+
const pathname = usePathname();
|
|
9
11
|
|
|
10
12
|
if (locales.length <= 1) return null;
|
|
11
13
|
|
|
12
|
-
const pathname =
|
|
13
|
-
typeof window !== 'undefined' ? window.location.pathname : '';
|
|
14
|
-
|
|
15
14
|
// Find the alternatePathMap entry where the current locale's path matches
|
|
16
15
|
let alternates: Record<string, string> | undefined;
|
|
17
16
|
for (const entry of Object.values(alternatePathMap)) {
|