{blog.title}
- {blog.excerpt} + {createExcerpt(blog.content)}
Loading blog posts...
+Failed to load blog posts
++ {error instanceof Error ? error.message : 'An unexpected error occurred'} +
+No blog posts found
+Every day at Mountain Children Home begins at 6:00 AM with the gentle sound of morning prayers. The children wake up naturally to this peaceful routine that has become second nature to them over the years.
- -Morning Routine (6:00 AM - 8:00 AM)
-After prayers, the children help each other get ready for the day. Personal hygiene is emphasized, and older children often help the younger ones brush their teeth and get dressed. Breakfast is served at 7:00 AM, featuring nutritious local foods prepared with love by our kitchen staff.
- -School Time (8:00 AM - 3:00 PM)
-Education is at the heart of everything we do. Our children attend both our on-site learning center and local schools in the community. We ensure each child receives quality education appropriate to their age and learning needs. Homework support is provided by our dedicated teaching staff.
- -Afternoon Activities (3:00 PM - 6:00 PM)
-After school, children engage in various activities including sports, arts and crafts, music lessons, and free play time. These activities help develop their creativity, physical fitness, and social skills.
- -Evening Wind Down (6:00 PM - 9:00 PM)
-Dinner is served at 6:00 PM, followed by family time where children share their daily experiences. Study time begins at 7:30 PM, and younger children have bedtime stories before lights out at 9:00 PM.
- -This structured yet loving environment helps our children feel secure and supported as they grow and learn. Every day is filled with opportunities for growth, learning, and joy.
- `, - date: 'March 15, 2024', - author: 'Sarah Johnson', - category: 'Daily Life', - image: 'https://images.unsplash.com/photo-1581091226825-a6a2a5aee158?ixlib=rb-4.0.3&auto=format&fit=crop&w=800&q=80', - readTime: '5 min read', - }, - { - id: 2, - title: "Success Story: Maria's Journey to University", - content: ` -Maria arrived at Mountain Children Home when she was just 8 years old, having lost both parents in a tragic accident. Scared and alone, she barely spoke for the first few months of her stay with us.
- -Finding Her Voice
-With patience, love, and dedicated support from our care team, Maria slowly began to open up. She showed a natural aptitude for mathematics and science, subjects that became her refuge and passion.
- -Academic Excellence
-Throughout her years at Mountain Children Home, Maria consistently excelled in her studies. She received tutoring support from volunteers and participated in academic competitions, often placing in the top positions.
- -Dreams Take Flight
-When it came time for university applications, Maria set her sights high. With support from our education fund and her own determination, she was accepted into the prestigious State University's Engineering program.
- -Giving Back
-Now in her second year of studies, Maria regularly visits Mountain Children Home to tutor younger children in mathematics. She says our home gave her not just shelter and education, but hope and purpose.
- -"Mountain Children Home didn't just save my life," Maria says, "they gave me the tools to build the life I dreamed of. Now I want to help other children discover their own potential."
- -Maria's story is one of many that inspire us every day. It reminds us why we do this work and the incredible potential that lies within every child who walks through our doors.
- `, - date: 'March 10, 2024', - author: 'Michael Chen', - category: 'Success Stories', - image: 'https://images.unsplash.com/photo-1649972904349-6e44c42644a7?ixlib=rb-4.0.3&auto=format&fit=crop&w=800&q=80', - readTime: '7 min read', - }, - { - id: 3, - title: 'Building Our New Learning Center', - content: ` -Construction on our new learning center is progressing wonderfully, and we're excited to share this milestone with our supporters who have made this dream possible.
- -Why We Need More Space
-Our current facility has served us well for 15 years, but as our family has grown, so has our need for dedicated learning spaces. The new center will provide modern classrooms, a computer lab, library, and multipurpose rooms for arts and crafts.
- -Construction Progress
-Ground was broken in January 2024, and we're pleased to report that construction is on schedule. The foundation has been completed, and walls are now rising. Local contractors have generously donated their services, and community volunteers help with various tasks.
- -Features of the New Center
--
-
- Six modern classrooms with improved lighting and ventilation -
- Computer lab with 20 workstations -
- Library with space for 2,000 books -
- Science laboratory for hands-on learning -
- Multipurpose hall for events and gatherings -
Expected Completion
-We anticipate the learning center will be ready for use by the start of the new school year in September 2024. This will allow us to serve up to 50 more children and provide enhanced educational opportunities for all.
- -Thank you to everyone who has supported this project. Your contributions are literally building the foundation for countless children's futures.
- `, - date: 'March 5, 2024', - author: 'Sarah Johnson', - category: 'Updates', - image: 'https://images.unsplash.com/photo-1518770660439-4636190af475?ixlib=rb-4.0.3&auto=format&fit=crop&w=800&q=80', - readTime: '4 min read', - }, - ]; - - const blog = blogs.find((b) => b.id === Number(id)); - const relatedBlogs = blogs.filter((b) => b.id !== Number(id)).slice(0, 3); + // Fetch all blog posts for related articles + const { + data: blogResponse, + isLoading: isLoadingBlogs, + isError: isBlogsError, + error: blogsError, + } = useQuery({ + queryKey: ['blogs'], + queryFn: blogService.getPosts, + }); + + // Fetch specific blog post by id + const { + data: blog, + isLoading: isLoadingBlog, + isError: isBlogError, + error: blogError, + } = useQuery({ + queryKey: ['blog', id], + queryFn: () => blogService.getPostById(id || ''), + }); + + // Format date helper + const formatDate = (dateString: string) => new Date(dateString).toLocaleDateString('en-US', { + year: 'numeric', + month: 'long', + day: 'numeric', + }); + + // Loading state + if (isLoadingBlog || isLoadingBlogs) { + return ( +Loading blog post...
++ {blogError?.message || blogsError?.message || 'Something went wrong'} +
+ + ← Back to Blog + +Blog post not found
- - ← Back to Blog - -Blog post not found
+ + ← Back to Blog + +
@@ -150,13 +188,14 @@ function BlogDetail() {
By
- {blog.author}
+ {' '}
+ {blog.author_name}
Tags
+Share this story
Related Stories
-Related Stories
++ {relatedBlog.title} +
++ {relatedBlog.content.replace(/<[^>]*>/g, '').substring(0, 100)} + ... +
- {relatedBlog.title} -
-- {relatedBlog.content.replace(/<[^>]*>/g, '').substring(0, 100)} - ... -
-Contact Information
Address
@@ -163,14 +163,14 @@ function ContactSection(props:ContactSectionProps) {
Phone
(555) 123-4567
info@mountainchildrenhome.org
diff --git a/src/pages/Gallery/GallerySection.tsx b/src/pages/Gallery/GallerySection.tsx index bc2bcc7..7dac965 100644 --- a/src/pages/Gallery/GallerySection.tsx +++ b/src/pages/Gallery/GallerySection.tsx @@ -6,25 +6,30 @@ import { X } from 'lucide-react'; import MaxWidthWrapper from '@/components/MaxWidthWrapper'; -// Define interfaces - make sure these match the parent component -interface Image { - src: string; - alt: string; -} +export interface Photo { + id: number; + image: string; + caption: string; + created_at: string; + album: number; + } -interface Album { - id: string; // Changed from string | number to just string to match parent - cover: string; - name: string; - images: Image[]; -} +export interface Album { + id: number; + title: string; + slug: string; + description: string; + cover_image: string; + created_at: string; + photos: Photo[]; + } interface GalleryProps { - selectedAlbum: string | null; // Changed from string | number | null to string | null - setSelectedAlbum: (id: string | null) => void; // Changed from string | number | null + selectedAlbum: string | null; + setSelectedAlbum: (id: string | null) => void; albums: Album[]; currentAlbum: Album | undefined; - currentImages: Image[]; + currentImages: Photo[]; selectedImage: number | null; openImage: (index: number) => void; closeImage: () => void; @@ -67,18 +72,18 @@ function GallerySection(props: GalleryProps) {{album.name}
+{album.title}
- {album.images.length} + {album.photos.length} {' '} photos
@@ -100,21 +105,21 @@ function GallerySection(props: GalleryProps) { > ← Back to Albums -{currentAlbum?.name}
+{currentAlbum?.title}
Loading gallery...
+Failed to load gallery
++ {error instanceof Error ? error.message : 'An unexpected error occurred'} +
+No albums found
+Our Gallery
++ Take a glimpse into the daily lives of our children and see the joy, + learning, and growth happening at Mountain Children Home. +
+