refactor: clean up message files and improve product category handling
This commit is contained in:
@@ -36,7 +36,6 @@ declare const messages: {
|
||||
"com_home_projects_title_bold": "initiatives",
|
||||
"com_home_projects_description": "Our successful project initiatives showcase our commitment to excellence and innovation across various industries.",
|
||||
|
||||
|
||||
"footer_title": "Industrial Solutions for a Modern World",
|
||||
"footer_description": "We are committed to providing personalized industrial solutions that meet the unique needs of our clients. Our team of experts is dedicated to delivering high-quality products and services that drive success in today’s competitive market.",
|
||||
"footer_slogan": "We are committed to providing personalized industrial solutions.",
|
||||
@@ -58,16 +57,13 @@ declare const messages: {
|
||||
"com_products_category_Ghermez_title": "Ghermez",
|
||||
"com_products_category_Semirom_title": "Semirom",
|
||||
"com_products_category_Zard_title": "Zard",
|
||||
"com_products_category_types_count": "count Types",
|
||||
"com_products_category_types_count": "{count} types",
|
||||
"com_products_category_show_all_CTA": "Show Products",
|
||||
"pages_products_content_title": "Brick Classification: Understanding the Variety and Applications",
|
||||
"pages_products_content_description": "Bricks, as one of humanity's oldest and most widely used building materials, have evolved significantly throughout history. Today, they are produced and supplied in an incredibly diverse range, allowing engineers and architects to choose the most suitable brick for any project and need, from traditional and historic structures to modern and advanced buildings. To better understand this diversity, we can classify bricks based on several key criteria, each with its own specific characteristics and applications. \n 1. Classification by Manufacturing Method: From Tradition to Advanced IndustryThe method by which bricks are produced directly impacts their appearance, texture, and properties. Hand-moulded/Stock Bricks: These bricks are produced by manually pressing clay into molds. The result is a brick with a relatively rough texture, uneven edges, and a more traditional appearance, where each piece feels unique. This type of brick is often used for restoration projects or for constructing buildings with a rustic or antique style. Machine-made Bricks: These bricks are produced using industrial machinery, resulting in much higher precision in dimensions and uniformity in appearance. Machine-made bricks themselves are divided into two main categories: Perforated/Hollow Bricks: These bricks have holes, offering several advantages: they reduce building weight, improve thermal and acoustic insulation, and enhance mortar adhesion. Solid Bricks: These bricks are without holes and possess very high compressive strength. They are ideal for load-bearing structures and walls requiring maximum strength. 2. Classification by Raw Material Type and Composition: From Clay to Concrete The material from which a brick is made determines its physical and chemical properties.",
|
||||
|
||||
"com_products_products_category_title": "Products of {title} Category",
|
||||
|
||||
|
||||
|
||||
|
||||
"com_contact_touch_title": "Get in touch",
|
||||
"com_contact_touch_title_bold": "with us",
|
||||
"com_contact_touch_description": "Reach out for any inquiries, support, or to discuss how we can meet your industrial needs.",
|
||||
@@ -89,7 +85,6 @@ declare const messages: {
|
||||
"com_contact_phone_required": "Phone is required",
|
||||
"com_contact_textarea_required": "Message is required",
|
||||
|
||||
|
||||
"com_contact_email_error": "Email is not valid",
|
||||
"com_contact_phone_error": "The contact number is not valid (for example: 09123456789)",
|
||||
"com_contact_textarea_error": "Message must be at least 10 characters long.",
|
||||
@@ -97,6 +92,5 @@ declare const messages: {
|
||||
"pages_notFound_title": "404 Not Found Page",
|
||||
"pages_notFound_description": "You can either head back to the Homepage or try a search.",
|
||||
"pages_notFound_button": "Go To Home"
|
||||
|
||||
};
|
||||
export default messages;
|
||||
+1
-7
@@ -33,7 +33,6 @@
|
||||
"com_home_projects_title_bold": "initiatives",
|
||||
"com_home_projects_description": "Our successful project initiatives showcase our commitment to excellence and innovation across various industries.",
|
||||
|
||||
|
||||
"footer_title": "Industrial Solutions for a Modern World",
|
||||
"footer_description": "We are committed to providing personalized industrial solutions that meet the unique needs of our clients. Our team of experts is dedicated to delivering high-quality products and services that drive success in today’s competitive market.",
|
||||
"footer_slogan": "We are committed to providing personalized industrial solutions.",
|
||||
@@ -55,16 +54,13 @@
|
||||
"com_products_category_Ghermez_title": "Ghermez",
|
||||
"com_products_category_Semirom_title": "Semirom",
|
||||
"com_products_category_Zard_title": "Zard",
|
||||
"com_products_category_types_count": "count Types",
|
||||
"com_products_category_types_count": "{count} types",
|
||||
"com_products_category_show_all_CTA": "Show Products",
|
||||
"pages_products_content_title": "Brick Classification: Understanding the Variety and Applications",
|
||||
"pages_products_content_description": "Bricks, as one of humanity's oldest and most widely used building materials, have evolved significantly throughout history. Today, they are produced and supplied in an incredibly diverse range, allowing engineers and architects to choose the most suitable brick for any project and need, from traditional and historic structures to modern and advanced buildings. To better understand this diversity, we can classify bricks based on several key criteria, each with its own specific characteristics and applications. \n 1. Classification by Manufacturing Method: From Tradition to Advanced IndustryThe method by which bricks are produced directly impacts their appearance, texture, and properties. Hand-moulded/Stock Bricks: These bricks are produced by manually pressing clay into molds. The result is a brick with a relatively rough texture, uneven edges, and a more traditional appearance, where each piece feels unique. This type of brick is often used for restoration projects or for constructing buildings with a rustic or antique style. Machine-made Bricks: These bricks are produced using industrial machinery, resulting in much higher precision in dimensions and uniformity in appearance. Machine-made bricks themselves are divided into two main categories: Perforated/Hollow Bricks: These bricks have holes, offering several advantages: they reduce building weight, improve thermal and acoustic insulation, and enhance mortar adhesion. Solid Bricks: These bricks are without holes and possess very high compressive strength. They are ideal for load-bearing structures and walls requiring maximum strength. 2. Classification by Raw Material Type and Composition: From Clay to Concrete The material from which a brick is made determines its physical and chemical properties.",
|
||||
|
||||
"com_products_products_category_title": "Products of {title} Category",
|
||||
|
||||
|
||||
|
||||
|
||||
"com_contact_touch_title": "Get in touch",
|
||||
"com_contact_touch_title_bold": "with us",
|
||||
"com_contact_touch_description": "Reach out for any inquiries, support, or to discuss how we can meet your industrial needs.",
|
||||
@@ -86,7 +82,6 @@
|
||||
"com_contact_phone_required": "Phone is required",
|
||||
"com_contact_textarea_required": "Message is required",
|
||||
|
||||
|
||||
"com_contact_email_error": "Email is not valid",
|
||||
"com_contact_phone_error": "The contact number is not valid (for example: 09123456789)",
|
||||
"com_contact_textarea_error": "Message must be at least 10 characters long.",
|
||||
@@ -94,5 +89,4 @@
|
||||
"pages_notFound_title": "404 Not Found Page",
|
||||
"pages_notFound_description": "You can either head back to the Homepage or try a search.",
|
||||
"pages_notFound_button": "Go To Home"
|
||||
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ export default async function ProductPage({
|
||||
productCategory={productCategory}
|
||||
className="mt-6"
|
||||
/>
|
||||
<div className="mt-20">
|
||||
<div id="productList" className="mt-20">
|
||||
<h2 className="mb-6 text-3xl font-semibold text-gray-500">
|
||||
{productCategory.title} Products
|
||||
</h2>
|
||||
|
||||
@@ -4,49 +4,33 @@ import { APIProductCategoryEntity } from '@/models/api';
|
||||
import { productCategoriesData } from './data';
|
||||
|
||||
export async function GET(request: Request) {
|
||||
try {
|
||||
let data = productCategoriesData as APIProductCategoryEntity[];
|
||||
|
||||
const cookieStore = await cookies();
|
||||
const lang = (await cookieStore).get('lang')?.value || 'fa';
|
||||
const lang = (await cookieStore).get('locale')?.value || 'en';
|
||||
console.log('!!!!!!!!!!!!!!!!!!!!');
|
||||
console.log(lang);
|
||||
|
||||
if (lang === 'fa') {
|
||||
data = productCategoriesData.map(
|
||||
({
|
||||
id,
|
||||
title,
|
||||
fa_title,
|
||||
icon,
|
||||
typesCount,
|
||||
priceTypeTitle,
|
||||
fa_priceTypeTitle,
|
||||
bestForTitle,
|
||||
fa_bestForTitle,
|
||||
description,
|
||||
fa_description,
|
||||
}) => {
|
||||
if (lang === 'fa') {
|
||||
return {
|
||||
id,
|
||||
icon,
|
||||
typesCount,
|
||||
title: fa_title || title,
|
||||
priceTypeTitle: fa_priceTypeTitle || priceTypeTitle,
|
||||
bestForTitle: fa_bestForTitle || bestForTitle,
|
||||
description: fa_description || description,
|
||||
};
|
||||
}
|
||||
return {
|
||||
id,
|
||||
icon,
|
||||
typesCount,
|
||||
title,
|
||||
priceTypeTitle,
|
||||
bestForTitle,
|
||||
description,
|
||||
};
|
||||
},
|
||||
);
|
||||
data = productCategoriesData.map((productCategory) => ({
|
||||
...productCategory,
|
||||
title: (lang && productCategory.fa_title) || productCategory.title,
|
||||
priceTypeTitle:
|
||||
productCategory.fa_priceTypeTitle || productCategory.priceTypeTitle,
|
||||
bestForTitle:
|
||||
productCategory.fa_bestForTitle || productCategory.bestForTitle,
|
||||
description:
|
||||
productCategory.fa_description || productCategory.description,
|
||||
}));
|
||||
}
|
||||
|
||||
return NextResponse.json({ data });
|
||||
} catch (error) {
|
||||
console.error('Error fetching product categories:', error);
|
||||
return NextResponse.json(
|
||||
{ error: 'Failed to fetch product categories' },
|
||||
{ status: 500 },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ const routeFactory: RouteFactory = (t, locale) => ({
|
||||
},
|
||||
blog: {
|
||||
title: t('pages_blog_title'),
|
||||
route: () => `/${locale}/blog-us`,
|
||||
route: () => `/${locale}/blog`,
|
||||
},
|
||||
contact: {
|
||||
title: t('pages_contact_title'),
|
||||
|
||||
@@ -5,15 +5,20 @@ import Navbar from '../navbar';
|
||||
import Button, { IconButton } from '@/components/uikit/button';
|
||||
import { Icon } from '@/components/uikit/icons';
|
||||
import { useTranslations } from 'next-intl';
|
||||
import routeFactory from '@/assets/constants/routeFactory';
|
||||
import { useParams } from 'next/navigation';
|
||||
|
||||
export default function Header() {
|
||||
const t = useTranslations();
|
||||
const params = useParams();
|
||||
const locale = params.locale as string;
|
||||
|
||||
const bannerFooter = [
|
||||
t('com_home_Banner_link1'),
|
||||
t('com_home_Banner_link2'),
|
||||
t('com_home_Banner_link3'),
|
||||
];
|
||||
const routes = routeFactory(t, locale);
|
||||
|
||||
return (
|
||||
<header
|
||||
@@ -37,7 +42,9 @@ export default function Header() {
|
||||
}}
|
||||
/>
|
||||
<div>
|
||||
<Button endIcon="showMore">{t('com_home_banner_button')}</Button>
|
||||
<Button endIcon="showMore" link={routes.productCategories.route()}>
|
||||
{t('com_home_banner_button')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -19,6 +19,10 @@ export default function ProductList({
|
||||
.then((res) => {
|
||||
setProducts(res.data);
|
||||
setPagination(res.pagination);
|
||||
|
||||
document
|
||||
.getElementById('productList')
|
||||
?.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Failed to fetch products:', error);
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
'use server';
|
||||
|
||||
import { IProjectCardProps } from '@/components/pages/project/project';
|
||||
import api from '@/lib/axios';
|
||||
import { IResponse } from '@/models/response';
|
||||
import { cookies } from 'next/headers';
|
||||
|
||||
export async function getProjects() {
|
||||
@@ -12,7 +10,6 @@ export async function getProjects() {
|
||||
headers: {
|
||||
Cookie: cookiesStore.toString(),
|
||||
},
|
||||
|
||||
})
|
||||
.then(({ data }) => Promise.resolve(data.data))
|
||||
.catch((error) => Promise.reject(error));
|
||||
|
||||
Reference in New Issue
Block a user