Ignore:
Timestamp:
06/24/26 16:51:52 (11 days ago)
Author:
kikisrbinoska <srbinoskakristina07@…>
Branches:
main
Children:
3ae4bab
Parents:
99c1e45
Message:

Fixed views count

File:
1 edited

Legend:

Unmodified
Added
Removed
  • chapterx-frontend/src/pages/writer/WriterDashboard.tsx

    r99c1e45 ra8f4a2d  
    11import React, { useEffect } from 'react'
    22import { useNavigate } from 'react-router-dom'
    3 import { Plus, BookOpen, Heart, MessageCircle, TrendingUp, Bell } from 'lucide-react'
     3import { Plus, BookOpen, Heart, MessageCircle, TrendingUp, Bell, Eye } from 'lucide-react'
    44import { useAuthStore } from '../../store/authStore'
    55import { useStoryStore } from '../../store/storyStore'
     
    3737  const drafts = myStories.filter(s => s.status === 'draft')
    3838  const totalLikes = myStories.reduce((acc, s) => acc + s.total_likes, 0)
     39  const totalViews = myStories.reduce((acc, s) => acc + s.total_views, 0)
    3940
    4041  const recentNotifs = notifications.slice(0, 5)
     
    5758
    5859      {/* Stats */}
    59       <div className="grid grid-cols-2 lg:grid-cols-3 gap-4 mb-8">
     60      <div className="grid grid-cols-2 lg:grid-cols-4 gap-4 mb-8">
    6061        {[
    6162          { icon: <BookOpen size={20} className="text-indigo-300" />, label: 'Total Stories', value: myStories.length, sub: `${published.length} published`, color: 'bg-indigo-500/20' },
    6263          { icon: <Heart size={20} className="text-rose-300" />, label: 'Total Likes', value: totalLikes.toLocaleString(), sub: 'Across all stories', color: 'bg-rose-500/20' },
     64          { icon: <Eye size={20} className="text-cyan-300" />, label: 'Total Views', value: totalViews.toLocaleString(), sub: 'Chapter reads', color: 'bg-cyan-500/20' },
    6365          { icon: <TrendingUp size={20} className="text-emerald-300" />, label: 'Drafts', value: drafts.length, sub: 'In progress', color: 'bg-emerald-500/20' },
    6466        ].map(s => (
     
    110112                        <span className="flex items-center gap-1"><Heart size={11} /> {story.total_likes}</span>
    111113                        <span className="flex items-center gap-1"><MessageCircle size={11} /> {story.total_comments}</span>
     114                        <span className="flex items-center gap-1"><Eye size={11} /> {story.total_views.toLocaleString()}</span>
    112115                        <span>{story.total_chapters} chapters</span>
    113116                      </div>
Note: See TracChangeset for help on using the changeset viewer.