Skip to content

Commit e96234e

Browse files
committed
feat: implement service context for managing active service state across components
1 parent 9362864 commit e96234e

22 files changed

Lines changed: 200 additions & 152 deletions

‎apps/codebility/app/(marketing)/layout.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"use server";
2+
23
import { ModalProviderMarketing } from "@/components/providers/modal-provider-marketing";
34

45
export default async function MarketingLayout({
Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
1+
import ForceScrollTop from "./_components/landing/ForceScrollTop";
12
import Admins from "./_components/landing/LandingAdmins";
23
import Features from "./_components/landing/LandingFeatures";
34
import Hero from "./_components/landing/LandingHero";
5+
import InternSectionContainer from "./_components/landing/LandingInternSection";
46
import Partners from "./_components/landing/LandingPartners";
57
import WhyChooseUs from "./_components/landing/LandingWhyChoose-us";
68
import WorkWithUs from "./_components/landing/LandingWorkWithUs";
79
import Calendly from "./_components/MarketingCalendly";
810
import Footer from "./_components/MarketingFooter";
911
import Navigation from "./_components/MarketingNavigation";
1012
import Testimonials from "./_components/testimonial/Testimonials";
11-
import InternSectionContainer from "./_components/landing/LandingInternSection";
12-
import ForceScrollTop from "./_components/landing/ForceScrollTop";
1313

1414
export const dynamic = "force-dynamic";
1515
export const revalidate = 0;
1616

1717
export default async function Index() {
1818
return (
1919
<div className="bg-black-400 relative w-full overflow-x-hidden">
20-
2120
<Navigation />
2221
<Hero />
2322
<Features />
@@ -29,8 +28,6 @@ export default async function Index() {
2928
<Testimonials />
3029
<Calendly />
3130
<Footer />
32-
33-
3431
</div>
3532
);
36-
}
33+
}

‎apps/codebility/app/(marketing)/services/_components/ClientTechyBackground.tsx‎

Lines changed: 0 additions & 11 deletions
This file was deleted.

‎apps/codebility/app/(marketing)/services/_components/ServicesGrid.tsx‎

Lines changed: 0 additions & 35 deletions
This file was deleted.

‎apps/codebility/app/(marketing)/services/_components/ServicesPageContent.tsx‎

Lines changed: 0 additions & 43 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export * from "./layout";
2+
export * from "./ui";
3+
export * from "./visuals";
4+
export * from "./tabs";
5+
export * from "../_context";

apps/codebility/app/(marketing)/services/_components/ServiceDetailView.tsx renamed to apps/codebility/app/(marketing)/services/_components/layout/ServiceDetailView.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
"use client";
22

33
import Image from "next/image";
4-
import Link from "next/link";
54
import { defaultAvatar } from "@/public/assets/images";
65
import { motion } from "framer-motion";
76

87
import { Button } from "@codevs/ui";
98

109
export const ServiceDetailView = ({ service, onBack }) => {
11-
console.log("ServiceDetailView rendered with service:", service);
12-
1310
return (
1411
<div className="mx-auto w-full max-w-[1200px] px-4 py-8 pb-24 sm:px-6 md:pb-8">
1512
{/* Back Button */}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"use client";
2+
3+
import { useServiceContext } from "../../_context";
4+
import { ServicesServiceCard } from "../ui";
5+
6+
export const ServicesGrid = ({ services }) => {
7+
const { activeService, setActiveService, clearActiveService } =
8+
useServiceContext();
9+
10+
if (activeService) {
11+
const { ServiceDetailView } = require("./ServiceDetailView");
12+
return (
13+
<ServiceDetailView service={activeService} onBack={clearActiveService} />
14+
);
15+
}
16+
17+
return (
18+
<div>
19+
{services.map((service) => (
20+
<ServicesServiceCard
21+
key={service.id}
22+
service={service}
23+
onSelect={(s) => setActiveService(s)}
24+
/>
25+
))}
26+
</div>
27+
);
28+
};

apps/codebility/app/(marketing)/services/_components/ServicesHero.tsx renamed to apps/codebility/app/(marketing)/services/_components/layout/ServicesHero.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import Container from "../../_components/MarketingContainer";
2-
import SideNavMenu from "../../_components/MarketingSidenavMenu";
1+
import Container from "../../../_components/MarketingContainer";
2+
import SideNavMenu from "../../../_components/MarketingSidenavMenu";
33

4-
export default function Hero() {
4+
export const Hero = () => {
55
return (
66
<div className="relative">
77
<section className="relative mt-2 flex min-h-[300px] w-full flex-col items-center justify-center overflow-hidden bg-cover bg-no-repeat lg:mt-20">
@@ -26,9 +26,9 @@ export default function Hero() {
2626
clipPath:
2727
"polygon(20.7% 28%, 76.2% 29%, 89.8% 59.5%, 87.3% 98%, 70% 100%, 30% 100%, 9.4% 96.8%, 7.3% 64.8%)",
2828
}}
29-
className="relative aspect-[855/678] w-[40rem] bg-customBlue-200 opacity-30 sm:w-[72.1875rem]"
29+
className="bg-customBlue-200 relative aspect-[855/678] w-[40rem] opacity-30 sm:w-[72.1875rem]"
3030
/>
3131
</div>
3232
</div>
3333
);
34-
}
34+
};
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
"use client";
2+
3+
import { useServiceContext } from "../../_context";
4+
import Calendly from "../../../_components/MarketingCalendly";
5+
import Footer from "../../../_components/MarketingFooter";
6+
import { ServicesHero, ServicesTab } from "../layout";
7+
import { ServiceDetailView } from "./ServiceDetailView";
8+
9+
interface Props {
10+
servicesData: any[];
11+
}
12+
13+
export const ServicesPageContent = ({ servicesData }: Props) => {
14+
const { activeService, clearActiveService, setActiveService } =
15+
useServiceContext();
16+
17+
// If a service is selected, show only the detail view
18+
if (activeService) {
19+
return (
20+
<ServiceDetailView service={activeService} onBack={clearActiveService} />
21+
);
22+
}
23+
24+
// Otherwise, show the normal services page
25+
return (
26+
<>
27+
<ServicesHero />
28+
<ServicesTab
29+
servicesData={servicesData}
30+
onServiceSelect={setActiveService}
31+
/>
32+
<Calendly />
33+
<Footer />
34+
</>
35+
);
36+
};

0 commit comments

Comments
 (0)