fix: dashboard — remove greeting & user card, fix weekly lessons count

- remove greeting header (mentor & client dashboards)
- remove CourseMyAccount user info block from right panel (mentor)
- lessons_this_week: compute client-side from upcoming_lessons filtered
  to remaining lessons in current Mon–Sun range (was using backend value)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Dev Server 2026-03-09 21:33:48 +03:00
parent 1b06404d64
commit 7cf7a78326
2 changed files with 15 additions and 22 deletions

View File

@ -237,16 +237,6 @@ export function OverviewClientView({ childId, childName }) {
borderRight: { lg: `solid 1px ${varAlpha(theme.vars.palette.grey['500Channel'], 0.12)}` }, borderRight: { lg: `solid 1px ${varAlpha(theme.vars.palette.grey['500Channel'], 0.12)}` },
}} }}
> >
{/* Greeting */}
<Box>
<Typography variant="h4" sx={{ mb: 0.5 }}>
Привет, {displayName}! 👋
</Typography>
<Typography sx={{ color: 'text.secondary' }}>
Твой прогресс и ближайшие занятия.
</Typography>
</Box>
{/* Stat widgets */} {/* Stat widgets */}
<Box <Box
sx={{ sx={{

View File

@ -8,7 +8,6 @@ import Avatar from '@mui/material/Avatar';
import Stack from '@mui/material/Stack'; import Stack from '@mui/material/Stack';
import Divider from '@mui/material/Divider'; import Divider from '@mui/material/Divider';
import { useTheme } from '@mui/material/styles'; import { useTheme } from '@mui/material/styles';
import { cardClasses } from '@mui/material/Card';
import Typography from '@mui/material/Typography'; import Typography from '@mui/material/Typography';
import CircularProgress from '@mui/material/CircularProgress'; import CircularProgress from '@mui/material/CircularProgress';
@ -28,7 +27,6 @@ import { getMentorDashboard, getMentorIncome } from 'src/utils/dashboard-api';
import { createLiveKitRoom } from 'src/utils/livekit-api'; import { createLiveKitRoom } from 'src/utils/livekit-api';
import { CourseProgress } from '../course-progress'; import { CourseProgress } from '../course-progress';
import { CourseMyAccount } from '../course-my-account';
import { CourseHoursSpent } from '../course-hours-spent'; import { CourseHoursSpent } from '../course-hours-spent';
import { CourseWidgetSummary } from '../course-widget-summary'; import { CourseWidgetSummary } from '../course-widget-summary';
@ -176,6 +174,20 @@ export function OverviewCourseView() {
}); });
}, [stats]); }, [stats]);
// Занятий оставшихся на этой неделе (пнвс)
const lessonsThisWeek = useMemo(() => {
const upcoming = stats?.upcoming_lessons || [];
const now = new Date();
const day = now.getDay(); // 0=вс, 1=пн, ..., 6=сб
const diffToMon = (day === 0 ? -6 : 1 - day);
const mon = new Date(now); mon.setHours(0, 0, 0, 0); mon.setDate(now.getDate() + diffToMon);
const sun = new Date(mon); sun.setDate(mon.getDate() + 6); sun.setHours(23, 59, 59, 999);
return upcoming.filter((l) => {
const t = new Date(l.start_time);
return t >= now && t >= mon && t <= sun;
}).length;
}, [stats]);
// Последние сданные ДЗ // Последние сданные ДЗ
const recentSubmissions = stats?.recent_submissions || []; const recentSubmissions = stats?.recent_submissions || [];
@ -283,14 +295,9 @@ export function OverviewCourseView() {
<Box sx={{ display: 'flex', flex: '1 1 auto', flexDirection: { xs: 'column', lg: 'row' } }}> <Box sx={{ display: 'flex', flex: '1 1 auto', flexDirection: { xs: 'column', lg: 'row' } }}>
{/* ЛЕВАЯ ЧАСТЬ */} {/* ЛЕВАЯ ЧАСТЬ */}
<Box sx={{ gap: 3, display: 'flex', flex: '1 1 auto', flexDirection: 'column', px: { xs: 2, sm: 3, xl: 5 }, py: 3, borderRight: { lg: `solid 1px ${varAlpha(theme.vars.palette.grey['500Channel'], 0.12)}` } }}> <Box sx={{ gap: 3, display: 'flex', flex: '1 1 auto', flexDirection: 'column', px: { xs: 2, sm: 3, xl: 5 }, py: 3, borderRight: { lg: `solid 1px ${varAlpha(theme.vars.palette.grey['500Channel'], 0.12)}` } }}>
<Box sx={{ mb: 2 }}>
<Typography variant="h4" sx={{ mb: 1 }}>Привет, {user?.first_name || 'Ментор'}! 🦾</Typography>
<Typography sx={{ color: 'text.secondary' }}>Ваша активность и доходы.</Typography>
</Box>
<Box sx={{ gap: 3, display: 'grid', gridTemplateColumns: { xs: 'repeat(1, 1fr)', md: 'repeat(3, 1fr)' } }}> <Box sx={{ gap: 3, display: 'grid', gridTemplateColumns: { xs: 'repeat(1, 1fr)', md: 'repeat(3, 1fr)' } }}>
<CourseWidgetSummary title="Ученики" total={Number(stats?.summary?.total_clients || 0)} icon={`${CONFIG.site.basePath}/assets/icons/courses/ic-courses-progress.svg`} /> <CourseWidgetSummary title="Ученики" total={Number(stats?.summary?.total_clients || 0)} icon={`${CONFIG.site.basePath}/assets/icons/courses/ic-courses-progress.svg`} />
<CourseWidgetSummary title="Занятий на неделе" total={Number(stats?.summary?.lessons_this_week || 0)} color="info" icon={`${CONFIG.site.basePath}/assets/icons/courses/ic-courses-certificates.svg`} /> <CourseWidgetSummary title="Занятий на неделе" total={lessonsThisWeek} color="info" icon={`${CONFIG.site.basePath}/assets/icons/courses/ic-courses-certificates.svg`} />
<CourseWidgetSummary title="На проверку" total={Number(stats?.summary?.pending_submissions || 0)} color="error" icon={`${CONFIG.site.basePath}/assets/icons/courses/ic-courses-completed.svg`} /> <CourseWidgetSummary title="На проверку" total={Number(stats?.summary?.pending_submissions || 0)} color="error" icon={`${CONFIG.site.basePath}/assets/icons/courses/ic-courses-completed.svg`} />
</Box> </Box>
@ -310,10 +317,6 @@ export function OverviewCourseView() {
{/* ПРАВАЯ ЧАСТЬ */} {/* ПРАВАЯ ЧАСТЬ */}
<Box sx={{ width: 1, display: 'flex', flexDirection: 'column', px: { xs: 2, sm: 3, xl: 5 }, pt: { lg: 8, xl: 10 }, pb: { xs: 8, xl: 10 }, flexShrink: 0, gap: 5, maxWidth: { lg: 320, xl: 360 }, bgcolor: { lg: 'background.neutral' } }}> <Box sx={{ width: 1, display: 'flex', flexDirection: 'column', px: { xs: 2, sm: 3, xl: 5 }, pt: { lg: 8, xl: 10 }, pb: { xs: 8, xl: 10 }, flexShrink: 0, gap: 5, maxWidth: { lg: 320, xl: 360 }, bgcolor: { lg: 'background.neutral' } }}>
<Box sx={{ px: { lg: 0 }, [`& .${cardClasses.root}`]: { p: 0, boxShadow: 'none', bgcolor: 'transparent' } }}>
<CourseMyAccount user={user} />
</Box>
{/* Ближайшие уроки */} {/* Ближайшие уроки */}
<Stack spacing={1.5}> <Stack spacing={1.5}>
<Stack direction="row" alignItems="center" justifyContent="space-between"> <Stack direction="row" alignItems="center" justifyContent="space-between">