forked from Transparency/kgroad-frontend2
Merge branch 'ali' into release005
This commit is contained in:
commit
5fb5487ea9
10 files changed
+249
-11
No files matched your search
@@ -4,7 +4,7 @@
|
||||
padding: 48px 30px 30px 30px;
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
min-height: 500px;
|
||||
min-height: 600px;
|
||||
position: fixed;
|
||||
top: 72px;
|
||||
left: 0;
|
||||
@@ -12,8 +12,10 @@
|
||||
flex-direction: column;
|
||||
gap: 26px;
|
||||
background-color: white;
|
||||
overflow: scroll;
|
||||
|
||||
a {
|
||||
a,
|
||||
button {
|
||||
justify-content: flex-start;
|
||||
font-size: 24px;
|
||||
font-weight: 500;
|
||||
@@ -22,4 +24,31 @@
|
||||
&__link_active {
|
||||
color: $light-blue;
|
||||
}
|
||||
|
||||
&__language {
|
||||
button {
|
||||
margin-bottom: 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
color: #66727f;
|
||||
img {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
}
|
||||
}
|
||||
&-wrapper {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
a {
|
||||
color: #66727f;
|
||||
}
|
||||
}
|
||||
|
||||
&_active {
|
||||
color: black !important;
|
||||
font-weight: 700 !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,10 @@ import { LINKS } from "@/shared/variables/links";
|
||||
import "./NavMenu.scss";
|
||||
import NavAuth from "../NavAuth/NavAuth";
|
||||
import { Link, usePathname } from "@/shared/config/navigation";
|
||||
import { useEffect, useState, useTransition } from "react";
|
||||
import { useParams, useRouter } from "next/navigation";
|
||||
import chevron_down from "./icons/chevron_down.svg";
|
||||
import Image from "next/image";
|
||||
|
||||
interface INavMenuProps {
|
||||
setOpenMenu: (boolean: boolean) => void;
|
||||
@@ -10,7 +14,37 @@ interface INavMenuProps {
|
||||
const NavMenu: React.FC<INavMenuProps> = ({
|
||||
setOpenMenu,
|
||||
}: INavMenuProps) => {
|
||||
const [openMenuLanguage, setOpenMenuLanguage] =
|
||||
useState<boolean>(false);
|
||||
const router = useRouter();
|
||||
const pathname = usePathname();
|
||||
const { locale } = useParams();
|
||||
|
||||
const [_, startTransition] = useTransition();
|
||||
const [currentLanguage, setCurrentLanguage] = useState<string>(
|
||||
locale as string
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
const params = window.location.search || "";
|
||||
startTransition(() => {
|
||||
router.replace(`/${currentLanguage}${pathname}${params}`, {
|
||||
scroll: false,
|
||||
});
|
||||
});
|
||||
}, [currentLanguage]);
|
||||
|
||||
const langKeys: Record<string, string> = {
|
||||
ru: "Русский",
|
||||
kg: "Кыргызча",
|
||||
en: "English",
|
||||
};
|
||||
|
||||
const languages = [
|
||||
{ id: 1, language: "Русский", pathname: "ru" as const },
|
||||
{ id: 2, language: "Кыргызча", pathname: "kg" as const },
|
||||
{ id: 3, language: "English", pathname: "en" as const },
|
||||
];
|
||||
|
||||
return (
|
||||
<nav className="nav-menu">
|
||||
@@ -18,7 +52,7 @@ const NavMenu: React.FC<INavMenuProps> = ({
|
||||
<Link
|
||||
onClick={() => setOpenMenu(false)}
|
||||
className={`nav-menu__link${
|
||||
pathname.slice(4) === link.pathname ? "_active" : ""
|
||||
pathname === link.pathname ? "_active" : ""
|
||||
}`}
|
||||
href={`${pathname.slice(1, 3)}/${link.pathname}`}
|
||||
key={link.id}
|
||||
@@ -28,6 +62,32 @@ const NavMenu: React.FC<INavMenuProps> = ({
|
||||
))}
|
||||
|
||||
<NavAuth setOpenMenu={setOpenMenu} responsible />
|
||||
|
||||
<div className="nav-menu__language">
|
||||
<button onClick={() => setOpenMenuLanguage((prev) => !prev)}>
|
||||
{langKeys[currentLanguage as string]}
|
||||
<Image src={chevron_down} alt="Chevron Down" />
|
||||
</button>
|
||||
|
||||
{openMenuLanguage && (
|
||||
<div className="nav-menu__language-wrapper">
|
||||
{languages.map((lang) => (
|
||||
<Link
|
||||
onClick={() => setCurrentLanguage(lang.pathname)}
|
||||
className={`${
|
||||
currentLanguage === lang.pathname
|
||||
? "nav-menu__language_active"
|
||||
: ""
|
||||
}`}
|
||||
href="#"
|
||||
locale={lang.pathname}
|
||||
>
|
||||
{lang.language}
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</nav>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<svg width="10" height="6" viewBox="0 0 10 6" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g clip-path="url(#clip0_1252_38469)">
|
||||
<path d="M0.246139 1.47381C-0.0820464 1.13666 -0.0820464 0.590022 0.246139 0.252867C0.574324 -0.084289 1.10642 -0.084289 1.4346 0.252867L5.59423 4.52619C5.92241 4.86334 5.92241 5.40998 5.59423 5.74713C5.26604 6.08429 4.73395 6.08429 4.40576 5.74713L0.246139 1.47381Z" fill="#66727F"/>
|
||||
<path d="M8.56495 0.252867C8.89313 -0.0842888 9.42523 -0.0842889 9.75341 0.252867C10.0816 0.590023 10.0816 1.13666 9.75341 1.47382L5.59378 5.747C5.26559 6.08416 4.7335 6.08416 4.40531 5.747C4.07713 5.40985 4.07714 4.86334 4.40532 4.52619L8.56495 0.252867Z" fill="#66727F"/>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0_1252_38469">
|
||||
<rect width="10" height="6" fill="white"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 807 B |
@@ -22,6 +22,7 @@ import { useSession } from "next-auth/react";
|
||||
import { IDisplayMap } from "@/shared/types/map-type";
|
||||
import Loader from "@/shared/ui/components/Loader/Loader";
|
||||
import { useRouter } from "@/shared/config/navigation";
|
||||
import ReportMessage from "@/features/ReportMessage/ReportMessage";
|
||||
|
||||
interface ILatLng {
|
||||
lat: number;
|
||||
@@ -30,10 +31,10 @@ interface ILatLng {
|
||||
|
||||
const ReportForm = () => {
|
||||
const session = useSession();
|
||||
const router = useRouter();
|
||||
const [latLng, setLatLng] = useState<ILatLng[]>([]);
|
||||
const [displayLatLng, setDisplayLatLng] = useState<string[]>([]);
|
||||
const [images, setImages] = useState<File[]>([]);
|
||||
const [showMessage, setShowMessage] = useState<boolean>(false);
|
||||
const position = {
|
||||
lat: 42.8746,
|
||||
lng: 74.606,
|
||||
@@ -124,7 +125,7 @@ const ReportForm = () => {
|
||||
);
|
||||
|
||||
if ([200, 201].includes(res.status)) {
|
||||
router.push("/");
|
||||
setShowMessage(true);
|
||||
}
|
||||
} catch (error: unknown) {
|
||||
if (error instanceof AxiosError) {
|
||||
@@ -294,6 +295,12 @@ const ReportForm = () => {
|
||||
)}
|
||||
</button>
|
||||
{error ? <p className="report-form__error">{error}</p> : null}
|
||||
{showMessage ? (
|
||||
<ReportMessage
|
||||
setShowMessage={setShowMessage}
|
||||
showMessage={showMessage}
|
||||
/>
|
||||
) : null}
|
||||
</form>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user