Skip to content

Commit

Permalink
refactor(data): replace string constants with numeric IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
AnYiEE committed Jan 21, 2025
1 parent 94e4a9f commit bacbd25
Show file tree
Hide file tree
Showing 23 changed files with 1,873 additions and 2,134 deletions.
154 changes: 77 additions & 77 deletions app/data/beverages/data.ts

Large diffs are not rendered by default.

27 changes: 3 additions & 24 deletions app/data/beverages/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,6 @@
import {type BEVERAGE_TAG_MAP} from '@/data/constant';
import type {IFoodBase} from '@/data/types';

type TTag =
| '无酒精'
| '低酒精'
| '中酒精'
| '高酒精'
| '可加冰'
| '可加热'
| '烧酒'
| '清酒'
| '鸡尾酒'
| '西洋酒'
| '利口酒'
| '啤酒'
| '直饮'
| '水果'
| '甘'
| '辛'
| '苦'
| '气泡'
| '古典'
| '现代'
| '提神';

type TFromBase = IFoodBase['from'];

interface IFrom extends Omit<TFromBase, 'fishing'> {
Expand All @@ -31,10 +9,11 @@ interface IFrom extends Omit<TFromBase, 'fishing'> {
}

export interface IBeverage extends IFoodBase {
tags: TTag[];
tags: (keyof typeof BEVERAGE_TAG_MAP)[];
from: Partial<IFrom>;
}

export type TBeverages = typeof import('./data').BEVERAGE_LIST;

export type TBeverageId = TBeverages[number]['id'];
export type TBeverageName = TBeverages[number]['name'];
42 changes: 21 additions & 21 deletions app/data/clothes/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const CLOTHES_LIST = [
izakaya: false,
from: [
{
bond: '露米娅',
bond: 1,
},
],
},
Expand All @@ -50,7 +50,7 @@ export const CLOTHES_LIST = [
izakaya: false,
from: [
{
bond: '上白泽慧音',
bond: 4,
},
],
},
Expand All @@ -64,7 +64,7 @@ export const CLOTHES_LIST = [
izakaya: false,
from: [
{
bond: '博丽灵梦',
bond: 7,
},
],
},
Expand All @@ -77,7 +77,7 @@ export const CLOTHES_LIST = [
izakaya: false,
from: [
{
bond: '帕秋莉',
bond: 27,
},
],
},
Expand All @@ -90,7 +90,7 @@ export const CLOTHES_LIST = [
izakaya: false,
from: [
{
bond: '蓬莱山辉夜',
bond: 25,
},
],
},
Expand All @@ -115,7 +115,7 @@ export const CLOTHES_LIST = [
buy: {
name: '【人间之里】香霖堂',
price: {
currency: '银色的青蛙硬币',
currency: 29,
amount: 25,
},
},
Expand Down Expand Up @@ -144,7 +144,7 @@ export const CLOTHES_LIST = [
buy: {
name: '【人间之里】香霖堂',
price: {
currency: '银色的青蛙硬币',
currency: 29,
amount: 25,
},
},
Expand All @@ -164,7 +164,7 @@ export const CLOTHES_LIST = [
buy: {
name: '【人间之里】香霖堂',
price: {
currency: '银色的青蛙硬币',
currency: 29,
amount: 15,
},
},
Expand All @@ -184,7 +184,7 @@ export const CLOTHES_LIST = [
buy: {
name: '【人间之里】香霖堂',
price: {
currency: '银色的青蛙硬币',
currency: 29,
amount: 25,
},
},
Expand All @@ -204,7 +204,7 @@ export const CLOTHES_LIST = [
buy: {
name: '【人间之里】香霖堂',
price: {
currency: '银色的青蛙硬币',
currency: 29,
amount: 15,
},
},
Expand All @@ -221,7 +221,7 @@ export const CLOTHES_LIST = [
izakaya: false,
from: [
{
bond: '东风谷早苗',
bond: 1005,
},
],
},
Expand All @@ -235,7 +235,7 @@ export const CLOTHES_LIST = [
izakaya: false,
from: [
{
bond: '雾雨魔理沙',
bond: 10,
},
],
},
Expand All @@ -249,7 +249,7 @@ export const CLOTHES_LIST = [
izakaya: false,
from: [
{
bond: '星熊勇仪',
bond: 2002,
},
],
},
Expand All @@ -263,7 +263,7 @@ export const CLOTHES_LIST = [
izakaya: false,
from: [
{
bond: '灵乌路空',
bond: 2005,
},
],
},
Expand All @@ -279,7 +279,7 @@ export const CLOTHES_LIST = [
buy: {
name: '【人间之里】香霖堂',
price: {
currency: '银色的青蛙硬币',
currency: 29,
amount: 10,
},
},
Expand All @@ -296,7 +296,7 @@ export const CLOTHES_LIST = [
izakaya: false,
from: [
{
bond: '村纱水蜜',
bond: 3001,
},
],
},
Expand All @@ -309,7 +309,7 @@ export const CLOTHES_LIST = [
izakaya: false,
from: [
{
bond: '霍青娥',
bond: 3004,
},
],
},
Expand All @@ -322,7 +322,7 @@ export const CLOTHES_LIST = [
izakaya: false,
from: [
{
bond: '风见幽香',
bond: 4002,
},
],
},
Expand All @@ -336,7 +336,7 @@ export const CLOTHES_LIST = [
izakaya: false,
from: [
{
bond: '鬼人正邪',
bond: 4003,
},
],
},
Expand All @@ -349,7 +349,7 @@ export const CLOTHES_LIST = [
izakaya: false,
from: [
{
bond: '绵月依姬',
bond: 5002,
},
],
},
Expand All @@ -363,7 +363,7 @@ export const CLOTHES_LIST = [
izakaya: false,
from: [
{
bond: '露易兹',
bond: 5005,
},
],
},
Expand Down
7 changes: 4 additions & 3 deletions app/data/clothes/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {type TCurrencyName, type TCustomerRareName} from '@/data';
import {type TCurrencyId, type TCustomerRareId} from '@/data';
import type {IItemBase, TMerchant} from '@/data/types';

export interface IClothes extends IItemBase {
Expand All @@ -9,11 +9,11 @@ export interface IClothes extends IItemBase {
from: Array<
| string
| Partial<{
bond: TCustomerRareName;
bond: TCustomerRareId;
buy: {
name: TMerchant;
price: {
currency: TCurrencyName;
currency: TCurrencyId;
amount: number;
};
};
Expand All @@ -25,4 +25,5 @@ export interface IClothes extends IItemBase {

export type TClothes = typeof import('./data').CLOTHES_LIST;

export type TClothesId = TClothes[number]['id'];
export type TClothesName = TClothes[number]['name'];
Loading

0 comments on commit bacbd25

Please sign in to comment.