11 files changed
+152
-24
No files matched your search
@@ -12,6 +12,7 @@
|
|||||||
"@bedrock-layout/split": "^2.3.5",
|
"@bedrock-layout/split": "^2.3.5",
|
||||||
"@bedrock-layout/stack": "^2.3.4",
|
"@bedrock-layout/stack": "^2.3.4",
|
||||||
"@bedrock-layout/use-forwarded-ref": "^1.1.11",
|
"@bedrock-layout/use-forwarded-ref": "^1.1.11",
|
||||||
|
"@reduxjs/toolkit": "^1.7.1",
|
||||||
"@testing-library/jest-dom": "^5.14.1",
|
"@testing-library/jest-dom": "^5.14.1",
|
||||||
"@testing-library/react": "^12.0.0",
|
"@testing-library/react": "^12.0.0",
|
||||||
"@testing-library/user-event": "^13.2.1",
|
"@testing-library/user-event": "^13.2.1",
|
||||||
@@ -20,11 +21,13 @@
|
|||||||
"@types/node": "^16.7.13",
|
"@types/node": "^16.7.13",
|
||||||
"@types/react": "^17.0.20",
|
"@types/react": "^17.0.20",
|
||||||
"@types/react-dom": "^17.0.9",
|
"@types/react-dom": "^17.0.9",
|
||||||
|
"@types/react-redux": "^7.1.21",
|
||||||
"@types/styled-components": "^5.1.18",
|
"@types/styled-components": "^5.1.18",
|
||||||
"d3": "^7.2.1",
|
"d3": "^7.2.1",
|
||||||
"history": "5",
|
"history": "5",
|
||||||
"react": "^17.0.2",
|
"react": "^17.0.2",
|
||||||
"react-dom": "^17.0.2",
|
"react-dom": "^17.0.2",
|
||||||
|
"react-redux": "^7.2.6",
|
||||||
"react-router-dom": "6",
|
"react-router-dom": "6",
|
||||||
"react-scripts": "5.0.0",
|
"react-scripts": "5.0.0",
|
||||||
"resize-observer-polyfill": "^1.5.1",
|
"resize-observer-polyfill": "^1.5.1",
|
||||||
|
|||||||
+14
-1
@@ -1,11 +1,24 @@
|
|||||||
import { Outlet } from "react-router-dom";
|
import { Outlet } from "react-router-dom";
|
||||||
|
|
||||||
|
import { useDimensions } from "./utils/hooks";
|
||||||
|
import { setMenuDimensions } from "./features/pageDimensions/pageDimensionsSlice";
|
||||||
|
|
||||||
import { MainMenu } from "./components/Menu";
|
import { MainMenu } from "./components/Menu";
|
||||||
|
import { useDispatch } from "react-redux";
|
||||||
|
import { useEffect } from "react";
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
const [ref, { height }] = useDimensions<HTMLDivElement>();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
// Make sure to not dispatch during a render.
|
||||||
|
dispatch(setMenuDimensions({ height }));
|
||||||
|
}, [height]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="App">
|
<div className="App">
|
||||||
<MainMenu />
|
<MainMenu ref={ref} />
|
||||||
<Outlet />
|
<Outlet />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
import { RootState } from "../../types/state";
|
||||||
|
|
||||||
|
export const menuSelector = (state: RootState) => state.pageDimensions.menu;
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
||||||
|
|
||||||
|
import { RootState, MenuDimensions } from "../../types/state";
|
||||||
|
|
||||||
|
const initialState: RootState["pageDimensions"] = {
|
||||||
|
menu: {
|
||||||
|
height: 0,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export const pageDimensionsSlice = createSlice({
|
||||||
|
name: "pageDimensions",
|
||||||
|
initialState,
|
||||||
|
reducers: {
|
||||||
|
setMenuDimensions: (state, action: PayloadAction<MenuDimensions>) => {
|
||||||
|
state.menu = action.payload;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export const { setMenuDimensions } = pageDimensionsSlice.actions;
|
||||||
|
export default pageDimensionsSlice.reducer;
|
||||||
+15
-10
@@ -1,5 +1,6 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import ReactDOM from "react-dom";
|
import ReactDOM from "react-dom";
|
||||||
|
import { Provider } from "react-redux";
|
||||||
import { BrowserRouter, Route, Routes } from "react-router-dom";
|
import { BrowserRouter, Route, Routes } from "react-router-dom";
|
||||||
import { ThemeProvider } from "styled-components";
|
import { ThemeProvider } from "styled-components";
|
||||||
|
|
||||||
@@ -9,19 +10,23 @@ import App from "./App";
|
|||||||
import Broadcast from "./routes/BroadcastRoute";
|
import Broadcast from "./routes/BroadcastRoute";
|
||||||
import { GlobalStyle, theme } from "./shared/theme";
|
import { GlobalStyle, theme } from "./shared/theme";
|
||||||
import { GlobalFonts } from "./fonts";
|
import { GlobalFonts } from "./fonts";
|
||||||
|
import { store } from "./store";
|
||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<React.StrictMode>
|
<React.StrictMode>
|
||||||
<ThemeProvider theme={theme}>
|
<Provider store={store}>
|
||||||
<GlobalStyle theme={theme} />
|
<ThemeProvider theme={theme}>
|
||||||
<GlobalFonts />
|
<GlobalStyle theme={theme} />
|
||||||
<BrowserRouter>
|
<GlobalFonts />
|
||||||
<Routes>
|
<BrowserRouter>
|
||||||
<Route path="/" element={<App />} />
|
<Routes>
|
||||||
<Route path="/broadcast" element={<Broadcast />} />
|
<Route path="/" element={<App />} >
|
||||||
</Routes>
|
<Route path="/broadcast" element={<Broadcast />} />
|
||||||
</BrowserRouter>
|
</Route>
|
||||||
</ThemeProvider>
|
</Routes>
|
||||||
|
</BrowserRouter>
|
||||||
|
</ThemeProvider>
|
||||||
|
</Provider>
|
||||||
</React.StrictMode>,
|
</React.StrictMode>,
|
||||||
document.getElementById("root"),
|
document.getElementById("root"),
|
||||||
);
|
);
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
|
import { useSelector } from "react-redux";
|
||||||
|
|
||||||
import { FullScreenContainer } from "./styles";
|
import { FullScreenContainer } from "./styles";
|
||||||
import { Layout } from "../components/Broadcast/Layout";
|
import { Layout } from "../components/Broadcast/Layout";
|
||||||
import { MainMenu } from "../components/Menu";
|
import { menuSelector } from "../features/pageDimensions/pageDimensionsSelector";
|
||||||
import { useDimensions } from "../utils/hooks";
|
|
||||||
|
|
||||||
export default function Broadcast() {
|
export default function Broadcast() {
|
||||||
const [ref, { height }] = useDimensions<HTMLDivElement>();
|
const { height } = useSelector(menuSelector);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FullScreenContainer minHeight={700} minWidth={900}>
|
<FullScreenContainer minHeight={700} minWidth={900} heightCutoff={height}>
|
||||||
<MainMenu ref={ref}/>
|
<Layout />
|
||||||
<Layout headerHeight={height} />
|
|
||||||
</FullScreenContainer>
|
</FullScreenContainer>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -3,16 +3,21 @@ import styled from "styled-components";
|
|||||||
type FullScreenContainerProps = {
|
type FullScreenContainerProps = {
|
||||||
minHeight?: number,
|
minHeight?: number,
|
||||||
minWidth?: number,
|
minWidth?: number,
|
||||||
}
|
heightCutoff?: number,
|
||||||
|
widthCutoff?: number,
|
||||||
|
};
|
||||||
|
|
||||||
export const FullScreenContainer = styled.div<FullScreenContainerProps>`
|
export const FullScreenContainer = styled.div<FullScreenContainerProps>`
|
||||||
--minHeight: ${({ minHeight = 0 }) => `${minHeight}px`};
|
--minHeight: ${({ minHeight = 0 }) => `${minHeight}px`};
|
||||||
--minWidth: ${({ minWidth = 0 }) => `${minWidth}px`};
|
--minWidth: ${({ minWidth = 0 }) => `${minWidth}px`};
|
||||||
--overflowY: ${({ minHeight }) => minHeight ? "scroll" : "hidden" };
|
--overflowY: ${({ minHeight }) => minHeight ? "scroll" : "hidden" };
|
||||||
--overflowX: ${({ minWidth }) => minWidth ? "scroll" : "hidden" };
|
--overflowX: ${({ minWidth }) => minWidth ? "scroll" : "hidden" };
|
||||||
|
--heightCutoff: ${({ heightCutoff = 0 }) => `${heightCutoff}px`};
|
||||||
|
--widthCutoff: ${({ widthCutoff = 0 }) => `${widthCutoff}px`};
|
||||||
|
|
||||||
height: 100vh;
|
position: relative;
|
||||||
width: 100%;
|
height: calc(100vh - var(--heightCutoff));
|
||||||
|
width: calc(100vw - var(--widthCutoff));
|
||||||
|
|
||||||
/* Demand a minimum width/height and scroll to support them. */
|
/* Demand a minimum width/height and scroll to support them. */
|
||||||
min-height: var(--minHeight);
|
min-height: var(--minHeight);
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import { configureStore, combineReducers } from "@reduxjs/toolkit";
|
||||||
|
|
||||||
|
import pageDimensions from "./features/pageDimensions/pageDimensionsSlice";
|
||||||
|
|
||||||
|
export const store = configureStore({
|
||||||
|
reducer: combineReducers({
|
||||||
|
pageDimensions,
|
||||||
|
}),
|
||||||
|
});
|
||||||
Vendored
+11
@@ -0,0 +1,11 @@
|
|||||||
|
export type RootState = {
|
||||||
|
pageDimensions: PageDimensions,
|
||||||
|
};
|
||||||
|
|
||||||
|
export type PageDimensions = {
|
||||||
|
menu: MenuDimensions,
|
||||||
|
};
|
||||||
|
|
||||||
|
export type MenuDimensions = {
|
||||||
|
height: number,
|
||||||
|
};
|
||||||
+2
-1
@@ -23,6 +23,7 @@
|
|||||||
"noUnusedParameters": false,
|
"noUnusedParameters": false,
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"src"
|
"src",
|
||||||
|
"src/types/**/*"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -1021,6 +1021,13 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
regenerator-runtime "^0.13.4"
|
regenerator-runtime "^0.13.4"
|
||||||
|
|
||||||
|
"@babel/runtime@^7.15.4":
|
||||||
|
version "7.16.7"
|
||||||
|
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.16.7.tgz#03ff99f64106588c9c403c6ecb8c3bafbbdff1fa"
|
||||||
|
integrity sha512-9E9FJowqAsytyOY6LG+1KuueckRL+aQW+mKvXRXnuFGyRAyepJPmEo9vgMfXUA6O9u3IeEdv9MAkppFcaQwogQ==
|
||||||
|
dependencies:
|
||||||
|
regenerator-runtime "^0.13.4"
|
||||||
|
|
||||||
"@babel/template@^7.16.0", "@babel/template@^7.3.3":
|
"@babel/template@^7.16.0", "@babel/template@^7.3.3":
|
||||||
version "7.16.0"
|
version "7.16.0"
|
||||||
resolved "https://registry.npmjs.org/@babel/template/-/template-7.16.0.tgz"
|
resolved "https://registry.npmjs.org/@babel/template/-/template-7.16.0.tgz"
|
||||||
@@ -1438,6 +1445,16 @@
|
|||||||
schema-utils "^3.0.0"
|
schema-utils "^3.0.0"
|
||||||
source-map "^0.7.3"
|
source-map "^0.7.3"
|
||||||
|
|
||||||
|
"@reduxjs/toolkit@^1.7.1":
|
||||||
|
version "1.7.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@reduxjs/toolkit/-/toolkit-1.7.1.tgz#994962aeb7df3c77be343dd2ad1aa48221dbaa0c"
|
||||||
|
integrity sha512-wXwXYjBVz/ItxB7SMzEAMmEE/FBiY1ze18N+VVVX7NtVbRUrdOGKhpQMHivIJfkbJvSdLUU923a/yAagJQzY0Q==
|
||||||
|
dependencies:
|
||||||
|
immer "^9.0.7"
|
||||||
|
redux "^4.1.2"
|
||||||
|
redux-thunk "^2.4.1"
|
||||||
|
reselect "^4.1.5"
|
||||||
|
|
||||||
"@rollup/plugin-babel@^5.2.0":
|
"@rollup/plugin-babel@^5.2.0":
|
||||||
version "5.3.0"
|
version "5.3.0"
|
||||||
resolved "https://registry.npmjs.org/@rollup/plugin-babel/-/plugin-babel-5.3.0.tgz"
|
resolved "https://registry.npmjs.org/@rollup/plugin-babel/-/plugin-babel-5.3.0.tgz"
|
||||||
@@ -1962,7 +1979,7 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
"@types/node" "*"
|
"@types/node" "*"
|
||||||
|
|
||||||
"@types/hoist-non-react-statics@*":
|
"@types/hoist-non-react-statics@*", "@types/hoist-non-react-statics@^3.3.0":
|
||||||
version "3.3.1"
|
version "3.3.1"
|
||||||
resolved "https://registry.yarnpkg.com/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz#1124aafe5118cb591977aeb1ceaaed1070eb039f"
|
resolved "https://registry.yarnpkg.com/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz#1124aafe5118cb591977aeb1ceaaed1070eb039f"
|
||||||
integrity sha512-iMIqiko6ooLrTh1joXodJK5X9xeEALT1kM5G3ZLhD3hszxBdIEd5C75U834D9mLcINgD4OyZf5uQXjkuYydWvA==
|
integrity sha512-iMIqiko6ooLrTh1joXodJK5X9xeEALT1kM5G3ZLhD3hszxBdIEd5C75U834D9mLcINgD4OyZf5uQXjkuYydWvA==
|
||||||
@@ -2056,6 +2073,16 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
"@types/react" "*"
|
"@types/react" "*"
|
||||||
|
|
||||||
|
"@types/react-redux@^7.1.20", "@types/react-redux@^7.1.21":
|
||||||
|
version "7.1.21"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/react-redux/-/react-redux-7.1.21.tgz#f32bbaf7cbc4b93f51e10d340aa54035c084b186"
|
||||||
|
integrity sha512-bLdglUiBSQNzWVVbmNPKGYYjrzp3/YDPwfOH3nLEz99I4awLlaRAPWjo6bZ2POpxztFWtDDXIPxBLVykXqBt+w==
|
||||||
|
dependencies:
|
||||||
|
"@types/hoist-non-react-statics" "^3.3.0"
|
||||||
|
"@types/react" "*"
|
||||||
|
hoist-non-react-statics "^3.3.0"
|
||||||
|
redux "^4.0.0"
|
||||||
|
|
||||||
"@types/react@*", "@types/react@^17.0.20":
|
"@types/react@*", "@types/react@^17.0.20":
|
||||||
version "17.0.37"
|
version "17.0.37"
|
||||||
resolved "https://registry.npmjs.org/@types/react/-/react-17.0.37.tgz"
|
resolved "https://registry.npmjs.org/@types/react/-/react-17.0.37.tgz"
|
||||||
@@ -4975,7 +5002,7 @@ history@5, history@^5.2.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
"@babel/runtime" "^7.7.6"
|
"@babel/runtime" "^7.7.6"
|
||||||
|
|
||||||
hoist-non-react-statics@^3.0.0, hoist-non-react-statics@^3.3.0:
|
hoist-non-react-statics@^3.0.0, hoist-non-react-statics@^3.3.0, hoist-non-react-statics@^3.3.2:
|
||||||
version "3.3.2"
|
version "3.3.2"
|
||||||
resolved "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz"
|
resolved "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz"
|
||||||
integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==
|
integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==
|
||||||
@@ -7574,11 +7601,23 @@ react-is@^16.7.0, react-is@^16.8.1:
|
|||||||
resolved "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz"
|
resolved "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz"
|
||||||
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==
|
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==
|
||||||
|
|
||||||
react-is@^17.0.1:
|
react-is@^17.0.1, react-is@^17.0.2:
|
||||||
version "17.0.2"
|
version "17.0.2"
|
||||||
resolved "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz"
|
resolved "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz"
|
||||||
integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==
|
integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==
|
||||||
|
|
||||||
|
react-redux@^7.2.6:
|
||||||
|
version "7.2.6"
|
||||||
|
resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-7.2.6.tgz#49633a24fe552b5f9caf58feb8a138936ddfe9aa"
|
||||||
|
integrity sha512-10RPdsz0UUrRL1NZE0ejTkucnclYSgXp5q+tB5SWx2qeG2ZJQJyymgAhwKy73yiL/13btfB6fPr+rgbMAaZIAQ==
|
||||||
|
dependencies:
|
||||||
|
"@babel/runtime" "^7.15.4"
|
||||||
|
"@types/react-redux" "^7.1.20"
|
||||||
|
hoist-non-react-statics "^3.3.2"
|
||||||
|
loose-envify "^1.4.0"
|
||||||
|
prop-types "^15.7.2"
|
||||||
|
react-is "^17.0.2"
|
||||||
|
|
||||||
react-refresh@^0.11.0:
|
react-refresh@^0.11.0:
|
||||||
version "0.11.0"
|
version "0.11.0"
|
||||||
resolved "https://registry.npmjs.org/react-refresh/-/react-refresh-0.11.0.tgz"
|
resolved "https://registry.npmjs.org/react-refresh/-/react-refresh-0.11.0.tgz"
|
||||||
@@ -7706,6 +7745,18 @@ redent@^3.0.0:
|
|||||||
indent-string "^4.0.0"
|
indent-string "^4.0.0"
|
||||||
strip-indent "^3.0.0"
|
strip-indent "^3.0.0"
|
||||||
|
|
||||||
|
redux-thunk@^2.4.1:
|
||||||
|
version "2.4.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/redux-thunk/-/redux-thunk-2.4.1.tgz#0dd8042cf47868f4b29699941de03c9301a75714"
|
||||||
|
integrity sha512-OOYGNY5Jy2TWvTL1KgAlVy6dcx3siPJ1wTq741EPyUKfn6W6nChdICjZwCd0p8AZBs5kWpZlbkXW2nE/zjUa+Q==
|
||||||
|
|
||||||
|
redux@^4.0.0, redux@^4.1.2:
|
||||||
|
version "4.1.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/redux/-/redux-4.1.2.tgz#140f35426d99bb4729af760afcf79eaaac407104"
|
||||||
|
integrity sha512-SH8PglcebESbd/shgf6mii6EIoRM0zrQyjcuQ+ojmfxjTtE0z9Y8pa62iA/OJ58qjP6j27uyW4kUF4jl/jd6sw==
|
||||||
|
dependencies:
|
||||||
|
"@babel/runtime" "^7.9.2"
|
||||||
|
|
||||||
regenerate-unicode-properties@^9.0.0:
|
regenerate-unicode-properties@^9.0.0:
|
||||||
version "9.0.0"
|
version "9.0.0"
|
||||||
resolved "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-9.0.0.tgz"
|
resolved "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-9.0.0.tgz"
|
||||||
@@ -7803,6 +7854,11 @@ requires-port@^1.0.0:
|
|||||||
resolved "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz"
|
resolved "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz"
|
||||||
integrity sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=
|
integrity sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=
|
||||||
|
|
||||||
|
reselect@^4.1.5:
|
||||||
|
version "4.1.5"
|
||||||
|
resolved "https://registry.yarnpkg.com/reselect/-/reselect-4.1.5.tgz#852c361247198da6756d07d9296c2b51eddb79f6"
|
||||||
|
integrity sha512-uVdlz8J7OO+ASpBYoz1Zypgx0KasCY20H+N8JD13oUMtPvSHQuscrHop4KbXrbsBcdB9Ds7lVK7eRkBIfO43vQ==
|
||||||
|
|
||||||
resize-observer-polyfill@^1.5.1:
|
resize-observer-polyfill@^1.5.1:
|
||||||
version "1.5.1"
|
version "1.5.1"
|
||||||
resolved "https://registry.yarnpkg.com/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz#0e9020dd3d21024458d4ebd27e23e40269810464"
|
resolved "https://registry.yarnpkg.com/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz#0e9020dd3d21024458d4ebd27e23e40269810464"
|
||||||
|
|||||||
Reference in new issue
Block a user