Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added JSON Server Support in the Dev Products Page | Issue #493 #558

Merged
merged 1 commit into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 39 additions & 1 deletion data.json
Original file line number Diff line number Diff line change
Expand Up @@ -48365,5 +48365,43 @@
{ "title": "Google Cloud NGFW Enterprise CyberRisk Validation Report", "description": "Read SecureIQlab's test results on Google Cloud Next Generation Firewall Enterprise." },
{ "title": "Google is a Leader in The Forrester Wave™: AI Foundation Models for Language, Q2 2024", "description": "Access your complimentary copy of the report to learn why Google was named a Leader." },
{ "title": "Google is a Leader in the 2024 Gartner® Magic Quadrant™ for Cloud AI Developer Services (CAIDS)", "description": "Access your complimentary copy of the report to learn why Google was named a Leader." }
]
],
"devproducts":[
{
"title": "Android",
"description": "Modern tools to help you build experiences that people love across every Android device.",
"image": "/devprod1.jpeg",
"link": "#"
},
{
"title": "Google Cloud",
"description": "New customers get $300 in free credits to deploy dynamic websites and launch VMs.",
"image": "/devprod2.png",
"link": "#"
},
{
"title": "Google AI Studio",
"description": "Build generative AI applications quickly with Gemini in Google AI Studio.",
"image": "/devprod3.jpeg",
"link": "#"
},
{
"title": "ChromeOS",
"description": "Modern tools and features to help you build high-quality web experiences.",
"image": "/devprod4.png",
"link": "#"
},
{
"title": "Android Studio",
"description": "An integrated development environment (IDE) optimized for Android apps.",
"image": "/devprod5.jpeg",
"link": "#"
},
{
"title": "Firebase Cloud Messaging",
"description": "A cross-platform messaging solution to reliably send messages at no cost.",
"image": "/devprod6.jpeg",
"link": "#"
}
]
}
60 changes: 21 additions & 39 deletions src/app/(pages)/devprod/page.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"use client";
import React, { useState } from 'react';
import React, { useState, useEffect } from 'react';
import { Search } from 'lucide-react';
import ProductNavbar from '../../../components/Global/ProductsNavbar';

Expand Down Expand Up @@ -112,44 +112,26 @@ const DeveloperProductsPage = () => {
const [selectedCategory, setSelectedCategory] = useState(null);
const [selectedFocus, setSelectedFocus] = useState(null);
const [selectedTab, setSelectedTab] = useState("All Products");
const products = [
{
title: "Android",
description: "Modern tools to help you build experiences that people love across every Android device.",
image: "/devprod1.jpeg",
link: "#",
},
{
title: "Google Cloud",
description: "New customers get $300 in free credits to deploy dynamic websites and launch VMs.",
image: "/devprod2.png",
link: "#",
},
{
title: "Google AI Studio",
description: "Build generative AI applications quickly with Gemini in Google AI Studio.",
image: "/devprod3.jpeg",
link: "#",
},
{
title: "ChromeOS",
description: "Modern tools and features to help you build high-quality web experiences.",
image: "/devprod4.png",
link: "#",
},
{
title: "Android Studio",
description: "An integrated development environment (IDE) optimized for Android apps.",
image: "/devprod5.jpeg",
link: "#",
},
{
title: "Firebase Cloud Messaging",
description: "A cross-platform messaging solution to reliably send messages at no cost.",
image: "/devprod6.jpeg",
link: "#",
},
];
const [products, setProducts] = useState([]);

// Fetch products data from JSON server
useEffect(() => {
const fetchProducts = async () => {
try {
const response = await fetch('http://localhost:5000/devproducts');
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
setProducts(data || []);
} catch (error) {
console.error('Error fetching products:', error);
setProducts([]); // Optional: Set an empty array if fetching fails
}
};

fetchProducts();
}, []);

return (
<div>
Expand Down
Loading