organized types

This commit is contained in:
2025-10-19 16:11:38 +01:00
parent 252027dab2
commit a69b7bbb5f
27 changed files with 231 additions and 203 deletions
+1
View File
@@ -1,3 +1,4 @@
export * from './types';
export * from './useScore';
export * from './useScorePaths';
export * from './useScoreTime';
+26
View File
@@ -0,0 +1,26 @@
export type TimerManager = {
timeValue: number;
startTimer: () => void;
stopTimer: () => void;
resetTimer: () => void;
};
export type ScorePathsResult = {
entranceToKey: number;
entranceToExit: number;
heroToKey: number;
heroToExit: number;
};
export type ScoreManager = {
timeValue: number;
startTimer: () => void;
stopTimer: () => void;
resetTimer: () => void;
distToKey: number;
distToExit: number;
keystrokes: number;
optimalSteps: number;
efficiency: number;
finalScore: number | null;
};
+3 -1
View File
@@ -2,7 +2,9 @@ import { useEffect, useRef, useState } from "react";
import { useTimer } from "./useTimer";
import { useScoreTime } from "./useScoreTime";
import { useScorePaths } from "./useScorePaths";
import type { BoardManager, GameStatusManager, UseHeroType } from "../types";
import type { BoardManager } from "../useBoard/types";
import type { GameStatusManager } from "../useGameStatus/types";
import type { UseHeroType } from "../useCursor/types";
type UseScoreParams = {
board: BoardManager;
+3 -2
View File
@@ -1,7 +1,8 @@
import { useEffect, useState } from "react";
import type { BoardManager, Coord, ScorePathsResult } from "../types";
import type { BoardManager, Coord } from "../useBoard/types";
import type { ScorePathsResult } from "./types";
export type { ScorePathsResult } from "../types";
export type { ScorePathsResult } from "./types";
type UseScorePathsParams = {
board: BoardManager;
+2 -1
View File
@@ -1,5 +1,6 @@
import { useEffect, useRef } from "react";
import type { TimerManager, GameStatus } from "../types";
import type { TimerManager } from "./types";
import type { GameStatus } from "../useGameStatus/types";
type UseScoreTimeParams = {
gameStatus: GameStatus;
+2 -2
View File
@@ -1,7 +1,7 @@
import { useState, useRef, useEffect } from "react";
import type { TimerManager } from '../types';
import type { TimerManager } from './types';
export type { TimerManager } from '../types';
export type { TimerManager } from './types';
export function useTimer(): TimerManager {
const [timeValue, setTimeValue] = useState(0);