diff --git a/src/App.tsx b/src/App.tsx index fa249d9..7979729 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -35,7 +35,7 @@ const LogoText = styled(Typography)(({ theme }) => ({ ? 'linear-gradient(135deg, #dee2e6 0%, #cccccc 100%)' : 'linear-gradient(135deg, #1a1a2e 0%, #333333 100%)', WebkitBackgroundClip: 'text', - WebkitTextFillColor: theme.palette.mode === 'dark' ? '#dee2e6' : '#1a1a2e', + WebkitTextFillColor: theme.palette.mode === 'dark' ? '#dee2e6' : 'rgba(0, 0, 0, 0.85)', letterSpacing: '-0.5px', cursor: 'pointer', '&:hover': { @@ -94,7 +94,7 @@ function AppBarContent() { - + diff --git a/src/classes/Ability.tsx b/src/classes/Ability.tsx index 231dddf..d17ebe0 100644 --- a/src/classes/Ability.tsx +++ b/src/classes/Ability.tsx @@ -1,6 +1,7 @@ import {AccordionDetails, AccordionSummary} from "@mui/material"; import {ExpandMore} from "@mui/icons-material"; import React from "react"; +import {useTheme} from "@mui/material/styles"; import {IAbilityShort} from "../types/IAbility"; import {getIcon} from "./ModifiersProvideTable"; import {IMod} from "../types/Imod"; @@ -15,23 +16,26 @@ interface IAbilityProps { } function Ability(props: IAbilityProps){ + const theme = useTheme(); + const isDark = theme.palette.mode === 'dark'; + const textColor = isDark ? '#dee2e6' : 'rgba(0, 0, 0, 0.85)'; const ability = props.ability return
} + sx={{color: textColor, '& .MuiAccordionSummary-content': { margin: '12px 0' }, '& .MuiAccordionSummary-content.Mui-expanded': { margin: '12px 0' }}} + expandIcon={} aria-controls="panel1-content" > - + {ability.activationType === "Passive ability" ? : }   {ability.name ? ability.name : ability.fileName.charAt(0).toUpperCase() + ability.fileName.slice(1).replaceAll('_', ' ').replace('.rgd', '')} ({ability.activationType}) - +
diff --git a/src/classes/AbilityFull.tsx b/src/classes/AbilityFull.tsx index e37eee0..66b4f5c 100644 --- a/src/classes/AbilityFull.tsx +++ b/src/classes/AbilityFull.tsx @@ -1,21 +1,19 @@ import React, {useEffect, useState} from "react"; +import {useTheme} from "@mui/material/styles"; import {AbilityUrl, AvailableBuildings, AvailableUnits, UserUrl, WeaponUrl} from "../core/api"; import {IWeapon} from "../types/IUnit"; import ArmorTypeNames from "../types/ArmorTypeValues"; import { AccordionDetails, Grid2, - styled, Table, TableBody, TableCell, - tableCellClasses, TableContainer, TableHead, TableRow, ToggleButton, ToggleButtonGroup } from "@mui/material"; import ArmorType from "./ArmorType"; import Required from "./Required"; -import {renderAffectedResearches} from "./building/Research"; import {IMod} from "../types/Imod"; import {Irace} from "../types/Irace"; import {IRaceUnits} from "../types/IUnitShort"; @@ -28,36 +26,22 @@ import AbilitySpawnedObject from "./AbilitySpawnedObject"; import DpsTable from "./DpsTable"; import {DescriptionBox} from "../commons/DescriptionBox"; import {StyledPaper} from "../commons/StyledPaper"; +import {StyledTableCell} from "../commons/StyledTableCell"; interface IAbilityFullState { ability?: IAbilityFill; } export default function AbilityFull(props: { abilityId?: number, mod: IMod, race: Irace, isChild?: boolean, abilityFull?: IAbilityFill }) { + const theme = useTheme(); + const isDark = theme.palette.mode === 'dark'; + const textColor = isDark ? '#dee2e6' : 'rgba(0, 0, 0, 0.85)'; const [abilityFull, setAbilityFull] = useState({ ability: undefined, }); - const StyledTableCell = styled(TableCell)(({theme}) => ({ - [`&.${tableCellClasses.head}`]: { - backgroundColor: theme.palette.mode === 'dark' ? 'rgba(255, 255, 255, 0.1)' : 'rgba(233, 69, 96, 0.15)', - fontWeight: 700, - marginRight: 'auto', - marginLeft: 'auto', - paddingLeft: 10, - borderBottom: `2px solid ${theme.palette.mode === 'dark' ? 'rgba(255, 255, 255, 0.3)' : 'rgba(233, 69, 96, 0.3)'}`, - }, - [`&.${tableCellClasses.body}`]: { - fontSize: 12, - textAlign: 'center', - color: '#dee2e6', - paddingRight: 18, - paddingLeft: 10, - }, - })); - useEffect(() => { if(props.abilityFull !== undefined){ @@ -94,11 +78,11 @@ export default function AbilityFull(props: { abilityId?: number, mod: IMod, race const showTargetTable = !showDpsTable && ability.abilityEnvironment == null && (ability.targetFilter.length > 0 || ability.radius !== 0) return ( -
+
{ability.initialDelayTime !== undefined && props.isChild === true && -
 After {ability.initialDelayTime.toFixed(1)}s  +
 After {ability.initialDelayTime.toFixed(1)}s 
} @@ -201,7 +185,7 @@ export default function AbilityFull(props: { abilityId?: number, mod: IMod, race {showDpsTable ? - {(ability.refreshTime !== undefined && ability.durationTime !== undefined && ability.refreshTime * 2 < ability.durationTime) && Every {ability.refreshTime.toFixed(1)}s deal damege:} + {(ability.refreshTime !== undefined && ability.durationTime !== undefined && ability.refreshTime * 2 < ability.durationTime) && Every {ability.refreshTime.toFixed(1)}s deal damege:} : showTargetTable ? diff --git a/src/classes/AbilitySpawnedObject.tsx b/src/classes/AbilitySpawnedObject.tsx index 46eb817..6747b8a 100644 --- a/src/classes/AbilitySpawnedObject.tsx +++ b/src/classes/AbilitySpawnedObject.tsx @@ -4,13 +4,14 @@ import { AccordionSummary, Grid2, Table, TableBody, - TableCell, TableContainer, + TableContainer, TableRow, Tooltip, Typography } from "@mui/material"; import {ExpandMore} from "@mui/icons-material"; import React from "react"; +import {useTheme} from "@mui/material/styles"; import {IAbilityShort} from "../types/IAbility"; import {getIcon} from "./ModifiersProvideTable"; import {IMod} from "../types/Imod"; @@ -25,6 +26,7 @@ import DeathExplosion from "./DeathExplosion"; import {styled} from '@mui/material/styles'; import {DescriptionBox} from "../commons/DescriptionBox"; import {StyledPaper} from "../commons/StyledPaper"; +import {StyledTableCell} from "../commons/StyledTableCell"; const SectionTitle = styled(Typography)(({ theme }) => ({ fontWeight: 700, @@ -40,10 +42,13 @@ interface AbilityEnvironmentProps { } function AbilitySpawnedObject(props: AbilityEnvironmentProps) { + const theme = useTheme(); + const isDark = theme.palette.mode === 'dark'; + const textColor = isDark ? '#dee2e6' : 'rgba(0, 0, 0, 0.85)'; const abilityEnvironment = props.abilityEnvironment - return
+ return
{props.abilityEnvironment.name ?? props.abilityEnvironment.filename.charAt(0).toUpperCase() + props.abilityEnvironment.filename.slice(1).replaceAll('_', ' ').replace('.rgd', '')} (Spawned object) @@ -57,23 +62,23 @@ function AbilitySpawnedObject(props: AbilityEnvironmentProps) { - Armor type - + Armor type + {abilityEnvironment.armorType2 == null ? : } - + } {abilityEnvironment.health !== null && - Health - + Health +   {abilityEnvironment.health} {abilityEnvironment.healthRegeneration != null && abilityEnvironment.healthRegeneration > 0 && @@ -81,36 +86,36 @@ function AbilitySpawnedObject(props: AbilityEnvironmentProps) { {abilityEnvironment.armour !== undefined && abilityEnvironment.armour !== 0 && {abilityEnvironment.armour} } - + } {abilityEnvironment.moveSpeed != null && - Move speed - {abilityEnvironment.moveSpeed} + Move speed + {abilityEnvironment.moveSpeed} } {abilityEnvironment.sightRadius != null && - Vision - + Vision + - + } {abilityEnvironment.lifetime != null && - Lifetime - + Lifetime +   {abilityEnvironment.lifetime.toFixed(0)}s  - + } diff --git a/src/classes/ArmorType.tsx b/src/classes/ArmorType.tsx index 9f87dbe..e8bca0e 100644 --- a/src/classes/ArmorType.tsx +++ b/src/classes/ArmorType.tsx @@ -53,6 +53,8 @@ class ArmorType extends React.Component { return '/images/ARM_Dmn_Hi.webp'; case 'Titan': return '/images/ARM_titan.webp'; + case 'Morale damage': + return '/images/ARM_Morale.webp'; default: return armorTypeId; } diff --git a/src/classes/DeathExplosion.tsx b/src/classes/DeathExplosion.tsx index 69a29ea..21cde68 100644 --- a/src/classes/DeathExplosion.tsx +++ b/src/classes/DeathExplosion.tsx @@ -3,12 +3,13 @@ import { AccordionSummary, Grid2, Table, TableBody, - TableCell, TableContainer, TableHead, + TableContainer, TableHead, TableRow, Tooltip } from "@mui/material"; import {ExpandMore} from "@mui/icons-material"; import React from "react"; +import {useTheme} from "@mui/material/styles"; import {IAbilityShort} from "../types/IAbility"; import {getIcon, ModifiersProvidesTable} from "./ModifiersProvideTable"; import {IMod} from "../types/Imod"; @@ -26,6 +27,7 @@ import DpsTable from "./DpsTable"; import {StyledAccordion} from "../commons/StyledAccordion"; import {StyledPaper} from "../commons/StyledPaper"; import {styled} from "@mui/material/styles"; +import {StyledTableCell} from "../commons/StyledTableCell"; interface DeathExpProps { @@ -34,6 +36,9 @@ interface DeathExpProps { } function DeathExplosion(props: DeathExpProps) { + const theme = useTheme(); + const isDark = theme.palette.mode === 'dark'; + const textColor = isDark ? '#dee2e6' : 'rgba(0, 0, 0, 0.85)'; const deathExplosion = props.deathExplosion const chanceTotalNotZero = deathExplosion.globalChance * deathExplosion.chance != 0 @@ -41,15 +46,15 @@ function DeathExplosion(props: DeathExpProps) { return chanceTotalNotZero ?
} + sx={{color: textColor, '& .MuiAccordionSummary-content': { margin: '12px 0' }, '& .MuiAccordionSummary-content.Mui-expanded': { margin: '12px 0' }}} + expandIcon={} aria-controls="panel1-content" > - + Death Explosion - + @@ -58,18 +63,18 @@ function DeathExplosion(props: DeathExpProps) { - Chance - {deathExplosion.globalChance * deathExplosion.chance}% + Chance + {deathExplosion.globalChance * deathExplosion.chance}% - Damage radius - {deathExplosion.damageRadius} + Damage radius + {deathExplosion.damageRadius} - Throw force - {deathExplosion.throwForceMin} - {deathExplosion.throwForceMax} + Throw force + {deathExplosion.throwForceMin} - {deathExplosion.throwForceMax} diff --git a/src/classes/DpsTable.tsx b/src/classes/DpsTable.tsx index 275844a..d5d520b 100644 --- a/src/classes/DpsTable.tsx +++ b/src/classes/DpsTable.tsx @@ -1,11 +1,8 @@ import React from "react"; import ArmorTypeNames from "../types/ArmorTypeValues"; import { - styled, Table, TableBody, - TableCell, - tableCellClasses, TableContainer, TableHead, TableRow @@ -14,27 +11,10 @@ import ArmorType from "./ArmorType"; import {IMod} from "../types/Imod"; import {IPiercing} from "../types/IPiercing"; import {IArmorType} from "../types/IArmorType"; +import {StyledTableCell} from "../commons/StyledTableCell"; export default function DpsTable(props: { mod: IMod, minDamageValue?: number, minDamage?: number, maxDamage?: number, piercings: IPiercing[], targetFilter: IArmorType[], moraleDamage?: number }) { - const StyledTableCell = styled(TableCell)(({theme}) => ({ - [`&.${tableCellClasses.head}`]: { - backgroundColor: theme.palette.mode === 'dark' ? 'rgba(255, 255, 255, 0.1)' : 'rgba(233, 69, 96, 0.15)', - fontWeight: 700, - marginRight: 'auto', - marginLeft: 'auto', - paddingLeft: 10, - borderBottom: `2px solid ${theme.palette.mode === 'dark' ? 'rgba(255, 255, 255, 0.3)' : 'rgba(233, 69, 96, 0.3)'}`, - }, - [`&.${tableCellClasses.body}`]: { - fontSize: 12, - textAlign: 'center', - color: '#dee2e6', - paddingRight: 18, - paddingLeft: 10, - }, - })); - function getPiercingK(armorType: string): number|null { if(props.targetFilter.length > 0 && props.targetFilter.find(tf => tf.name == armorType) === undefined) return null const piercing = props.piercings.find((p) => p.armorType.name === armorType) @@ -153,10 +133,8 @@ export default function DpsTable(props: { mod: IMod, minDamageValue?: number, mi name={ArmorTypeNames.BuildingHigh}/> - -
- Morale
+ @@ -207,10 +185,9 @@ export default function DpsTable(props: { mod: IMod, minDamageValue?: number, mi name={ArmorTypeNames.BuildingMedium}/>
- -
- Morale
+ + diff --git a/src/classes/ModifiersProvideTable.tsx b/src/classes/ModifiersProvideTable.tsx index 374c859..21c6819 100644 --- a/src/classes/ModifiersProvideTable.tsx +++ b/src/classes/ModifiersProvideTable.tsx @@ -1,5 +1,6 @@ import {Paper, Table, TableCell, TableContainer, TableRow} from "@mui/material"; import React from "react"; +import {useTheme} from "@mui/material/styles"; import {IModifier} from "../types/IModifier"; import {IconUrl} from "../core/api"; import {Irace} from "../types/Irace"; @@ -142,6 +143,9 @@ function getChangeDescription(ref: String, v: number) { } export function ModifiersProvidesAddonTable(props: IModifiersProvidesTable) { + const theme = useTheme(); + const isDark = theme.palette.mode === 'dark'; + const textColor = isDark ? '#dee2e6' : 'rgba(0, 0, 0, 0.85)'; let noWeaponMods = props.modifiers.filter(m => !m.reference.includes("default_weapon_modifier_hardpoint")) @@ -152,8 +156,8 @@ export function ModifiersProvidesAddonTable(props: IModifiersProvidesTable) { - {getModName(m.reference)} - {getModIcon(m.reference)} {getChangeDescription(m.usageType, m.value)} + {getModName(m.reference)} + {getModIcon(m.reference)} {getChangeDescription(m.usageType, m.value)} )} @@ -162,6 +166,9 @@ export function ModifiersProvidesAddonTable(props: IModifiersProvidesTable) { } export function ModifiersProvidesTable(props: IModifiersProvidesResearchTable) { + const theme = useTheme(); + const isDark = theme.palette.mode === 'dark'; + const textColor = isDark ? '#dee2e6' : 'rgba(0, 0, 0, 0.85)'; let mods = props.modifiers @@ -237,9 +244,9 @@ export function ModifiersProvidesTable(props: IModifiersProvidesResearchTable) { - {getTarget(m.target)} - {getModName(m.reference)} - {getModIcon(m.reference)} {getChangeDescription(m.usageType, m.value)} + {getTarget(m.target)} + {getModName(m.reference)} + {getModIcon(m.reference)} {getChangeDescription(m.usageType, m.value)} {m.maxLifeTime !== undefined && m.maxLifeTime > 0 && {m.maxLifeTime}s } diff --git a/src/classes/Required.tsx b/src/classes/Required.tsx index 0a0663e..09453bc 100644 --- a/src/classes/Required.tsx +++ b/src/classes/Required.tsx @@ -1,4 +1,5 @@ import React from "react"; +import {useTheme} from "@mui/material/styles"; import {IBuildingShort} from "../types/IBuildingShort"; import {IBuildingAddonShort} from "../types/IBuilding"; import {IconUrl} from "../core/api"; @@ -14,6 +15,9 @@ interface IRequiredProps{ } function Required (props: IRequiredProps) { + const theme = useTheme(); + const isDark = theme.palette.mode === 'dark'; + const textColor = isDark ? '#dee2e6' : 'rgba(0, 0, 0, 0.85)'; function renderRequirementGlobalAddons(rgas: IBuildingAddonShort[],) { @@ -115,20 +119,20 @@ function Required (props: IRequiredProps) { return ( -
-

Required:

+
+

Required:

{requirement.requiredTotalPop !== undefined && requirement.requiredTotalPop !== null && -
  Population:   Population:   {requirement.requiredTotalPop}
} {requirement.mobBonus !== null && requirement.mobBonus !== undefined && -
  Mob requirement:   Mob requirement:   {requirement.mobBonus.mobvalueRequired} in radius {requirement.mobBonus.proximityRequired}
} {requirement.requireAddon !== null && -
  Addon:   Addon:   {requirement.requireAddon.name} @@ -137,26 +141,26 @@ function Required (props: IRequiredProps) {
} {requirement.requirementAddonExclusive != null && -
{renderRequiremenAddonExclusive(requirement.requirementAddonExclusive,)}
} +
{renderRequiremenAddonExclusive(requirement.requirementAddonExclusive,)}
} {requirement.requirementBuildings.map(b => -
  Building:   Building:   {b.name}
) } {requirement.requirementResearches.length !== 0 && -
{renderRequirementResearches(requirement.requirementResearches,)}
} +
{renderRequirementResearches(requirement.requirementResearches,)}
} {requirement.requirementSquads.length !== 0 && -
{renderRequirementSquads(requirement.requirementSquads,)}
} +
{renderRequirementSquads(requirement.requirementSquads,)}
} {requirement.requirementResearchesEither.length !== 0 && -
{renderRequirementResearchesEither(requirement.requirementResearchesEither,)}
} +
{renderRequirementResearchesEither(requirement.requirementResearchesEither,)}
} {requirement.requirementBuildingsEither.length !== 0 && -
{renderRequirementBuildingEither(requirement.requirementBuildingsEither,)}
} +
{renderRequirementBuildingEither(requirement.requirementBuildingsEither,)}
} {requirement.requirementStructureExclusive != null && -
{renderRequiremenStructureExclusive(requirement.requirementStructureExclusive,)}
} - {requirement.limitByBuilding !== undefined && requirement.limitByBuilding !== null &&
{renderLimitPerBuilding(requirement.limitByBuilding)}
} +
{renderRequiremenStructureExclusive(requirement.requirementStructureExclusive,)}
} + {requirement.limitByBuilding !== undefined && requirement.limitByBuilding !== null &&
{renderLimitPerBuilding(requirement.limitByBuilding)}
} {requirement.requirementsGlobalAddons.length !== 0 && -
{renderRequirementGlobalAddons(requirement.requirementsGlobalAddons,)}
} -
{renderRequirementOwnership(requirement.requiredOwnership)}
+
{renderRequirementGlobalAddons(requirement.requirementsGlobalAddons,)}
} +
{renderRequirementOwnership(requirement.requiredOwnership)}
) } diff --git a/src/classes/Sergeant.tsx b/src/classes/Sergeant.tsx index f9a221b..1ef52c1 100644 --- a/src/classes/Sergeant.tsx +++ b/src/classes/Sergeant.tsx @@ -1,4 +1,5 @@ import React from "react"; +import {useTheme} from "@mui/material/styles"; import {ISergeant, IShortWeapon} from "../types/IUnit"; import {Grid2, Table, TableBody, TableCell, TableContainer, TableRow, Tooltip, Typography} from "@mui/material"; import AvTimerOutlinedIcon from "@mui/icons-material/AvTimer"; @@ -6,7 +7,7 @@ import ArmorType from "./ArmorType"; import WeaponSlot from "./WeaponSlot"; import Vision from "./Vision"; import {IMod} from "../types/Imod"; -import {renderAffectedResearches} from "./building/Research"; +import {AffectedResearches} from "./building/Research"; import {Irace} from "../types/Irace"; import Required from "./Required"; import {ModifiersProvidesTable} from "./ModifiersProvideTable"; @@ -30,6 +31,9 @@ export interface SergeantProps { } const Sergeant = (props: SergeantProps) => { + const theme = useTheme(); + const isDark = theme.palette.mode === 'dark'; + const textColor = isDark ? '#dee2e6' : 'rgba(0, 0, 0, 0.85)'; const sergeant = props.sergeant @@ -47,7 +51,7 @@ const Sergeant = (props: SergeantProps) => { }) return ( -
+
@@ -189,7 +193,7 @@ const Sergeant = (props: SergeantProps) => { } - {renderAffectedResearches(sergeant.affectedResearches, props.mod.id, props.race.id)} + Hotkey: {sergeant.hotkey} diff --git a/src/classes/UnitsTable.tsx b/src/classes/UnitsTable.tsx index 74af101..4e21e69 100644 --- a/src/classes/UnitsTable.tsx +++ b/src/classes/UnitsTable.tsx @@ -9,10 +9,10 @@ import {StyledPaper} from "../commons/StyledPaper"; const StyledTable = styled(Table)(({ theme }) => ({ '& .MuiTableCell-head': { - backgroundColor: theme.palette.mode === 'dark' ? 'rgba(255, 255, 255, 0.1)' : 'rgba(233, 69, 96, 0.15)', + backgroundColor: theme.palette.mode === 'dark' ? 'rgba(255, 255, 255, 0.1)' : 'rgba(0, 0, 0, 0.05)', fontWeight: 700, fontSize: '1rem', - borderBottom: `2px solid ${theme.palette.mode === 'dark' ? 'rgba(255, 255, 255, 0.3)' : 'rgba(233, 69, 96, 0.3)'}`, + borderBottom: `2px solid ${theme.palette.mode === 'dark' ? 'rgba(255, 255, 255, 0.3)' : 'rgba(0, 0, 0, 0.2)'}`, }, '& .MuiTableCell-body': { color: theme.palette.text.primary, @@ -20,7 +20,7 @@ const StyledTable = styled(Table)(({ theme }) => ({ fontSize: '0.9rem', }, '& .MuiTableRow-hover:hover': { - backgroundColor: theme.palette.mode === 'dark' ? 'rgba(255, 255, 255, 0.05)' : 'rgba(233, 69, 96, 0.08)', + backgroundColor: theme.palette.mode === 'dark' ? 'rgba(255, 255, 255, 0.05)' : 'rgba(0, 0, 0, 0.04)', }, })); @@ -28,7 +28,7 @@ const StyledHeaderLink = styled(StyledLink)(({ theme }) => ({ fontWeight: 700, fontSize: '1.1rem', '&:hover': { - color: theme.palette.mode === 'dark' ? '#dee2e6' : '#e94560', + color: theme.palette.mode === 'dark' ? '#dee2e6' : 'rgba(0, 0, 0, 0.85)', }, })); @@ -95,11 +95,11 @@ export default function UnitsTable(prop: {modId: number}) { return 3; case 'Demon Medium': return 4; - case 'Infantry Heavy Medium': + case 'Infantry H.Med.': return 5; - case 'Infantry Heavy High': + case 'Infantry H.High': return 6; - case 'Commander': + case 'Infantry Com.': return 7; case 'Vehicle Low': return 8; @@ -109,7 +109,7 @@ export default function UnitsTable(prop: {modId: number}) { return 10; case 'Demon High': return 11; - case 'Air': + case 'Vehicle Air': return 12; case 'Building Low': return 13; @@ -131,7 +131,7 @@ export default function UnitsTable(prop: {modId: number}) { } function generateRaceUnitTable(racesUnitsPart: IRaceUnits[], racesBuildings: IRaceBuildings[]){ - return ( + return ( { diff --git a/src/classes/Weapon.tsx b/src/classes/Weapon.tsx index b1bef73..5877390 100644 --- a/src/classes/Weapon.tsx +++ b/src/classes/Weapon.tsx @@ -1,6 +1,7 @@ import React from "react"; import {IShortWeapon, IWeapon} from "../types/IUnit"; import {AccordionDetails, AccordionSummary} from "@mui/material"; +import {withTheme} from "../core/api"; import {IconUrl} from "../core/api"; import {ExpandMore} from "@mui/icons-material"; import {IMod} from "../types/Imod"; @@ -31,18 +32,21 @@ class Weapon extends React.Component { render() { + const theme = (this.props as any).theme; + const isDark = theme.palette.mode === 'dark'; + const textColor = isDark ? '#dee2e6' : 'rgba(0, 0, 0, 0.85)'; const weapon = this.props.weapon return (
} + expandIcon={} aria-controls="panel1-content" id="panel1-header" - sx={{color: '#dee2e6', '& .MuiAccordionSummary-content': { margin: '12px 0' }, '& .MuiAccordionSummary-content.Mui-expanded': { margin: '12px 0' }}} + sx={{color: textColor, '& .MuiAccordionSummary-content': { margin: '12px 0' }, '& .MuiAccordionSummary-content.Mui-expanded': { margin: '12px 0' }}} > - {!this.props.isDefault && weapon.icon && !weapon.icon.endsWith("upgrade.png") ? + {!this.props.isDefault && weapon.icon && !weapon.icon.endsWith("upgrade.png") ? : ( weapon.isMeleeWeapon ? : @@ -51,7 +55,7 @@ class Weapon extends React.Component { {this.props.isDefault && (default)} - +
@@ -59,4 +63,4 @@ class Weapon extends React.Component { } } -export default Weapon; \ No newline at end of file +export default withTheme(Weapon); diff --git a/src/classes/WeaponFull.tsx b/src/classes/WeaponFull.tsx index 25d3243..d5a2100 100644 --- a/src/classes/WeaponFull.tsx +++ b/src/classes/WeaponFull.tsx @@ -1,21 +1,20 @@ import React, {useEffect, useState} from "react"; +import {useTheme} from "@mui/material/styles"; import {AvailableBuildings, AvailableUnits, UserUrl, WeaponUrl} from "../core/api"; import {IWeapon} from "../types/IUnit"; import ArmorTypeNames from "../types/ArmorTypeValues"; import { AccordionDetails, Grid2, - styled, Table, TableBody, TableCell, - tableCellClasses, TableContainer, TableHead, TableRow, ToggleButton, ToggleButtonGroup } from "@mui/material"; import ArmorType from "./ArmorType"; import Required from "./Required"; -import {renderAffectedResearches} from "./building/Research"; +import {AffectedResearches} from "./building/Research"; import {IMod} from "../types/Imod"; import {Irace} from "../types/Irace"; import {IRaceUnits} from "../types/IUnitShort"; @@ -23,6 +22,7 @@ import {IRaceBuildings} from "../types/IBuildingShort"; import {ModifiersProvidesTable} from "./ModifiersProvideTable"; import {DescriptionBox} from "../commons/DescriptionBox"; import {StyledPaper} from "../commons/StyledPaper"; +import {StyledTableCell} from "../commons/StyledTableCell"; import AvTimerOutlinedIcon from "@mui/icons-material/AvTimer"; interface IWeaponFull { @@ -31,29 +31,15 @@ interface IWeaponFull { } export default function WeaponFull(props: {weaponId: number, isDefault: Boolean, mod: IMod, race: Irace, haveReinforceMenu: Boolean}) { + const theme = useTheme(); + const isDark = theme.palette.mode === 'dark'; + const textColor = isDark ? '#dee2e6' : 'rgba(0, 0, 0, 0.85)'; const [weaoponFull, setWeaponFull] = useState({ currentTable: "dps", weapon: undefined, }); - const StyledTableCell = styled(TableCell)(({theme}) => ({ - [`&.${tableCellClasses.head}`]: { - backgroundColor: theme.palette.mode === 'dark' ? 'rgba(255, 255, 255, 0.1)' : 'rgba(233, 69, 96, 0.15)', - marginRight: 'auto', - marginLeft: 'auto', - paddingLeft: 10, - borderBottom: `2px solid ${theme.palette.mode === 'dark' ? 'rgba(255, 255, 255, 0.3)' : 'rgba(233, 69, 96, 0.3)'}`, - }, - [`&.${tableCellClasses.body}`]: { - fontSize: 12, - textAlign: 'center', - color: '#dee2e6', - paddingRight: 18, - paddingLeft: 10, - }, - })); - useEffect(() => { fetch(WeaponUrl + "/" + props.mod.id + "/" + props.weaponId) @@ -137,7 +123,7 @@ export default function WeaponFull(props: {weaponId: number, isDefault: Boolean, return ( -
+
{!props.isDefault && @@ -248,8 +234,8 @@ export default function WeaponFull(props: {weaponId: number, isDefault: Boolean, onChange={handleChange} sx={{ mb: 2 }} > - Dps - One hit average damage + Dps + One hit average damage { props.mod !== undefined && props.mod.technicalName === 'UltimateApocalypse' ? @@ -313,7 +299,7 @@ export default function WeaponFull(props: {weaponId: number, isDefault: Boolean, name={ArmorTypeNames.BuildingSuper}/> -
+
Morale
@@ -365,10 +351,8 @@ export default function WeaponFull(props: {weaponId: number, isDefault: Boolean, name={ArmorTypeNames.BuildingMedium}/> - -
- Morale
+ @@ -399,7 +383,7 @@ export default function WeaponFull(props: {weaponId: number, isDefault: Boolean, {weapon.modifiers.length > 0 && -

Modifiers

+

Modifiers

} {weapon.requirements !== null && !props.isDefault && props.haveReinforceMenu && @@ -407,7 +391,7 @@ export default function WeaponFull(props: {weaponId: number, isDefault: Boolean, } - {renderAffectedResearches(weapon.affectedResearches, props.mod.id, props.race.id)} + {!props.isDefault && props.haveReinforceMenu && Hotkey: {weapon.hotkey}} diff --git a/src/classes/building/BuildingAddon.tsx b/src/classes/building/BuildingAddon.tsx index 09f0edb..84e6756 100644 --- a/src/classes/building/BuildingAddon.tsx +++ b/src/classes/building/BuildingAddon.tsx @@ -1,4 +1,5 @@ import React from "react"; +import {useTheme} from "@mui/material/styles"; import { AccordionDetails, AccordionSummary, @@ -29,6 +30,9 @@ interface IBuildingAddonProps { } function BuildingAddon(props: IBuildingAddonProps){ + const theme = useTheme(); + const isDark = theme.palette.mode === 'dark'; + const textColor = isDark ? '#dee2e6' : 'rgba(0, 0, 0, 0.85)'; const addon = props.addon const building = props.building @@ -37,16 +41,16 @@ function BuildingAddon(props: IBuildingAddonProps){ return
} + sx={{color: textColor, '& .MuiAccordionSummary-content': { margin: '12px 0' }, '& .MuiAccordionSummary-content.Mui-expanded': { margin: '12px 0' }}} + expandIcon={} aria-controls="panel1-content" > - +   {addon.name} - + diff --git a/src/classes/building/Research.tsx b/src/classes/building/Research.tsx index 761e151..671d5cd 100644 --- a/src/classes/building/Research.tsx +++ b/src/classes/building/Research.tsx @@ -13,24 +13,13 @@ import { } from "@mui/material"; import {ExpandMore} from "@mui/icons-material"; import {getIcon, ModifiersProvidesTable} from "../ModifiersProvideTable"; -import AvTimerOutlinedIcon from "@mui/icons-material/AvTimer"; -import Required from "../Required"; import React from "react"; +import {useTheme} from "@mui/material/styles"; import {IBuilding} from "../../types/IBuilding"; import {IResearchShort} from "../../types/IResearchShort"; import ResearchFull from "./ResearchFull"; import {StyledAccordion} from "../../commons/StyledAccordion"; -import {styled} from "@mui/material/styles"; - -const StyledLink = styled('a')(({ theme }) => ({ - color: theme.palette.mode === 'dark' ? '#dee2e6' : '#e94560', - textDecoration: 'none', - '&:hover': { - color: theme.palette.mode === 'dark' ? '#cccccc' : '#ff6b6b', - textDecoration: 'underline', - }, -})); - +import {StyledLink} from "../../commons/StyledLink"; interface IResearchProps { research: IResearchShort, @@ -39,29 +28,36 @@ interface IResearchProps { } function Research(props: IResearchProps){ + const theme = useTheme(); + const isDark = theme.palette.mode === 'dark'; + const textColor = isDark ? '#dee2e6' : 'rgba(0, 0, 0, 0.85)'; const research = props.research const building = props.building return
} + sx={{color: textColor, '& .MuiAccordionSummary-content': { margin: '12px 0' }, '& .MuiAccordionSummary-content.Mui-expanded': { margin: '12px 0' }}} + expandIcon={} aria-controls="panel1-content" > - +   {research.name} - +
} -export function renderAffectedResearches(researches: IResearchShort[], modId: number, raceId: string) { +export function AffectedResearches(props: { researches: IResearchShort[], modId: number, raceId: string }) { + const { researches, modId, raceId } = props; + const theme = useTheme(); + const isDark = theme.palette.mode === 'dark'; + const textColor = isDark ? '#dee2e6' : 'rgba(0, 0, 0, 0.85)'; function researchLink(rs: IResearchShort) { return } - return
{researches.map(rs => + return
{researches.map(rs => rs.buildingId == null ? : Research affect: {researchLink(rs)}
)}
diff --git a/src/commons/BackButton.tsx b/src/commons/BackButton.tsx index c09cb11..05434f8 100644 --- a/src/commons/BackButton.tsx +++ b/src/commons/BackButton.tsx @@ -1,14 +1,17 @@ import {Button, Link} from "@mui/material"; import {styled} from '@mui/material/styles'; -export const BackButton = styled(Button)(({ theme }) => ({ - marginBottom: theme.spacing(3), - color: '#FFD700', - borderColor: 'rgba(255, 215, 0, 0.5)', - textTransform: 'none', - fontWeight: 600, - '&:hover': { - borderColor: '#FFD700', - backgroundColor: 'rgba(255, 215, 0, 0.1)', - }, -})); \ No newline at end of file +export const BackButton = styled(Button)(({ theme }) => { + const isDark = theme.palette.mode === 'dark'; + return { + marginBottom: theme.spacing(3), + color: isDark ? '#FFD700' : '#1976d2', + borderColor: isDark ? 'rgba(255, 215, 0, 0.5)' : 'rgba(25, 118, 210, 0.5)', + textTransform: 'none', + fontWeight: 600, + '&:hover': { + borderColor: isDark ? '#FFD700' : '#1976d2', + backgroundColor: isDark ? 'rgba(255, 215, 0, 0.1)' : 'rgba(25, 118, 210, 0.1)', + }, + }; +}); diff --git a/src/commons/StyledLink.tsx b/src/commons/StyledLink.tsx index 68da5c3..a79b218 100644 --- a/src/commons/StyledLink.tsx +++ b/src/commons/StyledLink.tsx @@ -2,11 +2,11 @@ import {Link} from "@mui/material"; import {styled} from '@mui/material/styles'; export const StyledLink = styled(Link)(({ theme }) => ({ - color: theme.palette.mode === 'dark' ? '#abc3ff' : '#e94560BB', + color: theme.palette.mode === 'dark' ? '#abc3ff' : '#1976d2', textDecoration: 'none', transition: 'all 0.2s ease', '&:hover': { - color: theme.palette.mode === 'dark' ? '#ffffff' : '#ff6b6bBB', + color: theme.palette.mode === 'dark' ? '#ffffff' : '#1565c0', textDecoration: 'underline', }, })); diff --git a/src/commons/StyledPaper.tsx b/src/commons/StyledPaper.tsx index a593891..587729b 100644 --- a/src/commons/StyledPaper.tsx +++ b/src/commons/StyledPaper.tsx @@ -12,7 +12,7 @@ export const StyledPaper = styled(Paper)(({ theme }) => ({ color: theme.palette.text.primary, }, '& .MuiTableBody .MuiTableRow-root .MuiTableCell-head': { - color: theme.palette.mode === 'dark' ? '#dee2e6' : '#e94560', + color: theme.palette.mode === 'dark' ? '#dee2e6' : 'rgba(0, 0, 0, 0.85)', fontWeight: 600, }, })); diff --git a/src/commons/StyledTableCell.tsx b/src/commons/StyledTableCell.tsx new file mode 100644 index 0000000..8bc387d --- /dev/null +++ b/src/commons/StyledTableCell.tsx @@ -0,0 +1,22 @@ +import {styled, TableCell, tableCellClasses} from "@mui/material"; + +export const StyledTableCell = styled(TableCell)(({theme}) => { + const isDark = theme.palette.mode === 'dark'; + const textColor = isDark ? '#dee2e6' : 'rgba(0, 0, 0, 0.85)'; + return { + [`&.${tableCellClasses.head}`]: { + backgroundColor: isDark ? 'rgba(255, 255, 255, 0.1)' : 'rgba(0, 0, 0, 0.05)', + marginRight: 'auto', + marginLeft: 'auto', + paddingLeft: 10, + borderBottom: `2px solid ${isDark ? 'rgba(255, 255, 255, 0.3)' : 'rgba(0, 0, 0, 0.2)'}`, + }, + [`&.${tableCellClasses.body}`]: { + fontSize: 12, + textAlign: 'center', + color: textColor, + paddingRight: 18, + paddingLeft: 10, + }, + }; +}); diff --git a/src/pages/BuildingPage.tsx b/src/pages/BuildingPage.tsx index a18bfbf..0ef205c 100644 --- a/src/pages/BuildingPage.tsx +++ b/src/pages/BuildingPage.tsx @@ -28,7 +28,7 @@ import {IBuilding} from "../types/IBuilding"; import Vision from "../classes/Vision"; import BuildingAddon from "../classes/building/BuildingAddon"; import {IUnitShort} from "../types/IUnitShort"; -import Research, {renderAffectedResearches} from "../classes/building/Research"; +import Research, {AffectedResearches} from "../classes/building/Research"; import Required from "../classes/Required"; import {ModifiersProvidesTable} from "../classes/ModifiersProvideTable"; import Ability from "../classes/Ability"; @@ -57,7 +57,7 @@ const StatsPaper = styled(Paper)(({ theme }) => ({ color: theme.palette.text.primary, }, '& .MuiTableBody .MuiTableRow-root .MuiTableCell-head': { - color: theme.palette.mode === 'dark' ? '#dee2e6' : '#e94560', + color: theme.palette.mode === 'dark' ? '#dee2e6' : 'rgba(0, 0, 0, 0.85)', fontWeight: 600, }, })); @@ -83,7 +83,7 @@ const BuildingSubtitle = styled(Typography)(({ theme }) => ({ const UnitLink = styled(Link)(({ theme }) => ({ color: theme.palette.text.primary, textDecoration: 'none', - '&:hover': { color: theme.palette.mode === 'dark' ? '#dee2e6' : '#e94560' }, + '&:hover': { color: theme.palette.mode === 'dark' ? '#dee2e6' : 'rgba(0, 0, 0, 0.85)' }, })); const UnitListItem = styled(ListItem)(({ theme }) => ({ @@ -288,7 +288,7 @@ function Building(building: IBuilding, mod: IMod, theme: Theme) { }).map(h => )} - {renderAffectedResearches(building.affectedResearches, mod.id, building.race.id)} + Hotkey: {building.hotkey} diff --git a/src/pages/ModPage.tsx b/src/pages/ModPage.tsx index 3b96c43..524d9e7 100644 --- a/src/pages/ModPage.tsx +++ b/src/pages/ModPage.tsx @@ -84,15 +84,13 @@ class ModPage extends React.Component { mb: 1, WebkitBackgroundClip: isDark ? 'text' : 'initial', WebkitTextFillColor: isDark ? '#dee2e6' : 'initial', - color: isDark ? '#dee2e6' : '#000000', + color: isDark ? '#dee2e6' : 'rgba(0, 0, 0, 0.85)', }}> - {this.state.mod.name} - - - ({this.state.mod.version}) + {this.state.mod.name} ({this.state.mod.version}) diff --git a/src/pages/ModsPage.tsx b/src/pages/ModsPage.tsx index 47fd8e7..949f070 100644 --- a/src/pages/ModsPage.tsx +++ b/src/pages/ModsPage.tsx @@ -62,13 +62,13 @@ const ModCard = styled(Card)(({ theme }) => ({ height: '3px', background: theme.palette.mode === 'dark' ? 'linear-gradient(90deg, #dee2e6 0%, #cccccc 100%)' - : 'linear-gradient(90deg, #e94560 0%, #ff6b6b 100%)', + : 'linear-gradient(90deg, #000000 0%, #333333 100%)', transform: 'scaleX(0)', transition: 'transform 0.3s ease', }, '&:hover': { - boxShadow: theme.palette.mode === 'dark' ? '0 20px 40px rgba(255, 255, 255, 0.1)' : '0 20px 40px rgba(233, 69, 96, 0.2)', - borderColor: theme.palette.mode === 'dark' ? 'rgba(255, 255, 255, 0.3)' : 'rgba(233, 69, 96, 0.3)', + boxShadow: theme.palette.mode === 'dark' ? '0 20px 40px rgba(255, 255, 255, 0.1)' : '0 20px 40px rgba(0, 0, 0, 0.2)', + borderColor: theme.palette.mode === 'dark' ? 'rgba(255, 255, 255, 0.3)' : 'rgba(0, 0, 0, 0.3)', '&::before': { transform: 'scaleX(1)', }, @@ -87,8 +87,8 @@ const VersionLink = styled(NavLink)(({ theme }) => ({ transition: 'all 0.2s ease', border: `1px solid ${theme.palette.mode === 'dark' ? 'rgba(255, 255, 255, 0.1)' : 'rgba(0, 0, 0, 0.1)'}`, '&:hover': { - background: theme.palette.mode === 'dark' ? 'rgba(255, 255, 255, 0.1)' : 'rgba(233, 69, 96, 0.15)', - borderColor: theme.palette.mode === 'dark' ? 'rgba(255, 255, 255, 0.3)' : 'rgba(233, 69, 96, 0.3)', + background: theme.palette.mode === 'dark' ? 'rgba(255, 255, 255, 0.1)' : 'rgba(0, 0, 0, 0.1)', + borderColor: theme.palette.mode === 'dark' ? 'rgba(255, 255, 255, 0.3)' : 'rgba(0, 0, 0, 0.3)', }, })); @@ -97,10 +97,10 @@ const ModTitle = styled(Typography)(({ theme }) => ({ mb: 1, background: theme.palette.mode === 'dark' ? 'linear-gradient(135deg, #dee2e6 0%, #e0e0e0 100%)' - : 'linear-gradient(135deg, #000000 0%, #333333 100%)', + : 'none', WebkitBackgroundClip: theme.palette.mode === 'dark' ? 'text' : 'initial', WebkitTextFillColor: theme.palette.mode === 'dark' ? '#dee2e6' : 'initial', - color: theme.palette.mode === 'dark' ? '#dee2e6' : '#000000', + color: theme.palette.mode === 'dark' ? '#dee2e6' : 'rgba(0, 0, 0, 0.85)', })); const ModDescription = styled(Typography)(({ theme }) => ({ @@ -109,8 +109,8 @@ const ModDescription = styled(Typography)(({ theme }) => ({ })); const VersionsChip = styled(Chip)(({ theme }) => ({ - backgroundColor: theme.palette.mode === 'dark' ? 'rgba(255, 255, 255, 0.15)' : 'rgba(233, 69, 96, 0.2)', - color: theme.palette.mode === 'dark' ? '#dee2e6' : '#ff6b6b', + backgroundColor: theme.palette.mode === 'dark' ? 'rgba(255, 255, 255, 0.15)' : 'rgba(0, 0, 0, 0.1)', + color: theme.palette.mode === 'dark' ? '#dee2e6' : 'rgba(0, 0, 0, 0.85)', fontWeight: 600, })); @@ -140,21 +140,24 @@ const BetaVersionsLabel = styled(Typography)(({ theme }) => ({ mb: 1, })); -const OpenLatestButton = styled(Button)(({ theme }) => ({ - width: '100%', - color: '#FFD700', - borderColor: 'rgba(255, 215, 0, 0.5)', - fontWeight: 600, - borderRadius: '10px', - textTransform: 'none', - fontSize: '1rem', - py: 1.5, - '&:hover': { - borderColor: '#FFD700', - backgroundColor: 'rgba(255, 215, 0, 0.1)', - boxShadow: '0 8px 20px rgba(255, 215, 0, 0.2)', - }, -})); +const OpenLatestButton = styled(Button)(({ theme }) => { + const isDark = theme.palette.mode === 'dark'; + return { + width: '100%', + color: isDark ? '#FFD700' : '#1976d2', + borderColor: isDark ? 'rgba(255, 215, 0, 0.5)' : 'rgba(25, 118, 210, 0.5)', + fontWeight: 600, + borderRadius: '10px', + textTransform: 'none', + fontSize: '1rem', + py: 1.5, + '&:hover': { + borderColor: isDark ? '#FFD700' : '#1976d2', + backgroundColor: isDark ? 'rgba(255, 215, 0, 0.1)' : 'rgba(25, 118, 210, 0.1)', + boxShadow: isDark ? '0 8px 20px rgba(255, 215, 0, 0.2)' : '0 8px 20px rgba(25, 118, 210, 0.2)', + }, + }; +}); interface ModsProps { mods: IMod[]; @@ -254,17 +257,17 @@ function Mods({ mods }: ModsProps) { state={latest?.id} sx={{ width: '100%', - color: '#FFD700', - borderColor: 'rgba(255, 215, 0, 0.5)', + color: theme.palette.mode === 'dark' ? '#FFD700' : '#1976d2', + borderColor: theme.palette.mode === 'dark' ? 'rgba(255, 215, 0, 0.5)' : 'rgba(25, 118, 210, 0.5)', fontWeight: 600, borderRadius: '10px', textTransform: 'none', fontSize: '1rem', py: 1.5, '&:hover': { - borderColor: '#FFD700', - backgroundColor: 'rgba(255, 215, 0, 0.1)', - boxShadow: '0 8px 20px rgba(255, 215, 0, 0.2)', + borderColor: theme.palette.mode === 'dark' ? '#FFD700' : '#1976d2', + backgroundColor: theme.palette.mode === 'dark' ? 'rgba(255, 215, 0, 0.1)' : 'rgba(25, 118, 210, 0.1)', + boxShadow: theme.palette.mode === 'dark' ? '0 8px 20px rgba(255, 215, 0, 0.2)' : '0 8px 20px rgba(25, 118, 210, 0.2)', }, }} > diff --git a/src/pages/RacePageFast.tsx b/src/pages/RacePageFast.tsx index c422fd8..f54557f 100644 --- a/src/pages/RacePageFast.tsx +++ b/src/pages/RacePageFast.tsx @@ -35,24 +35,27 @@ const SectionTitle = styled(Typography)(({ theme }) => ({ })); const UnitCard = styled(Paper)(({ theme }) => ({ - background: theme.palette.mode === 'dark' ? 'rgba(255, 255, 255, 0.03)' : 'rgba(0, 0, 0, 0.03)', - border: `1px solid ${theme.palette.mode === 'dark' ? 'rgba(255, 255, 255, 0.05)' : 'rgba(0, 0, 0, 0.05)'}`, - borderRadius: '10px', - padding: theme.spacing(1.5, 2), - transition: 'all 0.2s ease', + background: theme.palette.mode === 'dark' + ? 'linear-gradient(145deg, #1a1a2e 0%, #16213e 100%)' + : 'linear-gradient(145deg, #ffffff 0%, #f5f5f5 100%)', + border: `1px solid ${theme.palette.mode === 'dark' ? 'rgba(255, 255, 255, 0.1)' : 'rgba(0, 0, 0, 0.1)'}`, + borderRadius: '16px', + transition: 'all 0.3s cubic-bezier(0.4, 0, 0.2, 1)', '&:hover': { - background: theme.palette.mode === 'dark' ? 'rgba(255, 255, 255, 0.1)' : 'rgba(233, 69, 96, 0.1)', - borderColor: theme.palette.mode === 'dark' ? 'rgba(255, 255, 255, 0.3)' : 'rgba(233, 69, 96, 0.3)', + boxShadow: theme.palette.mode === 'dark' ? '0 20px 40px rgba(255, 255, 255, 0.1)' : '0 20px 40px rgba(0, 0, 0, 0.2)', + borderColor: theme.palette.mode === 'dark' ? 'rgba(255, 255, 255, 0.3)' : 'rgba(0, 0, 0, 0.3)', }, })); -const BuildingCard = styled(UnitCard)(({ theme }) => ({})); +const BuildingCard = styled(UnitCard)(({ theme }) => ({ + padding: theme.spacing(1), +})); const UnitLink = styled(Link)(({ theme }) => ({ color: theme.palette.text.primary, textDecoration: 'none', display: 'block', - '&:hover': { color: theme.palette.mode === 'dark' ? '#dee2e6' : '#e94560' } + '&:hover': { color: theme.palette.mode === 'dark' ? '#dee2e6' : 'rgba(0, 0, 0, 0.85)' } })); const LoadingText = styled(Typography)(({ theme }) => ({ @@ -75,12 +78,18 @@ function Unit(unit: IUnitShort, modId: number, raceId: String, theme: Theme) { {unit.icon && } {unit.name} @@ -95,14 +104,14 @@ function UnitSmall(unit: IUnitShort, modId: number, raceId: String) { var unitName = "" if (unit.name.length > 21) { - unitName = unit.name.substring(0, 20) + "..."; + unitName = unit.name.substring(0, 19) + "..."; } else { unitName = unit.name; } return ( {unit.icon && } - {unitName} +  {unitName} {unit.canDetect &&  }
) } @@ -114,14 +123,12 @@ function Building(building: IBuildingShort, modId: number, raceId: String, theme - + {building.icon && } - {building.name} +  {building.name} {building.canDetect &&  } @@ -208,27 +215,27 @@ class Units extends React.Component { } + expandIcon={} aria-controls="units-accordion" id="units-accordion" - sx={{color: isDark ? '#dee2e6' : '#000000', '& .MuiAccordionSummary-content': { margin: '12px 0' }, '& .MuiAccordionSummary-content.Mui-expanded': { margin: '12px 0' }}} + sx={{color: isDark ? '#dee2e6' : 'rgba(0, 0, 0, 0.85)', '& .MuiAccordionSummary-content': { margin: '12px 0' }, '& .MuiAccordionSummary-content.Mui-expanded': { margin: '12px 0' }}} > All units - Infantry + Infantry {this.state.units.infantry.map(unit => Unit(unit, this.props.modId, this.props.raceId, theme))} - Tech + Tech {this.state.units.tech.map(unit => Unit(unit, this.props.modId, this.props.raceId, theme))} - Support + Support {this.state.units.support.map(unit => Unit(unit, this.props.modId, this.props.raceId, theme))} @@ -263,6 +270,8 @@ class RacePageFast extends React.Component { mod: modData }); + document.title = `${modData.name} (${modData.version})`; + const response = await fetch(AvailableRacesPart + "/" + this.props.match.params.raceId); const racesData: Irace = await response.json(); @@ -294,10 +303,10 @@ class RacePageFast extends React.Component { mb: 1, background: isDark ? 'linear-gradient(135deg, #dee2e6 0%, #e0e0e0 100%)' - : 'linear-gradient(135deg, #000000 0%, #333333 100%)', + : 'none', WebkitBackgroundClip: isDark ? 'text' : 'initial', WebkitTextFillColor: isDark ? '#dee2e6' : 'initial', - color: isDark ? '#dee2e6' : '#000000', + color: isDark ? '#dee2e6' : 'rgba(0, 0, 0, 0.85)', }}> {this.state.race.name} diff --git a/src/pages/UnitPage.tsx b/src/pages/UnitPage.tsx index 077b00d..ae2016a 100644 --- a/src/pages/UnitPage.tsx +++ b/src/pages/UnitPage.tsx @@ -29,7 +29,7 @@ import UnitsTable from "../classes/UnitsTable"; import {IMod} from "../types/Imod"; import Vision from "../classes/Vision"; import Required from "../classes/Required"; -import {renderAffectedResearches} from "../classes/building/Research"; +import {AffectedResearches} from "../classes/building/Research"; import {ModifiersProvidesTable} from "../classes/ModifiersProvideTable"; import Ability from "../classes/Ability"; import DeathExplosion from "../classes/DeathExplosion"; @@ -55,7 +55,7 @@ const StatsPaper = styled(Paper)(({ theme }) => ({ '&:last-child td, &:last-child th': { border: 0 }, }, '& .MuiTableBody .MuiTableRow-root .MuiTableCell-head': { - color: theme.palette.mode === 'dark' ? '#dee2e6' : '#e94560', + color: theme.palette.mode === 'dark' ? '#dee2e6' : 'rgba(0, 0, 0, 0.85)', fontWeight: 600, }, })); @@ -132,7 +132,7 @@ function Unit(unit: IUnit, mod: IMod, theme: Theme) { const SergeantShort = (props: sergeantProps) => { return ( - + {props.icon && }   {props.name} {props.canDetect &&   + sx={{color: isDark ? '#dee2e6' : 'rgba(0, 0, 0, 0.85)', '& .MuiAccordionSummary-content': { margin: '12px 0' }, '& .MuiAccordionSummary-content.Mui-expanded': { margin: '12px 0' }}}> 0}/> @@ -366,7 +366,7 @@ function Unit(unit: IUnit, mod: IMod, theme: Theme) { } - {renderAffectedResearches(unit.affectedResearches, mod.id, unit.race.id)} +