Skip to content

Latest commit

 

History

History
473 lines (356 loc) · 10.1 KB

File metadata and controls

473 lines (356 loc) · 10.1 KB

🎨 TaskStars - Complete Component Usage Guide

🎉 ALL FEATURES IMPLEMENTED!

Your TaskStars app now has 18 premium features ready to use!


📦 Complete Component Inventory

UI Foundation (11 components)

  1. Button - @/components/ui/Button
  2. Card - @/components/ui/Card
  3. Badge - @/components/ui/Badge
  4. Loading - @/components/ui/Loading
  5. ThemeToggle - @/components/ui/ThemeToggle
  6. StreakCounter - @/components/ui/StreakCounter
  7. StatCard - @/components/ui/StatCard
  8. ProgressRing - @/components/ui/ProgressRing
  9. FloatingActionButton - @/components/ui/FloatingActionButton
  10. Modal - @/components/ui/Modal
  11. KeyboardShortcuts - @/components/ui/KeyboardShortcuts

Task Management (1 component)

  1. EnhancedTaskCard - @/components/enhanced/EnhancedTaskCard

Gamification (1 component)

  1. BadgeGallery - @/components/gamification/BadgeGallery

Analytics (2 components)

  1. AnalyticsDashboard - @/components/analytics/AnalyticsDashboard
  2. ProductivityHeatMap - @/components/analytics/ProductivityHeatMap

Social (1 component)

  1. Leaderboard - @/components/social/Leaderboard

Productivity (1 component)

  1. PomodoroTimer - @/components/productivity/PomodoroTimer

Enhanced Navbar

  1. Navbar - Fully redesigned with dark mode

🚀 Quick Start Examples

Dashboard Layout Example

import StatCard from "@/components/ui/StatCard";
import StreakCounter from "@/components/ui/StreakCounter";
import ProgressRing from "@/components/ui/ProgressRing";
import BadgeGallery from "@/components/gamification/BadgeGallery";
import Leaderboard from "@/components/social/Leaderboard";
import { FiCheckCircle, FiClock, FiTrendingUp } from "react-icons/fi";

export default function Dashboard() {
  return (
    <div className="p-6 space-y-6">
      {/* Hero Section */}
      <div className="card p-8">
        <h1 className="text-4xl font-bold text-gradient mb-2">
          Welcome back! 👋
        </h1>
        <p className="text-gray-600 dark:text-gray-400">
          You're doing great! Keep up the momentum.
        </p>
      </div>

      {/* Stats Grid */}
      <div className="grid grid-cols-1 md:grid-cols-3 gap-6">
        <StatCard
          title="Tasks Completed"
          value="24"
          subtitle="This week"
          icon={FiCheckCircle}
          color="success"
          trend={12}
        />
        <StatCard
          title="Focus Time"
          value="12.5h"
          subtitle="Last 7 days"
          icon={FiClock}
          color="primary"
        />
        <StreakCounter streak={7} maxStreak={14} />
      </div>

      {/* Main Content */}
      <div className="grid grid-cols-1 lg:grid-cols-3 gap-6">
        <div className="lg:col-span-2">{/* Your task list here */}</div>
        <div>
          <Leaderboard />
        </div>
      </div>

      {/* Badges */}
      <BadgeGallery
        userBadges={["first-task", "week-streak"]}
        stats={{ tasksCompleted: 24, currentStreak: 7 }}
      />
    </div>
  );
}

Analytics Page Example

import AnalyticsDashboard from "@/components/analytics/AnalyticsDashboard";
import ProductivityHeatMap from "@/components/analytics/ProductivityHeatMap";

export default function AnalyticsPage() {
  return (
    <div className="p-6 space-y-6">
      <h1 className="text-3xl font-bold text-gray-900 dark:text-gray-50">
        Analytics
      </h1>
      <ProductivityHeatMap />
      <AnalyticsDashboard />
    </div>
  );
}

Pomodoro Page Example

import PomodoroTimer from "@/components/productivity/PomodoroTimer";

export default function FocusPage() {
  return (
    <div className="min-h-screen flex items-center justify-center p-6">
      <div className="max-w-md w-full">
        <PomodoroTimer />
      </div>
    </div>
  );
}

🎨 Theme & Styling

Using Predefined Classes

// Cards
<div className="card p-6">Content</div>
<div className="glass p-6">Glass effect</div>

// Buttons
<button className="btn-primary">Primary</button>
<button className="btn-accent">Accent</button>
<button className="btn-success">Success</button>

// Badges
<span className="badge badge-primary">Primary</span>
<span className="badge badge-success">Success</span>

// Animations
<div className="animate-fade-in">Fades in</div>
<div className="animate-slide-up">Slides up</div>
<div className="animate-float">Floats</div>

// Text Gradients
<h1 className="text-gradient">Gradient text</h1>
<h1 className="text-gradient-fire">Fire gradient</h1>

Color System

// Primary (Blue) - Main brand
className = "bg-primary-500 text-primary-50";

// Accent (Purple) - Gamification
className = "bg-accent-500 text-accent-50";

// Success (Green) - Completion
className = "bg-success-500 text-success-50";

// Warning (Orange) - Streaks
className = "bg-warning-500 text-warning-50";

// Dark mode variants
className = "bg-white dark:bg-dark-800";
className = "text-gray-900 dark:text-gray-50";

🎮 Keyboard Shortcuts

Press ? anywhere in the app to see all shortcuts!

Shortcut Action
? Show shortcuts
N New task
T Toggle theme
P Start Pomodoro
Esc Close modal
Cmd + K Quick search
G + D Go to dashboard
G + T Go to tasks
G + A Go to analytics

📊 Data Integration

Connecting Real Data

Replace sample data with your API calls:

// Example: Fetch user stats
const [stats, setStats] = useState(null);

useEffect(() => {
  const fetchStats = async () => {
    const response = await fetch(`${API_URL}/api/users/stats`, {
      headers: {
        Authorization: `Bearer ${localStorage.getItem("token")}`,
      },
    });
    const data = await response.json();
    setStats(data);
  };

  fetchStats();
}, []);

// Use in components
<StatCard
  title="Tasks Completed"
  value={stats?.tasksCompleted || 0}
  trend={stats?.trend}
/>;

🎯 Feature Highlights

1. Badge Gallery

  • 8 unique badges to unlock
  • Real-time progress tracking
  • Celebration animations
  • Progress bars for locked badges

2. Analytics Dashboard

  • Weekly task completion chart
  • Productivity hours bar chart
  • Priority distribution pie chart
  • Category breakdown
  • Monthly summary stats

3. Productivity Heat Map

  • GitHub-style contribution graph
  • Last 365 days visualization
  • Interactive hover tooltips
  • Current streak tracking
  • Color-coded activity levels

4. Leaderboard

  • Animated rankings
  • Trend indicators (up/down/same)
  • User highlighting
  • Streak display
  • Progress bars

5. Pomodoro Timer

  • 25-minute focus sessions
  • 5-minute short breaks
  • 15-minute long breaks
  • Auto-mode switching
  • Session tracking
  • Customizable durations
  • Visual progress ring

6. Enhanced Task Cards

  • Smooth hover animations
  • Drag handle (ready for drag-drop)
  • Quick actions (edit, delete)
  • Priority badges
  • Deadline indicators
  • Tag display
  • Completion animation

7. Keyboard Shortcuts

  • Press ? to open
  • Organized by category
  • Visual key indicators
  • Always accessible

💡 Pro Tips

Performance

// Lazy load heavy components
import dynamic from "next/dynamic";

const Analytics = dynamic(
  () => import("@/components/analytics/AnalyticsDashboard"),
  { loading: () => <Loading /> }
);

Optimistic UI

// Show immediate feedback
const handleComplete = async (taskId) => {
  // Update UI immediately
  updateTaskLocally(taskId);

  // Then sync with server
  try {
    await api.completeTask(taskId);
    toast.success("Task completed!");
  } catch (error) {
    // Rollback on error
    revertTaskUpdate(taskId);
    toast.error("Failed to complete task");
  }
};

Dark Mode

// Access theme anywhere
import { useTheme } from "@/contexts/ThemeContext";

const { theme, toggleTheme } = useTheme();
const isDark = theme === "dark";

📱 Responsive Design

All components are mobile-ready! Use Tailwind breakpoints:

<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
  {/* 1 column on mobile, 2 on tablet, 3 on desktop */}
</div>

<div className="text-sm md:text-base lg:text-lg">
  {/* Responsive text sizes */}
</div>

🎨 Customization

Change Colors

Edit tailwind.config.js:

colors: {
  primary: {
    500: '#YOUR_COLOR',
  }
}

Add Animations

Edit tailwind.config.js:

animation: {
  'your-animation': 'yourAnim 1s ease',
},
keyframes: {
  yourAnim: {
    '0%': { /* start */ },
    '100%': { /* end */ },
  },
}

🐛 Troubleshooting

Component Not Found

# Make sure you're using @ alias
import Button from '@/components/ui/Button'  ✅
import Button from './components/ui/Button'

Dark Mode Not Working

// Ensure ThemeProvider wraps your app (in layout.js)
<ThemeProvider>{children}</ThemeProvider>

Animations Laggy

// Reduce motion for performance
<motion.div
  whileHover={{ scale: 1.02 }}  // Small scale
  transition={{ duration: 0.2 }} // Short duration
>

📚 Resources


Checklist for Integration

  • Import components you need
  • Replace sample data with real API calls
  • Test dark mode in all views
  • Test responsive design on mobile
  • Set up keyboard shortcuts
  • Configure Pomodoro durations
  • Customize badge requirements
  • Add your OAuth credentials
  • Test all animations
  • Deploy and celebrate! 🎉

You now have a complete, production-ready design system! 🚀

Every component is:

  • ✅ Fully animated
  • ✅ Dark mode ready
  • ✅ Responsive
  • ✅ Accessible
  • ✅ Documented

Start building your amazing productivity app! 💪