29 files changed
+573
-66
No files matched your search
@@ -4,8 +4,11 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@bedrock-layout/appboundary": "^2.2.4",
|
"@bedrock-layout/appboundary": "^2.2.4",
|
||||||
|
"@bedrock-layout/center": "^2.2.5",
|
||||||
"@bedrock-layout/columns": "^2.3.4",
|
"@bedrock-layout/columns": "^2.3.4",
|
||||||
|
"@bedrock-layout/cover": "^2.2.5",
|
||||||
"@bedrock-layout/frame": "^2.2.4",
|
"@bedrock-layout/frame": "^2.2.4",
|
||||||
|
"@bedrock-layout/grid": "^2.2.5",
|
||||||
"@bedrock-layout/inline": "^2.3.3",
|
"@bedrock-layout/inline": "^2.3.3",
|
||||||
"@bedrock-layout/inline-cluster": "^2.4.2",
|
"@bedrock-layout/inline-cluster": "^2.4.2",
|
||||||
"@bedrock-layout/padbox": "^2.1.4",
|
"@bedrock-layout/padbox": "^2.1.4",
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
|
|
||||||
import { FullScreenContainer } from "./styles";
|
import { FullScreenContainer } from "../Common/FullScreenContainer.styled";
|
||||||
import { Layout } from "../components/Broadcast/Layout";
|
import { Layout } from "./Layout";
|
||||||
import { menuSelector } from "../features/pageDimensions/pageDimensionsSelector";
|
import { menuSelector } from "../../features/pageDimensions/pageDimensionsSelector";
|
||||||
|
|
||||||
export default function Broadcast() {
|
export default function Broadcast() {
|
||||||
const { height } = useSelector(menuSelector);
|
const { height } = useSelector(menuSelector);
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import { MockupBlock } from "../../Common/MockupBlock.styled";
|
import { MockupBlock } from "../../Common/MockupBlock.styled";
|
||||||
import VideoFeed from "../VideoFeed/VideoFeed";
|
import VideoFeed from "../VideoFeed/VideoFeed";
|
||||||
import { LayoutGrid, LayoutGridItem } from "./styles";
|
import { LayoutGrid, LayoutGridItem } from "../../Common/LayoutGrid.styled";
|
||||||
|
|
||||||
type LayoutProps = {
|
type LayoutProps = {
|
||||||
headerHeight?: number,
|
headerHeight?: number,
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
import styled from "styled-components";
|
|
||||||
|
|
||||||
type LayoutGridProps = {
|
|
||||||
columns?: number,
|
|
||||||
rows?: number,
|
|
||||||
headerOffset?: number,
|
|
||||||
};
|
|
||||||
export const LayoutGrid = styled.div<LayoutGridProps>`
|
|
||||||
--columns: ${({ columns = 1 }) => columns};
|
|
||||||
--rows: ${({ rows = 1 }) => rows};
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(var(--columns), 1fr);
|
|
||||||
grid-template-rows: repeat(var(--rows), 1fr);
|
|
||||||
height: calc(100% - ${({ headerOffset = 0 }) => headerOffset}px);
|
|
||||||
width: 100%;
|
|
||||||
`;
|
|
||||||
LayoutGrid.displayName = "LayoutGrid";
|
|
||||||
|
|
||||||
type LayoutGridItemProps = {
|
|
||||||
column: number,
|
|
||||||
columnSpan?: number,
|
|
||||||
row: number,
|
|
||||||
rowSpan?: number,
|
|
||||||
};
|
|
||||||
export const LayoutGridItem = styled.div<LayoutGridItemProps>`
|
|
||||||
grid-column: ${({ column }) => column}
|
|
||||||
/ span ${({ columnSpan = 1 }) => columnSpan};
|
|
||||||
grid-row: ${({ row }) => row}
|
|
||||||
/ span ${({ rowSpan = 1 }) => rowSpan};;
|
|
||||||
`;
|
|
||||||
LayoutGridItem.displayName = "LayoutGridItem";
|
|
||||||
File renamed without changes.
@@ -0,0 +1,51 @@
|
|||||||
|
import { useState } from "react";
|
||||||
|
import { AnimatedBG } from "../../../../types/state";
|
||||||
|
import {
|
||||||
|
ToggleContainer,
|
||||||
|
ToggleBody,
|
||||||
|
ToggleInput,
|
||||||
|
ToggleLabel,
|
||||||
|
ToggleBackground,
|
||||||
|
ToggleCircle,
|
||||||
|
} from "./styles";
|
||||||
|
|
||||||
|
export type ToggleProps = {
|
||||||
|
label: string,
|
||||||
|
toggled: boolean,
|
||||||
|
onToggle: (value: AnimatedBG) => void,
|
||||||
|
showIndicators?: boolean,
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* This is my attempt at making a iOS-style toggle switch.
|
||||||
|
*/
|
||||||
|
export const Toggle = ({
|
||||||
|
label,
|
||||||
|
toggled,
|
||||||
|
onToggle,
|
||||||
|
showIndicators = false,
|
||||||
|
}: ToggleProps) => {
|
||||||
|
const [hovered, setHovered] = useState(false);
|
||||||
|
return (
|
||||||
|
<ToggleContainer>
|
||||||
|
{label}{" "}
|
||||||
|
<ToggleBody>
|
||||||
|
<ToggleInput
|
||||||
|
type="checkbox"
|
||||||
|
name={label}
|
||||||
|
id={label}
|
||||||
|
checked={toggled}
|
||||||
|
onChange={e => onToggle(e.target.checked)}
|
||||||
|
/>
|
||||||
|
<ToggleLabel
|
||||||
|
htmlFor={label}
|
||||||
|
onMouseDown={() => setHovered(true)}
|
||||||
|
onMouseUp={() => setHovered(false)}
|
||||||
|
>
|
||||||
|
<ToggleBackground toggled={toggled} showIndicators={showIndicators}>
|
||||||
|
<ToggleCircle toggled={toggled} stretched={hovered} />
|
||||||
|
</ToggleBackground>
|
||||||
|
</ToggleLabel>
|
||||||
|
</ToggleBody>
|
||||||
|
</ToggleContainer>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export * from "./Toggle";
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
import styled, { css } from "styled-components";
|
||||||
|
|
||||||
|
type ToggleContainerProps = {
|
||||||
|
fontSize?: string;
|
||||||
|
}
|
||||||
|
export const ToggleContainer = styled.div<ToggleContainerProps>`
|
||||||
|
text-align: center;
|
||||||
|
font-size: ${({ fontSize = "inherit" }) => fontSize};
|
||||||
|
`;
|
||||||
|
ToggleContainer.displayName = "ToggleContainer";
|
||||||
|
|
||||||
|
export const ToggleBody = styled.div`
|
||||||
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
text-align: left;
|
||||||
|
top: 0.5em;
|
||||||
|
`;
|
||||||
|
ToggleBody.displayName = "ToggleBody";
|
||||||
|
|
||||||
|
export const ToggleInput = styled.input`
|
||||||
|
display: none;
|
||||||
|
`;
|
||||||
|
ToggleInput.displayName = "ToggleInput";
|
||||||
|
|
||||||
|
export const ToggleLabel = styled.label`
|
||||||
|
display: block;
|
||||||
|
overflow: hidden;
|
||||||
|
border-radius: .75em;
|
||||||
|
height: 1.5em;
|
||||||
|
width: 2.7em;
|
||||||
|
cursor: pointer;
|
||||||
|
`;
|
||||||
|
ToggleLabel.displayName = "ToggleLabel";
|
||||||
|
|
||||||
|
type ToggleBackgroundProps = {
|
||||||
|
toggled: boolean,
|
||||||
|
toggledColor?: string,
|
||||||
|
showIndicators?: boolean,
|
||||||
|
};
|
||||||
|
export const ToggleBackground = styled.div<ToggleBackgroundProps>`
|
||||||
|
background-color: ${({
|
||||||
|
toggledColor,
|
||||||
|
toggled,
|
||||||
|
}) => (
|
||||||
|
toggled ?
|
||||||
|
(toggledColor ?? (p => p.theme.colors.activeGreen)) :
|
||||||
|
p => p.theme.colors.lightGrey
|
||||||
|
)};
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
transition: background-color 300ms;
|
||||||
|
|
||||||
|
${({ toggled }) => toggled && css`
|
||||||
|
box-shadow: inset 0 0 24px -16px black;
|
||||||
|
`}
|
||||||
|
|
||||||
|
${({ toggled, showIndicators }) => showIndicators && (toggled ?
|
||||||
|
css`
|
||||||
|
div:before {
|
||||||
|
position: absolute;
|
||||||
|
right: 26px;
|
||||||
|
bottom: -2px;
|
||||||
|
content: "I";
|
||||||
|
color: ${p => p.theme.colors.darkGrey};
|
||||||
|
}
|
||||||
|
` :
|
||||||
|
css`
|
||||||
|
div:after {
|
||||||
|
position: absolute;
|
||||||
|
left: 23px;
|
||||||
|
bottom: -2px;
|
||||||
|
content: "O";
|
||||||
|
color: ${p => p.theme.colors.grey};
|
||||||
|
}
|
||||||
|
`)}
|
||||||
|
`;
|
||||||
|
ToggleBackground.displayName = "ToggleBackground";
|
||||||
|
|
||||||
|
type ToggleCircleProps = {
|
||||||
|
toggled: boolean,
|
||||||
|
stretched: boolean,
|
||||||
|
};
|
||||||
|
export const ToggleCircle = styled.div<ToggleCircleProps>`
|
||||||
|
position: absolute;
|
||||||
|
height: 1.3em;
|
||||||
|
width: ${({ stretched }) => stretched ? "1.6em": "1.3em"};
|
||||||
|
border-radius: 0.65em;
|
||||||
|
margin: 0.1em;
|
||||||
|
background-color: white;
|
||||||
|
top: 0;
|
||||||
|
${({ toggled }) => toggled ? css`right: 0;` : css`left: 0;`}
|
||||||
|
`;
|
||||||
|
ToggleCircle.displayName = "ToggleCircle";
|
||||||
|
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
import styled from "styled-components";
|
||||||
|
|
||||||
|
type SizeProp = number | Array<number | string>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Slickly handle different values
|
||||||
|
* @param prop a number will use 1fr repeated. An array will interpret numbers
|
||||||
|
* as fractions. Else you can define anything with strings (such as "100px").
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
const parseSize = (prop: SizeProp): string => {
|
||||||
|
if (typeof prop === "number") {
|
||||||
|
return `repeat(${prop}, 1fr)`;
|
||||||
|
}
|
||||||
|
if (Array.isArray(prop)) {
|
||||||
|
return prop.map(value => {
|
||||||
|
if (typeof value === "number") {
|
||||||
|
return value + "fr";
|
||||||
|
} else {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}).join(" ");
|
||||||
|
}
|
||||||
|
return "1";
|
||||||
|
};
|
||||||
|
|
||||||
|
type LayoutGridProps = {
|
||||||
|
columns?: SizeProp,
|
||||||
|
rows?: SizeProp,
|
||||||
|
headerOffset?: number,
|
||||||
|
};
|
||||||
|
export const LayoutGrid = styled.div<LayoutGridProps>`
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: ${({ columns = 1 }) => parseSize(columns)};
|
||||||
|
grid-template-rows: ${({ rows = 1 }) => parseSize(rows)};
|
||||||
|
height: calc(100% - ${({ headerOffset = 0 }) => headerOffset}px);
|
||||||
|
width: 100%;
|
||||||
|
`;
|
||||||
|
LayoutGrid.displayName = "LayoutGrid";
|
||||||
|
|
||||||
|
type LayoutGridItemProps = {
|
||||||
|
column: number,
|
||||||
|
columnSpan?: number,
|
||||||
|
row: number,
|
||||||
|
rowSpan?: number,
|
||||||
|
};
|
||||||
|
export const LayoutGridItem = styled.div<LayoutGridItemProps>`
|
||||||
|
grid-column: ${({ column }) => column}
|
||||||
|
/ span ${({ columnSpan = 1 }) => columnSpan};
|
||||||
|
grid-row: ${({ row }) => row}
|
||||||
|
/ span ${({ rowSpan = 1 }) => rowSpan};;
|
||||||
|
`;
|
||||||
|
LayoutGridItem.displayName = "LayoutGridItem";
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
import styled, { css } from "styled-components";
|
||||||
|
import { PadBox } from "@bedrock-layout/padbox";
|
||||||
|
|
||||||
|
const hoverRules = css`
|
||||||
|
background: ${p => p.theme.colors.darkGrey};
|
||||||
|
color: white;
|
||||||
|
`;
|
||||||
|
|
||||||
|
export type MenuItemProps = {
|
||||||
|
isHovered?: boolean,
|
||||||
|
isActive?: boolean,
|
||||||
|
};
|
||||||
|
export const MenuItem = styled(PadBox).attrs(() => ({
|
||||||
|
padding: ["sm", "lg"],
|
||||||
|
})) <MenuItemProps>`
|
||||||
|
border-radius: ${p => p.theme.design.button.borderRadius};
|
||||||
|
color: ${p => p.theme.colors.darkGrey};
|
||||||
|
font-family: ${p => p.theme.fonts.f1Regular};
|
||||||
|
font-size: 0.8em;
|
||||||
|
|
||||||
|
${({ isActive }) => isActive && css`
|
||||||
|
background: ${p => p.theme.colors.lightGrey};
|
||||||
|
`}
|
||||||
|
${({ isHovered }) => {
|
||||||
|
// My cheap way of having uncontrolled hover behavior.
|
||||||
|
if (isHovered == null) {
|
||||||
|
return css`
|
||||||
|
&:hover {
|
||||||
|
${hoverRules}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
} else if (isHovered === true) {
|
||||||
|
return hoverRules;
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
`;
|
||||||
|
|
||||||
@@ -3,7 +3,8 @@ import { Link, NavLink } from "react-router-dom";
|
|||||||
import { InlineCluster } from "@bedrock-layout/inline-cluster";
|
import { InlineCluster } from "@bedrock-layout/inline-cluster";
|
||||||
import useForwardedRef from "@bedrock-layout/use-forwarded-ref";
|
import useForwardedRef from "@bedrock-layout/use-forwarded-ref";
|
||||||
|
|
||||||
import { MenuBar, MenuItem, Title } from "./styles";
|
import { MenuBar, Title } from "./styles";
|
||||||
|
import { MenuItem } from "../Common/MenuItem.styled";
|
||||||
|
|
||||||
import f1Logo from "../../public/images/logos/f1-logo-red.svg";
|
import f1Logo from "../../public/images/logos/f1-logo-red.svg";
|
||||||
|
|
||||||
@@ -15,6 +16,7 @@ export const MainMenu = React.forwardRef<HTMLDivElement>(
|
|||||||
links={[
|
links={[
|
||||||
{ label: "Home", to: "/" },
|
{ label: "Home", to: "/" },
|
||||||
{ label: "Broadcast Page", to: "/broadcast" },
|
{ label: "Broadcast Page", to: "/broadcast" },
|
||||||
|
{ label: "Workspaces", to: "/workspaces" },
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
import { InlineCluster } from "@bedrock-layout/inline-cluster";
|
import { InlineCluster } from "@bedrock-layout/inline-cluster";
|
||||||
import { PadBox } from "@bedrock-layout/padbox";
|
import { PadBox } from "@bedrock-layout/padbox";
|
||||||
import styled, { css } from "styled-components";
|
import styled from "styled-components";
|
||||||
|
|
||||||
export const Title = styled.h3`
|
export const Title = styled.h3`
|
||||||
font-family: ${p => p.theme.fonts.f1Bold};
|
font-family: ${p => p.theme.fonts.f1Bold};
|
||||||
`;
|
`;
|
||||||
|
Title.displayName = "Title";
|
||||||
|
|
||||||
export const MenuBar = styled(InlineCluster).attrs(() => ({
|
export const MenuBar = styled(InlineCluster).attrs(() => ({
|
||||||
as: PadBox,
|
as: PadBox,
|
||||||
@@ -16,25 +17,4 @@ export const MenuBar = styled(InlineCluster).attrs(() => ({
|
|||||||
background-image: linear-gradient(to right, #f0f0f0, #fff);
|
background-image: linear-gradient(to right, #f0f0f0, #fff);
|
||||||
border-block-end: 1px solid ${p => p.theme.colors.darkGrey};
|
border-block-end: 1px solid ${p => p.theme.colors.darkGrey};
|
||||||
`;
|
`;
|
||||||
|
MenuBar.displayName = "MenuBar";
|
||||||
type MenuItemProps = {
|
|
||||||
isHovered?: boolean,
|
|
||||||
isActive?: boolean,
|
|
||||||
};
|
|
||||||
export const MenuItem = styled(PadBox).attrs(() => ({
|
|
||||||
padding: ["sm", "lg"],
|
|
||||||
}))<MenuItemProps>`
|
|
||||||
border-radius: 0.25rem;
|
|
||||||
color: ${p => p.theme.colors.darkGrey};
|
|
||||||
font-family: ${p => p.theme.fonts.f1Regular};
|
|
||||||
font-size: 0.8em;
|
|
||||||
|
|
||||||
${({ isActive }) => isActive && css`
|
|
||||||
background: ${p => p.theme.colors.lightGrey};
|
|
||||||
`}
|
|
||||||
|
|
||||||
${({ isHovered }) => isHovered && css`
|
|
||||||
background: ${p => p.theme.colors.darkGrey};
|
|
||||||
color: white;
|
|
||||||
`}
|
|
||||||
`;
|
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
import { useParams } from "react-router-dom";
|
||||||
|
import { useSelector } from "react-redux";
|
||||||
|
import { Center } from "@bedrock-layout/center";
|
||||||
|
import { Stack } from "@bedrock-layout/stack";
|
||||||
|
|
||||||
|
import { workspaceSelector } from "../../../features/workspace/workspaceSelector";
|
||||||
|
|
||||||
|
import { PreviewWindow, H2, ControlsContainer } from "./styles";
|
||||||
|
import { WorkspaceControls } from "./WorkspaceControls";
|
||||||
|
import { MockupBlock } from "../../Common/MockupBlock.styled";
|
||||||
|
|
||||||
|
import { workspaceObject } from "../workspaces";
|
||||||
|
|
||||||
|
export const Workspace = () => {
|
||||||
|
const { workspaceId } = useParams();
|
||||||
|
const { animatedBG } = useSelector(workspaceSelector);
|
||||||
|
return (
|
||||||
|
<Stack
|
||||||
|
gutter="lg"
|
||||||
|
as={Center}
|
||||||
|
maxWidth="80%"
|
||||||
|
centerChildren
|
||||||
|
>
|
||||||
|
<H2>{workspaceId ? workspaceObject[workspaceId] : "Unknown"}</H2>
|
||||||
|
<PreviewWindow height={600} width={800} animatedBG={animatedBG}>
|
||||||
|
<MockupBlock
|
||||||
|
color="#415bad"
|
||||||
|
height="300px"
|
||||||
|
width="400px"
|
||||||
|
>Preview Item</MockupBlock>
|
||||||
|
</PreviewWindow>
|
||||||
|
<ControlsContainer>
|
||||||
|
<WorkspaceControls />
|
||||||
|
</ControlsContainer>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import { Grid } from "@bedrock-layout/grid";
|
||||||
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
|
import { workspaceSelector } from "../../../features/workspace/workspaceSelector";
|
||||||
|
import { setAnimatedBG } from "../../../features/workspace/workspaceSlice";
|
||||||
|
import { AnimatedBG } from "../../../types/state";
|
||||||
|
|
||||||
|
import { Toggle } from "../../Common/Inputs/Toggle";
|
||||||
|
|
||||||
|
export const WorkspaceControls = () => {
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
const { animatedBG } = useSelector(workspaceSelector);
|
||||||
|
|
||||||
|
return(
|
||||||
|
<Grid gutter="sm">
|
||||||
|
<Toggle
|
||||||
|
label="Animate BG"
|
||||||
|
toggled={animatedBG}
|
||||||
|
onToggle={(value: AnimatedBG) => {
|
||||||
|
dispatch(setAnimatedBG(value));
|
||||||
|
}} />
|
||||||
|
</Grid>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export * from "./Workspace";
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
import styled, { css, keyframes } from "styled-components";
|
||||||
|
import { PadBox } from "@bedrock-layout/padbox";
|
||||||
|
|
||||||
|
import bg from "../../../public/images/misc/checker-40x40.png";
|
||||||
|
|
||||||
|
const scrollAnimation = keyframes`
|
||||||
|
from { background-position: 0 0; }
|
||||||
|
to { background-position: 80px -40px; }
|
||||||
|
`;
|
||||||
|
|
||||||
|
export type PreviewWindowProps = {
|
||||||
|
height: number,
|
||||||
|
width: number,
|
||||||
|
animatedBG?: boolean,
|
||||||
|
};
|
||||||
|
export const PreviewWindow = styled(PadBox).attrs(() => ({
|
||||||
|
padding: "lg",
|
||||||
|
}))<PreviewWindowProps>`
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
height: ${({ height }) => height}px;
|
||||||
|
width: ${({ width }) => width}px;
|
||||||
|
|
||||||
|
border-radius: 1em;
|
||||||
|
|
||||||
|
background-image: url("${bg}");
|
||||||
|
background-position: 0px 0px;
|
||||||
|
background-repeat: repeat;
|
||||||
|
|
||||||
|
${({ animatedBG }) => animatedBG && css`
|
||||||
|
animation: ${scrollAnimation} 5s linear infinite;
|
||||||
|
`}
|
||||||
|
`;
|
||||||
|
PreviewWindow.displayName = "PreviewWindow";
|
||||||
|
|
||||||
|
export const H2 = styled.h2`
|
||||||
|
margin: 0.2em;
|
||||||
|
color: ${p => p.theme.colors.darkGrey};
|
||||||
|
font-family: ${p => p.theme.fonts.f1Regular};
|
||||||
|
max-inline-size: 600px;
|
||||||
|
`;
|
||||||
|
H2.displayName = "H2";
|
||||||
|
|
||||||
|
export const ControlsContainer = styled(PadBox).attrs(() => ({
|
||||||
|
padding: "lg",
|
||||||
|
}))`
|
||||||
|
background-color: ${p => p.theme.colors.faintGrey};
|
||||||
|
border-radius: 1em;
|
||||||
|
`;
|
||||||
|
ControlsContainer.displayName = "ControlsContainer";
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
import { WorkspaceListBox } from "./styles";
|
||||||
|
import { Stack } from "@bedrock-layout/stack";
|
||||||
|
import { NavLink } from "react-router-dom";
|
||||||
|
import { MenuItem } from "../../Common/MenuItem.styled";
|
||||||
|
import { workspaceList } from "../workspaces";
|
||||||
|
|
||||||
|
type WorkspaceListProps = {
|
||||||
|
headerOffset?: number,
|
||||||
|
};
|
||||||
|
export const WorkspaceList = ({ headerOffset }: WorkspaceListProps) => (
|
||||||
|
<WorkspaceListBox headerOffset={headerOffset}>
|
||||||
|
<Stack as="ul" gutter="md">
|
||||||
|
{workspaceList.map((workspace, i) => (
|
||||||
|
<WorkspaceListNavLink key={i} to={workspace.id} label={workspace.name} />
|
||||||
|
))}
|
||||||
|
</Stack>
|
||||||
|
</WorkspaceListBox>
|
||||||
|
);
|
||||||
|
|
||||||
|
type WorkspaceListNavLinkProps = {
|
||||||
|
to: string,
|
||||||
|
label: string,
|
||||||
|
};
|
||||||
|
const WorkspaceListNavLink = ({ to, label }: WorkspaceListNavLinkProps) => (
|
||||||
|
<li>
|
||||||
|
<NavLink to={to} style={{ textDecoration: "none" }}>
|
||||||
|
{({ isActive }) => (
|
||||||
|
<MenuItem isActive={isActive}>
|
||||||
|
{label}
|
||||||
|
</MenuItem>
|
||||||
|
)}
|
||||||
|
</NavLink>
|
||||||
|
</li>
|
||||||
|
);
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export * from "./WorkspaceList";
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import styled from "styled-components";
|
||||||
|
import { PadBox } from "@bedrock-layout/padbox";
|
||||||
|
|
||||||
|
type WorkspaceListBoxProps = {
|
||||||
|
headerOffset?: number,
|
||||||
|
};
|
||||||
|
export const WorkspaceListBox = styled(PadBox).attrs(() => ({
|
||||||
|
padding: ["lg", "md"],
|
||||||
|
}))<WorkspaceListBoxProps>`
|
||||||
|
height: calc(100vh - ${({ headerOffset = 0 }) => `${headerOffset}px`});
|
||||||
|
width: 100%;
|
||||||
|
background-image: linear-gradient(to bottom, #f0f0f0, #fff);
|
||||||
|
border-right: 1px solid ${p => p.theme.colors.darkGrey};
|
||||||
|
overflow-y: scroll;
|
||||||
|
`;
|
||||||
|
WorkspaceListBox.displayName = "WorkspaceListBox";
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import { useSelector } from "react-redux";
|
||||||
|
import { Outlet } from "react-router-dom";
|
||||||
|
|
||||||
|
import { menuSelector } from "../../features/pageDimensions/pageDimensionsSelector";
|
||||||
|
|
||||||
|
import { FullScreenContainer } from "../Common/FullScreenContainer.styled";
|
||||||
|
import { WorkspaceList } from "./WorkspaceList";
|
||||||
|
import { LayoutGrid, LayoutGridItem } from "../Common/LayoutGrid.styled";
|
||||||
|
|
||||||
|
export default function Workspaces() {
|
||||||
|
const { height } = useSelector(menuSelector);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<FullScreenContainer minHeight={700} minWidth={900} heightCutoff={height}>
|
||||||
|
<LayoutGrid columns={["180px", 1]} rows={1}>
|
||||||
|
<LayoutGridItem column={1} row={1}>
|
||||||
|
<WorkspaceList headerOffset={height} />
|
||||||
|
</LayoutGridItem>
|
||||||
|
<LayoutGridItem column={2} row={1}>
|
||||||
|
<Outlet />
|
||||||
|
</LayoutGridItem>
|
||||||
|
</LayoutGrid>
|
||||||
|
</FullScreenContainer>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
export const workspaceList = [
|
||||||
|
{
|
||||||
|
name: "Workspace 1",
|
||||||
|
id: "workspace1",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Workspace 2",
|
||||||
|
id: "workspace2",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Workspace 3",
|
||||||
|
id: "workspace3",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Workspace 4 has a longer name than the rest",
|
||||||
|
id: "workspace4",
|
||||||
|
},
|
||||||
|
{ name: "blah", id: "blah0" },
|
||||||
|
{ name: "blah", id: "blah1" },
|
||||||
|
{ name: "blah", id: "blah2" },
|
||||||
|
{ name: "blah", id: "blah3" },
|
||||||
|
{ name: "blah", id: "blah4" },
|
||||||
|
{ name: "blah", id: "blah5" },
|
||||||
|
{ name: "blah", id: "blah6" },
|
||||||
|
{ name: "blah", id: "blah7" },
|
||||||
|
{ name: "blah", id: "blah8" },
|
||||||
|
{ name: "blah", id: "blah9" },
|
||||||
|
{ name: "blah", id: "blah10" },
|
||||||
|
{ name: "blah", id: "blah11" },
|
||||||
|
{ name: "blah", id: "blah12" },
|
||||||
|
{ name: "blah", id: "blah13" },
|
||||||
|
{ name: "blah", id: "blah14" },
|
||||||
|
{ name: "blah", id: "blah15" },
|
||||||
|
{ name: "blah", id: "blah16" },
|
||||||
|
{ name: "blah", id: "blah17" },
|
||||||
|
{ name: "blah", id: "blah18" },
|
||||||
|
{ name: "blah", id: "blah19" },
|
||||||
|
{ name: "blah", id: "blah20" },
|
||||||
|
{ name: "blah", id: "blah21" },
|
||||||
|
{ name: "blah", id: "blah22" },
|
||||||
|
{ name: "blah", id: "blah23" },
|
||||||
|
{ name: "blah", id: "blah24" },
|
||||||
|
{ name: "blah", id: "blah25" },
|
||||||
|
{ name: "blah", id: "blah26" },
|
||||||
|
{ name: "blah", id: "blah27" },
|
||||||
|
{ name: "blah", id: "blah28" },
|
||||||
|
{ name: "blah", id: "blah29" },
|
||||||
|
];
|
||||||
|
|
||||||
|
export const workspaceObject = ((list: typeof workspaceList) => {
|
||||||
|
const obj: {[key: string]: string} = {};
|
||||||
|
list.forEach(item => {
|
||||||
|
obj[item.id] = item.name;
|
||||||
|
});
|
||||||
|
return obj;
|
||||||
|
})(workspaceList);
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
import { RootState } from "../../types/state";
|
||||||
|
|
||||||
|
export const workspaceSelector = (state: RootState) => state.workspace;
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
||||||
|
import { RootState, WorkspaceId, AnimatedBG } from "../../types/state";
|
||||||
|
|
||||||
|
const initialState: RootState["workspace"] = {
|
||||||
|
workspaceId: "",
|
||||||
|
animatedBG: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
export const workspaceSlice = createSlice({
|
||||||
|
name: "workspace",
|
||||||
|
initialState,
|
||||||
|
reducers: {
|
||||||
|
setWorkspaceId: (state, action: PayloadAction<WorkspaceId>) => {
|
||||||
|
state.workspaceId = action.payload;
|
||||||
|
},
|
||||||
|
setAnimatedBG: (state, action: PayloadAction<AnimatedBG>) => {
|
||||||
|
state.animatedBG = action.payload;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export const { setWorkspaceId, setAnimatedBG } = workspaceSlice.actions;
|
||||||
|
export default workspaceSlice.reducer;
|
||||||
+11
-2
@@ -7,7 +7,10 @@ import { ThemeProvider } from "styled-components";
|
|||||||
import "./clear.css";
|
import "./clear.css";
|
||||||
|
|
||||||
import App from "./App";
|
import App from "./App";
|
||||||
import Broadcast from "./routes/BroadcastRoute";
|
import Broadcast from "./components/Broadcast/BroadcastRoute";
|
||||||
|
import Workspaces from "./components/Workspaces/WorkspacesRoute";
|
||||||
|
import { Workspace } from "./components/Workspaces/Workspace";
|
||||||
|
|
||||||
import { GlobalStyle, theme } from "./shared/theme";
|
import { GlobalStyle, theme } from "./shared/theme";
|
||||||
import { GlobalFonts } from "./fonts";
|
import { GlobalFonts } from "./fonts";
|
||||||
import { store } from "./store";
|
import { store } from "./store";
|
||||||
@@ -21,8 +24,14 @@ ReactDOM.render(
|
|||||||
<BrowserRouter>
|
<BrowserRouter>
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route path="/" element={<App />}>
|
<Route path="/" element={<App />}>
|
||||||
<Route path="/broadcast" element={<Broadcast />} />
|
<Route index element={<h1>Home</h1>} />
|
||||||
|
<Route path="broadcast" element={<Broadcast />} />
|
||||||
|
<Route path="workspaces" element={<Workspaces />}>
|
||||||
|
<Route index element={<h1>Workspaces Home</h1>} />
|
||||||
|
<Route path=":workspaceId" element={<Workspace />} />
|
||||||
</Route>
|
</Route>
|
||||||
|
</Route>
|
||||||
|
<Route path="*" element={<h1>Page Not Found</h1>} />
|
||||||
</Routes>
|
</Routes>
|
||||||
</BrowserRouter>
|
</BrowserRouter>
|
||||||
</ThemeProvider>
|
</ThemeProvider>
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 2.8 KiB |
+7
-5
@@ -14,11 +14,18 @@ export const theme = {
|
|||||||
orange: "#f4ae40",
|
orange: "#f4ae40",
|
||||||
blue: "#387af5",
|
blue: "#387af5",
|
||||||
pink: "#eb57a3",
|
pink: "#eb57a3",
|
||||||
|
activeGreen: "#65c466",
|
||||||
grey: "#aaa",
|
grey: "#aaa",
|
||||||
lightGrey: "#ddd",
|
lightGrey: "#ddd",
|
||||||
|
faintGrey: "#eee",
|
||||||
darkGrey: "#303030",
|
darkGrey: "#303030",
|
||||||
videoFrameBG: "#333",
|
videoFrameBG: "#333",
|
||||||
},
|
},
|
||||||
|
design: {
|
||||||
|
button: {
|
||||||
|
borderRadius: "0.25rem",
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export type MainThemeProps = ThemeProps<typeof theme>;
|
export type MainThemeProps = ThemeProps<typeof theme>;
|
||||||
@@ -41,9 +48,4 @@ export const GlobalStyle = createGlobalStyle<MainThemeProps>`
|
|||||||
button {
|
button {
|
||||||
font-family: ${p => p.theme.fonts.basic};
|
font-family: ${p => p.theme.fonts.basic};
|
||||||
}
|
}
|
||||||
|
|
||||||
.main {
|
|
||||||
padding: 70px 0 20px;
|
|
||||||
min-height: calc(100vh - 50px);
|
|
||||||
}
|
|
||||||
`;
|
`;
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
import { configureStore, combineReducers } from "@reduxjs/toolkit";
|
import { configureStore, combineReducers } from "@reduxjs/toolkit";
|
||||||
|
|
||||||
import pageDimensions from "./features/pageDimensions/pageDimensionsSlice";
|
import pageDimensions from "./features/pageDimensions/pageDimensionsSlice";
|
||||||
|
import workspace from "./features/workspace/workspaceSlice";
|
||||||
|
|
||||||
export const store = configureStore({
|
export const store = configureStore({
|
||||||
reducer: combineReducers({
|
reducer: combineReducers({
|
||||||
pageDimensions,
|
pageDimensions,
|
||||||
|
workspace,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
Vendored
+11
@@ -1,7 +1,9 @@
|
|||||||
export type RootState = {
|
export type RootState = {
|
||||||
pageDimensions: PageDimensions,
|
pageDimensions: PageDimensions,
|
||||||
|
workspace: Workspace,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Page Dimensions
|
||||||
export type PageDimensions = {
|
export type PageDimensions = {
|
||||||
menu: MenuDimensions,
|
menu: MenuDimensions,
|
||||||
};
|
};
|
||||||
@@ -9,3 +11,12 @@ export type PageDimensions = {
|
|||||||
export type MenuDimensions = {
|
export type MenuDimensions = {
|
||||||
height: number,
|
height: number,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Workspace
|
||||||
|
export type Workspace = {
|
||||||
|
workspaceId: WorkspaceId,
|
||||||
|
animatedBG: AnimatedBG,
|
||||||
|
};
|
||||||
|
|
||||||
|
export type WorkspaceId = string;
|
||||||
|
export type AnimatedBG = boolean;
|
||||||
@@ -1081,6 +1081,13 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
"@bedrock-layout/spacing-constants" "^2.5.1"
|
"@bedrock-layout/spacing-constants" "^2.5.1"
|
||||||
|
|
||||||
|
"@bedrock-layout/center@^2.2.5":
|
||||||
|
version "2.2.5"
|
||||||
|
resolved "https://registry.yarnpkg.com/@bedrock-layout/center/-/center-2.2.5.tgz#a559215267ae6e008cadc790b8b287c74d99dcd0"
|
||||||
|
integrity sha512-Y3fXSFdwcxZh1A+VED/itwT5gAmlfuD0+5/hGV1/iHPvR8qCtZ7fbx/YyjA3Jb0P+NRX6sXrq5dCWv54fxvNMQ==
|
||||||
|
dependencies:
|
||||||
|
"@bedrock-layout/spacing-constants" "^2.5.1"
|
||||||
|
|
||||||
"@bedrock-layout/columns@^2.3.4":
|
"@bedrock-layout/columns@^2.3.4":
|
||||||
version "2.3.4"
|
version "2.3.4"
|
||||||
resolved "https://registry.yarnpkg.com/@bedrock-layout/columns/-/columns-2.3.4.tgz#805de442f9c5962dd9609d8ef8a05dd9768d7bd1"
|
resolved "https://registry.yarnpkg.com/@bedrock-layout/columns/-/columns-2.3.4.tgz#805de442f9c5962dd9609d8ef8a05dd9768d7bd1"
|
||||||
@@ -1092,6 +1099,13 @@
|
|||||||
"@bedrock-layout/use-container-query" "^1.2.14"
|
"@bedrock-layout/use-container-query" "^1.2.14"
|
||||||
"@bedrock-layout/use-forwarded-ref" "^1.1.11"
|
"@bedrock-layout/use-forwarded-ref" "^1.1.11"
|
||||||
|
|
||||||
|
"@bedrock-layout/cover@^2.2.5":
|
||||||
|
version "2.2.5"
|
||||||
|
resolved "https://registry.yarnpkg.com/@bedrock-layout/cover/-/cover-2.2.5.tgz#281d90719924a3e7bfa6d228b0c44235fede57ca"
|
||||||
|
integrity sha512-M2r8aZE7dCvluaSCBQ8kGktZ4L00LlF2Uxp3kZA1lAO/Y3fAocqVnp4apxZW5Wvmh7QPDZb4Ll+qE+d9YlxcNQ==
|
||||||
|
dependencies:
|
||||||
|
"@bedrock-layout/spacing-constants" "^2.5.1"
|
||||||
|
|
||||||
"@bedrock-layout/frame@^2.2.4":
|
"@bedrock-layout/frame@^2.2.4":
|
||||||
version "2.2.4"
|
version "2.2.4"
|
||||||
resolved "https://registry.yarnpkg.com/@bedrock-layout/frame/-/frame-2.2.4.tgz#7c124718e0543ec1b53903788d040d05a9e8e1de"
|
resolved "https://registry.yarnpkg.com/@bedrock-layout/frame/-/frame-2.2.4.tgz#7c124718e0543ec1b53903788d040d05a9e8e1de"
|
||||||
@@ -1099,6 +1113,13 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
"@bedrock-layout/spacing-constants" "^2.5.1"
|
"@bedrock-layout/spacing-constants" "^2.5.1"
|
||||||
|
|
||||||
|
"@bedrock-layout/grid@^2.2.5":
|
||||||
|
version "2.2.5"
|
||||||
|
resolved "https://registry.yarnpkg.com/@bedrock-layout/grid/-/grid-2.2.5.tgz#36b622481c5d8b3bfb5a0fd76e5e0986ed69b098"
|
||||||
|
integrity sha512-5HteSi7BEWU7RTEBG9dRanqsKxf18aOcFj0V12S1muGki6Xc1yxw1V4O/GH/wGppvU1NH5ICxGuUBBqmXMPoyQ==
|
||||||
|
dependencies:
|
||||||
|
"@bedrock-layout/spacing-constants" "^2.5.1"
|
||||||
|
|
||||||
"@bedrock-layout/inline-cluster@^2.4.2":
|
"@bedrock-layout/inline-cluster@^2.4.2":
|
||||||
version "2.4.2"
|
version "2.4.2"
|
||||||
resolved "https://registry.yarnpkg.com/@bedrock-layout/inline-cluster/-/inline-cluster-2.4.2.tgz#0019482153b61f63a85cc0c22133f3ecac1e2821"
|
resolved "https://registry.yarnpkg.com/@bedrock-layout/inline-cluster/-/inline-cluster-2.4.2.tgz#0019482153b61f63a85cc0c22133f3ecac1e2821"
|
||||||
|
|||||||
Reference in new issue
Block a user