Skip to content
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

Thumbnail make boxes same size #1210

Merged
merged 3 commits into from
Jan 18, 2024

Conversation

Arnei
Copy link
Member

@Arnei Arnei commented Nov 7, 2023

Currently in the thumbnail view, the videos are the same size as the thumbnails. However, the outlines surrounding them are different, as the outline around the thumbnails also contains buttons. This enlarges the videos to make the outlines have the same width.

Partially addresses #1207. From a usability point-of-view, I don't think making the timeline the same width as the stuff above it is currently reasonable. Since we cannot zoom into the timeline (yet™), it should be as wide as possible.

Arnei added 2 commits November 7, 2023 11:53
Currently in the thumbnail view, the videos are the same size
as the thumbnails. However, the outlines surrounding them are
different, as the outline around the thumbnails also contains buttons.
This enlarges the videos to make the outlines have the same width.
The timeline in the thumbnail view did not stretch to the full width
of the available screenspace in some cases (e.g. when there is only
one video). This fixes that.
@Arnei Arnei added the type:visual-clarity A part of the UI is not visually readable label Nov 7, 2023
Copy link

github-actions bot commented Nov 7, 2023

This pull request is deployed at test.editor.opencast.org/1210/2023-11-07_11-05-10/ .
It might take a few minutes for it to become available.

Copy link
Member

@LukasKalbertodt LukasKalbertodt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to work! I agree that the timeline should stretch the full width.

@@ -37,7 +37,7 @@ const VideoPlayers: React.FC<{refs: any, widthInPercent?: number}> = ({refs, wid
borderRadius: '5px',
...(flexGapReplacementStyle(10, false)),

maxHeight: '300px',
maxHeight: maxHeightInPixel + 'px',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Editor is also using emotion-js, right? You should be able to just pass integers here. Also the borderRadius: 5 above should just work. But if the whole codebase uses + 'px' already, then it's probably not necessary to fix this for this one PR now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does use Emotion, but not emotion-js specifically I think? Anyway, I like being specific about my units :D

@@ -106,7 +107,8 @@ const Thumbnail : React.FC = () => {
discard={discardThumbnail}
/>
<div css={bottomStyle}>
<VideoPlayers refs={generateRefs} widthInPercent={100}/>
{/* use maxHeightInPixel to make video players the same size*/}
<VideoPlayers refs={generateRefs} widthInPercent={100} maxHeightInPixel={376}/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This magic number depends on the width of the buttons. If a button is hidden (like in #1208), the width changes.

image

So this should likely have a different solution. Maybe both boxes just get a fixed width. Or something else.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welp, that teaches me to not go for the quick and dirty solution. I'll see if I can get a proper solution working, but that'll require some time.

Now actually gets the width from the video boxes. Still uses magic
numbers a bit though.
Copy link

github-actions bot commented Nov 8, 2023

This pull request is deployed at test.editor.opencast.org/1210/2023-11-08_08-27-25/ .
It might take a few minutes for it to become available.

Copy link
Member

@LukasKalbertodt LukasKalbertodt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure this approach is the best solution. This gets the width once in the render code and is only updated on rerender. Maybe the width can change without a rerender happening? E.g. text wrapping, other CSS wrapping or screen-width based logic? I feel a fully CSS-based solution might be better, i.e. wrapping everything in a flex or grid and then let one child control the column width, the other child just filling the column.

However, it seems to work and I couldn't find any problems in practice. And I know this kind of sizing via CSS can be very tricky to get right, I struggled a lot with it and even found browser bugs. So I don't want to block merging on this theoretical concern.


const { t } = useTranslation()
const theme = useTheme();

// The "+40" comes from padding that is not included in the "getWidth" function
const videoWidth = generateRef ? generateRef.getWidth() + 40 : undefined
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would using offsetWidth instead of clientWidth remove the need to add 40 manually?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It did not

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sad 🤷

@Arnei Arnei merged commit 4ab76ea into opencast:main Jan 18, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:visual-clarity A part of the UI is not visually readable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants