Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enh/cleanup #1151

Merged
merged 4 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions .knip.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,10 @@
"eternum-docs/package.json",
"eternum-docs/vocs.config.ts",
"sdk/packages/eternum/global.d.ts",

"config/bank/index.ts",
"**/**__test__**/**",
"**/**__tests__**/**",

"client/src/dojo/events/bankEventQueries.ts",
"client/src/hooks/store/useBankStore.tsx",
"client/src/ui/components/bank/BankEntityList.tsx",
"client/src/ui/components/bank/BankStats.tsx",
"config/bank/index.ts",

"client/src/three/components/FogManager.ts",
"client/src/hooks/useUISound.tsx"
]
Expand Down
109 changes: 0 additions & 109 deletions client/src/dojo/events/bankEventQueries.ts

This file was deleted.

31 changes: 0 additions & 31 deletions client/src/hooks/store/useBankStore.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion client/src/hooks/useUISound.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import useSound from "use-sound";
import useUIStore from "./store/useUIStore";
import { BuildingType, ResourcesIds } from "@bibliothecadao/eternum";
import { useCallback, useState } from "react";
import { ResourceMiningTypes } from "@/ui/utils/utils";
import { ResourceMiningTypes } from "@/types";

const dir = "/sound/";

Expand Down
7 changes: 7 additions & 0 deletions client/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,10 @@ export interface Health {
current: bigint;
lifetime: bigint;
}

export enum ResourceMiningTypes {
Forge = "forge",
Mine = "mine",
LumberMill = "lumber_mill",
Dragonhide = "dragonhide",
}
5 changes: 0 additions & 5 deletions client/src/ui/components/bank/BankEntityList.tsx

This file was deleted.

30 changes: 0 additions & 30 deletions client/src/ui/components/bank/BankStats.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ import { ResourceCost } from "@/ui/elements/ResourceCost";
import { ResourceIcon } from "@/ui/elements/ResourceIcon";
import { unpackResources } from "@/ui/utils/packedData";
import { hasEnoughPopulationForBuilding } from "@/ui/utils/realms";
import { ResourceIdToMiningType, ResourceMiningTypes } from "@/ui/utils/utils";
import { ResourceIdToMiningType } from "@/ui/utils/utils";
import { BUILDING_COSTS_SCALED } from "@bibliothecadao/eternum";
import React, { useMemo, useState } from "react";
import { HintSection } from "../hints/HintModal";
import { ResourceMiningTypes } from "@/types";

// TODO: THIS IS TERRIBLE CODE, PLEASE REFACTOR

Expand Down
2 changes: 1 addition & 1 deletion client/src/ui/components/military/TroopChip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const TroopMenuRow = ({
className?: string;
}) => {
return (
<div className={`grid w-full grid-cols-3 gap-2 relative w-full text-gold font-bold ${className}`}>
<div className={`grid grid-cols-3 gap-2 relative w-full text-gold font-bold ${className}`}>
edisontim marked this conversation as resolved.
Show resolved Hide resolved
<div className="px-2 py-1 bg-gold/10 clip-angled-sm flex flex-col justify-between gap-2 border border-gold/10">
<ResourceIcon withTooltip={false} resource={"Crossbowman"} size="lg" />
<div className="text-green text-xs self-center">{currencyFormat(troops?.crossbowman_count || 0, 0)}</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,17 @@
import useUIStore from "@/hooks/store/useUIStore";
import {
BUILDING_CAPACITY,
BUILDING_POPULATION,
BuildingType,
EternumGlobalConfig,
HYPERSTRUCTURE_POINTS_PER_CYCLE,
ID,
RESOURCE_INFORMATION,
RESOURCE_INPUTS_SCALED,
STRUCTURE_COSTS_SCALED,
StructureType,
findResourceById,
} from "@bibliothecadao/eternum";

import { getResourceBalance } from "@/hooks/helpers/useResources";
import { useQuestStore } from "@/hooks/store/useQuestStore";
import useRealmStore from "@/hooks/store/useRealmStore";
import { QuestId } from "@/ui/components/quest/questDetails";
import { Headline } from "@/ui/elements/Headline";
import { ResourceCost } from "@/ui/elements/ResourceCost";
import { ResourceIcon } from "@/ui/elements/ResourceIcon";
import { BUILDING_COSTS_SCALED } from "@bibliothecadao/eternum";
import clsx from "clsx";
import React from "react";
import { StructureCard } from "./StructureCard";
Expand Down
8 changes: 1 addition & 7 deletions client/src/ui/config.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
import { ResourceMiningTypes } from "@/types";
import { BuildingType } from "@bibliothecadao/eternum";

export const FELT_CENTER = 2147483647;

enum ResourceMiningTypes {
Forge = "forge",
Mine = "mine",
LumberMill = "lumber_mill",
Dragonhide = "dragonhide",
}

const BUILD_IMAGES_PREFIX = "/images/buildings/construction/";
export const BUILDING_IMAGES_PATH = {
[BuildingType.Castle]: "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const BattleDetails = ({ armies }: { armies: (ArmyInfo | undefined)[] | u
const { getAddressName } = useRealm();
return (
<div className="w-full">
<div className="p-2 w-full grid grid-cols-2 text-gold border-gold/20 border-gradient clip-angled p-2">
<div className="w-full grid grid-cols-2 text-gold border-gold/20 border-gradient clip-angled p-2">
cwastche marked this conversation as resolved.
Show resolved Hide resolved
<div key={0} className="mb-4 tile h-6 text-left border border-gold/20">
Army
</div>
Expand Down
8 changes: 1 addition & 7 deletions client/src/ui/utils/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { FELT_CENTER } from "../config";
import { SortInterface } from "../elements/SortButton";
import * as THREE from "three";
import { HEX_HORIZONTAL_SPACING, HEX_VERTICAL_SPACING } from "@/three/scenes/HexagonScene";
import { ResourceMiningTypes } from "@/types";

export { getEntityIdFromKeys };

Expand Down Expand Up @@ -170,13 +171,6 @@ export const pseudoRandom = (x: number, y: number) => {
return n - Math.floor(n);
};

export enum ResourceMiningTypes {
Forge = "forge",
Mine = "mine",
LumberMill = "lumber_mill",
Dragonhide = "dragonhide",
}

export const ResourceIdToMiningType: Partial<Record<ResourcesIds, ResourceMiningTypes>> = {
[ResourcesIds.Copper]: ResourceMiningTypes.Forge,
[ResourcesIds.ColdIron]: ResourceMiningTypes.Forge,
Expand Down
Loading