From bcffa1147f9532b7d7048555de90532e804c0b6a Mon Sep 17 00:00:00 2001 From: despiegk Date: Sun, 3 Aug 2025 09:58:01 +0200 Subject: [PATCH] ... --- src/App.jsx | 1 + src/content/freezone/dispute-resolution.md | 2 +- src/content/freezone/keep-your-assets-safe.md | 2 +- .../ultimate-convenience-and-features.md | 2 +- src/pages/Freezone.jsx | 69 ++++--------------- 5 files changed, 16 insertions(+), 60 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index 20dc15b..8757aa9 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -22,6 +22,7 @@ function App() { } /> } /> } /> + } /> } /> } /> } /> diff --git a/src/content/freezone/dispute-resolution.md b/src/content/freezone/dispute-resolution.md index 4056a51..be4473e 100644 --- a/src/content/freezone/dispute-resolution.md +++ b/src/content/freezone/dispute-resolution.md @@ -1,6 +1,6 @@ --- title: Dispute Resolution (AI & People) -slug: dispute-resolution-ai-and-people +slug: dispute-resolution description: Explore the innovative dispute resolution mechanisms available within a digital freezone, combining AI efficiency with human oversight. image: disputeresolution.jpg --- diff --git a/src/content/freezone/keep-your-assets-safe.md b/src/content/freezone/keep-your-assets-safe.md index 9be53b0..a87d67e 100644 --- a/src/content/freezone/keep-your-assets-safe.md +++ b/src/content/freezone/keep-your-assets-safe.md @@ -1,6 +1,6 @@ --- title: Keep Your Assets Safe Now and in Future -slug: keep-your-assets-safe-now-and-in-future +slug: keep-your-assets-safe description: Discover how a digital freezone provides robust protection for your assets against current and future threats. image: world.jpg --- diff --git a/src/content/freezone/ultimate-convenience-and-features.md b/src/content/freezone/ultimate-convenience-and-features.md index 59c67d1..ab5d799 100644 --- a/src/content/freezone/ultimate-convenience-and-features.md +++ b/src/content/freezone/ultimate-convenience-and-features.md @@ -1,6 +1,6 @@ --- title: Ultimate in Convenience and Features -slug: ultimate-in-convenience-and-features +slug: ultimate-convenience-and-features description: Experience unparalleled convenience and a rich suite of features designed to make your business life fun again within a digital freezone. image: stresssfree.jpg --- diff --git a/src/pages/Freezone.jsx b/src/pages/Freezone.jsx index 4adcec6..9127f9e 100644 --- a/src/pages/Freezone.jsx +++ b/src/pages/Freezone.jsx @@ -1,7 +1,7 @@ import React, { useEffect, useState } from 'react'; import { motion } from 'framer-motion'; import { Link } from 'react-router-dom'; -import { Gavel, Wallet, ShieldCheck, Smile } from 'lucide-react'; // Appropriate icons for Freezone +import { Gavel, Wallet, ShieldCheck, Smile, BookOpen, Landmark, Scale } from 'lucide-react'; // Appropriate icons for Freezone import HeroSection from '../components/HeroSection'; import Section from '../components/Section'; import FeatureCard from '../components/FeatureCard'; @@ -9,13 +9,11 @@ import matter from 'gray-matter'; // Import images const freezoneBackground = new URL('../assets/inthezone.png', import.meta.url).href; -const freezoneImage = new URL('../assets/freezone.jpg', import.meta.url).href; -const theworldImage = new URL('../assets/world.jpg', import.meta.url).href; -const disputeresolutionImage = new URL('../assets/disputeresolution.jpg', import.meta.url).href; -const stresssfreeImage = new URL('../assets/stresssfree.jpg', import.meta.url).href; -// Use Vite's import.meta.glob to import all freezone markdown files -const freezoneModules = import.meta.glob('../content/freezone/*.md', { query: '?raw', import: 'default', eager: true }); +// Use Vite's import.meta.glob to import all freezone markdown files and images +const freezoneModules = import.meta.glob('../content/freezone/*.md', { as: 'raw', eager: true }); +const imageModules = import.meta.glob('../assets/*.jpg', { eager: true, import: 'default' }); +const iconComponents = { Gavel, Wallet, ShieldCheck, Smile, BookOpen, Landmark, Scale }; const Freezone = () => { const [articles, setArticles] = useState([]); @@ -30,29 +28,17 @@ const Freezone = () => { const content = freezoneModules[path]; const { data: frontmatter } = matter(content); - // Map icon strings to actual components - const iconMap = { - 'Gavel': , - 'Wallet': , - 'ShieldCheck': , - 'Smile': - }; - - // Map image paths to actual imports - const imageMap = { - '/src/assets/freezone.jpg': freezoneImage, - '/src/assets/theworld.jpg': theworldImage, - '/src/assets/disputeresolution.jpg': disputeresolutionImage, - '/src/assets/stresssfree.jpg': stresssfreeImage - }; + const IconComponent = iconComponents[frontmatter.iconname]; + const imagePath = `../assets/${frontmatter.image}`; // Construct full path + const importedImage = imageModules[imagePath]; loadedArticles.push({ - icon: iconMap[frontmatter.icon] || , // Default icon + icon: IconComponent ? : , // Default icon title: frontmatter.title, description: frontmatter.description, - image: imageMap[frontmatter.image] || freezoneImage, // Default image + image: importedImage, order: frontmatter.order || 999, - slug: frontmatter.slug || frontmatter.title.toLowerCase().replace(/\s+/g, '-') + slug: frontmatter.slug || frontmatter.title.toLowerCase().replace(/&/g, 'and').replace(/[^a-z0-9\s-]/g, '').replace(/\s+/g, '-').replace(/^-+|-+$/g, '') }); } @@ -61,37 +47,6 @@ const Freezone = () => { setArticles(loadedArticles); } catch (error) { console.error('Error loading freezone articles:', error); - // Fallback to static data if loading fails (optional, but good for robustness) - setArticles([ - { - icon: , - title: "Legal and Financial Sovereignty", - description: "Understand how a digital freezone provides unparalleled legal and financial sovereignty for your operations.", - image: freezoneImage, - slug: "legal-and-financial-sovereignty" - }, - { - icon: , - title: "Keep Your Assets Safe Now and in Future", - description: "Discover how a digital freezone provides robust protection for your assets against current and future threats.", - image: theworldImage, - slug: "keep-your-assets-safe-now-and-in-future" - }, - { - icon: , - title: "Dispute Resolution (AI & People)", - description: "Explore the innovative dispute resolution mechanisms available within a digital freezone, combining AI efficiency with human oversight.", - image: disputeresolutionImage, - slug: "dispute-resolution" - }, - { - icon: , - title: "Ultimate in Convenience and Features", - description: "Experience unparalleled convenience and a rich suite of features designed to make your business life fun again within a digital freezone.", - image: stresssfreeImage, - slug: "ultimate-convenience-and-features" - } - ]); } finally { setLoading(false); } @@ -155,7 +110,7 @@ const Freezone = () => { )) ) : ( articles.map((article, index) => ( - +