An interactive political quiz application designed to help first-time and undecided voters make informed decisions in New Zealand elections by matching their values with political party policies.
- Features
- Demo
- Tech Stack
- Project Structure
- Data Models
- Getting Started
- How It Works
- Development Team
- Deployment
- License
- Interactive Political Quiz: 20 carefully crafted questions covering key political issues
- Bilingual Support: Full English and Te Reo MΔori language options
- Smart Scoring Algorithm: Real-time calculation of party alignment based on user responses
- Importance Weighting: Users can indicate how important each issue is to them
- Comprehensive Party Coverage: Includes Green, National, Labour, TPM, ACT, and TEST parties
- Responsive Design: Optimized for all devices from mobile to desktop
- Type-Safe Development: Full TypeScript implementation for robust code quality
- Modern State Management: Zustand with Immer for efficient state updates
- Accessible UI: Built with accessibility best practices in mind
We have a deployed WIP and technical evaluation deployed with Vercel. Visit the live application where you'll soon be able to take the quiz and discover which New Zealand political party aligns with your values.
This application is built with modern web technologies:
- Next.js 13: React framework with App Router for improved performance and SEO
- React 18: Latest React with concurrent features and improved performance
- TypeScript 5.1: Type safety and enhanced developer experience
- Tailwind CSS 3.3: Utility-first CSS framework for rapid UI development
- Zustand 4.3: Lightweight state management with Immer integration
- Immer: Immutable state updates for predictable data flow
swing/
βββ app/ # Next.js 13 App Router
β βββ components/ # Reusable UI components
β β βββ QuestionCard.tsx # Individual question display
β β βββ Results.tsx # Results visualization
β β βββ ResultsStats.tsx # Party score statistics
β β βββ ... # Other UI components
β βββ question/[slug]/ # Dynamic question pages
β βββ results/ # Results page and components
β βββ info/ # Information and about page
β βββ globals.css # Global styles and Tailwind config
βββ lib/ # Core business logic
β βββ dataStore.ts # Zustand store with state management
β βββ questions.ts # Quiz questions and options data
β βββ partyStances.ts # Political party positions on issues
β βββ partyScoresCalculator.ts # Scoring algorithm implementation
βββ models/ # TypeScript type definitions
β βββ Question.ts # Question structure interface
β βββ Answer.ts # User answer with importance weighting
β βββ PartyScore.ts # Party scoring model
β βββ DataState.ts # Global application state
β βββ Options.ts # Answer options interface
βββ public/ # Static assets and SVG icons
The application uses a well-structured TypeScript architecture:
Question: Bilingual question structure
interface Question {
id: number
englishQuestion: string
englishOptions: Options
teReoQuestion: string
teReoOptions: Options
}Answer: User response with importance weighting
interface Answer {
answer: number | null // User's selected option (1-5 scale)
importance?: number | null // How important this issue is (1-100)
}PartyScore: Real-time calculated party alignment
interface PartyScore {
partyName: string // Political party name
score: number // Calculated alignment score
}DataState: Global application state
interface DataState {
answers: Answer[] // Array of 20 user answers
partyScores: PartyScore[] // Scores for 6 political parties
}Clone the repository and install dependencies:
# Clone the repository
git clone https://github.com/doilyuser/swing.git
cd swing
# Install dependencies
npm installStart the development server:
npm run devVisit http://localhost:3000 to see the application.
Other available commands:
npm run build # Build for production
npm run start # Start production server
npm run lint # Run ESLint- Question Flow: Users progress through 20 political questions covering key issues
- Answer Collection: Each response is stored with optional importance weighting
- Real-time Scoring: The scoring algorithm calculates party alignment using:
- User's answer position on a 1-5 scale
- Party's known stance on each issue
- Importance weighting applied by the user
- Mathematical difference calculation for alignment scoring
- Results Display: Visual representation of party alignment percentages
- Bilingual Support: All content available in English and Te Reo MΔori
The scoring algorithm considers the mathematical difference between user positions and party stances, weighted by issue importance, providing nuanced and personalized results.
Product Owner: Louis Dyer
Back-End Lead: Dylan Guthrie
Front-End Lead: Humaidi 'Ado' Ridwan
Political Advisor: Allanah Lovelady
This application is deployed on Vercel with automatic deployments from the main branch.
Live Application: swing-zeta.vercel.app
The application is optimized for Vercel's platform with:
- Automatic builds on push
- Edge function optimization
- Global CDN distribution
- Performance monitoring
This project is open source and available under the MIT License.
