Spaces:
Running
Running
| // API simulation layer for CommunityConnect Hub | |
| class CommunityAPI { | |
| constructor() { | |
| this.baseURL = 'https://api.communityconnect.org'; | |
| } | |
| // Simulate API delay | |
| delay(ms = 500) { | |
| return new Promise(resolve => setTimeout(resolve, ms)); | |
| } | |
| // Events API | |
| async getUpcomingEvents(limit = 20) { | |
| await this.delay(); | |
| return [ | |
| { | |
| id: 1, | |
| title: "Community Health Fair", | |
| date: "2024-01-15", | |
| time: "10:00 AM - 4:00 PM", | |
| location: "Community Center", | |
| description: "Free health screenings, wellness workshops, and nutrition advice for all ages.", | |
| category: "social", | |
| attendees: "Open to all" | |
| }, | |
| { | |
| id: 2, | |
| title: "Youth Mentorship Program Kickoff", | |
| date: "2024-01-20", | |
| time: "6:00 PM - 8:00 PM", | |
| location: "Main Hall", | |
| description: "Join us for the launch of our new youth mentorship initiative.", | |
| category: "volunteer", | |
| attendees: "Registration required" | |
| }, | |
| { | |
| id: 3, | |
| title: "Career Development Workshop", | |
| date: "2024-01-25", | |
| time: "9:00 AM - 12:00 PM", | |
| location: "Conference Room A", | |
| description: "Learn resume writing, interview skills, and job search strategies.", | |
| category: "workshop", | |
| attendees: "Limited seats" | |
| }, | |
| { | |
| id: 4, | |
| title: "Annual Fundraising Gala", | |
| date: "2024-02-10", | |
| time: "7:00 PM - 11:00 PM", | |
| location: "Grand Ballroom", | |
| description: "An evening of celebration and fundraising for our community programs.", | |
| category: "fundraiser", | |
| attendees: "Ticketed event" | |
| } | |
| ].slice(0, limit); | |
| } | |
| // Member spotlights API | |
| async getMemberSpotlights(limit = 12) { | |
| await this.delay(); | |
| const members = [ | |
| { | |
| id: 1, | |
| name: "Sarah Johnson", | |
| role: "Community Leader", | |
| avatar: "https://static.photos/people/200x200/1", | |
| testimonial: "Being part of this community has transformed my life. The support and opportunities here are incredible.", | |
| category: "leader", | |
| rating: 5, | |
| socialLinks: [ | |
| { icon: "linkedin", url: "#" }, | |
| { icon: "twitter", url: "#" } | |
| ] | |
| }, | |
| { | |
| id: 2, | |
| name: "Michael Chen", | |
| role: "Volunteer Coordinator", | |
| avatar: "https://static.photos/people/200x200/2", | |
| testimonial: "I've found my purpose here helping others. Every day brings new opportunities to make a difference.", | |
| category: "volunteer", | |
| rating: 5, | |
| socialLinks: [ | |
| { icon: "facebook", url: "#" }, | |
| { icon: "instagram", url: "#" } | |
| ] | |
| }, | |
| { | |
| id: 3, | |
| name: "Emily Rodriguez", | |
| role: "Program Director", | |
| avatar: "https://static.photos/people/200x200/3", | |
| testimonial: "Our programs are changing lives daily. I'm proud to be part of such an impactful organization.", | |
| category: "staff", | |
| rating: 5, | |
| socialLinks: [ | |
| { icon: "linkedin", url: "#" }, | |
| { icon: "mail", url: "#" } | |
| ] | |
| }, | |
| { | |
| id: 4, | |
| name: "David Kim", | |
| role: "Youth Mentor", | |
| avatar: "https://static.photos/people/200x200/4", | |
| testimonial: "Mentoring young people is the most rewarding work I've ever done. Seeing them succeed is priceless.", | |
| category: "volunteer", | |
| rating: 5 | |
| }, | |
| { | |
| id: 5, | |
| name: "Lisa Thompson", | |
| role: "Board Member", | |
| avatar: "https://static.photos/people/200x200/5", | |
| testimonial: "This organization represents the best of our community - collaboration, compassion, and commitment.", | |
| category: "leader", | |
| rating: 5 | |
| }, | |
| { | |
| id: 6, | |
| name: "James Wilson", | |
| role: "Operations Manager", | |
| avatar: "https://static.photos/people/200x200/6", | |
| testimonial: "Keeping our programs running smoothly is my passion. Behind the scenes work that makes magic happen!", | |
| category: "staff", | |
| rating: 4 | |
| } | |
| ]; | |
| return members.slice(0, limit); | |
| } | |
| // Programs API | |
| async getPrograms() { | |
| await this.delay(); | |
| return [ | |
| { | |
| id: 1, | |
| title: "Youth Mentorship", | |
| description: "Pair young community members with experienced mentors for guidance and support.", | |
| icon: "users", | |
| color: "primary", | |
| features: [ | |
| "One-on-one mentoring", | |
| "Academic support", | |
| "Career guidance", | |
| "Personal development workshops" | |
| ] | |
| }, | |
| { | |
| id: 2, | |
| title: "Career Development", | |
| description: "Comprehensive job training and career advancement resources.", | |
| icon: "briefcase", | |
| color: "secondary", | |
| features: [ | |
| "Resume workshops", | |
| "Interview preparation", | |
| "Job placement assistance", | |
| "Skills training programs" | |
| ] | |
| }, | |
| { | |
| id: 3, | |
| title: "Health & Wellness", | |
| description: "Programs promoting physical and mental well-being for all ages.", | |
| icon: "heart", | |
| color: "primary", | |
| features: [ | |
| "Health screenings", | |
| "Fitness classes", | |
| "Mental health support", | |
| "Nutrition workshops" | |
| ] | |
| }, | |
| { | |
| id: 4, | |
| title: "Senior Services", | |
| description: "Support and activities tailored for our senior community members.", | |
| icon: "home", | |
| color: "secondary", | |
| features: [ | |
| "Social gatherings", | |
| "Transportation assistance", | |
| "Health monitoring", | |
| "Educational programs" | |
| ] | |
| }, | |
| { | |
| id: 5, | |
| title: "Education & Tutoring", | |
| description: "Academic support and educational enrichment programs.", | |
| icon: "book-open", | |
| color: "primary", | |
| features: [ | |
| "After-school tutoring", | |
| "Adult education classes", | |
| "STEM workshops", | |
| "Literacy programs" | |
| ] | |
| }, | |
| { | |
| id: 6, | |
| title: "Community Events", | |
| description: "Regular events fostering community connection and engagement.", | |
| icon: "calendar", | |
| color: "secondary", | |
| features: [ | |
| "Seasonal festivals", | |
| "Cultural celebrations", | |
| "Community clean-ups", | |
| "Sports tournaments" | |
| ] | |
| } | |
| ]; | |
| } | |
| // Services API | |
| async getServices() { | |
| await this.delay(); | |
| return [ | |
| { | |
| id: 1, | |
| title: "Legal Aid Clinic", | |
| description: "Free legal consultation services for community members in need.", | |
| icon: "gavel", | |
| tags: ["Legal", "Free", "Appointment Required"] | |
| }, | |
| { | |
| id: 2, | |
| title: "Food Bank", | |
| description: "Emergency food assistance for families and individuals.", | |
| icon: "shopping-cart", | |
| tags: ["Food Security", "Emergency", "Weekly Distribution"] | |
| }, | |
| { | |
| id: 3, | |
| title: "Childcare Services", | |
| description: "Affordable childcare for working parents and guardians.", | |
| icon: "baby", | |
| tags: ["Childcare", "Affordable", "Licensed"] | |
| }, | |
| { | |
| id: 4, | |
| title: "Transportation Services", | |
| description: "Transportation assistance for medical appointments and community events.", | |
| icon: "truck", | |
| tags: ["Transport", "Medical", "Senior Focus"] | |
| } | |
| ]; | |
| } | |
| // Resources API | |
| async getResources() { | |
| await this.delay(); | |
| return [ | |
| { | |
| id: 1, | |
| title: "Community Resource Guide", | |
| description: "Comprehensive guide to all local services and support systems.", | |
| type: "guides", | |
| featured: true, | |
| tags: ["Guide", "Resource", "Local"], | |
| downloads: 1240, | |
| date: "2024-01-10" | |
| }, | |
| { | |
| id: 2, | |
| title: "Resume Template Pack", | |
| description: "Professional resume templates for various industries and experience levels.", | |
| type: "templates", | |
| featured: true, | |
| tags: ["Resume", "Job Search", "Career"], | |
| downloads: 890, | |
| date: "2024-01-08" | |
| }, | |
| { | |
| id: 3, | |
| title: "Budget Planning Worksheet", | |
| description: "Interactive worksheet for personal and family budget planning.", | |
| type: "templates", | |
| tags: ["Finance", "Planning", "Budget"], | |
| downloads: 567, | |
| date: "2024-01-05" | |
| }, | |
| { | |
| id: 4, | |
| title: "Volunteer Training Videos", | |
| description: "Video series on effective volunteering and community engagement.", | |
| type: "videos", | |
| featured: true, | |
| tags: ["Training", "Volunteer", "Video"], | |
| downloads: 432, | |
| date: "2024-01-03" | |
| }, | |
| { | |
| id: 5, | |
| title: "Health Information Packet", | |
| description: "Important health resources and wellness information.", | |
| type: "documents", | |
| tags: ["Health", "Wellness", "Information"], | |
| downloads: 780, | |
| date: "2024-01-02" | |
| }, | |
| { | |
| id: 6, | |
| title: "Youth Activity Guide", | |
| description: "Fun and educational activities for children and teens.", | |
| type: "guides", | |
| tags: ["Youth", "Activities", "Education"], | |
| downloads: 654, | |
| date: "2023-12-28" | |
| } | |
| ]; | |
| } | |
| // Success Stories API | |
| async getSuccessStories() { | |
| await this.delay(); | |
| return [ | |
| { | |
| id: 1, | |
| name: "Maria Garcia", | |
| role: "Program Graduate", | |
| avatar: "https://static.photos/people/200x200/7", | |
| story: "The career development program helped me land my dream job. I'm now financially independent and giving back to the community.", | |
| achievement: "Secured Management Position" | |
| }, | |
| { | |
| id: 2, | |
| name: "Robert Taylor", | |
| role: "Youth Program Participant", | |
| avatar: "https://static.photos/people/200x200/8", | |
| story: "The mentorship program changed my life. My mentor guided me through college applications and scholarship opportunities.", | |
| achievement: "Full Scholarship Winner" | |
| }, | |
| { | |
| id: 3, | |
| name: "Amanda Lee", | |
| role: "Volunteer of the Year", | |
| avatar: "https://static.photos/people/200x200/9", | |
| story: "Volunteering here gave me purpose. I've helped organize over 20 events and mentored 15 young people this year alone.", | |
| achievement: "500+ Volunteer Hours" | |
| } | |
| ]; | |
| } | |
| // Form submission APIs | |
| async processDonation(donationData) { | |
| await this.delay(); | |
| console.log('Processing donation:', donationData); | |
| // In a real implementation, this would send data to a backend server | |
| return { success: true, message: 'Donation processed successfully' }; | |
| } | |
| async submitGetInvolvedForm(formData) { | |
| await this.delay(); | |
| console.log('Submitting involvement form:', formData); | |
| // In a real implementation, this would save to a database and trigger notifications | |
| return { success: true, message: 'Form submitted successfully' }; | |
| } | |
| } | |
| // Initialize API | |
| const api = new CommunityAPI(); |