Skip to content

SasheVuchkov/softuni-cursor-ai

Repository files navigation

🎯 Lead Predictor

A modern, responsive web application for predicting and analyzing marketing campaign performance. Built with React, TypeScript, and enhanced with beautiful animations using Framer Motion.

Lead Predictor

🤖 AI Development Prompts

This section documents the AI prompts used to build this application, demonstrating the power of AI-assisted development.

📱 Prompt #1: Layout Foundation

You're a world-class UI/UX designer of sleek, modern mobile apps. 

Create a responsive layout with two empty columns. The first column should be 1/4 of the content area. The second column should be 3/4 of the content area. 

The content area should have max width of 7xl and it should be centered. Use flex. Use darker tones for the background colors. 

Use react.js, tailwind css and headless ui to create the layout.

Replace the current app component

📝 Prompt #2: Input Fields

You are a world class UI/UX designer who creates sleek and modern mobile apps. 

Design a controlled input field as a separate component and put it under the common folder. 

Make sure you are using headless UI and tailwind CSS. Make it look cool. 

Then put four such fields in the first column of layout. Place all field under headless UI Field component and pack them with a Label component.  

The first field must have a label "Campaign start" and it must be date field. The second field must be also a date field, but with label Campaign End. The third field must be a number input field with max value of 100000 and a min value of 1. Its label is Target Revenue. The fourth field must be a number input field with max value of 100000 and min value of 1. The label says Avg. Order Value.

💰 Prompt #3: Currency Switcher

You're a world-class UI/UX designer of modern mobile apps.

Create a currency switcher component by using headless UI list component and Tailwind CSS to style it.

The available currencies are USD, EUR, GBP, and BGN with proper symbols.

Place it in the first column below the language switcher.

🌍 Prompt #4: Language Switcher

You're a world-class UI/UX designer of modern mobile apps.

Create a language switcher component by using headless UI list component and Tailwind CSS to style it.

The available languages are Bulgarian and US English. 

Place one above the currency switcher in the first column.

Use the svg images in the assets folder

📊 Prompt #5: Stats Card

You're a world-class UI/UX designer of modern mobile apps.

Create a stats card with three rows of content. The first row has an icon placeholder and a title "prospects" in the left corner and a percentage (100%) in the right corner. 

The middle row has big number 21. 

And the third row contains a progress bar. 

Make sure you use Tailwind CSS to create the card. 

Place one at the top of the second column of the layout.

🎚️ Prompt #6: Interactive Sliders

You're a world-class UI/UX designer of modern mobile apps.

By using the library rc-slider create a new component slider. 

Place two sliders in the second div of the second column. The min value is 0 and the max value is 100 percent. The first slider has the label "Avg. Lead Response Rate" and second slider has the label "Avg. Prospect Response Rate"

📈 Prompt #7: Data Visualization

You're a world-class UI/UX designer of modern mobile apps.

Create a nice horizontal bar chart in a separate component placed in the component folder. It depicts the metrics of number of customers, number of leads and number of prospects in time.

The period type is month. The graph shows overlapping horizontal bars of customers, leads, and prospects for each month. 

The x-axis shows the total number of people which is the number of prospects. And the y-axis shows the period number.

Use the library Observable Plot.

Then put an instance at the top of the second column beside the stats card.

🏗️ Data Structure #8: TypeScript Types

export type Metric = {
    id: string,
    value: number,
    title: string,
    color: string,
    percentage: number,
    periodType: string,
    period: number,
}

🧮 Prompt #9: Business Logic Functions

getTotalCustomers

Create a function with the name getTotalCustomers that accepts two parameters totalRevenue: number and avgOrderValue: number. Implement the function.

getTotalLeads

Create a function getTotalLeads that accepts the number of totalCustomers as float number and the average lead response rate as float number. Implement the logic

getTotalProspects

Create a function getTotalProspects that accepts the number of totalLeads as float number and the average prospect response rate as float number. Implement the logic

Date Calculation Functions

Create three functions. All of the three accept two arguments startDate and endDate which are strings. The first function is getNumberOfDays, the second is getNumberOfWeeks and the third is getNumberOfMonths. Implement the functions.

🌍 Prompt #10: Internationalization

Extract all labels and other strings and prepare the application for internationalization. The available languages are Bulgarian and English. Provide translations in Bulgarian. 

Use react-i18next

✨ Prompt #11: Visual Effects & Animations

You are a world-class UI/UX designer, please add some visual effects and animations by using Framer Motion and TailwindCSS. Keep the colors the same.

✨ Features

📊 Campaign Analytics

  • Real-time Calculations: Dynamic lead and prospect calculations based on your inputs
  • Visual Progress Tracking: Animated progress bars and statistics cards
  • Monthly Projections: Interactive charts showing campaign progression over time

🌍 Internationalization

  • Multi-language Support: English and Bulgarian translations
  • Dynamic Language Switching: Real-time language changes with flag-based switcher
  • Localized Content: All UI elements, business terminology, and help text translated

💰 Multi-Currency Support

  • 4 Currencies: USD, EUR, GBP, BGN
  • Currency Symbols: Proper formatting with currency symbols
  • Real-time Switching: Instant currency changes

🎨 Modern UI/UX

  • Dark Theme: Professional dark mode interface
  • Glass Morphism: Backdrop blur effects and translucent elements
  • Smooth Animations: Framer Motion powered transitions and interactions
  • Responsive Design: Mobile-first approach with breakpoint optimization

Accessibility

  • WCAG 2.1 AA Compliance: Full accessibility standards compliance
  • Keyboard Navigation: Complete keyboard accessibility
  • Screen Reader Support: Proper ARIA labels and live regions
  • Focus Management: Enhanced focus indicators and management

🚀 Quick Start

Prerequisites

  • Node.js 18+
  • npm or yarn

Installation

# Clone the repository
git clone <repository-url>
cd softuni-presentation2

# Install dependencies
npm install

# Start development server
npm start

Development

# Run in development mode
npm start

# Build for production
npm run build

# Run tests
npm test

# Preview production build
npm run preview

🏗️ Tech Stack

Frontend Framework

  • React 18 - Modern React with hooks and concurrent features
  • TypeScript - Type-safe development
  • Vite - Fast build tool and development server

Styling & UI

  • Tailwind CSS 4.x - Utility-first CSS framework
  • Headless UI 2.0 - Unstyled, accessible UI components
  • Heroicons - Beautiful hand-crafted SVG icons

Animations & Interactions

  • Framer Motion - Production-ready motion library
  • RC Slider - Customizable slider components

Data Visualization

  • Observable Plot 0.6.17 - Grammar of graphics for JavaScript

Internationalization

  • react-i18next 15.5.1 - Internationalization framework
  • i18next 25.1.2 - Internationalization ecosystem

📁 Project Structure

src/
├── components/           # Reusable UI components
│   └── common/          # Shared components
│       ├── ControlledInput.tsx
│       ├── CurrencySwitcher.tsx
│       ├── CustomSlider.tsx
│       ├── LanguageSwitcher.tsx
│       └── StatsCard.tsx
├── assets/              # Static assets
│   ├── flag-bg.svg      # Bulgarian flag
│   ├── flag-us.svg      # US flag
│   └── logo-text-gray.png
├── i18n.ts             # Internationalization configuration
├── types.ts            # TypeScript type definitions
├── utils.ts            # Business logic utilities
├── app.tsx             # Main application component
├── index.tsx           # Application entry point
└── index.css           # Global styles and CSS variables

🎛️ Configuration

Environment Variables

Create a .env file in the root directory:

# Application configuration
VITE_APP_TITLE="Lead Predictor"
VITE_DEFAULT_LANGUAGE="en"
VITE_DEFAULT_CURRENCY="USD"

CSS Custom Properties

The application uses CSS custom properties for theming:

:root {
  --color-prospects: #1e3a8a;     /* Blue for prospects */
  --color-leads: #7c3aed;         /* Purple for leads */
  --color-customers: #059669;     /* Green for customers */
  --color-slider: #3b82f6;        /* Slider track color */
  --color-slider-track: #374151;  /* Slider rail color */
}

📊 Business Logic

Lead Calculation Formula

// Calculate total customers needed
const totalCustomers = targetRevenue / avgOrderValue

// Calculate leads needed (based on lead response rate)
const totalLeads = totalCustomers / (leadResponseRate / 100)

// Calculate prospects needed (based on prospect response rate)
const totalProspects = totalLeads / (prospectResponseRate / 100)

Time Period Calculation

  • Days: For campaigns < 3 weeks
  • Weeks: For campaigns 3 weeks - 3 months
  • Months: For campaigns > 3 months

🎨 Design System

Color Palette

  • Background: bg-gray-900 - Main dark background
  • Cards: bg-gray-800 - Card backgrounds
  • Borders: border-gray-700 - Subtle borders
  • Text: text-gray-100 - Primary text
  • Accent: Blue/Purple gradient for interactive elements

Typography

  • Headings: Font weight 600-700, tracking wide
  • Body: Font weight 400-500
  • Labels: Font weight 600, uppercase tracking

Spacing

  • Containers: p-6 for large sections, p-4 for mobile
  • Gaps: gap-6 for main layout, gap-4 for components
  • Margins: mb-4 for component spacing

🔧 Component API

StatsCard

interface StatsCardProps {
  title: string           // Card title
  percentage: number      // Percentage value
  value: number          // Main display value
  progress: number       // Progress bar value (0-100)
  icon?: React.ReactNode // Optional icon
  className?: string     // Additional CSS classes
  color?: string         // Background color
}

ControlledInput

interface ControlledInputProps {
  label: string                           // Input label
  type?: 'text' | 'date' | 'number'     // Input type
  value: string | number                 // Current value
  onChange: (value: string | number) => void // Change handler
  placeholder?: string                   // Placeholder text
  min?: number                          // Min value (number inputs)
  max?: number                          // Max value (number inputs)
  required?: boolean                    // Required field
  className?: string                    // Additional CSS classes
  error?: string                        // Error message
  helpText?: string                     // Help text
}

CustomSlider

interface CustomSliderProps {
  label: string                    // Slider label
  value: number                   // Current value
  onChange: (value: number) => void // Change handler
  min?: number                    // Minimum value
  max?: number                    // Maximum value
  step?: number                   // Step increment
  className?: string              // Additional CSS classes
}

🌐 Internationalization

Adding New Languages

  1. Add language configuration in src/i18n.ts
  2. Create translation files in the resources object
  3. Add language option to LanguageSwitcher component
  4. Add corresponding flag SVG to assets

Translation Keys Structure

const translations = {
  // Navigation & UI
  appTitle: "Lead Predictor",
  
  // Form Labels
  campaignStart: "Campaign Start",
  campaignEnd: "Campaign End",
  
  // Business Terms
  prospects: "Prospects",
  leads: "Leads",
  customers: "Customers",
  
  // Settings
  responseRateSettings: "Response Rate Settings"
}

📱 Responsive Design

Breakpoints

  • Mobile: Default styles (< 768px)
  • Tablet: md: prefix (768px+)
  • Desktop: lg: prefix (1024px+)

Layout Adaptations

  • Mobile: Single column stack layout
  • Tablet+: Two-column layout (1/4 sidebar, 3/4 main)
  • Cards: Grid adapts from 1 to 3 columns
  • Charts: Responsive sizing and orientation

🧪 Testing

Manual Testing Checklist

  • All form inputs work correctly
  • Language switching updates all text
  • Currency switching updates display
  • Calculations update in real-time
  • Animations play smoothly
  • Responsive layout works on all devices
  • Accessibility features function properly

🚀 Deployment

Build for Production

npm run build

Deploy to Vercel

npm install -g vercel
vercel --prod

Deploy to Netlify

npm install -g netlify-cli
netlify deploy --prod --dir=dist

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Observable Plot for powerful data visualization
  • Headless UI for accessible component primitives
  • Framer Motion for smooth animations
  • Tailwind CSS for rapid UI development
  • React i18next for internationalization

📞 Contact

Александър Вучков


Built with ❤️ using AI-assisted development principles and modern web technologies.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages