-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a widget for managing thumbnail #1568
Conversation
4c6f9e2
to
9fae066
Compare
082b78c
to
acd3322
Compare
...nts/DashboardVideoLiveControlPane/customs/DashboardVideoLiveConfirmationModal/index.spec.tsx
Outdated
Show resolved
Hide resolved
...mponents/DashboardVideoLiveControlPane/customs/DashboardVideoLiveConfirmationModal/index.tsx
Outdated
Show resolved
Hide resolved
...dVideoLiveControlPane/widgets/DashboardVideoLiveWidgetThumbnail/ThumbnailDisplayer/index.tsx
Outdated
Show resolved
Hide resolved
size="0.875rem" | ||
style={{ fontFamily: 'Roboto-Regular' }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
size="0.875rem" | |
style={{ fontFamily: 'Roboto-Regular' }} | |
size="xsmall" |
Roboto-Regular shouldn't be needed.
Also, maybe xsmall
provides a similar size ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to refute or confirm what you suggest, but i can't fin any correspondence table between pre-defined size and size in rem in grommet...
...veControlPane/widgets/DashboardVideoLiveWidgetThumbnail/ThumbnailRemoveButton/index.spec.tsx
Show resolved
Hide resolved
{video.thumbnail && video.thumbnail.urls ? ( | ||
<ThumbnailDisplayer thumbnail={video.thumbnail} /> | ||
) : ( | ||
<Image fit="cover" src={appData.static.img.liveBackground} /> | ||
)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe is there a way to use the same components for both static and uploaded thumbnails ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I put everything in one component
UseDeleteThumbnailError, | ||
UseDeleteThumbnailData | ||
>; | ||
export const useDeleteThumbnail = (options?: UseDeleteThumbnailOptions) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, you should add tests in src/frontend/data/queries/index.spec.tsx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes i forgot it ty !
...deoLiveControlPane/widgets/DashboardVideoLiveWidgetThumbnail/ThumbnailRemoveButton/index.tsx
Outdated
Show resolved
Hide resolved
onClickOutside={onModalCloseOrCancel} | ||
responsive={false} | ||
style={{ | ||
width: size === 'small' ? '95%' : '500px', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's huge difference. Are you sure about this values ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For info, this component comes from the PR on the shared live media : https://github.com/openfun/marsha/blob/9f991d654dfb754566af8ca8dd71c93ec49becd7/src/frontend/components/DashboardVideoLiveControlPane/customs/DashboardVideoLiveConfirmationModal/index.tsx
I think the values are correct because this is what I wanted : a almost full page modal when the screen is small, a medium fixed sized modal otherwise
...dVideoLiveControlPane/widgets/DashboardVideoLiveWidgetThumbnail/ThumbnailDisplayer/index.tsx
Outdated
Show resolved
Hide resolved
acd3322
to
4a94fd6
Compare
uploadManagerState, | ||
}: ThumbnailManagerProps) => { | ||
const intl = useIntl(); | ||
const thumbnailState = thumbnail ? thumbnail.upload_state : uploadState.READY; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can thumbnail
be undefined or null ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you're right, ty !
if (thumbnailState === uploadState.ERROR) { | ||
textMessage = intl.formatMessage(messages.noThumbnailUploaded); | ||
} else if ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the state is in error, should we really display this message ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I agree, i changed the message to be more accurate
textMessage = intl.formatMessage(messages.noThumbnailUploaded); | ||
} else if ( | ||
(thumbnailState === uploadState.PENDING && | ||
uploadManagerState[thumbnail!.id]?.status === |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need an assert here ? And you shouldn't use assert (or there is no reason to use typescript in the project)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot to remove it, ty
(thumbnailState === uploadState.PENDING && | ||
uploadManagerState[thumbnail!.id]?.status === | ||
UploadManagerStatus.UPLOADING) || | ||
uploadManagerState[thumbnail!.id]?.status === UploadManagerStatus.INIT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment here about the assert
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot to remove it, ty
|
||
let textMessage = null; | ||
|
||
if (thumbnailState === uploadState.ERROR) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like you can externalize these if else if
from this component (like in a dedicated file).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mm the point of the ThumbnailManager was already to externalize the logic you are talking about
...dVideoLiveControlPane/widgets/DashboardVideoLiveWidgetThumbnail/ThumbnailDisplayer/index.tsx
Outdated
Show resolved
Hide resolved
|
||
export const ThumbnailDisplayer = ({ | ||
rounded, | ||
thumbnail, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you should use a thumbnail here, you are using only the urls.
If you change your component props to receive urls you will be able to use this component to render the default background with it.
CF : https://github.com/openfun/marsha/pull/1568/files#r891150092
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put everything in one component
And it would probably be easier if this is split in 2 PR:
|
121cf48
to
4a49034
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default live background is display with a very high size in the dashboard with firefox
...nts/DashboardVideoLiveControlPane/customs/DashboardVideoLiveConfirmationModal/index.spec.tsx
Outdated
Show resolved
Hide resolved
...veControlPane/widgets/DashboardVideoLiveWidgetThumbnail/ThumbnailRemoveButton/index.spec.tsx
Show resolved
Hide resolved
if (thumbnail.upload_state === uploadState.ERROR) { | ||
textMessage = intl.formatMessage(messages.thumbnailError); | ||
} else if ( | ||
(thumbnail.upload_state === uploadState.PENDING && | ||
uploadManagerState[thumbnail.id]?.status === | ||
UploadManagerStatus.UPLOADING) || | ||
uploadManagerState[thumbnail.id]?.status === UploadManagerStatus.INIT | ||
) { | ||
textMessage = intl.formatMessage(messages.thumbnailUploaded); | ||
} else if ( | ||
thumbnail.upload_state === uploadState.PROCESSING || | ||
(thumbnail.upload_state === uploadState.PENDING && | ||
uploadManagerState[thumbnail.id]?.status === UploadManagerStatus.SUCCESS) | ||
) { | ||
textMessage = intl.formatMessage(messages.thumbnailProcessed); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I insist, you can externalize this in a dedicated function returning a Nullable, and this component will be cleaner
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
...deoLiveControlPane/widgets/DashboardVideoLiveWidgetThumbnail/ThumbnailRemoveButton/index.tsx
Show resolved
Hide resolved
} else { | ||
id = thumbnail.id; | ||
} | ||
addUpload(modelName.THUMBNAILS, id, event.target.files![0]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove this assert ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
> | ||
<Box direction={'column'} justify={'center'} gap="small"> | ||
{!thumbnail || | ||
(thumbnail && !thumbnail.urls && !uploadManagerState[thumbnail!.id]) ? ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And this one too ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
<Stack anchor="top-right"> | ||
<Box> | ||
<ThumbnailManager | ||
thumbnail={thumbnail!} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And this one too ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
<PictureSVG height="24px" width="24px" iconColor="blue-active" /> | ||
</Box> | ||
} | ||
onClick={() => hiddenFileInput.current!.click()} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And this one too ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
...dVideoLiveControlPane/widgets/DashboardVideoLiveWidgetThumbnail/ThumbnailDisplayer/index.tsx
Show resolved
Hide resolved
248426d
to
836b074
Compare
Indeed, there was a display problem on the thumbnail (display was different whether you accessed the website from Firefox or Chrome). It's now fixed. |
e8fe35e
to
5bf4a97
Compare
CHANGELOG.md
Outdated
@@ -20,6 +20,7 @@ Versioning](https://semver.org/spec/v2.0.0.html). | |||
- Add Legacy LTI configuration XML | |||
- Add an instructor widget to modify join the discussion mode | |||
- Prevent join API calls in join mode denied | |||
- Add a widget for the instructor to upload a live video thumbnail |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remember to move it in the Unreleased
section
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, ty !
Add a Bin SVG (used for deletion) and a Picture SVG (used for upload image button) to the project.
5bf4a97
to
95940a1
Compare
Update advertising student screen, to display the uploaded thumbnail, when it exists.
95940a1
to
a1f9735
Compare
Add a button for removing thumbnail (and add its associated queries). Add a component to manage what to display when thumbnail is uploaded. Add a confirmation modal for when an user wants to delete a thumbnail. Co-Authored-By: Manuel Raynaud <[email protected]> Co-Authored-By: Nicolas Clerc <[email protected]>
Add a widget to allow teacher to upload a thumbnail for its live. It also allows him to replace it or delete it and display the default thumbnail.
a1f9735
to
6a071fb
Compare
Purpose
Add a widget for uploading a thumbnail for the live video.
It also allows the instructor to replace it and/or delete it to get back to the default thumbnail.
The thumbnail is displayed when the live is starting or paused (on the student side) and when the video is converted to a VOD.
Caution : For now deleting a thumbnail is not working, because there is a bug on python soft delete (see here)