Skip to content

Commit

Permalink
prettier + knip
Browse files Browse the repository at this point in the history
  • Loading branch information
edisontim committed Sep 24, 2024
1 parent 4a1fc6f commit 1511e5b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 16 deletions.
14 changes: 7 additions & 7 deletions client/src/hooks/helpers/useEntities.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ export const useEntities = () => {
const name = realm
? getRealmNameById(realm.realm_id)
: structureName
? `${structure?.category} ${structureName}`
: structure.category || "";
? `${structure?.category} ${structureName}`
: structure.category || "";
return { ...structure, position: position!, name };
})
.filter((structure): structure is PlayerStructure => structure !== undefined)
Expand Down Expand Up @@ -266,15 +266,15 @@ const formatStructures = (
const name = realm
? getRealmNameById(realm.realm_id)
: structureName
? `${structure?.category} ${structureName}`
: structure.category || "";
? `${structure?.category} ${structureName}`
: structure.category || "";
return { ...structure, position: position!, name };
})
.filter((structure): structure is PlayerStructure => structure !== undefined)
.sort((a, b) => (b.category || "").localeCompare(a.category || ""));
};

export const getStructureName = (
const getStructureName = (
entityName: ComponentValue<ClientComponents["EntityName"]["schema"]> | undefined,
structure: ComponentValue<ClientComponents["Structure"]["schema"]> | undefined,
realm: ComponentValue<ClientComponents["Realm"]["schema"]> | undefined,
Expand All @@ -285,8 +285,8 @@ export const getStructureName = (
structure.category === StructureType[StructureType.Realm]
? getRealmNameById(realm!.realm_id)
: entityName
? shortString.decodeShortString(entityName.name.toString())
: `${structure.category} ${structure.entity_id}` || "";
? shortString.decodeShortString(entityName.name.toString())
: `${structure.category} ${structure.entity_id}` || "";

return name;
};
6 changes: 1 addition & 5 deletions client/src/ui/components/military/ArmyManagementCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,7 @@ export const ArmyManagementCard = ({ owner_entity, army, setSelectedEntity }: Ar
<div className="flex justify-between p-2">
{editName ? (
<div className="flex space-x-2">
<TextInput
placeholder="Type Name"
className="h-full"
onChange={(name) => setNaming(name)}
/>
<TextInput placeholder="Type Name" className="h-full" onChange={(name) => setNaming(name)} />
<Button
variant="default"
isLoading={isLoading}
Expand Down
3 changes: 1 addition & 2 deletions client/src/ui/elements/TextInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ interface TextInputProps {
}

const TextInput = (props: TextInputProps) => {
const { disabled, onChange, className, placeholder, maxLength, onBlur, onFocus, onKeyDown } =
props;
const { disabled, onChange, className, placeholder, maxLength, onBlur, onFocus, onKeyDown } = props;

return (
<form
Expand Down
4 changes: 2 additions & 2 deletions client/src/ui/modules/chat/InputField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ export const InputField = ({
const recipientAddress = !!recipientEntities.length
? getComponentValue(AddressName, recipientEntities[0])?.address
: currentTab.name === "Global"
? undefined
: BigInt(currentTab.address);
? undefined
: BigInt(currentTab.address);

const channel = recipientAddress !== undefined ? toHexString(recipientAddress) : GLOBAL_CHANNEL;

Expand Down

0 comments on commit 1511e5b

Please sign in to comment.