resoled conflicts

This commit is contained in:
Alibek 2024-02-29 14:22:42 +06:00
parent e2db27b56f
commit 6650a98503
8 changed files with 2 additions and 212 deletions

View File

@ -1,6 +1,5 @@
import "./ReportDetails.scss"; import "./ReportDetails.scss";
import { IReport } from "@/shared/types/report-type"; import { IReport } from "@/shared/types/report-type";
import ReviewSection from "@/widgets/ReviewSection/ReviewSection"; import ReviewSection from "@/widgets/ReviewSection/ReviewSection";
import { Metadata } from "next"; import { Metadata } from "next";
import ReportInformation from "@/widgets/report-details/ReportInformation/ReportInformation"; import ReportInformation from "@/widgets/report-details/ReportInformation/ReportInformation";

View File

@ -1,4 +1,3 @@
<<<<<<< HEAD
import { ReactNode } from "react"; import { ReactNode } from "react";
type Props = { type Props = {
@ -7,40 +6,4 @@ type Props = {
export default function RootLayout({ children }: Props) { export default function RootLayout({ children }: Props) {
return children; return children;
=======
import type { Metadata } from "next";
import "./globals.scss";
import "./App.scss";
// import "@/shared/fonts/fonts.scss";
import { Providers } from "./Providers";
import Navbar from "@/widgets/Navbar/Navbar";
import Footer from "@/widgets/Footer/Footer";
import { GoogleAnalytics } from '@next/third-parties/google'
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<head>
</head>
<body>
<Providers>
<Navbar />
<div className="app">{children}</div>
<Footer />
</Providers>
</body>
{/*
Disable google analytics in uat
<GoogleAnalytics gaId={process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS || ""} />
*/}
</html>
);
>>>>>>> d1440f3907ca91b29db2977f043e44f54993aeb1
} }

View File

@ -1,138 +0,0 @@
import "./ReportDetails.scss";
import Image from "next/image";
import RoadType from "@/entities/RoadType/RoadType";
import ReportLike from "@/features/ReportLike/ReportLike";
import { apiInstance } from "@/shared/config/apiConfig";
import { IReport } from "@/shared/types/report-type";
import {
ROAD_TYPES,
ROAD_TYPES_COLORS,
} from "@/shared/variables/road-types";
import calendar from "./icons/calendar.svg";
import map_pin from "./icons/map-pin.svg";
import def_image from "./icons/def_image.svg";
import ReviewSection from "@/widgets/ReviewSection/ReviewSection";
import { Metadata } from "next";
export const metadata: Metadata = {
title: "KG ROAD | Обращение",
description:
"Страница обращения KG ROAD",
};
const ReportDetails = async ({
params,
}: {
params: { id: string };
}) => {
const getReportDetails = async () => {
const res = await fetch(
`${process.env.NEXT_PUBLIC_BASE_API}/report/${params.id}/`,
{ cache: "no-store" }
);
return res.json();
};
const report: IReport = await getReportDetails();
const months: Record<string, string> = {
"01": "Январь",
"02": "Февраль",
"03": "Март",
"04": "Апрель",
"05": "Май",
"06": "Июнь",
"07": "Июль",
"08": "Август",
"09": "Сентябрь",
"10": "Октябрь",
"11": "Ноябрь",
"12": "Декабрь",
};
const showImages = () => {
const images = [];
for (let i = 0; i < 5; i++) {
if (report.image[i]) {
const image = (
<img
className={`report-images__exist report-images__item${
i + 1
}`}
key={i}
src={report.image[i].image}
alt="Report Image"
/>
);
images.push(image);
} else {
const defImage = (
<div
className={`report-images__default report-images__item${
i + 1
}`}
key={i}
>
<Image src={def_image} alt="Default Image" />
</div>
);
images.push(defImage);
}
}
return images;
};
return (
<div className="report-details page-padding">
<div className="report-details__container">
<div className="report-information">
<RoadType color={ROAD_TYPES_COLORS[report.category]}>
{ROAD_TYPES[report.category]}
</RoadType>
<h2>{report.location[0].address}</h2>
<div className="report-information__date-and-like">
<div className="report-information__date">
<Image src={calendar} alt="Calendar Icon" />
<p>
{months[report.created_at.slice(5, 7)]}{" "}
{report.created_at.slice(5, 7).slice(0, 1) === "0"
? report.created_at.slice(6, 7)
: report.created_at.slice(5, 7)}
, {report.created_at.slice(0, 4)}
</p>
</div>
<ReportLike
count={report.total_likes}
report_id={report.id}
/>
</div>
<p className="report-information__description">
{report.description}
</p>
<p className="report-information__author">
Автор обращения:{" "}
<span>
{report.author.first_name}{" "}
{report.author.last_name.slice(0, 1)}.
</span>
</p>
<button className="report-information__show-map">
<Image src={map_pin} alt="Map Pin Icon" />
Показать на карте
</button>
</div>
<div className="report-images">
{showImages().map((image) => image)}
</div>
</div>
<ReviewSection endpoint="report" id={+params.id} />
</div>
);
};
export default ReportDetails;

View File

@ -4,10 +4,9 @@ import Image from "next/image";
import "./GoogleButton.scss"; import "./GoogleButton.scss";
import google from "./icons/google.svg"; import google from "./icons/google.svg";
import { useSearchParams } from "next/navigation"; import { useSearchParams } from "next/navigation";
import { signIn, useSession } from "next-auth/react"; import { signIn } from "next-auth/react";
const GoogleButton = () => { const GoogleButton = () => {
const session = useSession();
const searchParams = useSearchParams(); const searchParams = useSearchParams();
const callbackUrl = const callbackUrl =
searchParams.get("callbackUrl") || "/profile/personal"; searchParams.get("callbackUrl") || "/profile/personal";

View File

@ -25,7 +25,6 @@ const refreshToken = async (token: JWT): Promise<JWT> => {
// const date = new Date().toLocaleTimeString(); // const date = new Date().toLocaleTimeString();
// const expire = new Date(token.expires_in).toLocaleTimeString(); // const expire = new Date(token.expires_in).toLocaleTimeString();
<<<<<<< HEAD
const verify = await verifyToken(token.access_token); const verify = await verifyToken(token.access_token);
if (verify) if (verify)
@ -35,10 +34,6 @@ const refreshToken = async (token: JWT): Promise<JWT> => {
const response = await apiInstance.post<IRefresh>( const response = await apiInstance.post<IRefresh>(
"/users/refresh/", "/users/refresh/",
=======
const response = await axios.post<IToken>(
"https://api.kgroad.org/api/v1/token/refresh/",
>>>>>>> d1440f3907ca91b29db2977f043e44f54993aeb1
data data
); );
@ -71,23 +66,7 @@ export const authConfig: AuthOptions = {
password, password,
}; };
<<<<<<< HEAD
const res = await apiInstance.post("/users/login/", data); const res = await apiInstance.post("/users/login/", data);
=======
const res = await fetch(
"https://api.kgroad.org/api/v1/users/login/",
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
email,
password,
}),
}
);
>>>>>>> d1440f3907ca91b29db2977f043e44f54993aeb1
if (![200, 201].includes(res.status)) { if (![200, 201].includes(res.status)) {
return null; return null;

View File

@ -48,7 +48,7 @@ const Footer = () => {
</ul> </ul>
<p className="text-white">Photo By ThomasG, CC BY-SA 3.0</p> <p className="text-white">Photo By ThomasG, CC BY-SA 3.0</p>
</div> </div>
{/*
<div className="footer__apps"> <div className="footer__apps">
<h4>{t("download_our_app")}</h4> <h4>{t("download_our_app")}</h4>
<div className="footer__apps-btns"> <div className="footer__apps-btns">
@ -59,7 +59,6 @@ const Footer = () => {
))} ))}
</div> </div>
</div> </div>
*/}
</footer> </footer>
); );
}; };

View File

@ -88,9 +88,7 @@ const SignInForm = () => {
{loader ? <Loader /> : "Войти"} {loader ? <Loader /> : "Войти"}
</button> </button>
{/*
<GoogleButton /> <GoogleButton />
*/}
</div> </div>
</form> </form>
); );

View File

@ -14,17 +14,8 @@ const Header = () => {
alt="Background Image" alt="Background Image"
/> />
<div className="header__text"> <div className="header__text">
<<<<<<< HEAD:src/widgets/home/Header/Header.tsx
<h1>{t("title")}</h1> <h1>{t("title")}</h1>
<p>{t("subtitle")}</p> <p>{t("subtitle")}</p>
=======
<h1>
Дороги Кыргызстана
</h1>
<p>
Сделаем дороги безопасными! Актуальная информация о состоянии дорог.
</p>
>>>>>>> d1440f3907ca91b29db2977f043e44f54993aeb1:src/widgets/Header/Header.tsx
</div> </div>
<HeaderLink /> <HeaderLink />