Skip to content

Commit

Permalink
updated beam requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
ametel01 committed Jan 29, 2024
1 parent c4e6e4c commit cec7ff3
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 48 deletions.
84 changes: 39 additions & 45 deletions packages/frontend/src/components/descriptions/DefencesPopover.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { DefencesStats } from '../../constants/Stats'
import React from 'react';
import { DefencesStats } from '../../constants/Stats';
import {
PopoverBox,
PopoverHeaderDiv,
Expand All @@ -8,29 +8,29 @@ import {
PopoverGridContainer,
PopoverRequirements,
PopoverInfoData,
PopoverLabel
} from '../../shared/styled/PopoverStyle'
PopoverLabel,
} from '../../shared/styled/PopoverStyle';

import blasterImg from '../../assets/gameElements/defences/blaster4.webp'
import beamImg from '../../assets/gameElements/defences/beam4.webp'
import astralLauncherImg from '../../assets/gameElements/defences/astral4.webp'
import plasmaImg from '../../assets/gameElements/defences/plasma4.webp'
import blasterImg from '../../assets/gameElements/defences/blaster4.webp';
import beamImg from '../../assets/gameElements/defences/beam4.webp';
import astralLauncherImg from '../../assets/gameElements/defences/astral4.webp';
import plasmaImg from '../../assets/gameElements/defences/plasma4.webp';

// Component props
interface DescriptionComponentProps {
title: string
image: string
description: React.ReactNode
stats: React.ReactNode
requirements: React.ReactNode
title: string;
image: string;
description: React.ReactNode;
stats: React.ReactNode;
requirements: React.ReactNode;
}

const DescriptionComponent = ({
title,
image,
description,
stats,
requirements
requirements,
}: DescriptionComponentProps) => {
return (
<PopoverBox>
Expand All @@ -40,7 +40,7 @@ const DescriptionComponent = ({
display: 'flex',
flexDirection: 'row',
alignItems: 'flex-start',
marginBottom: '24px'
marginBottom: '24px',
}}
>
{/* Image */}
Expand All @@ -59,16 +59,16 @@ const DescriptionComponent = ({
{/* Stats */}
{stats}
</PopoverBox>
)
}
);
};

interface StatsProps {
cargo?: number
speed?: number
consumption?: number
hull: number
shield: number
weapon: number
cargo?: number;
speed?: number;
consumption?: number;
hull: number;
shield: number;
weapon: number;
}

const StatsComponent = ({
Expand All @@ -77,40 +77,34 @@ const StatsComponent = ({
consumption,
hull,
shield,
weapon
weapon,
}: StatsProps) => {
return (
<PopoverGridContainer>
{cargo
? (
{cargo ? (
<>
<PopoverInfoRow>
<PopoverLabel>Cargo Capacity:</PopoverLabel>
<PopoverInfoData>{cargo}</PopoverInfoData>
</PopoverInfoRow>
</>
)
: null}
{speed
? (
) : null}
{speed ? (
<>
<PopoverInfoRow>
<PopoverLabel>Base Speed: </PopoverLabel>
<PopoverInfoData>{speed}</PopoverInfoData>
</PopoverInfoRow>
</>
)
: null}
{consumption
? (
) : null}
{consumption ? (
<>
<PopoverInfoRow>
<PopoverLabel>Consumption: </PopoverLabel>
<PopoverInfoData>{consumption}</PopoverInfoData>
</PopoverInfoRow>
</>
)
: null}
) : null}
<PopoverInfoRow>
<PopoverLabel>Base Hull: </PopoverLabel>
<PopoverInfoData>{hull}</PopoverInfoData>
Expand All @@ -124,8 +118,8 @@ const StatsComponent = ({
<PopoverInfoData>{weapon}</PopoverInfoData>
</PopoverInfoRow>
</PopoverGridContainer>
)
}
);
};

export const BlasterDescription = () => (
<DescriptionComponent
Expand All @@ -139,7 +133,7 @@ export const BlasterDescription = () => (
</>
}
/>
)
);
export const BeamDescription = () => (
<DescriptionComponent
title="Beam"
Expand All @@ -148,13 +142,13 @@ export const BeamDescription = () => (
stats={StatsComponent(DefencesStats.beam)}
requirements={
<>
<li>Dockyar level 2</li>
<li>Energy Innovation level 2</li>
<li>Beam Tech level 3</li>
<li>Dockyar level 4</li>
<li>Energy Innovation level 3</li>
<li>Beam Tech level 6</li>
</>
}
/>
)
);
export const AstralDescription = () => (
<DescriptionComponent
title="Astral Launcher"
Expand All @@ -170,7 +164,7 @@ export const AstralDescription = () => (
</>
}
/>
)
);
export const PlasmaDescription = () => (
<DescriptionComponent
title="Plasma Projector"
Expand All @@ -184,4 +178,4 @@ export const PlasmaDescription = () => (
</>
}
/>
)
);
4 changes: 2 additions & 2 deletions packages/frontend/src/panels/DefencesTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
blasterImg,
BuildType,
blasterRequirements,
BeamDescription,
BeamCannonDescription,
beamImg,
beamRequirements,
AstralDescription,
Expand Down Expand Up @@ -39,7 +39,7 @@ export const DefenceTabPanel = ({
requirements: blasterRequirements(dockyardLevel),
},
{
description: <BeamDescription />,
description: <BeamCannonDescription />,
img: beamImg,
title: 'Beam',
functionCallName: BuildType.Beam,
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/shared/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ export const beamRequirements = (
return dockyardLevel
? dockyardLevel >= 2 && techs
? techs.energy >= 2 && techs
? techs.beam >= 3
? techs.beam >= 6
: false
: false
: false;
Expand Down

0 comments on commit cec7ff3

Please sign in to comment.