mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: add update creation time indicator
This commit is contained in:
parent
8a2ccb2534
commit
1d9445db70
1 changed files with 16 additions and 3 deletions
|
|
@ -18,6 +18,10 @@ import { useOrg } from '@components/Contexts/OrgContext'
|
||||||
import { createCourseUpdate, deleteCourseUpdate } from '@services/courses/updates'
|
import { createCourseUpdate, deleteCourseUpdate } from '@services/courses/updates'
|
||||||
import toast from 'react-hot-toast'
|
import toast from 'react-hot-toast'
|
||||||
import ConfirmationModal from '@components/StyledElements/ConfirmationModal/ConfirmationModal'
|
import ConfirmationModal from '@components/StyledElements/ConfirmationModal/ConfirmationModal'
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
import relativeTime from 'dayjs/plugin/relativeTime';
|
||||||
|
|
||||||
|
dayjs.extend(relativeTime);
|
||||||
|
|
||||||
function CourseUpdates() {
|
function CourseUpdates() {
|
||||||
const course = useCourse() as any;
|
const course = useCourse() as any;
|
||||||
|
|
@ -194,8 +198,17 @@ const UpdatesListView = () => {
|
||||||
return (
|
return (
|
||||||
<div className='px-5 bg-white overflow-y-auto' style={{ maxHeight: '400px' }}>
|
<div className='px-5 bg-white overflow-y-auto' style={{ maxHeight: '400px' }}>
|
||||||
{updates && updates.map((update: any) => (
|
{updates && updates.map((update: any) => (
|
||||||
<div key={update.id} className='py-2 border-b border-neutral-200'>
|
<div key={update.id} className='py-2 border-b border-neutral-200 antialiased'>
|
||||||
<div className='font-bold text-gray-500 flex space-x-2 items-center justify-between '>{update.title} {isAdmin && <DeleteUpdateButton update={update} />}</div>
|
<div className='font-bold text-gray-500 flex space-x-2 items-center justify-between '>
|
||||||
|
<div className='flex space-x-2 items-center'>
|
||||||
|
<span> {update.title}</span>
|
||||||
|
<span
|
||||||
|
title={"Created at " + dayjs(update.creation_date).format('MMMM D, YYYY')}
|
||||||
|
className='text-xs font-semibold text-gray-300'>
|
||||||
|
{dayjs(update.creation_date).fromNow()}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
{isAdmin && <DeleteUpdateButton update={update} />}</div>
|
||||||
<div className='text-gray-600'>{update.content}</div>
|
<div className='text-gray-600'>{update.content}</div>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue