a collection of tools for fly for fun universe skillulator.lol

move reused types to global type file

besaid.zone 1e905ea8 4c687911

verified
Changed files
+16 -12
apps
skillulator
src
routes
c
$class
utils
+2 -2
apps/skillulator/src/routes/c/$class/components/Skill.tsx
··· 1 + import type { Skill as SkillType } from "../../../../types"; 1 2 import { languages } from "../../../../utils/constants"; 2 3 import { getLanguageForSkill } from "../../../../utils/language"; 3 - import type { State } from "../../../../zustand/treeStore"; 4 4 import { 5 5 DecreaseSkillPointButton, 6 6 IncreaseSkillToMaxButton, ··· 9 9 import { Requirement } from "./Requirement"; 10 10 11 11 interface SkillProps { 12 - skill: State["jobTree"][0]["skills"][0]; 12 + skill: SkillType; 13 13 jobId: number; 14 14 skillId: number; 15 15 hasMinLevelRequirements: boolean;
+4 -3
apps/skillulator/src/routes/c/$class/components/action-buttons.tsx
··· 1 1 import clsx from "clsx"; 2 - import { type State, useTreeStore } from "../../../../zustand/treeStore"; 2 + import { useTreeStore } from "../../../../zustand/treeStore"; 3 + import type { Skill } from "../../../../types"; 3 4 4 5 export function DecreaseSkillPointButton(props: { 5 - skill: State["jobTree"][0]["skills"][0]; 6 + skill: Skill; 6 7 jobId: number; 7 8 }) { 8 9 const { decreaseSkillPoint } = useTreeStore(); ··· 52 53 53 54 export function SkillIconButton(props: { 54 55 jobId: number; 55 - skill: State["jobTree"][0]["skills"][0]; 56 + skill: Skill; 56 57 hasMinLevelRequirements: boolean; 57 58 isMaxed: boolean; 58 59 locale: string;
+9
apps/skillulator/src/types.ts
··· 1 + import type { State } from "./zustand/treeStore"; 2 + 3 + export type Skills = State["jobTree"][number]["skills"]; 4 + export type Skill = State["jobTree"][0]["skills"][0]; 5 + export type Jobs = State["jobTree"]; 6 + export type SkillBracket = { 7 + maxLevel: number; 8 + pointsPerLevel: number; 9 + };
+1 -7
apps/skillulator/src/utils/skill-tree-helpers.ts
··· 1 + import type { Jobs, SkillBracket, Skills } from "../types"; 1 2 import type { State } from "../zustand/treeStore"; 2 3 import type { JOB_SKILLPOINTS } from "./constants"; 3 - 4 - type Skills = State["jobTree"][number]["skills"]; 5 - type Jobs = State["jobTree"]; 6 - type SkillBracket = { 7 - maxLevel: number; 8 - pointsPerLevel: number; 9 - }; 10 4 11 5 export function getJobById(jobId: number, jobs: Jobs) { 12 6 return jobs.filter((job) => job.id === jobId).at(0);