Skip to content

Commit

Permalink
refactor: use util to get exp mind state
Browse files Browse the repository at this point in the history
  • Loading branch information
KatoakDR committed Jan 15, 2024
1 parent 9b263e7 commit ce62b4c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions electron/renderer/pages/grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react';
import * as rxjs from 'rxjs';
import { v4 as uuid } from 'uuid';
import { runInBackground } from '../../common/async';
import { ExperienceMindStateMap, GameEventType } from '../../common/game';
import { GameEventType, getExperienceMindState } from '../../common/game';
import type {
ExperienceGameEvent,
GameEvent,
Expand Down Expand Up @@ -97,7 +97,7 @@ const GridPage: React.FC = (): ReactNode => {
const formatExperienceText = useCallback(
(gameEvent: ExperienceGameEvent): string => {
const { skill, rank, percent, mindState } = gameEvent;
const mindStateRate = ExperienceMindStateMap[mindState];
const mindStateRate = getExperienceMindState(mindState) ?? 0;

const txtSkill = skill.padStart(15);
const txtRank = String(rank).padStart(3);
Expand Down Expand Up @@ -562,5 +562,7 @@ const GridPage: React.FC = (): ReactNode => {
);
};

GridPage.displayName = 'GridPage';

// nextjs pages must be default exports
export default GridPage;

0 comments on commit ce62b4c

Please sign in to comment.