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

@ -139,8 +139,17 @@ function ActivityClient(props: ActivityClientProps) {
</AuthenticatedClientElement>
</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
className={`p-7 drop-shadow-sm rounded-lg ${bgColor}`}
>
@ -173,8 +182,6 @@ function ActivityClient(props: ActivityClientProps) {
)}
</div>
</div>
) : (
<div></div>
)}
{<div style={{ height: '100px' }}></div>}
</div>

View file

@ -12,7 +12,7 @@ import {
getCourseThumbnailMediaDirectory,
getUserAvatarMediaDirectory,
} 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 UserAvatar from '@components/Objects/UserAvatar'
import CourseUpdates from '@components/Objects/CourseUpdates/CourseUpdates'
@ -185,6 +185,15 @@ const CourseClient = (props: any) => {
/>
</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>
<Link
className="flex font-semibold grow pl-2 text-neutral-500"
@ -262,6 +271,27 @@ const CourseClient = (props: any) => {
</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>
</>

View file

@ -90,7 +90,7 @@ export function AssignmentTaskGeneralEdit() {
<FormLabelAndMessage label="Reference file" message={formik.errors.hint} />
<div className='flex space-x-1.5 text-xs items-center text-gray-500 '>
<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>

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 '>
<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>
{isLoading ? (
<div className="flex justify-center items-center">

View file

@ -305,7 +305,7 @@ function TaskQuizObject({ view, assignmentTaskUUID }: TaskQuizObjectProps) {
)}
</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="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>
{view === 'teacher' && (
{view === 'teacher' &&questions.length <= 5 && (
<div className="flex justify-center mx-auto px-2">
<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"

View file

@ -14,6 +14,7 @@ import { getAPIUrl } from '@services/config/config';
import toast from 'react-hot-toast';
import Link from 'next/link';
import { useParams } from 'next/navigation';
import { updateActivity } from '@services/courses/activities';
function AssignmentEdit() {
const params = useParams<{ assignmentuuid: string; }>()
@ -74,7 +75,8 @@ function PublishingState() {
async function updateAssignmentPublishState(assignmentUUID: string) {
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}`)
toast.success('The assignment has been updated successfully')
}
@ -84,7 +86,6 @@ function PublishingState() {
}
useEffect(() => {
console.log('assignment', assignment)
}, [assignment])
return (