jaw-sh / stream-nexus

Unified multicast stream chat overlay.
25 stars 8 forks source link

Add simple poll command #5

Closed cohlexyz closed 1 year ago

cohlexyz commented 1 year ago

Adds a simple poll command. I initially thought about handling commands on the server side, but two things kept me from doing so:

  1. I fucking hate rust
  2. This worked just as well

Basic functionality is:

Not the most elegant solution, but it works. Currently the user who can start and stop polls is hardcoded here which should probably be configurable.

Screenshots: image image

jaw-sh commented 1 year ago

Is your flyout message robust enough that I could stick paid-for chats under it?

cohlexyz commented 1 year ago

It would need some changes. If the html looked like this:

 <main></main>
    <div id="flyout">
        <div id="poll-ui">
        </div>
        <div id="superchat-ui">
            <div class="superchat">
                <strong>Chuck</strong> ($5.00)
                <p>Message text</p>
            </div>
        </div>
    </div>

you could insert the messages into superchat-ui and they'd be below the poll, but it's not a completely smooth transition when showing and hiding the poll:

https://github.com/jaw-sh/stream-nexus/assets/142505474/e9e87c44-ec30-4311-a9df-34a4831e42f5

cohlexyz commented 1 year ago

I'm not sure how far you are along with implementing premium chats, so that last commit can be removed if you have your own implementation. I tested this today and it seems like premium chats from rumble are not coming in so I just send my own "donations" to the websocket server for testing. With the last commit it now looks like this:

https://github.com/jaw-sh/stream-nexus/assets/142505474/964fd002-8ee2-4574-928d-0e1f9ec44f0f

The chats time out after 30 seconds, which should probably be configurable. The oldest ones will also be removed if there's more than five on screen. Also the message is cut off after 80 characters to make sure each donation doesn't take up more than two lines.