@c-rex/templates 0.1.21 → 0.1.23
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/package.json
CHANGED
|
@@ -28,7 +28,7 @@ interface FilterSidebarProps {
|
|
|
28
28
|
export const FilterSidebar: FC<FilterSidebarProps> = ({ tags, totalItemCount, updateFilterParam }) => {
|
|
29
29
|
const t = useTranslations();
|
|
30
30
|
const device = useBreakpoint();
|
|
31
|
-
const isMobile = (device === DEVICE_OPTIONS.MOBILE);
|
|
31
|
+
const isMobile = device !== null && (device === DEVICE_OPTIONS.MOBILE);
|
|
32
32
|
|
|
33
33
|
if (Object.keys(tags).length === 0) return null;
|
|
34
34
|
|
package/src/home/page.tsx
CHANGED
|
@@ -37,7 +37,7 @@ export const HomePage: FC<HomePageProps> = ({ data }) => {
|
|
|
37
37
|
const t = useTranslations();
|
|
38
38
|
const { setLoading } = useSearchContext();
|
|
39
39
|
const device = useBreakpoint();
|
|
40
|
-
const isMobile = device === DEVICE_OPTIONS.MOBILE;
|
|
40
|
+
const isMobile = device !== null && device === DEVICE_OPTIONS.MOBILE;
|
|
41
41
|
const [open, setOpen] = useState<boolean>(false)
|
|
42
42
|
const [params, setParams] = useQueryStates({
|
|
43
43
|
language: parseAsString,
|
|
@@ -186,7 +186,7 @@ export const HomePage: FC<HomePageProps> = ({ data }) => {
|
|
|
186
186
|
return filters
|
|
187
187
|
}, [tags, params]);
|
|
188
188
|
|
|
189
|
-
useEffect(() => setLoading(false), [data])
|
|
189
|
+
useEffect(() => setLoading(false), [data, setLoading])
|
|
190
190
|
|
|
191
191
|
const updateFilterParam = (key: string, item: any) => {
|
|
192
192
|
setLoading(true)
|
package/src/home/page2.tsx
CHANGED
|
@@ -37,7 +37,7 @@ export const HomePage: FC<HomePageProps> = ({ data }) => {
|
|
|
37
37
|
const t = useTranslations();
|
|
38
38
|
const { setLoading } = useSearchContext();
|
|
39
39
|
const device = useBreakpoint();
|
|
40
|
-
const isMobile = device === DEVICE_OPTIONS.MOBILE;
|
|
40
|
+
const isMobile = device !== null && device === DEVICE_OPTIONS.MOBILE;
|
|
41
41
|
const [open, setOpen] = useState<boolean>(false)
|
|
42
42
|
const [params, setParams] = useQueryStates({
|
|
43
43
|
language: parseAsString,
|
package/src/utils.ts
CHANGED
|
@@ -3,19 +3,14 @@ import { headers } from "next/headers";
|
|
|
3
3
|
|
|
4
4
|
const getBrowserLangFromHeader = (): string => {
|
|
5
5
|
const h = headers();
|
|
6
|
-
const accept = h.get("accept-language");
|
|
6
|
+
const accept = h.get("accept-language"); // ex: "pt-BR,pt;q=0.9,en-US;q=0.8,en;q=0.7"
|
|
7
7
|
|
|
8
8
|
if (!accept) return "";
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (primary && primary[0]) {
|
|
13
|
-
return primary[0].toLowerCase();
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return "";
|
|
10
|
+
return accept.split(",")[0]?.toLowerCase() || "";
|
|
17
11
|
}
|
|
18
12
|
|
|
13
|
+
|
|
19
14
|
export const resolveUILanguage = ({
|
|
20
15
|
uiLangCookie,
|
|
21
16
|
defaultLang,
|