詳細な型設定の変更
This commit is contained in:
@@ -4,8 +4,6 @@ import { useCurrentTrain } from "@/stateBox/useCurrentTrain";
|
||||
import { useStationList, StationProps } from "@/stateBox/useStationList";
|
||||
import { FC, useEffect, useState } from "react";
|
||||
import { Text, TouchableOpacity, View, Image } from "react-native";
|
||||
import { customTrainDataDetector } from "../../custom-train-data";
|
||||
import { getStringConfig } from "@/lib/getStringConfig";
|
||||
import { getTrainType } from "@/lib/getTrainType";
|
||||
import { trainPosition } from "@/lib/trainPositionTextArray";
|
||||
import { StationNumberMaker } from "../../駅名表/StationNumberMaker";
|
||||
@@ -184,11 +182,6 @@ export const FixedTrain: FC<props> = ({ trainID }) => {
|
||||
);
|
||||
}
|
||||
}, [customData, trainDataWidhThrough]);
|
||||
const [stringConfig, setStringConfig] = useState([, ,]);
|
||||
useEffect(() => {
|
||||
const x = getStringConfig(customData.type, customData.TrainNumber);
|
||||
setStringConfig(x);
|
||||
}, [customData]);
|
||||
|
||||
const [station, setStation] = useState<StationProps[]>([]);
|
||||
useEffect(() => {
|
||||
@@ -236,15 +229,15 @@ export const FixedTrain: FC<props> = ({ trainID }) => {
|
||||
<Text
|
||||
style={{
|
||||
fontSize: 14,
|
||||
fontFamily: stringConfig[1] ? "JR-Nishi" : undefined,
|
||||
fontWeight: !stringConfig[1] ? "bold" : undefined,
|
||||
marginTop: stringConfig[1] ? 3 : 0,
|
||||
fontFamily: customTrainType.fontAvailable ? "JR-Nishi" : undefined,
|
||||
fontWeight: !customTrainType.fontAvailable ? "bold" : undefined,
|
||||
marginTop: customTrainType.fontAvailable ? 3 : 0,
|
||||
color: "white",
|
||||
textAlignVertical: "center",
|
||||
textAlign: "center",
|
||||
}}
|
||||
>
|
||||
{stringConfig[0]}
|
||||
{customTrainType.shortName}
|
||||
</Text>
|
||||
{customData.trainName && (
|
||||
<Text
|
||||
|
@@ -28,6 +28,7 @@ export type CustomTrainData = {
|
||||
type?: trainTypeID;
|
||||
viaData?: string;
|
||||
info?: string;
|
||||
infoUrl?: string;
|
||||
infogram?: string;
|
||||
uwasa?: string;
|
||||
isEdit?: boolean;
|
||||
|
@@ -36,7 +36,7 @@ type getTrainType = (e: {
|
||||
}) => {
|
||||
color: colorString;
|
||||
name: trainTypeString;
|
||||
shortName?: string;
|
||||
shortName: string;
|
||||
fontAvailable: boolean;
|
||||
isOneMan: boolean;
|
||||
data: trainTypeDataString;
|
||||
@@ -163,41 +163,40 @@ export const getTrainType: getTrainType = ({ type, id, whiteMode }) => {
|
||||
};
|
||||
case "Other":
|
||||
default:
|
||||
if(id){
|
||||
switch (true) {
|
||||
case !!id.includes("T"):
|
||||
return {
|
||||
color: "#5f5f5fff",
|
||||
name: "単機回送",
|
||||
shortName: "単機回送",
|
||||
fontAvailable: false,
|
||||
isOneMan: false,
|
||||
data: "notService",
|
||||
};
|
||||
case !!id.includes("R"):
|
||||
case !!id.includes("E"):
|
||||
case !!id.includes("L"):
|
||||
case !!id.includes("A"):
|
||||
case !!id.includes("B"):
|
||||
return {
|
||||
color: "#5f5f5fff",
|
||||
name: "回送",
|
||||
shortName: "回送",
|
||||
fontAvailable: false,
|
||||
isOneMan: false,
|
||||
data: "notService",
|
||||
};
|
||||
case !!id.includes("H"):
|
||||
return {
|
||||
color: "#5f5f5fff",
|
||||
name: "試運転",
|
||||
shortName: "試運転",
|
||||
fontAvailable: false,
|
||||
isOneMan: false,
|
||||
data: "notService",
|
||||
};
|
||||
}
|
||||
|
||||
if (id) {
|
||||
switch (true) {
|
||||
case !!id.includes("T"):
|
||||
return {
|
||||
color: "#5f5f5fff",
|
||||
name: "単機回送",
|
||||
shortName: "単機回送",
|
||||
fontAvailable: false,
|
||||
isOneMan: false,
|
||||
data: "notService",
|
||||
};
|
||||
case !!id.includes("R"):
|
||||
case !!id.includes("E"):
|
||||
case !!id.includes("L"):
|
||||
case !!id.includes("A"):
|
||||
case !!id.includes("B"):
|
||||
return {
|
||||
color: "#5f5f5fff",
|
||||
name: "回送",
|
||||
shortName: "回送",
|
||||
fontAvailable: false,
|
||||
isOneMan: false,
|
||||
data: "notService",
|
||||
};
|
||||
case !!id.includes("H"):
|
||||
return {
|
||||
color: "#5f5f5fff",
|
||||
name: "試運転",
|
||||
shortName: "試運転",
|
||||
fontAvailable: false,
|
||||
isOneMan: false,
|
||||
data: "notService",
|
||||
};
|
||||
}
|
||||
}
|
||||
return {
|
||||
color: whiteMode ? "black" : "white",
|
||||
|
Reference in New Issue
Block a user