classify web

This commit is contained in:
Husanjonazamov
2026-02-24 12:52:49 +05:00
commit 64af77101f
310 changed files with 45449 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
"use client";
import { getCurrentLangCode } from "@/redux/reducer/languageSlice";
import { getDefaultLanguageCode } from "@/redux/reducer/settingSlice";
import Link from "next/link";
import { useSelector } from "react-redux";
const CustomLink = ({ href, children, ...props }) => {
const defaultLangCode = useSelector(getDefaultLanguageCode);
const currentLangCode = useSelector(getCurrentLangCode);
const langCode = currentLangCode || defaultLangCode;
// Split hash (#) safely from href
const [baseHref, hash = ""] = href.split("#");
// Append lang param safely
const separator = baseHref.includes("?") ? "&" : "?";
const newHref = `${baseHref}${separator}lang=${langCode}${
hash ? `#${hash}` : ""
}`;
return (
<Link href={newHref} {...props}>
{children}
</Link>
);
};
export default CustomLink;