Repository navigation
Add video block show metadata option - #1696
Conversation
owi92
left a comment
There was a problem hiding this comment.
Thank you for the PR, and sorry for the delay in reviewing.
I think this is a reasonable and useful feature to add. I have a few comments on the frontend code, but otherwise this looks good to me.
owi92
left a comment
There was a problem hiding this comment.
Thanks again. I think Lukas wanted to take a look at this before we merge it, but he's on vacation right now. We'll probably get it in next week.
This comment was marked as resolved.
This comment was marked as resolved.
This adds the show metadata option for the video block to show supplemental metadata for embedded videos.
5377270 to
743f249
Compare
LukasKalbertodt
left a comment
There was a problem hiding this comment.
Why copy & pasting that much code from routes/Video.tsx? I haven't checked everything but the snippets I did check matched that other code 1:1 basically. I would extract the relevant parts of the code of Video.tsx into a component and use it in both places. I saw your comment saying extracting that component isn't easy and sth sth coupling, but I don't quite follow there. Should certainly be possible to deduplicate that. If you need help with that, just let us know.
Also:
- I think we should maintain the same behavior as on the video page: show the description block even if the description is empty. I think the consistent layout outweighs the "useless block in some cases".
- In your current solution, the description does not use automatic link and timestamp detection. That will also be fixed by just deduplicating the code.
- The metadata table here also doesn't show the series or the duration. Again, I don't see why that would be advantageous, and I'd argue for keeping it consistent with the video page.
Otherwise: yeah, seems like a useful feature!
| event: row.video::<Option<Key>>().map(Id::event), | ||
| show_title: unwrap_type_dep(row.show_title(), "event", "show_title"), | ||
| show_link: unwrap_type_dep(row.show_link(), "event", "show_link"), | ||
| show_metadata: unwrap_type_dep(row.show_metadata(), "event", "show_metadata"), |
There was a problem hiding this comment.
This made me wonder about existing video blocks. The show_metadata column is not NOT NULL, i.e. it can be null, but it has a default of false. So all added blocks have false in that column, which is also true for our test DB dumps. So I guess the only way a null could sneak in there if we set it explicitly right? And from grepping the code base it does not seem like there is any way Tobira sets it to null.
So I guess it's fine! For series and playlist we have a DB constraint to make sure its not null and I guess it would be nice for events as well, but no need to introduce a new migration in this PR. So yeah, just wanted to write down my reasoning here, no need for action.
LukasKalbertodt
left a comment
There was a problem hiding this comment.
There is still lots of code duplication in this PR and the latest commit confuses me a bit in terms of how it approaches deduplicating code. It seems to pull out rather small parts of routes/Video components instead of lots at once. If you'd like some guidance on how I would approach it, let me know.
|
I was, or I am still :D, confused about the structure. For me, routes should have dependencies on the ui package, but not vice versa. But maybe that's a misconception on my part. |
I agree, the current code structure and import graph is... suboptimal to say the least. This is one of the things we want to tackle over the coming weeks. I decided to take this PR and add some commits on top of it as #1810. That's because in the next few weeks we want to move quickly and I didn't want to make you go through another review round after all that time. I will keep this PR open, as I think github will mark it as "merged" once the other one is merged (since all commits will be on |
This is based on #1696, merges `main` (instead of rebase to not touch the original commits) and refactors it a bit. This adds a migration file but does not enable it yet, to keep the next release migration-free. It is not needed for the functionality, just adds some checks. Do not review commit by commit, but as a whole. Frontend changes can now easily be reviewed with `git diff upstream/main --color-moved=dimmed-zebra --color-moved-ws=allow-indentation-change -- frontend`. Most code is just moved from `routes/Video.tsx` to `ui/metadata.tsx` unchanged.
This PR introduces the option to display supplemental metadata for embedded videos within the video block.
Without description:
