ISSUE-035 - Added team flag overlays.

Added new workspace for team flags and adjusted custom workspace and tools to allow for work.
This commit is contained in:
Kyle Geib committed 2022-01-31 19:03:23 -05:00
1 parent 651f0bee6d
commit 064d684fa8
14 files changed
+35 -8

No files matched your search

@@ -11,17 +11,18 @@ type AngledFlagWorkSpaceProps = {
}; };
export function AngledFlagWorkSpace({ flagMode }: AngledFlagWorkSpaceProps) { export function AngledFlagWorkSpace({ flagMode }: AngledFlagWorkSpaceProps) {
const { prototypeState } = useSelector(workspaceSelector); const { prototypeState } = useSelector(workspaceSelector);
const defaultFlag = flagMode === "country" ? "GBR" : flagMode === "team" ? "alpine" : "";
return ( return (
<BasicBlock width={750} height={450} color="rgba(30, 30, 30, .7)"> <BasicBlock width={750} height={450} color="rgba(30, 30, 30, .7)">
<AngledFlag <AngledFlag
flagMode={flagMode} flagMode={flagMode}
flag={prototypeState?.angledFlag?.flagA ?? "GBR"} flag={prototypeState?.angledFlag?.flagA ?? defaultFlag}
flagHeight={64} flagHeight={64}
/> />
<AngledFlag <AngledFlag
flagMode={flagMode} flagMode={flagMode}
flag={prototypeState?.angledFlag?.flagB ?? "GBR"} flag={prototypeState?.angledFlag?.flagB ?? defaultFlag}
flagHeight={128} flagHeight={128}
/> />
</BasicBlock> </BasicBlock>
@@ -4,6 +4,7 @@ import { useDispatch, useSelector } from "react-redux";
import { workspaceSelector } from "../../../../features/workspace/workspaceSelector"; import { workspaceSelector } from "../../../../features/workspace/workspaceSelector";
import { setPrototypeState } from "../../../../features/workspace/workspaceSlice"; import { setPrototypeState } from "../../../../features/workspace/workspaceSlice";
import { FlagMode, TeamId } from "../../../../types/state";
import { SlotSelector } from "../../../Common/Inputs/SlotSelector"; import { SlotSelector } from "../../../Common/Inputs/SlotSelector";
@@ -11,23 +12,31 @@ const countries = [
"GBR", "NLD", "FIN", "JPN", "FRA", "DEU", "MEX", "POL", "MCO", "CHN", "THA", "GBR", "NLD", "FIN", "JPN", "FRA", "DEU", "MEX", "POL", "MCO", "CHN", "THA",
"CAN", "RUS", "RAF", "AUS", "ESP", "ITA", "CAN", "RUS", "RAF", "AUS", "ESP", "ITA",
]; ];
const teams: Array<TeamId> = [
"alpine", "alfaRomeo", "alphaTauri", "astonMartin", "haas", "ferrari",
"mclaren", "mercedes", "redBull", "williams",
];
export function AngledFlagPrototypeControls() { type AngledFlagPrototypeControlsProps = {
flagMode: FlagMode,
};
export function AngledFlagPrototypeControls({ flagMode }: AngledFlagPrototypeControlsProps) {
const dispatch = useDispatch(); const dispatch = useDispatch();
const { prototypeState } = useSelector(workspaceSelector); const { prototypeState } = useSelector(workspaceSelector);
const flagList = flagMode === "country" ? countries : flagMode === "team" ? teams : [];
const onChange = (flag: "flagA" | "flagB") => (index: number) => { const onChange = (flag: "flagA" | "flagB") => (index: number) => {
dispatch(setPrototypeState({ dispatch(setPrototypeState({
angledFlag: { angledFlag: {
flagA: flag === "flagA" ? countries[index] : prototypeState?.angledFlag?.flagA ?? "GBR", flagA: flag === "flagA" ? flagList[index] : prototypeState?.angledFlag?.flagA ?? "GBR",
flagB: flag === "flagB" ? countries[index] : prototypeState?.angledFlag?.flagB ?? "GBR", flagB: flag === "flagB" ? flagList[index] : prototypeState?.angledFlag?.flagB ?? "GBR",
}, },
})); }));
}; };
return ( return (
<Split as={PadBox} gutter="md" padding="md"> <Split as={PadBox} gutter="md" padding="md">
<SlotSelector label="64px" items={countries} onChange={onChange("flagA")}/> <SlotSelector label="64px" items={flagList} onChange={onChange("flagA")}/>
<SlotSelector label="128px" items={countries} onChange={onChange("flagB")}/> <SlotSelector label="128px" items={flagList} onChange={onChange("flagB")}/>
</Split> </Split>
); );
} }
@@ -67,7 +67,14 @@ export default function Workspaces() {
<Workspace <Workspace
workspaceId="angledFlagCountry" workspaceId="angledFlagCountry"
previewContent={<AngledFlagWorkSpace flagMode="country"/>} previewContent={<AngledFlagWorkSpace flagMode="country"/>}
prototypeControls={<AngledFlagPrototypeControls />} prototypeControls={<AngledFlagPrototypeControls flagMode="country" />}
/>
} />
<Route path="angledFlagTeam" element={
<Workspace
workspaceId="angledFlagTeam"
previewContent={<AngledFlagWorkSpace flagMode="team"/>}
prototypeControls={<AngledFlagPrototypeControls flagMode="team"/>}
/> />
} /> } />
<Route path="*" element={<h1>Unknown Workspace</h1>} /> <Route path="*" element={<h1>Unknown Workspace</h1>} />
+10
View File
@@ -47,4 +47,14 @@ export const workspaces: WorkspaceObject = {
height: 500, height: 500,
}, },
}, },
angledFlagTeam: {
name: "Angled Flag (Team)",
overlayIds: [
"angled-flag-ferrari.png",
],
previewWindowDimensions: {
width: 800,
height: 500,
},
},
}; };
Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB