diff --git a/src/Components/Sections/DepartmentDetail/DepartmentDetail.jsx b/src/Components/Sections/DepartmentDetail/DepartmentDetail.jsx index de465ed..b9364da 100644 --- a/src/Components/Sections/DepartmentDetail/DepartmentDetail.jsx +++ b/src/Components/Sections/DepartmentDetail/DepartmentDetail.jsx @@ -1,15 +1,13 @@ import React, { useState, useEffect, useRef, useCallback } from "react"; import { motion, AnimatePresence } from "framer-motion"; import { useTranslation } from "react-i18next"; -import "../../../../src/i18n"; // احتفظت بالاستيراد كما طلبت +import "../../../../src/i18n"; -// استيراد الصور كما كانت في واجهتك import d1 from "../../../../src/assets/Images/d1.jpeg"; import d2 from "../../../../src/assets/Images/d2.jpeg"; import d3 from "../../../../src/assets/Images/d3.jpeg"; import d4 from "../../../../src/assets/Images/d4.jpeg"; -/* -------------------- ProjectsTimeline (مضمن داخل نفس الملف كما في واجهتك) -------------------- */ function ProjectsTimeline({ projects, mainTitle = "المشاريع المنفذة", @@ -130,7 +128,11 @@ function ProjectsTimeline({ const scrollLeft = scrollContainer.scrollLeft; const targetScroll = - scrollLeft + itemRect.left - containerRect.left - containerRect.width / 2 + itemRect.width / 2; + scrollLeft + + itemRect.left - + containerRect.left - + containerRect.width / 2 + + itemRect.width / 2; scrollContainer.scrollTo({ left: targetScroll, behavior: "smooth" }); setActiveItem(index); @@ -187,7 +189,8 @@ function ProjectsTimeline({ return () => { clearTimeout(t); - if (scrollContainer) scrollContainer.removeEventListener("scroll", onScroll); + if (scrollContainer) + scrollContainer.removeEventListener("scroll", onScroll); window.removeEventListener("resize", onResize); }; }, [itemsRefs, drawCurvedLines, setActiveItem]); @@ -238,25 +241,64 @@ function ProjectsTimeline({ .projects-timeline-root.plain-bleed .project-card { max-width:420px; } `; - const mainStyle = plain ? { background: "#ffffff", paddingBottom: 0 } : { background: "linear-gradient(135deg, var(--bg-start) 0%, var(--bg-mid) 30%, var(--bg-end) 60%)" }; + const mainStyle = plain + ? { background: "#ffffff", paddingBottom: 0 } + : { + background: + "linear-gradient(135deg, var(--bg-start) 0%, var(--bg-mid) 30%, var(--bg-end) 60%)", + }; return ( -
+
{!plain && (
-

+

{mainTitle}

-

{subtitle}

+

+ {subtitle} +

)}
-
-
+
+
{projects.map((project, idx) => (
- - + +
@@ -295,8 +353,6 @@ function ProjectsTimeline({ ); } -/* -------------------- نهاية ProjectsTimeline -------------------- */ - const defaultProjects = [ { year: "1999-2015", @@ -308,7 +364,10 @@ const defaultProjects = [ ], }, { year: "2001", items: ["أعمال تشغيل وصيانة الدورة لمعمل الوهيب ستوك إير"] }, - { year: "2002", items: ["أعمال تشغيل وصيانة الدورة لمعمل العربية لدرفلة إير"] }, + { + year: "2002", + items: ["أعمال تشغيل وصيانة الدورة لمعمل العربية لدرفلة إير"], + }, { year: "2004", items: ["أعمال متنوعة في مجال الدرفلة والتصنيع"] }, { year: "2016", @@ -317,7 +376,10 @@ const defaultProjects = [ "أي أم، التايتيك - التروت، تصميم وتنفيذ", ], }, - { year: "2016-2017", items: ["التدريب العالمي 600 طن/يوم", "التدريب للصناعات الغذائية"] }, + { + year: "2016-2017", + items: ["التدريب العالمي 600 طن/يوم", "التدريب للصناعات الغذائية"], + }, { year: "2017", items: ["دراسة تأهيلية معمل الشمس (العسافي - حمص)"] }, { year: "2019", @@ -327,8 +389,17 @@ const defaultProjects = [ ], }, { year: "2020", items: ["استكمال دراسة تأهيلية للصم وقياس الشمس"] }, - { year: "2021", items: ["منشأ تيسير لمعمل المتحدة، تصميم الاسور - أبو الشامات"] }, - { year: "2022", items: ["استكمال منشأ تيسير لمعمل المتحدة", "معمل المثنى للتصنيع السريع - طرطوس"] }, + { + year: "2021", + items: ["منشأ تيسير لمعمل المتحدة، تصميم الاسور - أبو الشامات"], + }, + { + year: "2022", + items: [ + "استكمال منشأ تيسير لمعمل المتحدة", + "معمل المثنى للتصنيع السريع - طرطوس", + ], + }, { year: "2023", items: ["مشاريع متنوعة في مجال التصنيع والدرفلة"] }, ]; @@ -342,29 +413,47 @@ export default function DepartmentDetail() { { id: 3, title: t("department.buttons.works"), key: "works" }, ]; - const expertiseItems = t("department.expertiseItems", { returnObjects: true }) || [ - "دراسات الجدوى الاقتصادية وتحليل الربحية والمخاطر للمشاريع الصناعية والهندسية", - "الدراسات الهندسية الأولية والنهائية والتفصيلية", - "تصميم المخططات التنفيذية", - "تنفيذ الأعمال المدنية والمعمارية والمعدنية للمنشآت الصناعية", - "تصنيع وتركيب خطوط الإنتاج محلياً أو خطوط الانتاج المستوردة", - "تنفيذ الأعمال الميكانيكية والكهربائية وأنظمة التحكم", - "الإشراف على التشغيل التجريبي وتدريب الكوادر الفنية", - ]; + const expertiseItemsRaw = t("department.expertiseItems", { + returnObjects: true, + }); + const expertiseItems = Array.isArray(expertiseItemsRaw) + ? expertiseItemsRaw + : [ + "دراسات الجدوى الاقتصادية وتحليل الربحية والمخاطر للمشاريع الصناعية والهندسية", + "الدراسات الهندسية الأولية والنهائية والتفصيلية", + "تصميم المخططات التنفيذية", + "تنفيذ الأعمال المدنية والمعمارية والمعدنية للمنشآت الصناعية", + "تصنيع وتركيب خطوط الإنتاج محلياً أو خطوط الانتاج المستوردة", + "تنفيذ الأعمال الميكانيكية والكهربائية وأنظمة التحكم", + "الإشراف على التشغيل التجريبي وتدريب الكوادر الفنية", + ]; - const servicesItems = t("department.servicesItems", { returnObjects: true }) || [ - "الصيانة الدورية والوقائية.", - "الصيانة الطارئة ومعالجة الأعطال.", - "إعادة التأهيل والتحديث الفني للمنشآت.", - "فحص وتقييم الحالة الفنية للتجهيزات والآلات.", - "أعمال التفتيش الفني والهندسي وفق المعايير العالمية.", - "رفع كفاءة التشغيل وتقليل تكاليف الأعطال", - ]; + const servicesItemsRaw = t("department.servicesItems", { + returnObjects: true, + }); + const servicesItems = Array.isArray(servicesItemsRaw) + ? servicesItemsRaw + : [ + "الصيانة الدورية والوقائية.", + "الصيانة الطارئة ومعالجة الأعطال.", + "إعادة التأهيل والتحديث الفني للمنشآت.", + "فحص وتقييم الحالة الفنية للتجهيزات والآلات.", + "أعمال التفتيش الفني والهندسي وفق المعايير العالمية.", + "رفع كفاءة التشغيل وتقليل تكاليف الأعطال", + ]; - const defaultProjectsTranslated = t("department.defaultProjects", { returnObjects: true }) || defaultProjects; + const defaultProjectsTranslated = + t("department.defaultProjects", { returnObjects: true }) || defaultProjects; const displayItems = active === "services" ? servicesItems : expertiseItems; - const heroImage = active === "expertise" ? d2 : active === "services" ? d3 : active === "works" ? d4 : d1; + const heroImage = + active === "expertise" + ? d2 + : active === "services" + ? d3 + : active === "works" + ? d4 + : d1; const handleButtonClick = (key) => { setActive((prev) => (prev === key ? null : key)); @@ -400,12 +489,21 @@ export default function DepartmentDetail() {
{active === "expertise" ? ( - +
- {t("department.hero.expertiseBadge") || "اختصاص القسم"} + {t("department.hero.expertiseBadge") || + "اختصاص القسم"}

- {t("department.hero.expertiseTitle") || "حلول متكاملة للمنشآت الصناعية"} + {t("department.hero.expertiseTitle") || + "حلول متكاملة للمنشآت الصناعية"}

{t("department.hero.expertiseSubtitle") || @@ -413,19 +511,35 @@ export default function DepartmentDetail() {

) : active === "services" ? ( - +
{t("department.hero.servicesBadge") || "خدمات القسم"}

- {t("department.hero.servicesTitle") || "خدمات الصيانة للمنشآت وخطوط الإنتاج"} + {t("department.hero.servicesTitle") || + "خدمات الصيانة للمنشآت وخطوط الإنتاج"}

- {t("department.hero.servicesSubtitle") || "يتضمن هذا القسم خدمات الصيانة الشاملة والدورية للمنشآت الصناعية وخطوط الانتاج، وتشمل:"} + {t("department.hero.servicesSubtitle") || + "يتضمن هذا القسم خدمات الصيانة الشاملة والدورية للمنشآت الصناعية وخطوط الانتاج، وتشمل:"}

) : active === "works" ? ( - +
{t("department.hero.worksBadge") || "الأعمال المنفذة"}
@@ -433,13 +547,22 @@ export default function DepartmentDetail() { {t("department.hero.worksTitle") || "الأعمال المنفذة"}

- {t("department.hero.worksSubtitle") || "عرض مشروعاتنا وخط الزمن الخاص بالأعمال المنفذة."} + {t("department.hero.worksSubtitle") || + "عرض مشروعاتنا وخط الزمن الخاص بالأعمال المنفذة."}

) : ( - +

- {t("department.sectionTitle") || "قسم إنشاء وصيانة المنشآت الصناعية وخطوط الإنتاج"} + {t("department.sectionTitle") || + "قسم إنشاء وصيانة المنشآت الصناعية وخطوط الإنتاج"}

)} @@ -447,7 +570,10 @@ export default function DepartmentDetail() {
-
+
{!active && ( handleButtonClick(b.key)} className="group relative rounded-2xl p-4 sm:p-6 shadow-2xl border border-transparent flex flex-col h-full text-right focus:outline-none focus:ring-4 focus:ring-amber-200 transition-all duration-300 overflow-hidden bg-white/80 backdrop-blur-sm" @@ -477,12 +607,24 @@ export default function DepartmentDetail() {
{b.id}
-

{b.title}

+

+ {b.title} +

{t("department.clickForDetails")} - - + +

@@ -495,8 +637,16 @@ export default function DepartmentDetail() {
- - + +
@@ -529,11 +679,25 @@ export default function DepartmentDetail() { {b.id}
-

{b.title}

-

{t("department.clickForDetails")}

+

+ {b.title} +

+

+ {t("department.clickForDetails")} +

- - + + ))} @@ -546,25 +710,92 @@ export default function DepartmentDetail() {
{!active ? ( - + ) : active === "works" ? ( - - setActive(null)} whileHover={{ x: 8 }} className="inline-flex items-center gap-3 text-amber-600 hover:text-amber-700 font-bold mb-6 sm:mb-8 group text-sm sm:text-base focus:outline-none focus:ring-2 focus:ring-amber-200 rounded-lg px-3 py-2 mr-0 md:-mr-4"> - - + + setActive(null)} + whileHover={{ x: 8 }} + className="inline-flex items-center gap-3 text-amber-600 hover:text-amber-700 font-bold mb-6 sm:mb-8 group text-sm sm:text-base focus:outline-none focus:ring-2 focus:ring-amber-200 rounded-lg px-3 py-2 mr-0 md:-mr-4" + > + +
{t("department.backToMenu")} -
- +
+
) : ( - - setActive(null)} whileHover={{ x: 8 }} className="inline-flex items-center gap-3 text-amber-600 hover:text-amber-700 font-bold mb-6 sm:mb-8 group text-sm sm:text-base focus:outline-none focus:ring-2 focus:ring-amber-200 rounded-lg px-3 py-2 mr-0 md:-mr-4"> - - + + setActive(null)} + whileHover={{ x: 8 }} + className="inline-flex items-center gap-3 text-amber-600 hover:text-amber-700 font-bold mb-6 sm:mb-8 group text-sm sm:text-base focus:outline-none focus:ring-2 focus:ring-amber-200 rounded-lg px-3 py-2 mr-0 md:-mr-4" + > + + {t("department.backToMenu")} @@ -581,19 +812,51 @@ export default function DepartmentDetail() { >
- - + + + +
-

{text}

+

+ {text} +

- - - + + +
@@ -601,11 +864,21 @@ export default function DepartmentDetail() { ))}
- +
- Professional integrated services -
+ + Professional integrated services + +
diff --git a/src/Components/Sections/DepartmentDetail6/DepartmentDetail6.jsx b/src/Components/Sections/DepartmentDetail6/DepartmentDetail6.jsx index 760c52b..cea183c 100644 --- a/src/Components/Sections/DepartmentDetail6/DepartmentDetail6.jsx +++ b/src/Components/Sections/DepartmentDetail6/DepartmentDetail6.jsx @@ -1,4 +1,4 @@ -import React, { useState, useEffect, useRef, useCallback } from "react"; +import React, { useState, useEffect, useRef, useCallback } from "react"; import { motion, AnimatePresence } from "framer-motion"; import { useTranslation } from "react-i18next"; import d19 from "../../../../src/assets/Images/d19.jpeg"; @@ -15,7 +15,7 @@ function ProjectsTimeline({ dir = "rtl", scrollLabel = "خط زمني قابل للتمرير", prevLabel = "السابق", - nextLabel = "التالي" + nextLabel = "التالي", }) { const wrapperRef = useRef(null); const scrollRef = useRef(null); @@ -131,7 +131,11 @@ function ProjectsTimeline({ const scrollLeft = scrollContainer.scrollLeft; const targetScroll = - scrollLeft + itemRect.left - containerRect.left - containerRect.width / 2 + itemRect.width / 2; + scrollLeft + + itemRect.left - + containerRect.left - + containerRect.width / 2 + + itemRect.width / 2; scrollContainer.scrollTo({ left: targetScroll, behavior: "smooth" }); setActiveItem(index); @@ -188,7 +192,8 @@ function ProjectsTimeline({ return () => { clearTimeout(t); - if (scrollContainer) scrollContainer.removeEventListener("scroll", onScroll); + if (scrollContainer) + scrollContainer.removeEventListener("scroll", onScroll); window.removeEventListener("resize", onResize); }; }, [itemsRefs, drawCurvedLines, setActiveItem]); @@ -253,25 +258,65 @@ function ProjectsTimeline({ .projects-timeline-root.plain-bleed .project-card { max-width:420px; } `; - const mainStyle = plain ? { background: "#ffffff", paddingBottom: 0 } : { background: "linear-gradient(135deg, var(--bg-start) 0%, var(--bg-mid) 30%, var(--bg-end) 60%)" }; + const mainStyle = plain + ? { background: "#ffffff", paddingBottom: 0 } + : { + background: + "linear-gradient(135deg, var(--bg-start) 0%, var(--bg-mid) 30%, var(--bg-end) 60%)", + }; return ( -
+
{!plain && (
-

+

{mainTitle}

-

{subtitle}

+

+ {subtitle} +

)}
-
-
+
+
{projects.map((project, idx) => (
- - + +
@@ -319,19 +380,53 @@ export default function DepartmentDetail6() { const cycleImgs = [d28, d27, d29]; const [cycleIndex, setCycleIndex] = useState(0); useEffect(() => { - const tInterval = setInterval(() => setCycleIndex((i) => (i + 1) % cycleImgs.length), 3000); + const tInterval = setInterval( + () => setCycleIndex((i) => (i + 1) % cycleImgs.length), + 3000 + ); return () => clearInterval(tInterval); }, []); // buttons from translations (array) - const buttons = t("departmentDetail6.buttons", { returnObjects: true }); + const buttons = [ + { id: 1, title: t("departmentDetail6.buttons.1"), key: "expertise" }, + { id: 3, title: t("departmentDetail6.buttons.3"), key: "works" }, + ]; // card groups from translations - const cardGroups = t("departmentDetail6.cardGroups", { returnObjects: true }); + const cardGroupsRaw = t("departmentDetail6.cardGroups", { + returnObjects: true, + }); - const projectsTimeline = t("departmentDetail6.projectsTimeline.defaultProjects", { returnObjects: true }); + const expertiseItemsRaw = t("departmentDetail6.expertiseItems", { + returnObjects: true, + }); + const validExpertiseItems = Array.isArray(expertiseItemsRaw) + ? expertiseItemsRaw + : []; - const heroImage = active === "expertise" ? cycleImgs[cycleIndex] : active === "works" ? d30 : d19; + const cardGroups = Array.isArray(cardGroupsRaw) + ? cardGroupsRaw + : [ + { + title: + t("departmentDetail6.hero.expertiseBadge") || + "Department Expertise", + items: validExpertiseItems, + }, + ]; + + const projectsTimeline = t( + "departmentDetail6.projectsTimeline.defaultProjects", + { returnObjects: true } + ); + + const heroImage = + active === "expertise" + ? cycleImgs[cycleIndex] + : active === "works" + ? d30 + : d19; const handleButtonClick = (key) => { setActive((prev) => (prev === key ? null : key)); @@ -344,7 +439,10 @@ export default function DepartmentDetail6() { const backToMenu = t("departmentDetail6.backToMenu"); return ( -
+
@@ -354,7 +452,11 @@ export default function DepartmentDetail6() { animate={{ opacity: 1, scale: 1 }} exit={{ opacity: 0, scale: 0.98 }} transition={{ duration: 0.6 }} - className={`relative ${active ? 'h-80 sm:h-96 md:h-[540px] lg:h-[680px]' : 'h-72 sm:h-80 md:h-[480px] lg:h-[580px]'} overflow-visible`} + className={`relative ${ + active + ? "h-80 sm:h-96 md:h-[540px] lg:h-[680px]" + : "h-72 sm:h-80 md:h-[480px] lg:h-[580px]" + } overflow-visible`} > {active === "expertise" ? ( - -
{t("departmentDetail6.hero.expertiseBadge")}
-

{t("departmentDetail6.hero.expertiseTitle")}

-

{t("departmentDetail6.hero.expertiseSubtitle")}

+ +
+ {t("departmentDetail6.hero.expertiseBadge")} +
+

+ {t("departmentDetail6.hero.expertiseTitle")} +

+

+ {t("departmentDetail6.hero.expertiseSubtitle")} +

) : active === "works" ? ( - -
{t("departmentDetail6.hero.worksBadge")}
-

{t("departmentDetail6.hero.worksTitle")}

-

{t("departmentDetail6.hero.worksSubtitle")}

+ +
+ {t("departmentDetail6.hero.worksBadge")} +
+

+ {t("departmentDetail6.hero.worksTitle")} +

+

+ {t("departmentDetail6.hero.worksSubtitle")} +

) : ( - -

{t("departmentDetail6.hero.defaultTitle")}

+ +

+ {t("departmentDetail6.hero.defaultTitle")} +

)}
-
+
{!active && ( handleButtonClick(b.key)} - className={`group relative rounded-2xl p-4 sm:p-6 shadow-2xl border border-transparent flex flex-col h-full ${isRTL ? 'text-right' : 'text-left'} focus:outline-none focus:ring-4 focus:ring-amber-200 transition-all duration-300 overflow-hidden bg-white/80 backdrop-blur-sm`} + className={`group relative rounded-2xl p-4 sm:p-6 shadow-2xl border border-transparent flex flex-col h-full ${ + isRTL ? "text-right" : "text-left" + } focus:outline-none focus:ring-4 focus:ring-amber-200 transition-all duration-300 overflow-hidden bg-white/80 backdrop-blur-sm`} >
@@ -424,12 +576,24 @@ export default function DepartmentDetail6() {
{b.id}
-

{b.title}

+

+ {b.title} +

{ui.clickToView} - - + +

@@ -442,8 +606,16 @@ export default function DepartmentDetail6() {
- - + +
@@ -470,17 +642,33 @@ export default function DepartmentDetail6() { transition={{ delay: index * 0.05, duration: 0.35 }} whileHover={{ scale: 1.02 }} onClick={() => handleButtonClick(b.key)} - className={`group relative rounded-2xl p-3 shadow-md border border-transparent flex items-center gap-3 ${isRTL ? 'text-right' : 'text-left'} focus:outline-none focus:ring-4 focus:ring-amber-200 transition-all duration-200 overflow-hidden bg-white/90`} + className={`group relative rounded-2xl p-3 shadow-md border border-transparent flex items-center gap-3 ${ + isRTL ? "text-right" : "text-left" + } focus:outline-none focus:ring-4 focus:ring-amber-200 transition-all duration-200 overflow-hidden bg-white/90`} >
{b.id}
-

{b.title}

-

{ui.clickToView}

+

+ {b.title} +

+

+ {ui.clickToView} +

- - + + ))} @@ -493,21 +681,63 @@ export default function DepartmentDetail6() {
{!active ? ( - + ) : active === "works" ? ( - - setActive(null)} whileHover={{ x: 8 }} className={`inline-flex items-center gap-3 text-amber-600 hover:text-amber-700 font-bold mb-6 sm:mb-8 group text-sm sm:text-base focus:outline-none focus:ring-2 focus:ring-amber-200 rounded-lg px-3 py-2 ${isRTL ? 'mr-0 md:-mr-4' : 'ml-0 md:-ml-4'}`}> - - + + setActive(null)} + whileHover={{ x: 8 }} + className={`inline-flex items-center gap-3 text-amber-600 hover:text-amber-700 font-bold mb-6 sm:mb-8 group text-sm sm:text-base focus:outline-none focus:ring-2 focus:ring-amber-200 rounded-lg px-3 py-2 ${ + isRTL ? "mr-0 md:-mr-4" : "ml-0 md:-ml-4" + }`} + > + +
{backToMenu} -
+
) : ( - - setActive(null)} whileHover={{ x: 8 }} className={`inline-flex items-center gap-3 text-amber-600 hover:text-amber-700 font-bold mb-6 sm:mb-8 group text-sm sm:text-base focus:outline-none focus:ring-2 focus:ring-amber-200 rounded-lg px-3 py-2 ${isRTL ? 'mr-0 md:-mr-4' : 'ml-0 md:-ml-4'}`}> - - + + setActive(null)} + whileHover={{ x: 8 }} + className={`inline-flex items-center gap-3 text-amber-600 hover:text-amber-700 font-bold mb-6 sm:mb-8 group text-sm sm:text-base focus:outline-none focus:ring-2 focus:ring-amber-200 rounded-lg px-3 py-2 ${ + isRTL ? "mr-0 md:-mr-4" : "ml-0 md:-ml-4" + }`} + > + + {backToMenu}
{cardGroups.map((group, gIndex) => ( -
-

{group.title}

+
+

+ {group.title} +

{group.items.map((text, idx) => ( - +
- - + + + +
-

{text}

+

+ {text} +

- - + +
@@ -557,11 +853,21 @@ export default function DepartmentDetail6() { ))}
- +
- {t("departmentDetail6.ui.servicesProfessional")} -
+ + {t("departmentDetail6.ui.servicesProfessional")} + +
diff --git a/src/Components/Sections/DepartmentDetail7/DepartmentDetail7.jsx b/src/Components/Sections/DepartmentDetail7/DepartmentDetail7.jsx index fc39036..7c03e0f 100644 --- a/src/Components/Sections/DepartmentDetail7/DepartmentDetail7.jsx +++ b/src/Components/Sections/DepartmentDetail7/DepartmentDetail7.jsx @@ -320,9 +320,13 @@ export default function DepartmentDetail7() { }; // جلب الأزرار/البيانات من الترجمة - const buttons = t("departmentDetail7.buttons", { returnObjects: true }); + const buttons = [ + { id: 1, title: t("departmentDetail7.buttons.1"), key: "expertise" }, + { id: 2, title: t("departmentDetail7.buttons.2"), key: "works" }, + ]; const projectsTimeline = t("departmentDetail7.projectsTimeline.defaultProjects", { returnObjects: true }); - const expertiseTexts = t("departmentDetail7.expertiseItems", { returnObjects: true }); + const expertiseTextsRaw = t("departmentDetail7.expertiseItems", { returnObjects: true }); + const expertiseTexts = Array.isArray(expertiseTextsRaw) ? expertiseTextsRaw : []; const hero = t("departmentDetail7.hero", { returnObjects: true }); const ui = t("departmentDetail7.ui", { returnObjects: true }); const backToMenu = t("departmentDetail7.backToMenu"); diff --git a/src/Components/Sections/DepartmentDetail8/DepartmentDetail8.jsx b/src/Components/Sections/DepartmentDetail8/DepartmentDetail8.jsx index 394483a..74f4860 100644 --- a/src/Components/Sections/DepartmentDetail8/DepartmentDetail8.jsx +++ b/src/Components/Sections/DepartmentDetail8/DepartmentDetail8.jsx @@ -15,7 +15,7 @@ function ProjectsTimeline({ dir = "rtl", scrollLabel = "خط زمني قابل للتمرير", prevLabel = "السابق", - nextLabel = "التالي" + nextLabel = "التالي", }) { const wrapperRef = useRef(null); const scrollRef = useRef(null); @@ -25,7 +25,9 @@ function ProjectsTimeline({ useEffect(() => { setItemsRefs((r) => { - const arr = Array(projects.length).fill().map((_, i) => r[i] || React.createRef()); + const arr = Array(projects.length) + .fill() + .map((_, i) => r[i] || React.createRef()); return arr; }); }, [projects.length]); @@ -129,7 +131,11 @@ function ProjectsTimeline({ const scrollLeft = scrollContainer.scrollLeft; const targetScroll = - scrollLeft + itemRect.left - containerRect.left - containerRect.width / 2 + itemRect.width / 2; + scrollLeft + + itemRect.left - + containerRect.left - + containerRect.width / 2 + + itemRect.width / 2; scrollContainer.scrollTo({ left: targetScroll, behavior: "smooth" }); setActiveItem(index); @@ -186,7 +192,8 @@ function ProjectsTimeline({ return () => { clearTimeout(t); - if (scrollContainer) scrollContainer.removeEventListener("scroll", onScroll); + if (scrollContainer) + scrollContainer.removeEventListener("scroll", onScroll); window.removeEventListener("resize", onResize); }; }, [itemsRefs, drawCurvedLines, setActiveItem]); @@ -250,25 +257,65 @@ function ProjectsTimeline({ .projects-timeline-root.plain-bleed .project-card { max-width:420px; } `; - const mainStyle = plain ? { background: "#ffffff", paddingBottom: 0 } : { background: "linear-gradient(135deg, var(--bg-start) 0%, var(--bg-mid) 30%, var(--bg-end) 60%)" }; + const mainStyle = plain + ? { background: "#ffffff", paddingBottom: 0 } + : { + background: + "linear-gradient(135deg, var(--bg-start) 0%, var(--bg-mid) 30%, var(--bg-end) 60%)", + }; return ( -
+
{!plain && (
-

+

{mainTitle}

-

{subtitle}

+

+ {subtitle} +

)}
-
-
+
+
{projects.map((project, idx) => (
- - + +
@@ -315,44 +378,110 @@ export default function DepartmentDetail8() { const [active, setActive] = useState(null); const hero = t("departmentDetail8.hero", { returnObjects: true }); - const buttons = t("departmentDetail8.buttons", { returnObjects: true }); - const projectsTimeline = t("departmentDetail8.projectsTimeline.defaultProjects", { returnObjects: true }); - const expertiseTexts = t("departmentDetail8.expertiseItems", { returnObjects: true }); + + const buttons = [ + { id: 1, title: t("departmentDetail8.buttons.1"), key: "expertise" }, + { id: 2, title: t("departmentDetail8.buttons.2"), key: "works" }, + ]; + const projectsTimeline = t( + "departmentDetail8.projectsTimeline.defaultProjects", + { returnObjects: true } + ); + const expertiseTextsRaw = t("departmentDetail8.expertiseItems", { + returnObjects: true, + }); + const expertiseTexts = Array.isArray(expertiseTextsRaw) + ? expertiseTextsRaw + : []; const ui = t("departmentDetail8.ui", { returnObjects: true }); const backToMenu = t("departmentDetail8.backToMenu"); const scrollLabels = t("departmentDetail8.scroll", { returnObjects: true }); const icons = [ - ( - - - - ), - ( - - - - ), - ( - - - - ), - ( - - - - ), - ( - - - - ), - ( - - - - ) + + + , + + + , + + + , + + + , + + + , + + + , ]; const expertiseItems = expertiseTexts.map((text, idx) => { @@ -368,10 +497,14 @@ export default function DepartmentDetail8() { setActive((prev) => (prev === key ? null : key)); }; - const heroImage = active === "expertise" ? d34 : active === "works" ? d33 : d21; + const heroImage = + active === "expertise" ? d34 : active === "works" ? d33 : d21; return ( -
+
@@ -400,27 +533,71 @@ export default function DepartmentDetail8() {
{active === "expertise" ? ( - -
{hero.expertiseBadge}
-

{hero.expertiseTitle}

-

{hero.expertiseSubtitle}

+ +
+ {hero.expertiseBadge} +
+

+ {hero.expertiseTitle} +

+

+ {hero.expertiseSubtitle} +

) : active === "works" ? ( - -
{hero.worksBadge}
-

{hero.worksTitle}

-

{hero.worksSubtitle}

+ +
+ {hero.worksBadge} +
+

+ {hero.worksTitle} +

+

+ {hero.worksSubtitle} +

) : ( - -

{hero.defaultTitle}

+ +

+ {hero.defaultTitle} +

)}
-
+
{!active && ( handleButtonClick(b.key)} - className={`group relative rounded-2xl p-4 sm:p-6 shadow-2xl border border-transparent flex flex-col h-full ${isRTL ? 'text-right' : 'text-left'} focus:outline-none focus:ring-4 focus:ring-amber-200 transition-all duration-300 overflow-hidden bg-white/85 backdrop-blur-sm`} + className={`group relative rounded-2xl p-4 sm:p-6 shadow-2xl border border-transparent flex flex-col h-full ${ + isRTL ? "text-right" : "text-left" + } focus:outline-none focus:ring-4 focus:ring-amber-200 transition-all duration-300 overflow-hidden bg-white/85 backdrop-blur-sm`} >
@@ -450,12 +633,24 @@ export default function DepartmentDetail8() {
{b.id}
-

{b.title}

+

+ {b.title} +

{ui.clickToView} - - + +

@@ -468,8 +663,16 @@ export default function DepartmentDetail8() {
- - + +
@@ -496,17 +699,33 @@ export default function DepartmentDetail8() { transition={{ delay: index * 0.05, duration: 0.35 }} whileHover={{ scale: 1.02 }} onClick={() => handleButtonClick(b.key)} - className={`group relative rounded-2xl p-3 shadow-md border border-transparent flex items-center gap-3 ${isRTL ? 'text-right' : 'text-left'} focus:outline-none focus:ring-4 focus:ring-amber-200 transition-all duration-200 overflow-hidden bg-white/90`} + className={`group relative rounded-2xl p-3 shadow-md border border-transparent flex items-center gap-3 ${ + isRTL ? "text-right" : "text-left" + } focus:outline-none focus:ring-4 focus:ring-amber-200 transition-all duration-200 overflow-hidden bg-white/90`} >
{b.id}
-

{b.title}

-

{ui.clickToView}

+

+ {b.title} +

+

+ {ui.clickToView} +

- - + + ))} @@ -519,21 +738,63 @@ export default function DepartmentDetail8() {
{!active ? ( - + ) : active === "works" ? ( - - setActive(null)} whileHover={{ x: 8 }} className={`inline-flex items-center gap-3 text-amber-600 hover:text-amber-700 font-bold mb-6 sm:mb-8 group text-sm sm:text-base focus:outline-none focus:ring-2 focus:ring-amber-200 rounded-lg px-3 py-2 ${isRTL ? 'mr-0 md:-mr-4' : 'ml-0 md:-ml-4'}`}> - - + + setActive(null)} + whileHover={{ x: 8 }} + className={`inline-flex items-center gap-3 text-amber-600 hover:text-amber-700 font-bold mb-6 sm:mb-8 group text-sm sm:text-base focus:outline-none focus:ring-2 focus:ring-amber-200 rounded-lg px-3 py-2 ${ + isRTL ? "mr-0 md:-mr-4" : "ml-0 md:-ml-4" + }`} + > + +
{backToMenu} -
+
) : ( - - setActive(null)} whileHover={{ x: 8 }} className={`inline-flex items-center gap-3 text-amber-600 hover:text-amber-700 font-bold mb-6 sm:mb-8 group text-sm sm:text-base focus:outline-none focus:ring-2 focus:ring-amber-200 rounded-lg px-3 py-2 ${isRTL ? 'mr-0 md:-mr-4' : 'ml-0 md:-ml-4'}`}> - - + + setActive(null)} + whileHover={{ x: 8 }} + className={`inline-flex items-center gap-3 text-amber-600 hover:text-amber-700 font-bold mb-6 sm:mb-8 group text-sm sm:text-base focus:outline-none focus:ring-2 focus:ring-amber-200 rounded-lg px-3 py-2 ${ + isRTL ? "mr-0 md:-mr-4" : "ml-0 md:-ml-4" + }`} + > + + {backToMenu} @@ -563,30 +850,60 @@ export default function DepartmentDetail8() { >
- + {item.icon}
-

{item.text}

+

+ {item.text} +

- - - + + +
))} - +
- {ui.servicesProfessional} -
+ + {ui.servicesProfessional} + +
diff --git a/src/Components/Sections/Departments/Departments.jsx b/src/Components/Sections/Departments/Departments.jsx index 61e2d69..d6bd3dd 100644 --- a/src/Components/Sections/Departments/Departments.jsx +++ b/src/Components/Sections/Departments/Departments.jsx @@ -21,7 +21,11 @@ import d21 from "../../../../src/assets/Images/d21.jpeg"; import d22 from "../../../../src/assets/Images/d22.jpg"; const departments = [ - { id: 1, title: "قسم إنشاء وصيانة المنشآت الصناعية وخطوط الإنتاج", image: d1 }, + { + id: 1, + title: "قسم إنشاء وصيانة المنشآت الصناعية وخطوط الإنتاج", + image: d1, + }, { id: 2, title: "قسم تنفيذ المرافق السكنية والخدمية", image: d7 }, { id: 3, title: "قسم اعادة تأهيل وصيانة المباني", image: d14 }, { id: 4, title: "قسم محطات الوقود وصيانة المنشآت النفطية", image: d17 }, @@ -79,11 +83,14 @@ function DepartmentCard({ dept, offset, index }) { const progressParallax = useTransform(scrollYProgress, [0, 1], [15, -15]); - const y = useTransform([velocityParallax, progressParallax], ([v, p]) => v + p); + const y = useTransform( + [velocityParallax, progressParallax], + ([v, p]) => v + p + ); const handleClick = () => { if (dept.id === 1) { - navigate("/departments/:id"); + navigate("/departments/1"); } if (dept.id === 9) { navigate("/department-detail9"); @@ -110,7 +117,9 @@ function DepartmentCard({ dept, offset, index }) { } }; - const translatedTitle = t(`departments.list.${dept.id - 1}`, { defaultValue: dept.title }); + const translatedTitle = t(`departments.list.${dept.id - 1}`, { + defaultValue: dept.title, + }); return (
@@ -152,10 +162,14 @@ export default function Departments() { const { t } = useTranslation(); return ( -
+

- {t('departments.heading', { defaultValue: 'أقسامنا' })} + {t("departments.heading", { defaultValue: "أقسامنا" })}

diff --git a/src/Components/Sections/Home/Home.jsx b/src/Components/Sections/Home/Home.jsx index ab1d9d6..1718eff 100644 --- a/src/Components/Sections/Home/Home.jsx +++ b/src/Components/Sections/Home/Home.jsx @@ -1,12 +1,16 @@ import React, { useEffect, useState, useRef } from "react"; -import styled from 'styled-components'; -import { useTranslation } from 'react-i18next'; - +import styled from "styled-components"; +import { useTranslation } from "react-i18next"; +import REXNT from "../../../assets/Images/REXNT.png"; +import TPSlogo from "../../../assets/Images/TPS-logo.png"; +import NSC from "../../../assets/Images/NSC.png"; +import LOGO from "../../../assets/Images/LOGO.png"; export default function EngineeringHeroFlowbite() { const { t, i18n } = useTranslation(); const defaultConfig = { - main_title: "عندما تطلب الرؤية مستشارًا, ويحتاج المخطط منفذًا استراتيجيًا…نكون القرار بالقيادة من الرؤية حتى التسليم", + main_title: + "عندما تطلب الرؤية مستشارًا, ويحتاج المخطط منفذًا استراتيجيًا…نكون القرار بالقيادة من الرؤية حتى التسليم", subtitle: "حلول متكاملة تشمل التصميم، التنفيذ، التشغيل، والصيانة\nللمشاريع الصناعية والمدنية، وفق أحدث المعايير والتقنيات", primary_color: "#e67e22", @@ -20,8 +24,8 @@ export default function EngineeringHeroFlowbite() { const [config, setConfig] = useState({ ...defaultConfig, - main_title: t ? t('hero.main_title') : defaultConfig.main_title, - subtitle: t ? t('hero.subtitle') : defaultConfig.subtitle, + main_title: t ? t("hero.main_title") : defaultConfig.main_title, + subtitle: t ? t("hero.subtitle") : defaultConfig.subtitle, }); const [isMounted, setIsMounted] = useState(false); @@ -34,7 +38,8 @@ export default function EngineeringHeroFlowbite() { const link = document.createElement("link"); link.id = id; link.rel = "stylesheet"; - link.href = "https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800&display=swap"; + link.href = + "https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800&display=swap"; document.head.appendChild(link); } }, []); @@ -46,23 +51,23 @@ export default function EngineeringHeroFlowbite() { useEffect(() => { const updateFromI18n = () => { - const lang = i18n.language || 'en'; - let main = t('hero.main_title'); - if (lang && lang.startsWith('en')) { - main = main.replace(/[—–]/g, ' - '); + const lang = i18n.language || "en"; + let main = t("hero.main_title"); + if (lang && lang.startsWith("en")) { + main = main.replace(/[—–]/g, " - "); } setConfig((c) => ({ ...c, main_title: main, - subtitle: t('hero.subtitle'), + subtitle: t("hero.subtitle"), })); document.documentElement.lang = lang; - document.documentElement.dir = lang.startsWith('ar') ? 'rtl' : 'ltr'; + document.documentElement.dir = lang.startsWith("ar") ? "rtl" : "ltr"; }; updateFromI18n(); - i18n.on && i18n.on('languageChanged', updateFromI18n); + i18n.on && i18n.on("languageChanged", updateFromI18n); return () => { - i18n.off && i18n.off('languageChanged', updateFromI18n); + i18n.off && i18n.off("languageChanged", updateFromI18n); }; }, [i18n, t]); @@ -70,23 +75,34 @@ export default function EngineeringHeroFlowbite() { const main = mainTitleRef.current; const sub = subtitleRef.current; const baseFontStack = "Arial, sans-serif"; - const font = (config.font_family || defaultConfig.font_family) + ", " + baseFontStack; + const font = + (config.font_family || defaultConfig.font_family) + ", " + baseFontStack; const baseSize = config.font_size || defaultConfig.font_size; const applyStyles = () => { - const lang = i18n.language || 'en'; - const isArabic = lang.startsWith('ar'); + const lang = i18n.language || "en"; + const isArabic = lang.startsWith("ar"); const width = typeof window !== "undefined" ? window.innerWidth : 1024; - const responsiveBase = width <= 400 ? baseSize * 0.78 : width <= 640 ? baseSize * 0.88 : width <= 1024 ? baseSize * 0.96 : baseSize; + const responsiveBase = + width <= 400 + ? baseSize * 0.78 + : width <= 640 + ? baseSize * 0.88 + : width <= 1024 + ? baseSize * 0.96 + : baseSize; const headingMultiplier = width <= 640 ? 2.6 : 3.2; const subtitleMultiplier = width <= 640 ? 0.95 : 1.1; - const mainText = (config.main_title || defaultConfig.main_title).replace(/\s+/g, " ").trim(); + const mainText = (config.main_title || defaultConfig.main_title) + .replace(/\s+/g, " ") + .trim(); const mainTextLength = mainText.length; - const lengthFactor = mainTextLength > 100 ? 0.78 : mainTextLength > 70 ? 0.86 : 1.0; + const lengthFactor = + mainTextLength > 100 ? 0.78 : mainTextLength > 70 ? 0.86 : 1.0; const maxFont = 68; - const minFont = Math.max( Math.round(responsiveBase * 1.6), 14 ); + const minFont = Math.max(Math.round(responsiveBase * 1.6), 14); const root = document.documentElement; - root.style.setProperty('--base', `${responsiveBase}px`); + root.style.setProperty("--base", `${responsiveBase}px`); if (main) { const headingText = (config.main_title || defaultConfig.main_title) @@ -96,12 +112,20 @@ export default function EngineeringHeroFlowbite() { if (headingText.length === 1) { main.textContent = headingText[0]; } else { - main.innerHTML = `${headingText[0]}${headingText + main.innerHTML = `${ + headingText[0] + }${headingText .slice(1) .join("
")}
`; } main.style.fontFamily = font; - const computedSize = Math.min(Math.max(Math.round(responsiveBase * headingMultiplier * lengthFactor), minFont), maxFont); + const computedSize = Math.min( + Math.max( + Math.round(responsiveBase * headingMultiplier * lengthFactor), + minFont + ), + maxFont + ); main.style.fontSize = `${computedSize}px`; main.style.color = config.text_color || defaultConfig.text_color; main.style.fontWeight = 800; @@ -131,10 +155,22 @@ export default function EngineeringHeroFlowbite() { sub.style.display = "block"; } - root.style.setProperty("--ehb-primary", config.primary_color || defaultConfig.primary_color); - root.style.setProperty("--ehb-background", config.background_color || defaultConfig.background_color); - root.style.setProperty("--ehb-surface", config.secondary_surface || defaultConfig.secondary_surface); - root.style.setProperty("--ehb-action", config.secondary_action || defaultConfig.secondary_action); + root.style.setProperty( + "--ehb-primary", + config.primary_color || defaultConfig.primary_color + ); + root.style.setProperty( + "--ehb-background", + config.background_color || defaultConfig.background_color + ); + root.style.setProperty( + "--ehb-surface", + config.secondary_surface || defaultConfig.secondary_surface + ); + root.style.setProperty( + "--ehb-action", + config.secondary_action || defaultConfig.secondary_action + ); }; applyStyles(); @@ -155,20 +191,37 @@ export default function EngineeringHeroFlowbite() { const OrangeActionButton = ({ onClick }) => { return ( -