fix(contexts): replace ProfileContext with UserContext in timetable pages
This commit is contained in:
parent
c7207eb805
commit
00a6f941c7
@ -2,13 +2,13 @@ import React, { useEffect, useState } from 'react';
|
|||||||
import { useParams, Link, useNavigate } from 'react-router-dom';
|
import { useParams, Link, useNavigate } from 'react-router-dom';
|
||||||
import { AccessTimeIcon, AddIcon, ArrowBackIcon, CalendarTodayIcon, DeleteIcon, EditIcon, MenuBookIcon, PeopleIcon } from '@mui/icons-material';
|
import { AccessTimeIcon, AddIcon, ArrowBackIcon, CalendarTodayIcon, DeleteIcon, EditIcon, MenuBookIcon, PeopleIcon } from '@mui/icons-material';
|
||||||
import useTimetableStore from '../../stores/timetableStore';
|
import useTimetableStore from '../../stores/timetableStore';
|
||||||
import { useProfile } from '../../contexts/ProfileContext';
|
import { useUser } from '../../contexts/UserContext';
|
||||||
import Modal from '../../components/common/Modal';
|
import Modal from '../../components/common/Modal';
|
||||||
|
|
||||||
const ClassDetailPage: React.FC = () => {
|
const ClassDetailPage: React.FC = () => {
|
||||||
const { classId } = useParams<{ classId: string }>();
|
const { classId } = useParams<{ classId: string }>();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { profile } = useProfile();
|
const { profile } = useUser();
|
||||||
const {
|
const {
|
||||||
currentClass,
|
currentClass,
|
||||||
timetables,
|
timetables,
|
||||||
|
|||||||
@ -2,11 +2,11 @@ import React, { useEffect, useState } from 'react';
|
|||||||
import { Link, useNavigate } from 'react-router-dom';
|
import { Link, useNavigate } from 'react-router-dom';
|
||||||
import { AddIcon, CalendarTodayIcon, FilterListIcon, MenuBookIcon, PeopleIcon, SearchIcon } from '@mui/icons-material';
|
import { AddIcon, CalendarTodayIcon, FilterListIcon, MenuBookIcon, PeopleIcon, SearchIcon } from '@mui/icons-material';
|
||||||
import useTimetableStore from '../../stores/timetableStore';
|
import useTimetableStore from '../../stores/timetableStore';
|
||||||
import { useProfile } from '../../contexts/ProfileContext';
|
import { useUser } from '../../contexts/UserContext';
|
||||||
|
|
||||||
const ClassesPage: React.FC = () => {
|
const ClassesPage: React.FC = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { profile } = useProfile();
|
const { profile } = useUser();
|
||||||
const {
|
const {
|
||||||
classes,
|
classes,
|
||||||
totalCount,
|
totalCount,
|
||||||
|
|||||||
@ -2,14 +2,14 @@ import React, { useEffect, useState } from 'react';
|
|||||||
import { useParams, Link, useNavigate } from 'react-router-dom';
|
import { useParams, Link, useNavigate } from 'react-router-dom';
|
||||||
import { AccessTimeIcon, ArrowBackIcon, CalendarTodayIcon, CancelIcon, CheckCircleIcon, DeleteIcon, DescriptionIcon, EditIcon, LocationOnIcon, MenuBookIcon, PeopleIcon } from '@mui/icons-material';
|
import { AccessTimeIcon, ArrowBackIcon, CalendarTodayIcon, CancelIcon, CheckCircleIcon, DeleteIcon, DescriptionIcon, EditIcon, LocationOnIcon, MenuBookIcon, PeopleIcon } from '@mui/icons-material';
|
||||||
import useTimetableStore from '../../stores/timetableStore';
|
import useTimetableStore from '../../stores/timetableStore';
|
||||||
import { useProfile } from '../../contexts/ProfileContext';
|
import { useUser } from '../../contexts/UserContext';
|
||||||
import { format, parseISO } from 'date-fns';
|
import { format, parseISO } from 'date-fns';
|
||||||
import Modal from '../../components/common/Modal';
|
import Modal from '../../components/common/Modal';
|
||||||
|
|
||||||
const LessonPage: React.FC = () => {
|
const LessonPage: React.FC = () => {
|
||||||
const { lessonId } = useParams<{ lessonId: string }>();
|
const { lessonId } = useParams<{ lessonId: string }>();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { profile } = useProfile();
|
const { profile } = useUser();
|
||||||
const {
|
const {
|
||||||
currentLesson,
|
currentLesson,
|
||||||
currentTimetable,
|
currentTimetable,
|
||||||
|
|||||||
@ -2,10 +2,10 @@ import React, { useEffect } from 'react';
|
|||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import { AccessTimeIcon, KeyboardArrowRightIcon, MenuBookIcon, PeopleIcon, SchoolIcon } from '@mui/icons-material';
|
import { AccessTimeIcon, KeyboardArrowRightIcon, MenuBookIcon, PeopleIcon, SchoolIcon } from '@mui/icons-material';
|
||||||
import useTimetableStore from '../../stores/timetableStore';
|
import useTimetableStore from '../../stores/timetableStore';
|
||||||
import { useProfile } from '../../contexts/ProfileContext';
|
import { useUser } from '../../contexts/UserContext';
|
||||||
|
|
||||||
const MyClassesPage: React.FC = () => {
|
const MyClassesPage: React.FC = () => {
|
||||||
const { profile } = useProfile();
|
const { profile } = useUser();
|
||||||
const {
|
const {
|
||||||
myClasses,
|
myClasses,
|
||||||
myClassesLoading,
|
myClassesLoading,
|
||||||
|
|||||||
@ -2,13 +2,13 @@ import React, { useEffect } from 'react';
|
|||||||
import { useParams, Link, useNavigate } from 'react-router-dom';
|
import { useParams, Link, useNavigate } from 'react-router-dom';
|
||||||
import { AccessTimeIcon, AddIcon, ArrowBackIcon, CalendarTodayIcon, DeleteIcon, EditIcon, KeyboardArrowLeftIcon, KeyboardArrowRightIcon, LocationOnIcon } from '@mui/icons-material';
|
import { AccessTimeIcon, AddIcon, ArrowBackIcon, CalendarTodayIcon, DeleteIcon, EditIcon, KeyboardArrowLeftIcon, KeyboardArrowRightIcon, LocationOnIcon } from '@mui/icons-material';
|
||||||
import useTimetableStore from '../../stores/timetableStore';
|
import useTimetableStore from '../../stores/timetableStore';
|
||||||
import { useProfile } from '../../contexts/ProfileContext';
|
import { useUser } from '../../contexts/UserContext';
|
||||||
import { format, parseISO, addDays, startOfWeek, isSameDay } from 'date-fns';
|
import { format, parseISO, addDays, startOfWeek, isSameDay } from 'date-fns';
|
||||||
|
|
||||||
const TimetablePage: React.FC = () => {
|
const TimetablePage: React.FC = () => {
|
||||||
const { timetableId } = useParams<{ timetableId: string }>();
|
const { timetableId } = useParams<{ timetableId: string }>();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { profile } = useProfile();
|
const { profile } = useUser();
|
||||||
const {
|
const {
|
||||||
currentTimetable,
|
currentTimetable,
|
||||||
currentLessons,
|
currentLessons,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user