-
Notifications
You must be signed in to change notification settings - Fork 124
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
Allow the DisabledComposerView
to have a HTML templated description
#864
Conversation
Changes used in matrix-org/matrix-viewer#54 so we can add a link.
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'm very surprised if this actually allows you to return DOM nodes from the VM property (not something we typically do in MVVM but I can see why you want to take that shortcut here) rather than a string, as the change you made should actually add a text binding which coerces the result of the binding to a string and updates the DOM by setting node.textContent
... did you actually see this working?
Ideally you would be able to inject an alternative view for DisabledComposerView
but there is no good way to do this currently without breaking tree-shaking during bundling (which you don't care about as you're on the server, but for browser builds we do actually want). Need to think of a better solution...
@bwindels The current method works and what drives this UI in the archive:
It can't just be a string because it has a link in the middle of it. Any way forward will work though 🙂 |
Yeah, I know just a string is not what you need, I was just trying to make sense of how it can work. But actually, I just realized I was reading the diff wrong 🤦 You are removing the text binding, rather than adding it. In that case, yes, I can see how that would allow you to return DOM nodes from the view model. I'd be fine to take this shortcut for now, but the problem with your change is that updates from the As I said, I need to think of a better solution ... |
Actually, I think the proper thing to do here will be to use the |
This seems like a cop-out to me. Although this seems fine today because
In some cases, whole components might need to be swapped but maybe we need slots for that (see how I replaced the To me, it seems like we're just running into a composability problem. Things are way too tightly coupled to random Hydrogen things with hard to penetrate abstractions. Right now, we're running into some teething problems trying to adapt the one and only Hydrogen use case to something slightly different. It still seems crazy that I can't just provide a room meta data object and a list of events to a I know you have apprehension and believe the use cases are more separate than how I look at it so some compromise is probably the correct solution to some of these things. |
I hear you, but our understanding of what To me, it's a library to build or embed an interactive matrix chat client. You can either build your own UI on top of From your comment above, you seem to view it as a collection of chat-related utilities from which you can grab any component in isolation and expect a logical and extensible interface close to your needs. Given your use case, I can see why you would want that, but I think that we just don't have the manpower to provide that and it might also collide with some optimizations. The biggest reason the abstractions are sometimes not as clean as you would like is that Hydrogen relies heavily on storage to be fast. It stores data in denormalized fashion as it comes in through sync. That implementation detail bleeds into most classes in Having said that, I'm sure things can be improved, and if you have any concrete suggestions where abstractions could be cleaned up, I'd be happy to hear them. I continue to suspect that using I'd be open however to your idea of allowing to inject subview constructors into a view ( There is also the fact that this approach, doing injection at runtime, prevents proper tree-shaking of code that is not used. But I can't think of a good way to do it at compile-time while providing the SDK as an npm package, so perhaps the runtime approach is better than nothing. Wrt to the mock-http-storage approach, if it helps, we could put a |
In any case, I've refactored things to use
Video call rooms don't have much historical value without playback but there could be many more room types that would. Also depends on the type of widgets but they could have historical context as well. Like if polls was an inline widget as originally proposed, it would be nice to see the vote summary. Or a widget that shows the review queue count in the UI, it would be nice to see the count at the time (granted the widget needs to be smarter than grab the latest state for this kind of thing). We want many of the fancy features of the room/timeline today, lightbox, context menu options including dialog/modals like "View source", stick to bottom/top, member list and inspecting a single member, probably some spaces hierarchy exploration, threading. What about threads? Will threads be implemented as part of
To be clear, I don't like this aspect of having our own custom Ideally, we would be using the same
This is a great point if the simple grid layout was all that is necessary 👍
Maybe. I don't really have problem with doing the fake HTTP part of it especially since the use-case can morph. The rest of the Hydrogen But as an alternative, it feels more like I should be able to do Pseudo codeconst room = await createRoomWithEvents('!foo:bar', events);
const timeline = await room.openTimeline();
const timelineVM = new TimelineViewModel({
timeline,
roomVM: { room }
});
const view = new TimelineView(timelineVM, viewClassForTile);
view.mount();
const app = document.querySelector('#app');
app.appendChild(view.root()); Closing this PR as it's no longer necessary but would love to continue this conversation to make things more sane. |
Allow the
DisabledComposerView
to have a HTML templated description. Changes used in matrix-org/matrix-viewer#54 so we can add a link.The previous behavior is still possible by providing
description: (vm) => vm.description
.Dev notes
LowerPowerLevelViewModel
ArchivedViewModel