Take control over your live stream video by running it yourself. Streaming + chat out of the box.
HTML activitypubbroadcastingchatdecentralizedfederationfediversegolanghacktoberfesthlslivelivestreamowncastrtmpself-hostedstreaming-videovideo
fix(web): constrain single follower card width
Gabe Kangas139e60bd3e24
diff --git a/web/components/ui/followers/FollowerCollection/FollowerCollection.module.scss b/web/components/ui/followers/FollowerCollection/FollowerCollection.module.scssindex 990bd6585a..56061f0e23 100644--- a/web/components/ui/followers/FollowerCollection/FollowerCollection.module.scss+++ b/web/components/ui/followers/FollowerCollection/FollowerCollection.module.scss@@ -9,7 +9,7 @@.followerRow {display: grid;gap: 16px 0;- grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));+ grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));grid-auto-rows: min-content;> * {diff --git a/web/components/ui/followers/FollowerCollection/FollowerCollection.stories.tsx b/web/components/ui/followers/FollowerCollection/FollowerCollection.stories.tsxindex 849b871954..e4ec74ef64 100644--- a/web/components/ui/followers/FollowerCollection/FollowerCollection.stories.tsx+++ b/web/components/ui/followers/FollowerCollection/FollowerCollection.stories.tsx@@ -1,4 +1,4 @@-import { StoryFn, Meta } from '@storybook/nextjs';+import { Meta, StoryFn, StoryObj } from '@storybook/nextjs';import { Provider } from 'jotai';import { http, HttpResponse } from 'msw';import { FollowerCollection } from './FollowerCollection';@@ -234,6 +234,11 @@ const noFollowersData = {results: [],};+const singleFollowerData = {+ total: 1,+ results: mockFollowersData.results.slice(0, 1),+};+const meta = {title: 'owncast/Components/Followers/Followers collection',component: FollowerCollection,@@ -243,6 +248,7 @@ const meta = {} satisfies Meta<typeof FollowerCollection>;export default meta;+type Story = StoryObj<typeof meta>;const Template: StoryFn<typeof FollowerCollection> = (args: object) => (<Provider>@@ -264,6 +270,73 @@ export const NoFollowers = {},};+const singleFollowerStory = {+ render: Template,+ args: {+ name: 'Example stream name',+ onFollowButtonClick: () => {},+ },++ parameters: {+ msw: {+ handlers: [+ http.get('/api/followers*', () => {+ return HttpResponse.json(singleFollowerData);+ }),+ ],+ },+ },++ play: async ({ canvasElement }) => {+ const deadline = Date.now() + 5000;+ let follower: HTMLElement | null = null;++ while (!follower && Date.now() < deadline) {+ follower = canvasElement.querySelector<HTMLElement>('.followers-follower');+ if (!follower) {+ const { promise, resolve } = Promise.withResolvers<void>();+ window.setTimeout(resolve, 100);+ // eslint-disable-next-line no-await-in-loop+ await promise;+ }+ }++ const collection = canvasElement.querySelector('#followers-collection');+ if (!follower || !collection) {+ throw new Error('Single follower story did not render');+ }++ const collectionWidth = collection.getBoundingClientRect().width;+ const followerWidth = follower.getBoundingClientRect().width;+ if (collectionWidth >= 600 && followerWidth > collectionWidth / 2) {+ throw new Error('Single follower expanded beyond one grid column');+ }+ },+} satisfies Story;++export const SingleFollowerOfflineFullWidth = {+ ...singleFollowerStory,+ parameters: {+ ...singleFollowerStory.parameters,+ chromatic: { viewports: [1568] },+ },+} satisfies Story;++export const SingleFollowerOnlineWithChatWidth = {+ ...singleFollowerStory,+ decorators: [+ Story => (+ <div style={{ width: 'calc(100% - 320px)' }}>+ <Story />+ </div>+ ),+ ],+ parameters: {+ ...singleFollowerStory.parameters,+ chromatic: { viewports: [1568] },+ },+} satisfies Story;+export const Example = {render: Template,