Lecture view additional features - #390
szebiniso-tuwien merged 36 commits into
Conversation
…ts without a group
…lecture-view # Conflicts: # packages/labextension/src/app/components/grader-service/assignments/assignment-group.tsx # packages/labextension/style/css/output.css
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…release them in one
…onal-features-dialog-overflow fix: overflowing text for release, delete, edit dialogs
…-Wien-dataLAB/grader-service into feat/lecture-view-additional-features
…b.com/TU-Wien-dataLAB/grader-service into feat/lecture-view-additional-features # Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit.
…-Wien-dataLAB/grader-service into feat/lecture-view-additional-features
There was a problem hiding this comment.
I looked through the design again, and I think that we need this component only for the release dialog. Maybe it would be also fine if we just migrate this component to release-dialog.tsx? :)
There was a problem hiding this comment.
Make sense, I just moved that out to make release-dialog component more shorten so it looks easier to read and understand. Should I move that in? ))
| case 'released': | ||
| return <ReleasedAssignmentBadge />; | ||
| case 'complete': | ||
| return <Badge>Completed</Badge>; |
There was a problem hiding this comment.
There is a CompletedAssignmentBadge component that we can use here :)
| if (!props.assignments) { | ||
| return 'Release assignments'; | ||
| } | ||
|
|
||
| if (props.isAssignmentsGrouped || Array.isArray(props.assignments)) { | ||
| return 'Release assignments'; | ||
| } | ||
|
|
||
| if (typeof props.assignments === 'object' && props.assignments.name) { | ||
| return `Release ${props.assignments.name}`; | ||
| } | ||
|
|
||
| return 'Release assignments'; |
There was a problem hiding this comment.
I might be missing something, but I am a bit confused regarding the checks here. I don't know if the suggestion would be correct, I tried it out and it seemed to work fine as well :) But please correct me if I am missing something!
| if (!props.assignments) { | |
| return 'Release assignments'; | |
| } | |
| if (props.isAssignmentsGrouped || Array.isArray(props.assignments)) { | |
| return 'Release assignments'; | |
| } | |
| if (typeof props.assignments === 'object' && props.assignments.name) { | |
| return `Release ${props.assignments.name}`; | |
| } | |
| return 'Release assignments'; | |
| if (props.isAssignmentsGrouped || Array.isArray(props.assignments)) { | |
| return 'Release assignments'; | |
| } | |
| return `Release ${props.assignments.name}`; |
There was a problem hiding this comment.
Yeah, make sense, looks good. Let me check all test cases with version ))
| onSubmit: async ({ value }) => { | ||
| if (props.isAssignmentsGrouped) { | ||
| const flatAssignments = Object.values(props.assignments).flat(); | ||
| await handleAssignmentsRelease(flatAssignments, props.lectureId); | ||
| } | ||
| if (Array.isArray(props.assignments)) { | ||
| await handleAssignmentsRelease(props.assignments, props.lectureId); | ||
| } else { | ||
| await handleRelease(props.assignments, props.lectureId); | ||
| } | ||
| props.setOpenDialog(false); | ||
| } |
There was a problem hiding this comment.
I know it might seem weird, but the hooks (handleAssignmentsRelease and handleRelease) are actually not asynchronous, since we use mutate in the background and not mutateAsync. So the await and async operators are not necessary here :)
There was a problem hiding this comment.
oh, really. Okk I'll look again and fix this moment )
| style={{ wordBreak: 'break-all' }} | ||
| className={ | ||
| 'flex flex-col p-6 gap-4 items-start self-stretch border-t border-border' |
There was a problem hiding this comment.
| style={{ wordBreak: 'break-all' }} | |
| className={ | |
| 'flex flex-col p-6 gap-4 items-start self-stretch border-t border-border' | |
| className={ | |
| 'flex flex-col p-6 gap-4 items-start self-stretch border-t border-border break-all' |
There was a problem hiding this comment.
does it work? just that option wasn't working on my end
| style={{ wordBreak: 'break-all' }} | ||
| className={ | ||
| 'flex flex-col p-6 gap-4 items-start self-stretch border-t border-border' |
There was a problem hiding this comment.
| style={{ wordBreak: 'break-all' }} | |
| className={ | |
| 'flex flex-col p-6 gap-4 items-start self-stretch border-t border-border' | |
| className={ | |
| 'flex flex-col p-6 gap-4 items-start self-stretch border-t border-border break-all' |
| }); | ||
|
|
||
| const handleDeleteAssignment = (assignmentId: number, lectureId: number) => { | ||
| const handleDeleteAssignment = async ( |
There was a problem hiding this comment.
I don't know how this reappeared but async is not needed here :)
| render={ | ||
| <span className="inline-block"> | ||
| <Button | ||
| className={'ml-auto cursor-pointer'} |
There was a problem hiding this comment.
I see that cursor-pointer has been added at multiple places for button, maybe we should just add the class in the button component? :)
There was a problem hiding this comment.
Yeah, make sense, I thought about that and maybe add switcher to turn on/off the cursor style
| <DialogTitle> | ||
| {props.assignment | ||
| ? `Edit ${props.assignment.name}` | ||
| ? `Edit ${truncateText(props.assignment.name, 40)}` | ||
| : 'New Assignment'} | ||
| </DialogTitle> |
There was a problem hiding this comment.
Could we achieve the same behavior with css classes?
There was a problem hiding this comment.
I tried, but tailwind.css seems doesn't support. Or you mean css itself?
nadjajovancevic
left a comment
There was a problem hiding this comment.
Just a few small remarks, nothing too important :)
Additional features include:
Fixes: