Rename game to edition in the UI
Much clearer to say Classic vs Special Edition instead of "skyrim" vs "skyrimspecialedition".
This commit is contained in:
parent
941eb7b08f
commit
eebc43fbee
@ -2,15 +2,13 @@ import React, { createContext, useCallback } from "react";
|
|||||||
import useSWRImmutable from "swr/immutable";
|
import useSWRImmutable from "swr/immutable";
|
||||||
|
|
||||||
import { jsonFetcher } from "../lib/api";
|
import { jsonFetcher } from "../lib/api";
|
||||||
|
import type { GameName } from "../lib/games";
|
||||||
|
|
||||||
interface Game {
|
interface Game {
|
||||||
id: number;
|
id: number;
|
||||||
name: GameName;
|
name: GameName;
|
||||||
nexus_game_id: number;
|
nexus_game_id: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type GameName = "skyrim" | "skyrimspecialedition";
|
|
||||||
|
|
||||||
interface GamesContext {
|
interface GamesContext {
|
||||||
games?: Game[] | null;
|
games?: Game[] | null;
|
||||||
getGameNameById: (id: number) => GameName | undefined;
|
getGameNameById: (id: number) => GameName | undefined;
|
||||||
|
@ -7,6 +7,7 @@ import { useAppDispatch, useAppSelector } from "../lib/hooks";
|
|||||||
import CellList from "./CellList";
|
import CellList from "./CellList";
|
||||||
import styles from "../styles/ModData.module.css";
|
import styles from "../styles/ModData.module.css";
|
||||||
import { jsonFetcher } from "../lib/api";
|
import { jsonFetcher } from "../lib/api";
|
||||||
|
import { editionNames } from "../lib/games";
|
||||||
import {
|
import {
|
||||||
PluginsByHashWithMods,
|
PluginsByHashWithMods,
|
||||||
removeFetchedPlugin,
|
removeFetchedPlugin,
|
||||||
@ -239,6 +240,14 @@ const ModData: React.FC<Props> = ({
|
|||||||
{modData.name}
|
{modData.name}
|
||||||
</a>
|
</a>
|
||||||
</h1>
|
</h1>
|
||||||
|
<div>
|
||||||
|
<strong>Edition: </strong>
|
||||||
|
{
|
||||||
|
editionNames[
|
||||||
|
getGameNameById(modData.game_id) ?? "skyrimspecialedition"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<strong>Category: </strong>
|
<strong>Category: </strong>
|
||||||
<a
|
<a
|
||||||
|
@ -20,6 +20,7 @@ import {
|
|||||||
setCategory,
|
setCategory,
|
||||||
setIncludeTranslations,
|
setIncludeTranslations,
|
||||||
} from "../slices/modListFilters";
|
} from "../slices/modListFilters";
|
||||||
|
import { editionNames } from "../lib/games";
|
||||||
import { useAppDispatch, useAppSelector } from "../lib/hooks";
|
import { useAppDispatch, useAppSelector } from "../lib/hooks";
|
||||||
import { DownloadCountsContext } from "./DownloadCountsProvider";
|
import { DownloadCountsContext } from "./DownloadCountsProvider";
|
||||||
import { GamesContext } from "./GamesProvider";
|
import { GamesContext } from "./GamesProvider";
|
||||||
@ -229,7 +230,7 @@ const ModList: React.FC<Props> = ({ mods, files }) => {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles["filter-row"]}>
|
<div className={styles["filter-row"]}>
|
||||||
<label htmlFor="game">Game:</label>
|
<label htmlFor="game">Edition:</label>
|
||||||
<select
|
<select
|
||||||
name="game"
|
name="game"
|
||||||
id="game"
|
id="game"
|
||||||
@ -243,7 +244,7 @@ const ModList: React.FC<Props> = ({ mods, files }) => {
|
|||||||
.sort()
|
.sort()
|
||||||
.map((game) => (
|
.map((game) => (
|
||||||
<option key={game} value={game}>
|
<option key={game} value={game}>
|
||||||
{game}
|
{editionNames[game]}
|
||||||
</option>
|
</option>
|
||||||
))}
|
))}
|
||||||
</select>
|
</select>
|
||||||
@ -325,6 +326,14 @@ const ModList: React.FC<Props> = ({ mods, files }) => {
|
|||||||
View on Nexus Mods
|
View on Nexus Mods
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<strong>Edition: </strong>
|
||||||
|
{
|
||||||
|
editionNames[
|
||||||
|
getGameNameById(mod.game_id) ?? "skyrimspecialedition"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<strong>Category: </strong>
|
<strong>Category: </strong>
|
||||||
<a
|
<a
|
||||||
|
8
lib/games.ts
Normal file
8
lib/games.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
export type GameName = "skyrim" | "skyrimspecialedition";
|
||||||
|
|
||||||
|
// Translates gameName (e.g. "skyrim" or "skyrimspecialedition") to edition name which is displayed in the
|
||||||
|
// UI ("Classic" or "Special Edition").
|
||||||
|
export const editionNames: Record<GameName, string> = {
|
||||||
|
skyrim: 'Classic',
|
||||||
|
skyrimspecialedition: 'Special Edition',
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user