Files
aplp.frontend.lms/src/pages/Course/CourseDetails.jsx
T

110 lines
3.6 KiB
React
Raw Normal View History

2026-09-03 21:49:25 +07:00
import { Card } from '../../components/ui/card';
import { Button } from '../../components/ui/button';
import { Badge } from '../../components/ui/badge';
import { Label } from '../../components/ui/label';
import { Input } from '../../components/ui/input';
import { Textarea } from '../../components/ui/textarea';
2026-08-19 21:15:42 +07:00
import PageHeader from '../../components/PageHeader';
import { useParams } from 'react-router-dom';
const data = [
{
code: 'LDR-101',
title: 'Foundations of Modern Leadership',
description:
'An introductory course covering essential leadership principles for new managers.',
status: 'Active',
lastUpdate: '2026-08-19',
image:
'https://images.unsplash.com/photo-1556761175-b413da4baf72?auto=format&fit=crop&w=800&q=80'
},
{
code: 'TEC-204',
title: 'Advanced Cloud Architecture Patterns',
description:
'Deep dive into scalable cloud infrastructure design and implementation strategies.',
status: 'Inactive',
lastUpdate: '2026-08-19',
image:
'https://images.unsplash.com/photo-1533090161767-e6ffed986c88?auto=format&fit=crop&w=800&q=80'
},
{
code: 'CMP-099',
title: '2022 Annual Compliance Review',
description: 'Outdated compliance materials from the previous fiscal year.',
status: 'Inactive',
lastUpdate: '2026-08-19',
image:
'https://images.unsplash.com/photo-1497366754035-f200968a6e72?auto=format&fit=crop&w=800&q=80'
}
];
function CourseDetail() {
const { courseId } = useParams();
const course = data.find((e) => e.code === courseId);
if (!course) {
return <div>Course not found</div>;
}
return (
<>
<PageHeader />
<div className="mb-4 flex flex-row items-center justify-between">
2026-09-03 21:49:25 +07:00
<h2 className="text-xl font-bold text-app-text">{course?.title}</h2>
<div className="flex flex-row items-center gap-2">
<Button
color="gray"
className="rounded-xl bg-app-surface-muted text-app-text hover:bg-app-interactive-hover"
>
2026-08-19 21:15:42 +07:00
Inactivate
</Button>
2026-09-03 21:49:25 +07:00
<Button className="rounded-xl bg-app-primary text-white hover:bg-app-primary-dark">
Publish
</Button>
2026-08-19 21:15:42 +07:00
</div>
</div>
<div>
<Card
2026-09-03 21:49:25 +07:00
className="w-full max-w-100 overflow-hidden rounded-xl border border-app-border bg-white"
style={{ boxShadow: 'rgba(0,0,0,0.03) 0px 4px 24px' }}
2026-08-19 21:15:42 +07:00
>
2026-09-03 21:49:25 +07:00
<div className="p-5">
<h4 className="font-medium text-app-text">Course Details</h4>
</div>
<div className="px-5 pb-5">
<div className="my-2 w-full max-w-64">
<Label className="mb-1 block text-app-text">Course Code</Label>
2026-08-19 21:15:42 +07:00
<Input
value={course?.code}
2026-09-03 21:49:25 +07:00
readOnly
2026-08-19 21:15:42 +07:00
/>
2026-09-03 21:49:25 +07:00
</div>
<Label className="mb-1 block text-app-text">Status</Label>
2026-08-19 21:15:42 +07:00
{course?.status === 'Active' ? (
2026-09-03 21:49:25 +07:00
<Badge className="rounded-[6px] bg-app-success text-app-success-text">
2026-08-19 21:15:42 +07:00
Active
2026-09-03 21:49:25 +07:00
</Badge>
2026-08-19 21:15:42 +07:00
) : (
2026-09-03 21:49:25 +07:00
<Badge className="rounded-[8px] bg-app-neutral-badge text-app-neutral-badge-text">
Inactive
</Badge>
2026-08-19 21:15:42 +07:00
)}
2026-09-03 21:49:25 +07:00
<div className="my-2 w-full max-w-64">
<Label className="mb-1 block text-app-text">Description</Label>
<Textarea
2026-08-19 21:15:42 +07:00
className="max-h-50"
placeholder="..."
rows={4}
value={course?.description}
2026-09-03 21:49:25 +07:00
readOnly
2026-08-19 21:15:42 +07:00
/>
2026-09-03 21:49:25 +07:00
</div>
</div>
2026-08-19 21:15:42 +07:00
</Card>
</div>
</>
);
}
export default CourseDetail;