diff --git a/frontend/src/components/views/shell/index.tsx b/frontend/src/components/views/shell/index.tsx index 59643c3ab..95de415ed 100644 --- a/frontend/src/components/views/shell/index.tsx +++ b/frontend/src/components/views/shell/index.tsx @@ -31,6 +31,12 @@ import styled from 'styled-components'; import { pipe, subscribe } from 'wonka'; import { styles } from './shell.styles'; +// there is a bug that means that the CONSTRUCT_BUILDING_MOBILE_UNIT action +// fails for zone ids above 40. As a temporary measure to limit confusion we +// will disable the construct button on these zones while we consider options +// see: https://github.com/playmint/ds/issues/1402 +const isBuggyZone = (id: number) => id > 40; + export interface ShellProps extends ComponentProps {} const StyledShell = styled('div')` @@ -63,6 +69,7 @@ export const Shell: FunctionComponent = () => { const kinds = global?.buildingKinds || []; const unitTimeoutBlocks = parseInt(global?.gameSettings?.unitTimeoutBlocks?.value || '0x0', 16); const zoneUnitLimit = parseInt(global?.gameSettings?.zoneUnitLimit?.value || '0x0', 16); + const zoneId = parseInt(zone?.key || 0, 16); const ui = usePluginState(); const [questsActive, setQuestsActive] = useState(true); @@ -413,7 +420,7 @@ export const Shell: FunctionComponent = () => {
- +
diff --git a/frontend/src/plugins/action-bar/index.tsx b/frontend/src/plugins/action-bar/index.tsx index 0f6dd3ef0..986555a4b 100644 --- a/frontend/src/plugins/action-bar/index.tsx +++ b/frontend/src/plugins/action-bar/index.tsx @@ -11,13 +11,17 @@ const CONSTRUCT_INTENT = 'construct'; const MOVE_INTENT = 'move'; const COMBAT_INTENT = 'combat'; -export interface ActionBarProps extends ComponentProps {} +export interface ActionBarProps extends ComponentProps { + construct: boolean; + move: boolean; + combat: boolean; +} const StyledActionBar = styled('div')` ${styles} `; -export const ActionBar: FunctionComponent = ({}: ActionBarProps) => { +export const ActionBar: FunctionComponent = ({ construct, move, combat }: ActionBarProps) => { const { selectIntent, intent, mobileUnit, selectTiles, selectMapElement } = useSelection(); const handleSelectIntent = useCallback( @@ -44,24 +48,30 @@ export const ActionBar: FunctionComponent = ({}: ActionBarProps) return (
- handleSelectIntent(MOVE_INTENT)} - > - Move - - handleSelectIntent(CONSTRUCT_INTENT)} - > - Build - - handleSelectIntent(COMBAT_INTENT)} - > - Attack - + {move && ( + handleSelectIntent(MOVE_INTENT)} + > + Move + + )} + {construct && ( + handleSelectIntent(CONSTRUCT_INTENT)} + > + Build + + )} + {combat && ( + handleSelectIntent(COMBAT_INTENT)} + > + Attack + + )}
);