diff --git a/.storybook/main.js b/.storybook/main.js index 54b5050b..207fe186 100644 --- a/.storybook/main.js +++ b/.storybook/main.js @@ -1,4 +1,5 @@ const svgrPlugin = require("vite-plugin-svgr"); +const path = require("path"); module.exports = { stories: ["../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"], @@ -9,6 +10,14 @@ module.exports = { }, async viteFinal(config) { config.plugins.push(svgrPlugin()); + config.resolve = config.resolve || {}; + config.resolve.alias = config.resolve.alias || {}; + config.resolve.alias["$(res)"] = path.resolve( + __dirname, + "../node_modules/matrix-react-sdk/res" + ); + config.resolve.dedupe = config.resolve.dedupe || []; + config.resolve.dedupe.push("react", "react-dom", "matrix-js-sdk"); return config; }, }; diff --git a/src/Header.stories.jsx b/src/Header.stories.jsx index 6d9a7141..2ab16962 100644 --- a/src/Header.stories.jsx +++ b/src/Header.stories.jsx @@ -1,5 +1,5 @@ import React from "react"; -import { GridLayoutMenu } from "./GridLayoutMenu"; +import { GridLayoutMenu } from "./room/GridLayoutMenu"; import { Header, HeaderLogo, diff --git a/src/room/InCallView.jsx b/src/room/InCallView.jsx index ffe2c1dc..bfcfa8ed 100644 --- a/src/room/InCallView.jsx +++ b/src/room/InCallView.jsx @@ -10,6 +10,7 @@ import { Header, LeftNav, RightNav, RoomHeaderInfo } from "../Header"; import VideoGrid, { useVideoGridLayout, } from "matrix-react-sdk/src/components/views/voip/GroupCallView/VideoGrid"; +import { VideoTileContainer } from "matrix-react-sdk/src/components/views/voip/GroupCallView/VideoTileContainer"; import SimpleVideoGrid from "matrix-react-sdk/src/components/views/voip/GroupCallView/SimpleVideoGrid"; import "matrix-react-sdk/res/css/views/voip/GroupCallView/_VideoGrid.scss"; import { getAvatarUrl } from "../matrix-utils"; @@ -140,10 +141,18 @@ export function InCallView({ + > + {({ item, ...rest }) => ( + + )} + )}
diff --git a/src/video-grid/VideoGrid.stories.jsx b/src/video-grid/VideoGrid.stories.jsx new file mode 100644 index 00000000..f716eba6 --- /dev/null +++ b/src/video-grid/VideoGrid.stories.jsx @@ -0,0 +1,45 @@ +import React, { useState } from "react"; +import VideoGrid from "matrix-react-sdk/src/components/views/voip/GroupCallView/VideoGrid"; +import VideoTile from "matrix-react-sdk/src/components/views/voip/GroupCallView/VideoTile"; +import "matrix-react-sdk/res/css/views/voip/GroupCallView/_VideoGrid.scss"; +import { useMemo } from "react"; + +export default { + title: "VideoGrid", + parameters: { + layout: "fullscreen", + }, + argTypes: { + layout: { + options: ["freedom", "spotlight"], + control: { type: "radio" }, + }, + }, +}; + +export const ParticipantsTest = ({ layout, participantCount }) => { + const items = useMemo( + () => + new Array(participantCount).fill(undefined).map((_, i) => ({ + id: (i + 1).toString(), + focused: false, + presenter: false, + })), + [participantCount] + ); + + return ( +
+ + {({ item, ...rest }) => ( + + )} + +
+ ); +}; + +ParticipantsTest.args = { + layout: "freedom", + participantCount: 1, +};