refactor: clean up imports, fix typos, and enhance pet action handling

This commit is contained in:
2025-02-01 13:50:27 -03:00
parent f133e18302
commit 8875eb75af
14 changed files with 341 additions and 113 deletions

14
src/utils/petUtils.ts Normal file
View File

@@ -0,0 +1,14 @@
import { PetAction } from '../types/PetUpdateActionRequest';
export function isGatheringAction(action: PetAction): boolean {
return action.startsWith('GATHERING_');
}
export function getResourceFromAction(action: PetAction): string | null {
if (!isGatheringAction(action)) return null;
return action.replace('GATHERING_', '').toLowerCase();
}
export function formatResourceName(resource: string): string {
return resource.charAt(0).toUpperCase() + resource.slice(1);
}