Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Emrysil committed Apr 15, 2024
2 parents 6ec28bf + c6414ce commit e5e4f1e
Show file tree
Hide file tree
Showing 9 changed files with 3,833 additions and 180 deletions.
25 changes: 25 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/app/[locale]/manager/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ export default function ManagerLayout({
children: React.ReactNode;
}>) {
return (
<>
<div className="h-screen max-h-screen flex flex-col">
<HeaderManager />
{children}
</>
<div className="flex-1 min-h-0 max-h-full">{children}</div>
</div>
);
}
2 changes: 1 addition & 1 deletion src/app/[locale]/manager/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import StudentList from '@/containers/Manager/StudentList';

const ManagerPage: NextPage = () => {
return (
<div>
<div className="h-full max-h-full">
<StudentList />
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion src/app/[locale]/manager/tut-list/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { NextPage } from 'next';

const TutorListPage: NextPage = () => {
return (
<div>
<div className="h-full max-h-full">
<TutorList />
</div>
);
Expand Down
11 changes: 5 additions & 6 deletions src/containers/Manager/StudentList/components/list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,22 @@ const List: React.FC<ListProps> = ({
];

return (
<div style={{ padding: '20px', backgroundColor: '#f0f2f5', minHeight: '100vh' }}>
<div className="p-5 bg-gray-50 min-h-screen">
<Title level={2}>{listTitle}</Title>
<Button style={{ marginBottom: '2%' }} onClick={handleButtonClick}>
<Button className="mb-2" onClick={handleButtonClick}>
{buttonName}
</Button>
{assignStudentClick && (
<Button style={{ marginBottom: '2%', marginLeft: '2%' }} onClick={assignStudentClick}>
{' '}
Assign to Tutor{' '}
<Button className="mb-2 ml-2" onClick={assignStudentClick}>
Assign to Tutor
</Button>
)}
<Table
columns={columns}
dataSource={users}
pagination={false}
scroll={{ x: 'max-content' }}
style={{ backgroundColor: '#ffffff' }}
className="bg-white"
/>
</div>
);
Expand Down
17 changes: 9 additions & 8 deletions src/containers/Manager/StudentList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ const StudentList: React.FC = () => {
const [modalVisible, setModalVisible] = useState<boolean>(false);
const [inputValue, setInputValue] = useState<string>('');

const getStudentData = async () => {
const res: { user: Student[] } = await getStudents().unwrap();
setStudents(res.user);
};

useEffect(() => {
const getStudentData = async () => {
const res: { user: Student[] } = await getStudents().unwrap();
setStudents(res.user);
};

getStudentData();
}, []);
}, [getStudents]);


const handleCheckboxChange = (studentId: number, checked: boolean) => {
setSelectedIds((prevIds) => {
Expand Down Expand Up @@ -115,7 +116,7 @@ const StudentList: React.FC = () => {
};

return (
<div style={{ padding: '20px', backgroundColor: '#f0f2f5', minHeight: '100vh' }}>
<div className="p-5 bg-gray-50 min-h-screen">
<List
users={students}
onCheckboxChange={handleCheckboxChange}
Expand All @@ -135,7 +136,7 @@ const StudentList: React.FC = () => {
<Input type="number" value={inputValue} onChange={(e) => setInputValue(e.target.value)} />
</Modal>
</div>
);
);
};

export default StudentList;
17 changes: 9 additions & 8 deletions src/containers/Manager/TutorList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ const TutorList: React.FC = () => {
const [demoteTutors] = useDemoteTutorsMutation();
const [tutors, setTutors] = useState<Student[]>([]);
const [selectedIds, setSelectedIds] = useState<number[]>([]);

const getTutorData = async () => {
const res: { user: Tutor[] } = await getTutors().unwrap();
setTutors(res.user);
};


useEffect(() => {
const getTutorData = async () => {
const res: { user: Tutor[] } = await getTutors().unwrap();
setTutors(res.user);
};

getTutorData();
}, []);
}, [getTutors]);

const handleCheckboxChange = (tutorId: number, checked: boolean) => {
setSelectedIds((prevIds) => {
Expand Down Expand Up @@ -50,7 +50,7 @@ const TutorList: React.FC = () => {
};

return (
<div style={{ padding: '20px', backgroundColor: '#f0f2f5', minHeight: '100vh' }}>
<div className="p-5 bg-gray-50 min-h-screen">
<List
users={tutors}
onCheckboxChange={handleCheckboxChange}
Expand All @@ -60,6 +60,7 @@ const TutorList: React.FC = () => {
/>
</div>
);

};

export default TutorList;
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const QuestionList = ({ questionList, pathname, handleDeleteQuestion }) => {
<div className="flex justify-between items-center">
<div>
<p className="font-semibold">{item.question_title}</p>
<p>Published: {item.pub_date}</p>
<p>Published: {new Date(item.pub_date).toISOString().slice(0, 19).replace('T', ' ')} </p>
<p>Due by: {item.due_date}</p>
</div>
<div className="flex space-x-2">
Expand Down
Loading

0 comments on commit e5e4f1e

Please sign in to comment.