Skip to content

python-fuse/hng-stage2-vue

Repository files navigation

Ticketly - Vue 3 Ticket Management System

A modern, responsive ticket management application built with Vue 3, TypeScript, and Tailwind CSS. This is a carbon copy migration from the original React implementation, maintaining exact feature parity and user experience.

๐Ÿš€ Features

  • Landing Page with wavy SVG background and decorative elements
  • Authentication System with login/signup and session management
  • Dashboard with ticket statistics and quick navigation
  • Complete CRUD Operations for ticket management
  • Responsive Design optimized for mobile, tablet, and desktop
  • Responsive Sidebar with mobile hamburger menu
  • Form Validation with real-time error handling
  • Toast Notifications for user feedback
  • Protected Routes with session-based authentication

๐Ÿ“‹ Requirements Met

  • โœ… Max-width 1440px centered layout
  • โœ… Wavy background hero section
  • โœ… Decorative circle elements
  • โœ… Card-style boxes with shadows and rounded corners
  • โœ… Responsive mobile/tablet/desktop layouts
  • โœ… Complete authentication with localStorage session management
  • โœ… Full ticket CRUD with validation
  • โœ… Status-based color coding (green/amber/gray)
  • โœ… Accessibility compliance with semantic HTML
  • โœ… Error handling for all scenarios

๏ฟฝ Tech Stack

  • Vue 3.5.22 - Progressive JavaScript framework with Composition API
  • TypeScript 5.9.3 - Type-safe development
  • Pinia 3.0.3 - Official Vue state management library
  • Vue Router 4.6.3 - Client-side routing with navigation guards
  • shadcn-vue - High-quality, accessible UI components
  • Tailwind CSS 4.1.16 - Utility-first CSS framework
  • vue-sonner 2.x - Beautiful toast notifications
  • Vite 7.1.12 - Next-generation frontend tooling

๐Ÿš€ Setup Instructions

Prerequisites

  • Node.js (version 16 or higher)
  • pnpm package manager

Installation

  1. Clone or download the project

    cd /path/to/stage2-vue
  2. Install dependencies

    pnpm install
  3. Start the development server

    pnpm dev
  4. Open your browser

    • Navigate to http://localhost:5173
    • The application will automatically reload when you make changes

Build for Production

pnpm build

Preview Production Build

pnpm preview

๐Ÿ“ Project Structure

src/
โ”œโ”€โ”€ components/
โ”‚   โ”œโ”€โ”€ forms/
โ”‚   โ”‚   โ”œโ”€โ”€ CreateTicketForm.vue    # Create ticket modal
โ”‚   โ”‚   โ””โ”€โ”€ EditTicketForm.vue      # Edit ticket modal
โ”‚   โ”œโ”€โ”€ layout/
โ”‚   โ”‚   โ”œโ”€โ”€ AppLayout.vue           # Main app layout wrapper
โ”‚   โ”‚   โ”œโ”€โ”€ Sidebar.vue             # Responsive sidebar (desktop/mobile)
โ”‚   โ”‚   โ””โ”€โ”€ Footer.vue              # Footer component
โ”‚   โ””โ”€โ”€ ui/
โ”‚       โ”œโ”€โ”€ StatusBadge.vue         # Ticket status badge
โ”‚       โ”œโ”€โ”€ WaveBackground.vue      # SVG wave decoration
โ”‚       โ”œโ”€โ”€ DecorativeCircle.vue    # Floating circles
โ”‚       โ””โ”€โ”€ [shadcn components]     # UI primitives
โ”œโ”€โ”€ composables/
โ”‚   โ””โ”€โ”€ useToast.ts                 # Toast notification wrapper
โ”œโ”€โ”€ stores/
โ”‚   โ”œโ”€โ”€ auth.ts                     # Pinia auth store
โ”‚   โ””โ”€โ”€ tickets.ts                  # Pinia tickets store
โ”œโ”€โ”€ router/
โ”‚   โ””โ”€โ”€ index.ts                    # Vue Router configuration
โ”œโ”€โ”€ types/
โ”‚   โ””โ”€โ”€ index.ts                    # TypeScript type definitions
โ”œโ”€โ”€ utils/
โ”‚   โ””โ”€โ”€ statusColors.ts             # Status color mappings
โ”œโ”€โ”€ views/
โ”‚   โ”œโ”€โ”€ LandingPage.vue             # Public landing page
โ”‚   โ”œโ”€โ”€ LoginPage.vue               # Login form
โ”‚   โ”œโ”€โ”€ SignupPage.vue              # Signup form
โ”‚   โ”œโ”€โ”€ Dashboard.vue               # Dashboard with stats
โ”‚   โ””โ”€โ”€ TicketManagement.vue        # Ticket CRUD interface
โ””โ”€โ”€ main.ts                         # Application entry point

๐Ÿ”„ Migration Notes from React

This Vue implementation maintains exact feature parity with the React version:

Key Equivalences:

  • React Context API โ†’ Pinia Stores
  • useState / useEffect โ†’ ref / reactive / onMounted
  • createContext โ†’ defineStore
  • React Router โ†’ Vue Router
  • Props drilling โ†’ Props with TypeScript interfaces
  • className โ†’ class
  • Event handlers: onClick โ†’ @click

Validation Rules (Identical):

  • Title: Required, 3-100 characters
  • Description: Optional, max 500 characters
  • Status: Required, one of: open/in_progress/closed
  • Priority: Optional, one of: low/medium/high
  • Email: Required, valid email format
  • Password: Required, min 6 characters
  • Name: Required, min 2 characters

Toast Messages (Exact Matches):

  • "Account created successfully! Welcome to Ticketly!"
  • "Welcome back to Ticketly!"
  • "Invalid email or password. Please check your credentials and try again."
  • "Email already exists. Please use a different email or login."
  • "Ticket created successfully!"
  • "Ticket updated successfully!"
  • "Ticket deleted successfully!"
  • "Please fix the errors below"

Data Formats (Identical):

User Object:

{
  id: string; // Format: "user_" + timestamp
  name: string;
  email: string;
  password: string;
}

Ticket Object:

{
  id: string                                    // Format: "ticket_" + timestamp + "_" + random
  title: string                                 // 3-100 characters
  description?: string                          // Max 500 characters
  status: 'open' | 'in_progress' | 'closed'
  priority?: 'low' | 'medium' | 'high'
  createdBy: string                             // User ID
  createdAt: string                             // ISO date string
  updatedAt: string                             // ISO date string
}

Session Token:

string; // Format: "token_" + timestamp + "_" + random

๐Ÿ” State Management

Authentication Store (stores/auth.ts)

  • User State: Current logged-in user information
  • Session Management: localStorage-based session tokens
  • Actions: login(), signup(), logout(), initializeAuth()
  • Data: Stored in ticketapp_session, ticketapp_user, ticketapp_users

Ticket Store (stores/tickets.ts)

  • Ticket State: Reactive array of all tickets
  • CRUD Actions: addTicket(), updateTicket(), deleteTicket(), loadTickets()
  • Getters: getTicketStats() for dashboard metrics
  • Data: Persisted in ticketapp_tickets localStorage key

Data Persistence

All data is stored in localStorage with the following keys:

  • ticketapp_session: Current user session token
  • ticketapp_user: Current user information
  • ticketapp_users: Database of all registered users
  • ticketapp_tickets: Array of all tickets

๐ŸŽฏ Authentication System

User Registration

  • Form validation for email, password, and name
  • Duplicate email prevention
  • Automatic login after successful registration

User Login

  • Email and password validation
  • Session token generation and storage
  • Redirect to dashboard on success

Session Management

  • Protected routes check for valid session token
  • Automatic logout and redirect for invalid sessions
  • Session persistence across browser refreshes

Test User Credentials

For testing purposes, you can use these credentials or create new accounts:

Pre-seeded Test User:

  • Email: admin@ticketly.com
  • Password: password123
  • Name: Admin User

Or create a new account:

  • Use any valid email format
  • Password must be at least 6 characters
  • Full name is required

๐Ÿ“ฑ Responsive Design

Mobile (< 768px)

  • Stacked layout with hamburger menu
  • Full-width cards and forms
  • Touch-friendly button sizes
  • Collapsible sidebar with slide-out sheet

Tablet (768px - 1024px)

  • Two-column grid layouts
  • Optimized spacing and typography
  • Responsive sidebar behavior

Desktop (> 1024px)

  • Three-column layouts where appropriate
  • Fixed sidebar navigation
  • Max-width 1440px container
  • Hover states and interactions

โ™ฟ Accessibility Features

Semantic HTML

  • Proper heading hierarchy (h1, h2, h3)
  • Semantic elements (<main>, <section>, <nav>)
  • Form labels and associations

Keyboard Navigation

  • Tab order and focus management
  • Visible focus indicators
  • Skip links where appropriate

Color & Contrast

  • WCAG-compliant color contrast ratios
  • Status colors with sufficient contrast:
    • Open tickets: Green (#16a34a)
    • In Progress: Amber (#d97706)
    • Closed: Gray (#6b7280)

Screen Reader Support

  • ARIA labels and descriptions
  • Alternative text for decorative elements
  • Meaningful link text

๐Ÿงช Data Validation

Ticket Validation Rules

  • Title: Required, 1-100 characters
  • Description: Optional, max 500 characters
  • Status: Required, must be one of: open, in_progress, closed
  • Priority: Optional, must be one of: low, medium, high

Authentication Validation

  • Email: Valid email format required
  • Password: Minimum 6 characters
  • Name: Required for registration

Error Handling

  • Real-time validation with inline error messages
  • Toast notifications for system-level errors
  • Graceful fallbacks for failed operations

๏ฟฝ Known Limitations

  • No backend integration (localStorage only)
  • No user avatar/profile images
  • No ticket attachments
  • No real-time collaboration
  • No email notifications
  • No password reset functionality
  • No pagination (all tickets loaded at once)

๐Ÿ”ฎ Future Enhancements

  • Backend API integration (REST/GraphQL)
  • User profile management
  • Ticket assignment to users
  • Comments/activity log per ticket
  • File attachments
  • Email notifications
  • Advanced filtering (date ranges, priority)
  • Sorting options
  • Export to CSV/PDF
  • Dark mode toggle
  • Multi-language support

๏ฟฝ Development Commands

# Install new dependencies
pnpm add <package-name>

# Add shadcn-vue component
pnpm dlx shadcn-vue@latest add <component-name>

# Type checking
pnpm vue-tsc --noEmit

# Linting
pnpm eslint src/

๐Ÿค Contributing

This project is a learning exercise and migration reference. Feel free to:

  • Report bugs via issues
  • Suggest enhancements
  • Submit pull requests for improvements

๐Ÿ“„ License

This project is part of the HNG Frontend Stage 2 requirements.


Built with โค๏ธ for the HNG Internship Program

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published