feat: minor visual and feature updates

This commit is contained in:
swve 2024-07-20 19:09:57 +02:00
parent bfb977ac5d
commit c13a7b4538
7 changed files with 48 additions and 11 deletions

View file

@ -487,7 +487,6 @@ async def put_assignment_task_reference_file(
assignment.assignment_uuid, assignment.assignment_uuid,
assignment_task_uuid, assignment_task_uuid,
) )
course.thumbnail_image = name_in_disk
# Update reference file # Update reference file
assignment_task.reference_file = name_in_disk assignment_task.reference_file = name_in_disk

View file

@ -139,8 +139,17 @@ function ActivityClient(props: ActivityClientProps) {
</AuthenticatedClientElement> </AuthenticatedClientElement>
</div> </div>
</div> </div>
{activity && activity.published == false && (
<div className="p-7 drop-shadow-sm rounded-lg bg-gray-800">
<div className="text-white">
<h1 className="font-bold text-2xl">
This activity is not published yet
</h1>
</div>
</div>
)}
{activity ? ( {activity && activity.published == true && (
<div <div
className={`p-7 drop-shadow-sm rounded-lg ${bgColor}`} className={`p-7 drop-shadow-sm rounded-lg ${bgColor}`}
> >
@ -173,8 +182,6 @@ function ActivityClient(props: ActivityClientProps) {
)} )}
</div> </div>
</div> </div>
) : (
<div></div>
)} )}
{<div style={{ height: '100px' }}></div>} {<div style={{ height: '100px' }}></div>}
</div> </div>

View file

@ -12,7 +12,7 @@ import {
getCourseThumbnailMediaDirectory, getCourseThumbnailMediaDirectory,
getUserAvatarMediaDirectory, getUserAvatarMediaDirectory,
} from '@services/media/media' } from '@services/media/media'
import { ArrowRight, Check, File, Sparkles, Video } from 'lucide-react' import { ArrowRight, Backpack, Check, File, Sparkles, Video } from 'lucide-react'
import { useOrg } from '@components/Contexts/OrgContext' import { useOrg } from '@components/Contexts/OrgContext'
import UserAvatar from '@components/Objects/UserAvatar' import UserAvatar from '@components/Objects/UserAvatar'
import CourseUpdates from '@components/Objects/CourseUpdates/CourseUpdates' import CourseUpdates from '@components/Objects/CourseUpdates/CourseUpdates'
@ -185,6 +185,15 @@ const CourseClient = (props: any) => {
/> />
</div> </div>
)} )}
{activity.activity_type ===
'TYPE_ASSIGNMENT' && (
<div className="bg-gray-100 px-2 py-2 rounded-full">
<Backpack
className="text-gray-400"
size={13}
/>
</div>
)}
</div> </div>
<Link <Link
className="flex font-semibold grow pl-2 text-neutral-500" className="flex font-semibold grow pl-2 text-neutral-500"
@ -262,6 +271,27 @@ const CourseClient = (props: any) => {
</Link> </Link>
</> </>
)} )}
{activity.activity_type ===
'TYPE_ASSIGNMENT' && (
<>
<Link
className="flex grow pl-2 text-gray-500"
href={
getUriWithOrg(orgslug, '') +
`/course/${courseuuid}/activity/${activity.activity_uuid.replace(
'activity_',
''
)}`
}
rel="noopener noreferrer"
>
<div className="text-xs bg-gray-100 text-gray-400 font-bold px-2 py-1 rounded-full flex space-x-1 items-center">
<p>Assignment</p>
<ArrowRight size={13} />
</div>
</Link>
</>
)}
</div> </div>
</div> </div>
</> </>

View file

@ -90,7 +90,7 @@ export function AssignmentTaskGeneralEdit() {
<FormLabelAndMessage label="Reference file" message={formik.errors.hint} /> <FormLabelAndMessage label="Reference file" message={formik.errors.hint} />
<div className='flex space-x-1.5 text-xs items-center text-gray-500 '> <div className='flex space-x-1.5 text-xs items-center text-gray-500 '>
<Info size={16} /> <Info size={16} />
<p>Allowed formats : pdf, docx, mp4, jpg, jpeg, pptx</p> <p>Allowed formats : pdf, docx, mp4, jpg, jpeg, png, pptx</p>
</div> </div>
</div> </div>

View file

@ -181,7 +181,7 @@ export default function TaskFileObject({ view, assignmentTaskUUID }: TaskFileObj
)} )}
<div className='flex pt-4 font-semibold space-x-1.5 text-xs items-center text-gray-500 '> <div className='flex pt-4 font-semibold space-x-1.5 text-xs items-center text-gray-500 '>
<Info size={16} /> <Info size={16} />
<p>Allowed formats : pdf, docx, mp4, jpg, jpeg, pptx</p> <p>Allowed formats : pdf, docx, mp4, jpg, jpeg, png, pptx</p>
</div> </div>
{isLoading ? ( {isLoading ? (
<div className="flex justify-center items-center"> <div className="flex justify-center items-center">

View file

@ -305,7 +305,7 @@ function TaskQuizObject({ view, assignmentTaskUUID }: TaskQuizObjectProps) {
)} )}
</div> </div>
{view === 'teacher' && oIndex === question.options.length - 1 && ( {view === 'teacher' && oIndex === question.options.length - 1 && questions[qIndex].options.length <= 4 && (
<div className="flex justify-center mx-auto px-2"> <div className="flex justify-center mx-auto px-2">
<div <div
className="outline text-xs outline-3 outline-white px-2 shadow w-full flex items-center h-[30px] hover:bg-opacity-100 hover:shadow-md rounded-lg bg-white duration-150 cursor-pointer ease-linear nice-shadow" className="outline text-xs outline-3 outline-white px-2 shadow w-full flex items-center h-[30px] hover:bg-opacity-100 hover:shadow-md rounded-lg bg-white duration-150 cursor-pointer ease-linear nice-shadow"
@ -322,7 +322,7 @@ function TaskQuizObject({ view, assignmentTaskUUID }: TaskQuizObjectProps) {
</div> </div>
))} ))}
</div> </div>
{view === 'teacher' && ( {view === 'teacher' &&questions.length <= 5 && (
<div className="flex justify-center mx-auto px-2"> <div className="flex justify-center mx-auto px-2">
<div <div
className="flex w-full my-2 py-2 px-4 bg-white text-slate text-xs rounded-md nice-shadow hover:shadow-sm cursor-pointer space-x-3 items-center transition duration-150 ease-linear" className="flex w-full my-2 py-2 px-4 bg-white text-slate text-xs rounded-md nice-shadow hover:shadow-sm cursor-pointer space-x-3 items-center transition duration-150 ease-linear"

View file

@ -14,6 +14,7 @@ import { getAPIUrl } from '@services/config/config';
import toast from 'react-hot-toast'; import toast from 'react-hot-toast';
import Link from 'next/link'; import Link from 'next/link';
import { useParams } from 'next/navigation'; import { useParams } from 'next/navigation';
import { updateActivity } from '@services/courses/activities';
function AssignmentEdit() { function AssignmentEdit() {
const params = useParams<{ assignmentuuid: string; }>() const params = useParams<{ assignmentuuid: string; }>()
@ -74,7 +75,8 @@ function PublishingState() {
async function updateAssignmentPublishState(assignmentUUID: string) { async function updateAssignmentPublishState(assignmentUUID: string) {
const res = await updateAssignment({ published: !assignment?.assignment_object?.published }, assignmentUUID, access_token) const res = await updateAssignment({ published: !assignment?.assignment_object?.published }, assignmentUUID, access_token)
if (res.success) { const res2 = await updateActivity({ published: !assignment?.assignment_object?.published }, assignment?.activity_object?.activity_uuid, access_token)
if (res.success && res2) {
mutate(`${getAPIUrl()}assignments/${assignmentUUID}`) mutate(`${getAPIUrl()}assignments/${assignmentUUID}`)
toast.success('The assignment has been updated successfully') toast.success('The assignment has been updated successfully')
} }
@ -84,7 +86,6 @@ function PublishingState() {
} }
useEffect(() => { useEffect(() => {
console.log('assignment', assignment)
}, [assignment]) }, [assignment])
return ( return (