forked from Transparency/kgroad-frontend2
fixed sort in profile-reports table and in statistics table, improved error messages, improved metatags by fetching metadata from server
This commit is contained in:
1 parent
0221a79015
commit
0ba0f1df89
25 files changed
+413
-171
No files matched your search
@@ -4,26 +4,52 @@ import Image from "next/image";
|
||||
import header from "./assets/header.svg";
|
||||
import { Metadata } from "next";
|
||||
import BreadCrumbs from "@/features/BreadCrumbs/BreadCrumbs";
|
||||
import { apiInstance } from "@/shared/config/apiConfig";
|
||||
import { IMetatag } from "@/shared/types/metatag-type";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "KG ROAD | О нас",
|
||||
description:
|
||||
"Transparency International - Кыргызстан - филиал международной организации Transparency International в Кыргызской Республике.",
|
||||
keywords: [
|
||||
"Миссия Transparency International - Кыргызстан",
|
||||
"Цели и приоритеты ТИ-Кыргызстан",
|
||||
],
|
||||
openGraph: {
|
||||
images: [
|
||||
{
|
||||
url: header.src,
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const data = await apiInstance
|
||||
.get<IMetatag[]>("/metatags/")
|
||||
.then((res) => res.data)
|
||||
.catch((e) => console.log(e));
|
||||
|
||||
if (!data)
|
||||
return {
|
||||
title: "KG ROAD | О нас",
|
||||
description:
|
||||
"Transparency International - Кыргызстан - филиал международной организации Transparency International в Кыргызской Республике.",
|
||||
openGraph: {
|
||||
title: "KG ROAD | О нас",
|
||||
description:
|
||||
"Transparency International - Кыргызстан - филиал международной организации Transparency International в Кыргызской Республике.",
|
||||
},
|
||||
],
|
||||
title: "KG ROAD | О нас",
|
||||
description:
|
||||
"Transparency International - Кыргызстан - филиал международной организации Transparency International в Кыргызской Республике.",
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
const metadata = data.filter((tag) => tag.page === "about-us")[0];
|
||||
if (!metadata) {
|
||||
return {
|
||||
title: "KG ROAD | О нас",
|
||||
description:
|
||||
"Transparency International - Кыргызстан - филиал международной организации Transparency International в Кыргызской Республике.",
|
||||
openGraph: {
|
||||
title: "KG ROAD | О нас",
|
||||
description:
|
||||
"Transparency International - Кыргызстан - филиал международной организации Transparency International в Кыргызской Республике.",
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
title: `KG ROAD | ${metadata.title}`,
|
||||
description: metadata.description,
|
||||
keywords: metadata.keywords.split(","),
|
||||
openGraph: {
|
||||
title: `KG ROAD | ${metadata.title}`,
|
||||
description: metadata.description,
|
||||
type: "website",
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const AboutUs = () => {
|
||||
return (
|
||||
|
||||
@@ -26,7 +26,6 @@ export async function generateMetadata({
|
||||
type: "article",
|
||||
publishedTime: response.data.created_at,
|
||||
},
|
||||
keywords: ["Новости КР", "Кыргызстан"],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -3,11 +3,40 @@ import "./News.scss";
|
||||
import Typography from "@/shared/ui/components/Typography/Typography";
|
||||
import NewsList from "@/widgets/NewsList/NewsList";
|
||||
import { Metadata } from "next";
|
||||
import { apiInstance } from "@/shared/config/apiConfig";
|
||||
import { IMetatag } from "@/shared/types/metatag-type";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "KG ROAD | Новости",
|
||||
description: "Страница новостей KG ROAD",
|
||||
};
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const data = await apiInstance
|
||||
.get<IMetatag[]>("/metatags/")
|
||||
.then((res) => res.data)
|
||||
.catch((e) => console.log(e));
|
||||
|
||||
if (!data)
|
||||
return {
|
||||
title: "KG ROAD | Новости",
|
||||
description: "Страница новостей KG ROAD",
|
||||
};
|
||||
|
||||
const metadata = data.filter((tag) => tag.page === "news")[0];
|
||||
if (!metadata) {
|
||||
return {
|
||||
title: "KG ROAD | Новости",
|
||||
description: "Страница новостей KG ROAD",
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
title: `KG ROAD | ${metadata.title}`,
|
||||
description: metadata.description,
|
||||
keywords: metadata.keywords.split(","),
|
||||
openGraph: {
|
||||
title: `KG ROAD | ${metadata.title}`,
|
||||
description: metadata.description,
|
||||
type: "website",
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const News = ({
|
||||
searchParams,
|
||||
|
||||
+48
-22
@@ -4,29 +4,55 @@ import RatingSection from "@/widgets/home/RatingSection/RatingSection";
|
||||
import NewsSection from "@/widgets/home/NewsSection/NewsSection";
|
||||
import MapSection from "@/widgets/home/MapSection/MapSection";
|
||||
import { Metadata } from "next";
|
||||
import { apiInstance } from "@/shared/config/apiConfig";
|
||||
import { IMetatag } from "@/shared/types/metatag-type";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "KG ROAD | Главная",
|
||||
description:
|
||||
"Главная страница KG ROAD | Сделаем дороги безопасными!",
|
||||
keywords: [
|
||||
"Новости",
|
||||
"Разбитые дороги",
|
||||
"Очаги аварийности",
|
||||
"Локальные дефекты",
|
||||
"Дороги В планах ремонта",
|
||||
"Отремонтированные дороги",
|
||||
"Исправленные локальные дефекты",
|
||||
"Карта дорог",
|
||||
"Рейтинг",
|
||||
],
|
||||
openGraph: {
|
||||
title: "KG ROAD | Главная",
|
||||
description:
|
||||
"Главная страница KG ROAD | Сделаем дороги безопасными!",
|
||||
type: "website",
|
||||
},
|
||||
};
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const data = await apiInstance
|
||||
.get<IMetatag[]>("/metatags/")
|
||||
.then((res) => res.data)
|
||||
.catch((e) => console.log(e));
|
||||
|
||||
if (!data)
|
||||
return {
|
||||
title: "KG ROAD | Главная",
|
||||
description:
|
||||
"Главная страница KG ROAD | Сделаем дороги безопасными!",
|
||||
openGraph: {
|
||||
title: "KG ROAD | Главная",
|
||||
description:
|
||||
"Главная страница KG ROAD | Сделаем дороги безопасными!",
|
||||
type: "website",
|
||||
},
|
||||
};
|
||||
|
||||
const metadata = data.filter((tag) => tag.page === "home")[0];
|
||||
|
||||
if (!metadata) {
|
||||
return {
|
||||
title: "KG ROAD | Главная",
|
||||
description:
|
||||
"Главная страница KG ROAD | Сделаем дороги безопасными!",
|
||||
openGraph: {
|
||||
title: "KG ROAD | Главная",
|
||||
description:
|
||||
"Главная страница KG ROAD | Сделаем дороги безопасными!",
|
||||
type: "website",
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
title: `KG ROAD | ${metadata.title}`,
|
||||
description: metadata.description,
|
||||
keywords: metadata.keywords.split(","),
|
||||
openGraph: {
|
||||
title: `KG ROAD | ${metadata.title}`,
|
||||
description: metadata.description,
|
||||
type: "website",
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const Home = async ({
|
||||
searchParams,
|
||||
|
||||
@@ -11,6 +11,7 @@ import React from "react";
|
||||
|
||||
const Personal = async () => {
|
||||
const session = await getServerSession(authConfig);
|
||||
console.log(session?.expires_in);
|
||||
const getProfile = async () => {
|
||||
const Authorization = `Bearer ${session?.access_token}`;
|
||||
const config = {
|
||||
|
||||
@@ -32,7 +32,7 @@ export async function generateMetadata({
|
||||
title: `KG ROAD | ${response.data.location[0].address}`,
|
||||
description: response.data.description,
|
||||
images: [response.data.image[0].image],
|
||||
type: "website",
|
||||
type: "article",
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -3,18 +3,42 @@ import "./Statistics.scss";
|
||||
import StatisticsTable from "@/widgets/tables/StatisticsTable/StatisticsTable";
|
||||
import { Metadata } from "next";
|
||||
import BreadCrumbs from "@/features/BreadCrumbs/BreadCrumbs";
|
||||
import { IMetatag } from "@/shared/types/metatag-type";
|
||||
import { apiInstance } from "@/shared/config/apiConfig";
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const data = await apiInstance
|
||||
.get<IMetatag[]>("/metatags/")
|
||||
.then((res) => res.data)
|
||||
.catch((e) => console.log(e));
|
||||
|
||||
if (!data)
|
||||
return {
|
||||
title: "KG ROAD | Статистика",
|
||||
description: `Статистика по населенным пунктам Кыргызстана`,
|
||||
keywords: ["Бишкек", "Чуй", "Кыргызстан", "Дороги"],
|
||||
};
|
||||
|
||||
const metadata = data.filter((tag) => tag.page === "statistics")[0];
|
||||
if (!metadata) {
|
||||
return {
|
||||
title: "KG ROAD | Статистика",
|
||||
description: `Статистика по населенным пунктам Кыргызстана`,
|
||||
};
|
||||
}
|
||||
|
||||
export async function generateMetadata({
|
||||
searchParams,
|
||||
}: {
|
||||
searchParams: { "поиск-населенного-пункта": string };
|
||||
}): Promise<Metadata> {
|
||||
return {
|
||||
title: "KG ROAD | Статистика",
|
||||
description: `Статистика по ${searchParams["поиск-населенного-пункта"]} KG ROAD`,
|
||||
keywords: ["Бишкек", "Чуй", "Кыргызстан", "Дороги"],
|
||||
title: `KG ROAD | ${metadata.title}`,
|
||||
description: metadata.description,
|
||||
keywords: metadata.keywords.split(","),
|
||||
openGraph: {
|
||||
title: `KG ROAD | ${metadata.title}`,
|
||||
description: metadata.description,
|
||||
type: "website",
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const Statistics = ({
|
||||
searchParams,
|
||||
}: {
|
||||
|
||||
@@ -3,11 +3,42 @@ import "./Volunteers.scss";
|
||||
import VolunteersTable from "@/widgets/tables/VolunteersTable/VolunteersTable";
|
||||
import { Metadata } from "next";
|
||||
import BreadCrumbs from "@/features/BreadCrumbs/BreadCrumbs";
|
||||
import { apiInstance } from "@/shared/config/apiConfig";
|
||||
import { IMetatag } from "@/shared/types/metatag-type";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "KG ROAD | Волонтеры",
|
||||
description: "Страница лучших волонтеров Кыргызской Республики!",
|
||||
};
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const data = await apiInstance
|
||||
.get<IMetatag[]>("/metatags/")
|
||||
.then((res) => res.data)
|
||||
.catch((e) => console.log(e));
|
||||
|
||||
if (!data)
|
||||
return {
|
||||
title: "KG ROAD | Волонтеры",
|
||||
description:
|
||||
"Страница лучших волонтеров Кыргызской Республики!",
|
||||
};
|
||||
|
||||
const metadata = data.filter((tag) => tag.page === "volunteers")[0];
|
||||
if (!metadata) {
|
||||
return {
|
||||
title: "KG ROAD | Волонтеры",
|
||||
description:
|
||||
"Страница лучших волонтеров Кыргызской Республики!",
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
title: `KG ROAD | ${metadata.title}`,
|
||||
description: metadata.description,
|
||||
keywords: metadata.keywords.split(","),
|
||||
openGraph: {
|
||||
title: `KG ROAD | ${metadata.title}`,
|
||||
description: metadata.description,
|
||||
type: "website",
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const Volunteers = () => {
|
||||
return (
|
||||
|
||||
Reference in new issue
Block a user