diff --git a/app/about/page.js b/app/about/page.js index 9b4ee4e..b2ee257 100644 --- a/app/about/page.js +++ b/app/about/page.js @@ -1,160 +1,17 @@ import "./AboutPage.css"; import { Container, Row, Col } from "react-bootstrap"; -import { - FaLightbulb, - FaBalanceScale, - FaUsers, - FaLinkedinIn, - FaGlobe, -} from "react-icons/fa"; import AOSWrapper from "@/components/AOSWrapper"; - import Hero from "@/components/Hero"; import CustomButton from "@/components/CustomButton"; import CallToAction from "@/components/CallToAction"; -import BlackCard from "@/components/BlackCard"; +import Leads from "@/components/Leads"; +import OurValues from "@/components/OurValues"; import Image from "next/image"; const AboutPage = () => { - const values = [ - { - icon: , - title: "Innovation", - description: - "We constantly seek out new ideas and approaches to stay ahead of industry trends and provide our clients with cutting-edge solutions.", - }, - { - icon: , - title: "Integrity", - description: - "We believe in doing business with honesty and transparency, building trust with our clients and partners through ethical practices.", - }, - { - icon: , - title: "Collaboration", - description: - "We work closely with our clients and partners, fostering a collaborative environment that drives success for everyone involved.", - }, - ]; - - const consultingLeads = [ - { - image: "/assets/about/team/phelan.webp", - name: "Mark Phelan", - title: "Senior Consultant,", - specialty: "E-Commerce Solutions", - socials: [ - { - icon: , - href: "https://www.linkedin.com/in/phelanmarkw", - }, - { - icon: , - href: "https://www.thephelanfocus.com/", - }, - ], - }, - { - image: "/assets/about/team/kathy.webp", - name: "Kathy Seaton", - title: "Senior Consultant,", - specialty: "Non Profit Development", - socials: [ - { - icon: , - href: "https://www.linkedin.com/in/klseaton", - }, - { - icon: , - href: "https://www.klseatonconsulting.com/", - }, - ], - }, - { - image: "/assets/about/team/donavon.webp", - name: "Donavon Roberson", - title: "Senior Consultant,", - specialty: "Tech + Software Solutions", - socials: [ - { - icon: , - href: "https://www.linkedin.com/in/donavonroberson", - }, - { - icon: , - href: "https://medium.com/@thejourneyofthedreamer", - }, - ], - }, - { - image: "/assets/about/team/melissa.webp", - name: "Melissa Eboli", - title: "Senior Consultant,", - specialty: "Health + Wellness Solutions", - socials: [ - { - icon: , - href: "https://www.linkedin.com/in/viamelissa", - }, - { icon: , href: "https://www.viaskitchen.com/" }, - ], - }, - ]; - - const teamLeads = [ - { - image: "/assets/about/team/bast.webp", - name: "Bast Herrera", - title: "Team Lead,", - specialty: "Program Development", - socials: [ - { - icon: , - href: "https://www.linkedin.com/in/vincentcherrera", - }, - ], - }, - { - image: "/assets/about/team/dania.webp", - name: "Dania Ali", - title: "Team Lead,", - specialty: "Operations + Strategy", - socials: [ - { - icon: , - href: "https://www.linkedin.com/in/syeda-dania-ali", - }, - ], - }, - { - image: "/assets/about/team/megha.webp", - name: "Megha Vinjamuru", - title: "Team Lead,", - specialty: "Project Management", - socials: [ - { - icon: , - href: "https://www.linkedin.com/in/meghanethra", - }, - ], - }, - { - image: "/assets/about/team/alexandria.webp", - name: "Alexandria Boreman", - title: "Team Lead,", - specialty: "Marketing + Creative", - socials: [ - { - icon: , - href: "https://www.linkedin.com/in/alexandriaboreman", - }, - ], - }, - ]; - return (
@@ -176,7 +33,7 @@ const AboutPage = () => { width={800} height={400} className="overflow-hidden rounded-3 object-fit-cover w-100" - // placeholder="blur" + // placeholder="blur" /> @@ -265,22 +122,7 @@ const AboutPage = () => { {/* Our Values Section */} -
- -

- Our Core Values -

- - {values.map((value, index) => ( - - ))} - -
-
+ {/* Our Team Section */}
@@ -295,79 +137,8 @@ const AboutPage = () => { -

Consulting Leads

- - {consultingLeads.map((member, i) => ( - -
- {member.name} -
-

{member.name}

-
{member.title}
-
{member.specialty}
-
- {member.socials.map((link, index) => ( - - {link.icon} - - ))} -
-
-
- - ))} -
- -

Delivery Team Leads

- - {teamLeads.map((member, i) => ( - -
- {member.name} -
-

{member.name}

-
{member.title}
-
{member.specialty}
-
- {member.socials.map((link, index) => ( - - {link.icon} - - ))} -
-
-
- - ))} -
+ {/* Consulting Leads and Team Leads Sections */} +
diff --git a/app/api/blog/route.js b/app/api/blog/route.js deleted file mode 100644 index 6f88eb1..0000000 --- a/app/api/blog/route.js +++ /dev/null @@ -1,33 +0,0 @@ -export async function GET(req) { - const { searchParams } = new URL(req.url); - const slug = searchParams.get("slug"); - - try { - const endpoint = slug ? `/posts?_embed&slug=${slug}` : `/posts?_embed`; - - console.log(`Fetching from: ${process.env.WORDPRESS_API_URL}${endpoint}`); - - const res = await fetch(`${process.env.WORDPRESS_API_URL}${endpoint}`, { - headers: { - Authorization: - "Basic " + - btoa( - `${process.env.WORDPRESS_API_USERNAME}:${process.env.WORDPRESS_API_PASSWORD}` - ), - }, - }); - - if (!res.ok) { - throw new Error(`Failed to fetch data: ${res.statusText}`); - } - - const data = await res.json(); - return new Response(JSON.stringify(data), { status: 200 }); - } catch (error) { - console.error("Error fetching blogs:", error); - return new Response( - JSON.stringify({ message: "Error fetching blogs", error: error.message }), - { status: 500 } - ); - } -} \ No newline at end of file diff --git a/app/api/client/[id]/route.js b/app/api/client/[id]/route.js index 441c0ff..b5cbc6f 100644 --- a/app/api/client/[id]/route.js +++ b/app/api/client/[id]/route.js @@ -1,51 +1,29 @@ -import { authenticateUser } from "@/lib/authenticateUser"; - -export async function GET(req, { params }) { - try { - const res = await fetch(`${process.env.WORDPRESS_CUSTOM_API_URL}/clients`); - const data = await res.json(); - const client = data.find((c) => c.id === params.id); - - return client - ? Response.json(client) - : new Response(JSON.stringify({ message: "Client not found" }), { - status: 404, - }); - } catch (error) { - return new Response( - JSON.stringify({ - message: "Error fetching client", - error: error.message, - }), - { status: 500 } - ); - } -} +import { authenticateUser } from "@/lib/authenticateUser" export async function DELETE(req, { params }) { - try { - authenticateUser(req); + try { + authenticateUser(req); - const { id } = await params + const { id } = await params - const res = await fetch( - `${process.env.WORDPRESS_CUSTOM_API_URL}/clients/${id}`, - { - method: "DELETE", - headers: { - Authorization: req.headers.get("authorization"), - }, - } - ); + const res = await fetch( + `${process.env.WORDPRESS_CUSTOM_API_URL}/clients/${id}`, + { + method: "DELETE", + headers: { + Authorization: req.headers.get("authorization"), + }, + } + ); - return Response.json(await res.json()); - } catch (error) { - return new Response( - JSON.stringify({ - message: "Error deleting client", - error: error.message, - }), - { status: 500 } - ); - } -} + return Response.json(await res.json()); + } catch (error) { + return new Response( + JSON.stringify({ + message: "Error deleting client", + error: error.message, + }), + { status: 500 } + ); + } +} \ No newline at end of file diff --git a/app/api/client/route.js b/app/api/client/route.js index f66f7e1..fe51349 100644 --- a/app/api/client/route.js +++ b/app/api/client/route.js @@ -1,48 +1,49 @@ import { authenticateUser } from "@/lib/authenticateUser"; +import getClients from "@/lib/getClients"; export async function GET() { - try { - const res = await fetch(`${process.env.WORDPRESS_CUSTOM_API_URL}/clients`); - const data = await res.json(); - return Response.json(data); - } catch (error) { - return new Response( - JSON.stringify({ - message: "Error fetching clients", - error: error.message, - }), - { status: 500 } - ); - } + try { + const clients = await getClients(null, false) + return new Response(JSON.stringify(clients), { status: 200 }) + } catch (error) { + return new Response( + JSON.stringify({ + message: "Error fetching clients", + error: error.message + }), + { status: 500 } + ) + } } export async function POST(req) { - try { - authenticateUser(req); // Protect this route + try { + authenticateUser(req); // Protect this route - const body = await req.json(); - console.log("Received client data:", body); - const res = await fetch(`${process.env.WORDPRESS_CUSTOM_API_URL}/clients`, { - method: "POST", - headers: { - Authorization: req.headers.get("authorization"), - "Content-Type": "application/json", - }, - body: JSON.stringify(body), - }); + const body = await req.json(); + console.log("Received client data:", body); - if (!res.ok) { - const errorResponse = await res.json(); - console.error("Error from WordPress API:", errorResponse); // Log error response from WordPress - throw new Error(`Failed to add client. Status code: ${res.status}`); - } + const res = await fetch(`${process.env.WORDPRESS_CUSTOM_API_URL}/clients`, { + method: "POST", + headers: { + Authorization: req.headers.get("authorization"), + "Content-Type": "application/json", + }, + body: JSON.stringify(body), + }); - const responseData = await res.json(); - return Response.json(responseData, { status: 201 }); - } catch (error) { - return new Response( - JSON.stringify({ message: "Error adding client", error: error.message }), - { status: 500 } - ); - } -} + if (!res.ok) { + const errorResponse = await res.json(); + console.error("Error from WordPress API:", errorResponse); // Log error response from WordPress + throw new Error(`Failed to add client. Status code: ${res.status}`); + } + + const responseData = await res.json(); + return Response.json(responseData, { status: 201 }); + } catch (error) { + return new Response( + JSON.stringify({ message: "Error adding client", error: error.message }), + { status: 500 } + ); + } +} \ No newline at end of file diff --git a/app/api/upload/route.js b/app/api/upload/route.js index 06689ab..7ace254 100644 --- a/app/api/upload/route.js +++ b/app/api/upload/route.js @@ -9,14 +9,13 @@ export async function POST(req) { const authHeader = req.headers.get('Authorization'); if (!authHeader || !authHeader.startsWith('Bearer ')) { - return NextResponse.json({ message: 'Unauthorized' }, { status: 401 }); + return NextResponse.json({ message: 'Unauthorized' }, { status: 401 }); } const token = authHeader.split(' ')[1]; const formData = new FormData(); const body = await req.formData(); const file = body.get('file'); - console.log('this is file', file) if (!file) { return NextResponse.json({ message: 'No file uploaded' }, { status: 400 }); @@ -26,7 +25,6 @@ export async function POST(req) { const buffer = Buffer.from(await file.arrayBuffer()); formData.append('file', buffer, file.name); - console.log('FormData:', formData); // Make the POST request to the WordPress media API const response = await axios.post(`${process.env.WORDPRESS_API_URL}/media`, formData, { @@ -35,7 +33,6 @@ export async function POST(req) { 'Authorization': `Bearer ${token}`, }, }); - console.log('WordPress API response:', response.data); // Return the image URL from the WordPress API return NextResponse.json({ url: response.data.source_url }, { status: 200 }); @@ -43,4 +40,4 @@ export async function POST(req) { console.error('Error uploading image:', error.response ? error.response.data : error); return NextResponse.json({ message: 'Error uploading image' }, { status: 500 }); } -} +} \ No newline at end of file diff --git a/app/editor/TestimonialEditorPage.css b/app/editor/TestimonialEditorPage.css index 504f91b..f35d6ae 100644 --- a/app/editor/TestimonialEditorPage.css +++ b/app/editor/TestimonialEditorPage.css @@ -5,9 +5,9 @@ body { font-family: Arial, sans-serif; - margin: 20px; text-align: center; } + .testimonial-carousel { margin: 20px auto; width: 60%; @@ -16,21 +16,25 @@ body { border-radius: 8px; background: #f9f9f9; } + .testimonial { display: flex; flex-direction: column; align-items: center; margin-bottom: 20px; } + .testimonial img { max-width: 150px; border-radius: 50%; margin-bottom: 10px; } + .testimonial span { display: block; margin-bottom: 5px; } + textarea { width: 90%; margin-bottom: 10px; @@ -38,6 +42,7 @@ textarea { border: 1px solid #ccc; border-radius: 5px; } + button { margin: 5px; padding: 10px 20px; @@ -51,10 +56,11 @@ button { transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; } + button:hover { background-color: rgb(234 179 8 / 1) !important; } input[type="file"] { margin-bottom: 20px; -} +} \ No newline at end of file diff --git a/app/editor/page.js b/app/editor/page.js index ff8cfc4..49ad08d 100644 --- a/app/editor/page.js +++ b/app/editor/page.js @@ -2,17 +2,12 @@ import AuthGuard from "@/components/AuthGuard"; import React, { useState, useEffect, useRef } from "react"; -import { - fetchClients, - addClient, - deleteClient, - uploadFile -} from "../../services/clientService"; +import { addClient, deleteClient, uploadFile } from "@/services/clientService"; import "./TestimonialEditorPage.css"; import { useRouter } from "next/navigation"; -import { logout } from "../../services/loginService"; -import ImageUpload from "../../components/ImageUpload"; -import axiosInstance from "../../utils/axiosInstance"; +import { logout } from "@/services/loginService"; +import ImageUpload from "@/components/ImageUpload"; +import axios from 'axios'; export default function EditorPage() { const router = useRouter(); @@ -39,11 +34,10 @@ export default function EditorPage() { }; useEffect(() => { - const loadClients = async () => { - const response = await fetchClients(); - setClients(response); - }; - loadClients(); + (async () => { + const response = await axios.get("/api/client") + setClients(response.data) + })() }, []); const getCurrentClient = () => { @@ -60,15 +54,13 @@ export default function EditorPage() { const handlePrev = () => { if (clients.length > 0) { - setCurrentTestIndex( - (prevIndex) => (prevIndex - 1 + clients.length) % clients.length - ); + setCurrentTestIndex(prevIndex => (prevIndex - 1 + clients.length) % clients.length) } }; const handleNext = () => { if (clients.length > 0) { - setCurrentTestIndex((prevIndex) => (prevIndex + 1) % clients.length); + setCurrentTestIndex(prevIndex => (prevIndex + 1) % clients.length); } }; @@ -80,8 +72,8 @@ export default function EditorPage() { try { const success = await deleteClient(clientId); if (success) { - const updatedClients = await fetchClients(); - setClients(updatedClients); + const updatedClients = await axios.get("/api/client"); + setClients(updatedClients.data); setCurrentTestIndex(Math.max(0, currentTestIndex - 1)); } } catch (error) { @@ -89,48 +81,48 @@ export default function EditorPage() { } }; - const handleInputChange = (e) => { + const handleInputChange = e => { setNewTestimonial({ ...newTestimonial, [e.target.name]: e.target.value }); }; - const handleAdd = async (e) => { + const handleAdd = async e => { e.preventDefault(); // Make sure you handle the JWT token (can be stored in cookies or context) const token = localStorage.getItem('authToken'); // Or use context if needed - - if (!token) { - return; - } + if (!token) return try { - // Upload file if there is one - let fileUrl = ''; - if (file) { - fileUrl = await uploadFile(file); - } - - const newClient = { - name: newTestimonial.name, - quote: newTestimonial.quote, - title: newTestimonial.title, - image: fileUrl, - }; - const addedClient = await addClient(newClient, token); - if (addedClient) { - setClients((prevClients) => { - const updatedClients = [...prevClients, newClient]; - setCurrentTestIndex(updatedClients.length - 1); - return updatedClients; - }); - } - - console.log('Added client:', addedClient); - // Handle success (e.g., clear form, show success message) + // Upload file if there is one + let fileUrl = ''; + if (file) fileUrl = await uploadFile(file) + + const newClient = { + name: newTestimonial.name, + quote: newTestimonial.quote, + title: newTestimonial.title, + image: fileUrl, + }; + const addedClient = await addClient(newClient, token) + if (addedClient) { + const updatedClients = await axios.get("/api/client") + setClients(updatedClients.data) + setCurrentTestIndex(updatedClients.data.length - 1) + + setNewTestimonial({ + image: "", + quote: "", + name: "", + title: "" + }) + + setFile(null); + if (fileInputRef.current) fileInputRef.current.value = "" + } } catch (error) { - console.error('Error adding client:', error); + console.error('Error adding client:', error); } -}; + }; return ( @@ -162,7 +154,7 @@ export default function EditorPage() { setFile(file)} + onFileSelect={file => setFile(file)} />