Skip to content

Commit

Permalink
Отчет за 30.09.24
Browse files Browse the repository at this point in the history
*Обновление QoL в рамках авторизации через смс код (добавил фокус на custom  компонент / возможность навигации / arial label для слабо видящих-глухонемых[скрин ридеры] )
* Работа над товарами по категориям (подготовка инфраструктуры ожидание согласование дизайна страницы товаров по категориям)
  • Loading branch information
hays0503 committed Sep 30, 2024
1 parent fd4f794 commit 9f60ff4
Show file tree
Hide file tree
Showing 36 changed files with 753 additions and 4 deletions.
11 changes: 11 additions & 0 deletions app/[locale]/[city]/catalog/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"use server";
import { headers } from 'next/headers'
import { isMobileDevice } from "@/shared/tools/responsive";
import { CatalogPage } from '@/_pages/CatalogPage';

const Page = async ({ params }: { params: any }) => {
const mobile = isMobileDevice(headers().get('user-agent')||"");
return <CatalogPage params={{ ...params, mobile }} />;
};

export default Page;
38 changes: 38 additions & 0 deletions app/[locale]/[city]/login/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { UrlApiWithDomain, UrlRevalidate } from "@/shared/api/url";
import type { Metadata } from "next";
import { unstable_setRequestLocale } from "next-intl/server";

export const metadata: Metadata = {
title: "dev.SCK-1.kz",
description: "Сайт в разработке dev.SCK-1.kz",
};


export async function generateStaticParams() {
const fetchCity = await (
await fetch(UrlApiWithDomain.getCity, {
...UrlRevalidate.getCity,
headers: {
"Content-Type": "application/json",
Accept: "application/json",
},
})
).json();
const city = fetchCity.map((i: any) => ({ city: i.additional_data.EN }));
return city;
}

export default async function RootLayout({
children,
params: { locale, city },
}: {
children: React.ReactNode;
params: { locale: string; city: string };
}) {
unstable_setRequestLocale(locale);
return (
<html lang={locale}>
<body>{children}</body>
</html>
);
}
11 changes: 11 additions & 0 deletions app/[locale]/[city]/login/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"use server";
import { headers } from 'next/headers'
import { isMobileDevice } from "@/shared/tools/responsive";
import { LoginPage } from '@/_pages/LoginPage';

const Page = async ({ params }: { params: any }) => {
const mobile = isMobileDevice(headers().get('user-agent')||"");
return <LoginPage params={{ ...params, mobile }} />;
};

export default Page;
14 changes: 14 additions & 0 deletions public/google-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions public/vk-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/_pages/AccountPage/ui/AccountPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export async function AccountPage({ params }: { params: any }) {
<section>
<AccountMenu params={params} />
</section>
<footer>
<footer style={{position:"relative",width:"100%",bottom:"0"}}>
<FooterMobileSCK params={params} />
<FooterSCK params={params} />
</footer>
Expand Down
1 change: 1 addition & 0 deletions src/_pages/CatalogPage/api/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { }
1 change: 1 addition & 0 deletions src/_pages/CatalogPage/config/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { }
4 changes: 4 additions & 0 deletions src/_pages/CatalogPage/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * from './api'
export * from './config'
export * from './model'
export * from './ui'
1 change: 1 addition & 0 deletions src/_pages/CatalogPage/model/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { }
78 changes: 78 additions & 0 deletions src/_pages/CatalogPage/ui/CatalogPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
"use server";

import { ProvidersClient } from "@/_app/providers/providersClient";
import { ProvidersServer } from "@/_app/providers/providersServer";
import { FooterMobileSCK } from "@/features/FooterMobileSCK";
import { FooterSCK } from "@/features/FooterSCK";
import { UrlApi, UrlApiWithDomain, UrlRevalidate } from "@/shared/api/url";
import { Catalog } from "@/widgets/Catalog";

import { HeaderSCK } from "@/widgets/HeaderSCK";
import { Flex } from "antd";

export default async function CatalogPage({params}: {params: any}) {
const fetchCity = await (
await fetch(UrlApiWithDomain.getCity, {
...UrlRevalidate.getCity,
headers: {
"Content-Type": "application/json",
Accept: "application/json",
},
})
).json();

const fetchCategory = await (
await fetch(UrlApiWithDomain.getCategory, {
...UrlRevalidate.getCategory,
headers: {
"Content-Type": "application/json",
Accept: "application/json",
},
})
).json();

const UrlProductCatalog = `${UrlApi.getProducts}filter_by_cat/${params.slug}`;
const UrlProductCatalogWithDomain = `${UrlApiWithDomain.getProducts}filter_by_cat/${params.slug}`;

console.log(UrlProductCatalog);
console.log(UrlProductCatalogWithDomain);

const fetchProductCatalog = await (
await fetch(UrlProductCatalogWithDomain, {
...UrlRevalidate.getProducts,
headers: {
"Content-Type": "application/json",
Accept: "application/json",
},
})
).json();


const fallback = {
[UrlApi.getCity]: fetchCity,
[UrlApi.getCategory]: fetchCategory,
[UrlProductCatalog]: fetchProductCatalog
};

return (
<>
<ProvidersServer>
<ProvidersClient
fallback={fallback}
params={params}
>
<Flex vertical={true}>
<HeaderSCK params={params} carousel />
<section>
<Catalog params={params} />
</section>
<footer style={{position:"relative",width:"100%",bottom:"0"}}>
<FooterMobileSCK params={params} />
<FooterSCK params={params} />
</footer>
</Flex>
</ProvidersClient>
</ProvidersServer>
</>
);
}
3 changes: 3 additions & 0 deletions src/_pages/CatalogPage/ui/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import CatalogPage from './CatalogPage.tsx'

export { CatalogPage }
1 change: 1 addition & 0 deletions src/_pages/LoginPage/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './ui'
90 changes: 90 additions & 0 deletions src/_pages/LoginPage/ui/LoginPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
"use server";

import { ProvidersClient } from "@/_app/providers/providersClient";
import { ProvidersServer } from "@/_app/providers/providersServer";
import { FooterMobileSCK } from "@/features/FooterMobileSCK";
import { FooterSCK } from "@/features/FooterSCK";
import { UrlApi, UrlApiWithDomain, UrlRevalidate } from "@/shared/api/url";
import { Populates } from "@/shared/types/populates";

import { HeaderSCK } from "@/widgets/HeaderSCK";
import { Login } from "@/widgets/Login";
import { Sale } from "@/widgets/Sale";
import { Flex } from "antd";
export default async function LoginPage({ params }: { params: any }) {
const fetchCity = await (
await fetch(UrlApiWithDomain.getCity, {
...UrlRevalidate.getCity,
headers: {
"Content-Type": "application/json",
Accept: "application/json",
},
})
).json();

const fetchCategory = await (
await fetch(UrlApiWithDomain.getCategory, {
...UrlRevalidate.getCategory,
headers: {
"Content-Type": "application/json",
Accept: "application/json",
},
})
).json();

const fetchPopulates = await (
await fetch(UrlApiWithDomain.getPopulates, {
...UrlRevalidate.getPopulates,
headers: {
"Content-Type": "application/json",
Accept: "application/json",
},
})
).json();

const PopularProductsByIds = `by_ids/${fetchPopulates
.flatMap((i: Populates) => i.products)
.join(",")}`;
const UrlApiPopularProductsByIds = UrlApi.getProducts + PopularProductsByIds;
const UrlApiWithDomainPopularProductsByIds =
UrlApiWithDomain.getProducts + PopularProductsByIds;
const fetchPopularProductsByIds = await (
await fetch(UrlApiWithDomainPopularProductsByIds, {
...UrlRevalidate.getProducts,
headers: {
"Content-Type": "application/json",
Accept: "application/json",
},
})
).json();

const fallback = {
[UrlApi.getCity]: fetchCity,
[UrlApi.getCategory]: fetchCategory,
[UrlApi.getPopulates]: fetchPopulates,
[UrlApiPopularProductsByIds]: fetchPopularProductsByIds,
};

return (
<>
<ProvidersServer>
<ProvidersClient
fallback={fallback}
// fallback={{}}
params={params}
>
<Flex vertical={true} gap={"15px"}>
<HeaderSCK params={params}/>
<section>
<Login params={params} />
</section>
<footer style={{position:"relative",width:"100%",bottom:"0"}}>
<FooterMobileSCK params={params} />
<FooterSCK params={params} />
</footer>
</Flex>
</ProvidersClient>
</ProvidersServer>
</>
);
}
3 changes: 3 additions & 0 deletions src/_pages/LoginPage/ui/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import LoginPage from './LoginPage.tsx'

export { LoginPage }
2 changes: 1 addition & 1 deletion src/_pages/MainPage/MainPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export async function MainPage({ params }: { params: any }) {
<section>
<Sale params={params} />
</section>
<footer>
<footer style={{position:"relative",width:"100%",bottom:"0"}}>
<FooterMobileSCK params={params} />
<FooterSCK params={params} />
</footer>
Expand Down
2 changes: 1 addition & 1 deletion src/_pages/ProductPage/ui/ProductPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default async function ProductPage({ params }: { params: any }) {
<section>
<ProductDetailCard params={params}/>
</section>
<footer>
<footer style={{position:"relative",width:"100%",bottom:"0"}}>
<FooterMobileSCK params={params} />
<FooterSCK params={params} />
</footer>
Expand Down
1 change: 1 addition & 0 deletions src/features/ProductShowcase/api/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { }
1 change: 1 addition & 0 deletions src/features/ProductShowcase/config/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { }
4 changes: 4 additions & 0 deletions src/features/ProductShowcase/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * from './api'
export * from './config'
export * from './model'
export * from './ui'
1 change: 1 addition & 0 deletions src/features/ProductShowcase/model/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { }
41 changes: 41 additions & 0 deletions src/features/ProductShowcase/ui/ProductShowcase.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

import { CarouselShopSCK } from "@/entities/CarouselShopSCK";
import { ProductCard } from "@/entities/ProductCard";
import { useGetCityParams } from "@/shared/hook/useGetCityParams";
import useSelectCurrentCity from "@/shared/hook/useSelectCurrentCity";
import { Products } from "@/shared/types/products";
import { Flex } from "antd";


export default function ProductShowcase({
params,
products,
}: {
params: any;
products: Products[];
}) {
const currentCityEN = useGetCityParams();
const currentCityRU = useSelectCurrentCity("en", currentCityEN)?.name_city!;
// Нам нечего демонстрировать
if (products.length === 0) {
return null;
}

const filteredProductsCurrentCity = products.filter((i: Products) => {
return i?.price?.hasOwnProperty(currentCityRU);
});
const {deviceType} = JSON.parse(params.mobile.value);
return (
<Flex
gap={"15px"}
style={{
width: "80%",
backgroundColor: "#fffffff6",
}}
>
{filteredProductsCurrentCity.map((i: Products) => (
<ProductCard key={i.id} product={i} currentCityRU={currentCityRU} params={params}/>
))}
</Flex>
);
}
3 changes: 3 additions & 0 deletions src/features/ProductShowcase/ui/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import ProductShowcase from './ProductShowcase.tsx'

export { ProductShowcase }
1 change: 0 additions & 1 deletion src/features/ShopWindow/ui/ShopWindow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export default function ShopWindow({
return i?.price?.hasOwnProperty(currentCityRU);
});
const {deviceType} = JSON.parse(params.mobile.value);
console.log("deviceType",deviceType)
return (
<Flex
gap={"15px"}
Expand Down
1 change: 1 addition & 0 deletions src/widgets/Catalog/api/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { }
1 change: 1 addition & 0 deletions src/widgets/Catalog/config/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { }
4 changes: 4 additions & 0 deletions src/widgets/Catalog/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * from './api'
export * from './config'
export * from './model'
export * from './ui'
1 change: 1 addition & 0 deletions src/widgets/Catalog/model/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { }
Loading

0 comments on commit 9f60ff4

Please sign in to comment.