Merge commit '0c002c443deab8e12299d8d5696e70b02313b53b' into develop
This commit is contained in:
commit
08d105588f
BIN
assets/fonts/DelaGothicOne-Regular.ttf
Normal file
BIN
assets/fonts/DelaGothicOne-Regular.ttf
Normal file
Binary file not shown.
BIN
assets/fonts/西日本方向幕ロゴ.otf
Normal file
BIN
assets/fonts/西日本方向幕ロゴ.otf
Normal file
Binary file not shown.
@ -46,7 +46,10 @@ export const EachStopList = ({
|
||||
.set("minute", parseInt(time.split(":")[1]))
|
||||
.add(isNaN(currentTrainData?.delay) ? 0 : currentTrainData.delay, "minute");
|
||||
const timeString = se == "通過" ? "" : dates.format("HH:mm").split(":");
|
||||
|
||||
const onClickStateText = (string) => {
|
||||
if (string != "通過") return;
|
||||
alert("この駅は通過駅です");
|
||||
};
|
||||
return (
|
||||
<TouchableWithoutFeedback
|
||||
onPress={() =>
|
||||
@ -140,6 +143,7 @@ export const EachStopList = ({
|
||||
: "red",
|
||||
width: 60,
|
||||
}}
|
||||
onPress={() => onClickStateText(se)}
|
||||
>
|
||||
{se == "通過" ? "レ" : `${timeString[0]}:${timeString[1]}`}
|
||||
</Text>
|
||||
|
@ -10,6 +10,7 @@ import {
|
||||
LayoutAnimation,
|
||||
} from "react-native";
|
||||
import { SheetManager } from "react-native-actions-sheet";
|
||||
import { useFonts } from "expo-font";
|
||||
import { AS } from "../../storageControl";
|
||||
import trainList from "../../assets/originData/trainList";
|
||||
import { lineListPair } from "../../lib/getStationList";
|
||||
@ -44,6 +45,10 @@ export const EachTrainInfoCore = ({
|
||||
from,
|
||||
navigate,
|
||||
}) => {
|
||||
const [fontLoaded, error] = useFonts({
|
||||
"JR-Nishi": require("../../assets/fonts/西日本方向幕ロゴ.otf"),
|
||||
"Zou": require("../../assets/fonts/DelaGothicOne-Regular.ttf"),
|
||||
});
|
||||
// const [actionSheetHorizonalScroll, setActionSheetHorizonalScroll] = useState(false);
|
||||
const { currentTrain } = useCurrentTrain();
|
||||
const { originalStationList, stationList } = useStationList();
|
||||
@ -405,6 +410,7 @@ export const EachTrainInfoCore = ({
|
||||
tailStation={tailStation}
|
||||
navigate={navigate}
|
||||
from={from}
|
||||
fontLoaded={fontLoaded}
|
||||
/>
|
||||
|
||||
<DynamicHeaderScrollView
|
||||
@ -494,6 +500,7 @@ export const EachTrainInfoCore = ({
|
||||
currentTrainData,
|
||||
openStationACFromEachTrainInfo,
|
||||
showThrew,
|
||||
fontLoaded,
|
||||
}}
|
||||
/>
|
||||
)
|
||||
|
@ -6,6 +6,7 @@ import { getType } from "../../../lib/eachTrainInfoCoreLib/getType";
|
||||
import { migrateTrainName } from "../../../lib/eachTrainInfoCoreLib/migrateTrainName";
|
||||
import { TrainIconStatus } from "./trainIconStatus";
|
||||
import { TrainViewIcon } from "./trainViewIcon";
|
||||
import { OneManText } from "./HeaderTextParts/OneManText";
|
||||
|
||||
type Props = {
|
||||
data: { trainNum: string; limited: string };
|
||||
@ -16,10 +17,11 @@ type Props = {
|
||||
tailStation: { id: string }[];
|
||||
navigate: any;
|
||||
from: string;
|
||||
fontLoaded: boolean;
|
||||
};
|
||||
|
||||
const textConfig: TextStyle = {
|
||||
fontSize: 20,
|
||||
fontSize: 18,
|
||||
fontWeight: "bold",
|
||||
color: "white",
|
||||
};
|
||||
@ -33,37 +35,129 @@ export const HeaderText: FC<Props> = ({
|
||||
tailStation,
|
||||
navigate,
|
||||
from,
|
||||
fontLoaded,
|
||||
}) => {
|
||||
const trainName = useMemo(() => {
|
||||
if (!data.limited) return "";
|
||||
const limitedArray = data.limited.split(":");
|
||||
const type = getType(limitedArray[0]);
|
||||
const { limited, trainNum } = data;
|
||||
|
||||
// 貨物の判定
|
||||
const freightDetect = (num:string)=>{
|
||||
switch(num){
|
||||
case "71":
|
||||
return "貨物 東京(タ)→高松(タ)";
|
||||
case "73":
|
||||
case "75":
|
||||
return "貨物 大阪(タ)→高松(タ)";
|
||||
case "3079":
|
||||
return "貨物 高松(タ)→伊予三島";
|
||||
case "3071":
|
||||
case "3077":
|
||||
return "貨物 高松(タ)→新居浜";
|
||||
case "3073":
|
||||
return "貨物 高松(タ)→松山貨物";
|
||||
case "70":
|
||||
return "貨物 高松(タ)→東京(タ)";
|
||||
case "74":
|
||||
case "76":
|
||||
return "貨物 高松(タ)→大阪(タ)";
|
||||
case "3078":
|
||||
return "貨物 伊予三島→高松(タ)";
|
||||
case "3070":
|
||||
return "貨物 新居浜→高松(タ)";
|
||||
case "3076":
|
||||
return "貨物 新居浜→高松(タ)";
|
||||
case "3072":
|
||||
return "貨物 松山貨物→高松(タ)";
|
||||
case "9070":
|
||||
return "貨物 臨時";
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 列車名、種別、フォントの取得
|
||||
const [typeName, trainName, fontAvailable] = useMemo(() => {
|
||||
if (!limited) return "";
|
||||
const limitedArray = limited.split(":");
|
||||
const [type, fontAvailable] = (() => {
|
||||
const d = getType(limitedArray[0]);
|
||||
switch (true) {
|
||||
case !!d:
|
||||
return [d, true];
|
||||
case !!trainNum.includes("T"):
|
||||
return ["単機回送", false];
|
||||
case !!trainNum.includes("R"):
|
||||
case !!trainNum.includes("E"):
|
||||
case !!trainNum.includes("L"):
|
||||
case !!trainNum.includes("A"):
|
||||
case !!trainNum.includes("B"):
|
||||
return ["回送", false];
|
||||
case !!trainNum.includes("H"):
|
||||
return ["試運転", false];
|
||||
case !!trainNum.match("D"):
|
||||
case !!trainNum.match("M"):
|
||||
return ["普通", true];
|
||||
case !!freightDetect(trainNum):
|
||||
return [freightDetect(trainNum), false];
|
||||
default:
|
||||
return ["", false];
|
||||
}
|
||||
})();
|
||||
switch (true) {
|
||||
case !!limitedArray[1]:
|
||||
// 特急の場合は、列車名を取得
|
||||
return type + migrateTrainName(limitedArray[1]);
|
||||
return [type, migrateTrainName(limitedArray[1]), fontAvailable];
|
||||
case trainData.length == 0:
|
||||
// 特急以外の場合は、列車番号を取得
|
||||
return type;
|
||||
|
||||
return [type, "", fontAvailable];
|
||||
default:
|
||||
// 行先がある場合は、行先を取得
|
||||
return (
|
||||
type +
|
||||
return [
|
||||
type,
|
||||
migrateTrainName(
|
||||
trainData[trainData.length - 1].split(",")[0] + "行き"
|
||||
)
|
||||
);
|
||||
),
|
||||
fontAvailable,
|
||||
];
|
||||
}
|
||||
}, [data.limited, trainData]);
|
||||
}, [limited, trainData]);
|
||||
|
||||
// 1人運転の判定
|
||||
const isOneMan = useMemo(() => {
|
||||
const OneManRegex = new RegExp(/^4[1-9]\d\d[DM]$/);
|
||||
const OneManRegex2 = new RegExp(/^5[1-7]\d\d[DM]$/);
|
||||
return !!(
|
||||
OneManRegex.test(trainNum) ||
|
||||
OneManRegex2.test(trainNum) ||
|
||||
trainNum === "3621D"
|
||||
);
|
||||
}, [trainNum]);
|
||||
|
||||
return (
|
||||
<View style={{ padding: 10, flexDirection: "row", alignItems: "center" }}>
|
||||
<TrainIconStatus {...{ data, navigate, from}}/>
|
||||
<Text style={textConfig}>{trainName}</Text>
|
||||
<TrainIconStatus {...{ data, navigate, from }} />
|
||||
<View
|
||||
style={{ borderRadius: 5, flexDirection: "row", alignItems: "center" }}
|
||||
>
|
||||
<Text
|
||||
style={{
|
||||
fontSize: 20,
|
||||
color: "white",
|
||||
fontFamily: fontAvailable ? "JR-Nishi" : undefined,
|
||||
fontWeight: !fontAvailable ?"bold":undefined,
|
||||
marginRight: 5,
|
||||
}}
|
||||
>
|
||||
{typeName}
|
||||
</Text>
|
||||
{isOneMan && <OneManText />}
|
||||
<Text style={textConfig}>{trainName}</Text>
|
||||
</View>
|
||||
|
||||
<View style={{ flex: 1 }} />
|
||||
<Text style={textConfig}>
|
||||
{showHeadStation.map((d) => `${headStation[d].id} + `)}
|
||||
{data.trainNum}
|
||||
{trainNum}
|
||||
{showTailStation.map((d) => ` + ${tailStation[d].id}`)}
|
||||
</Text>
|
||||
|
||||
|
@ -0,0 +1,16 @@
|
||||
import React, { FC } from "react";
|
||||
import { Text, View } from "react-native";
|
||||
export const OneManText: FC = () => {
|
||||
const styles = {
|
||||
fontSize: 12,
|
||||
margin: -2,
|
||||
color: "white",
|
||||
fontFamily: "Zou",
|
||||
};
|
||||
return (
|
||||
<View style={{ flexDirection: "column", marginRight: 7 }}>
|
||||
<Text style={{ ...styles, marginRight: 5 }}>ワン</Text>
|
||||
<Text style={{ ...styles, marginLeft: 5 }}>マン</Text>
|
||||
</View>
|
||||
);
|
||||
};
|
@ -5,6 +5,7 @@ import dayjs from "dayjs";
|
||||
import { useInterval } from "../../../lib/useInterval";
|
||||
import { Icon } from "@expo/vector-icons/build/createIconSet";
|
||||
import { SheetManager } from "react-native-actions-sheet";
|
||||
import { customTrainDataDetector } from "../../custom-train-data";
|
||||
|
||||
type GlyphNames = ComponentProps<typeof Ionicons>["name"];
|
||||
|
||||
@ -20,8 +21,14 @@ type apt = {
|
||||
export const TrainIconStatus: FC<Props> = ({ data, navigate, from }) => {
|
||||
const [trainIcon, setTrainIcon] = useState(null);
|
||||
const [anpanmanStatus, setAnpanmanStatus] = useState<apt>();
|
||||
const [address, setAddress] = useState("");
|
||||
useEffect(() => {
|
||||
if (!data.trainNum) return;
|
||||
const { trainIcon, infoUrl } = customTrainDataDetector(data.trainNum);
|
||||
if (trainIcon) setTrainIcon(trainIcon);
|
||||
|
||||
if (infoUrl) setAddress(infoUrl);
|
||||
|
||||
switch (data.trainNum) {
|
||||
case "32D":
|
||||
case "36D":
|
||||
@ -33,11 +40,6 @@ export const TrainIconStatus: FC<Props> = ({ data, navigate, from }) => {
|
||||
case "45D":
|
||||
case "49D":
|
||||
case "57D":
|
||||
setTrainIcon(
|
||||
`https://n8n.haruk.in/webhook/dosan-anpanman-pictures.png?trainNum=${
|
||||
data.trainNum
|
||||
}&day=${dayjs().format("yyyy-MM-DD")}`
|
||||
);
|
||||
fetch(
|
||||
`https://n8n.haruk.in/webhook/dosan-anpanman?trainNum=${
|
||||
data.trainNum
|
||||
@ -72,7 +74,7 @@ export const TrainIconStatus: FC<Props> = ({ data, navigate, from }) => {
|
||||
<TouchableOpacity
|
||||
onPress={() => {
|
||||
navigate("howto", {
|
||||
info: "https://www.jr-eki.com/aptrain/naani/dosan/jikoku.html",
|
||||
info: address,
|
||||
goTo: from == "LED" ? "menu" : from,
|
||||
});
|
||||
SheetManager.hide("EachTrainInfo");
|
||||
@ -81,11 +83,15 @@ export const TrainIconStatus: FC<Props> = ({ data, navigate, from }) => {
|
||||
{move ? (
|
||||
<Image
|
||||
source={{ uri: trainIcon }}
|
||||
style={{ height: 30, width: 30, margin: 5 }}
|
||||
resizeMethod="resize"
|
||||
style={{ height: 34, width: 30, marginRight: 5 }}
|
||||
resizeMethod="scale"
|
||||
/>
|
||||
) : (
|
||||
<Ionicons {...anpanmanStatus} size={30} style={{ margin: 5 }} />
|
||||
<Ionicons
|
||||
{...anpanmanStatus}
|
||||
size={30}
|
||||
style={{ marginRight: 5 }}
|
||||
/>
|
||||
)}
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
|
@ -1,3 +1,4 @@
|
||||
import dayjs from "dayjs";
|
||||
export const customTrainDataDetector = (TrainNumber: string) => {
|
||||
switch (TrainNumber) {
|
||||
//しおかぜメイン
|
||||
@ -22,7 +23,9 @@ export const customTrainDataDetector = (TrainNumber: string) => {
|
||||
return {
|
||||
type: "LTDEXP",
|
||||
trainName: "しおかぜ",
|
||||
trainIcon: "http://www.trainfrontview.net/b/s8000nr.png",
|
||||
trainIcon: "https://storage.haruk.in/s8000nr.png",
|
||||
infoUrl:
|
||||
"http://jr-shikoku.co.jp/01_trainbus/vehicle-info/shiokaze.html",
|
||||
trainNumDistance: 0,
|
||||
info: "いしづちと併結 / 8000系で運転",
|
||||
};
|
||||
@ -30,19 +33,22 @@ export const customTrainDataDetector = (TrainNumber: string) => {
|
||||
return {
|
||||
type: "LTDEXP",
|
||||
trainName: "しおかぜ",
|
||||
trainIcon: "http://www.trainfrontview.net/b/s8000nr.png",
|
||||
trainIcon: "https://storage.haruk.in/s8000nr.png",
|
||||
infoUrl:
|
||||
"http://jr-shikoku.co.jp/01_trainbus/vehicle-info/shiokaze.html",
|
||||
trainNumDistance: 0,
|
||||
info: "8000系で運転",
|
||||
};
|
||||
//8000 アンパン
|
||||
case "10M":
|
||||
case "22M":
|
||||
case "9M":
|
||||
case "10M":
|
||||
case "21M":
|
||||
return {
|
||||
type: "LTDEXP",
|
||||
trainName: "しおかぜ",
|
||||
trainIcon: "http://www.trainfrontview.net/f/s8000ap.png",
|
||||
trainIcon: "https://storage.haruk.in/s8000ap.png",
|
||||
infoUrl: "https://www.jr-eki.com/aptrain/naani/yosan/train.html",
|
||||
trainNumDistance: 0,
|
||||
info: "いしづちと併結 / アンパンマン列車で運転",
|
||||
};
|
||||
@ -58,7 +64,9 @@ export const customTrainDataDetector = (TrainNumber: string) => {
|
||||
return {
|
||||
type: "LTDEXP",
|
||||
trainName: "しおかぜ",
|
||||
trainIcon: "http://www.trainfrontview.net/b/s8600.png",
|
||||
trainIcon: "https://storage.haruk.in/s8600.png",
|
||||
infoUrl:
|
||||
"http://jr-shikoku.co.jp/01_trainbus/vehicle-info/shiokaze.html",
|
||||
trainNumDistance: 0,
|
||||
info: "いしづちと併結 / 8600系で運転",
|
||||
};
|
||||
@ -86,7 +94,9 @@ export const customTrainDataDetector = (TrainNumber: string) => {
|
||||
return {
|
||||
type: "LTDEXP",
|
||||
trainName: "いしづち",
|
||||
trainIcon: "http://www.trainfrontview.net/b/s8000no.png",
|
||||
trainIcon: "https://storage.haruk.in/s8000no.png",
|
||||
infoUrl:
|
||||
"http://jr-shikoku.co.jp/01_trainbus/vehicle-info/ishizuchi.html",
|
||||
trainNumDistance: 1000,
|
||||
info: "しおかぜと併結 / 8000系で運転",
|
||||
};
|
||||
@ -99,7 +109,8 @@ export const customTrainDataDetector = (TrainNumber: string) => {
|
||||
return {
|
||||
type: "LTDEXP",
|
||||
trainName: "いしづち",
|
||||
trainIcon: "http://www.trainfrontview.net/f/s8000ap.png",
|
||||
trainIcon: "https://storage.haruk.in/s8000ap.png",
|
||||
infoUrl: "https://www.jr-eki.com/aptrain/naani/yosan/train.html",
|
||||
trainNumDistance: 1000,
|
||||
info: "しおかぜと併結 / アンパンマン列車で運転",
|
||||
};
|
||||
@ -116,7 +127,9 @@ export const customTrainDataDetector = (TrainNumber: string) => {
|
||||
return {
|
||||
type: "LTDEXP",
|
||||
trainName: "いしづち",
|
||||
trainIcon: "http://www.trainfrontview.net/b/s8600_isz.png",
|
||||
trainIcon: "https://storage.haruk.in/s8600_isz.png",
|
||||
infoUrl:
|
||||
"http://jr-shikoku.co.jp/01_trainbus/vehicle-info/ishizuchi.html",
|
||||
trainNumDistance: 1000,
|
||||
info: "しおかぜと併結 / 8600系で運転",
|
||||
};
|
||||
@ -127,7 +140,9 @@ export const customTrainDataDetector = (TrainNumber: string) => {
|
||||
return {
|
||||
type: "LTDEXP",
|
||||
trainName: "モーニングEXP高松",
|
||||
trainIcon: "http://www.trainfrontview.net/b/s8000no.png",
|
||||
trainIcon: "https://storage.haruk.in/s8000nr.png",
|
||||
infoUrl:
|
||||
"http://jr-shikoku.co.jp/01_trainbus/vehicle-info/morning.html",
|
||||
trainNumDistance: null,
|
||||
info: "8000系で運転",
|
||||
};
|
||||
@ -136,7 +151,9 @@ export const customTrainDataDetector = (TrainNumber: string) => {
|
||||
return {
|
||||
type: "LTDEXP",
|
||||
trainName: "モーニングEXP松山",
|
||||
trainIcon: "http://www.trainfrontview.net/b/s8600_isz.png",
|
||||
trainIcon: "https://storage.haruk.in/s8600_isz.png",
|
||||
infoUrl:
|
||||
"http://jr-shikoku.co.jp/01_trainbus/vehicle-info/morning.html",
|
||||
trainNumDistance: null,
|
||||
info: "8600系で運転",
|
||||
};
|
||||
@ -147,7 +164,8 @@ export const customTrainDataDetector = (TrainNumber: string) => {
|
||||
return {
|
||||
type: "LTDEXP",
|
||||
trainName: "いしづち",
|
||||
trainIcon: "http://www.trainfrontview.net/f/s8000ap.png",
|
||||
trainIcon: "https://storage.haruk.in/s8000ap.png",
|
||||
infoUrl: "https://www.jr-eki.com/aptrain/naani/yosan/train.html",
|
||||
trainNumDistance: 940,
|
||||
info: "アンパンマン列車で運転",
|
||||
};
|
||||
@ -158,7 +176,9 @@ export const customTrainDataDetector = (TrainNumber: string) => {
|
||||
return {
|
||||
type: "LTDEXP",
|
||||
trainName: "いしづち",
|
||||
trainIcon: "http://www.trainfrontview.net/b/s8600_isz.png",
|
||||
trainIcon: "https://storage.haruk.in/s8600_isz.png",
|
||||
infoUrl:
|
||||
"http://jr-shikoku.co.jp/01_trainbus/vehicle-info/ishizuchi.html",
|
||||
trainNumDistance: 940,
|
||||
info: "8600系で運転",
|
||||
};
|
||||
@ -171,7 +191,8 @@ export const customTrainDataDetector = (TrainNumber: string) => {
|
||||
return {
|
||||
type: "LTDEXP",
|
||||
trainName: "南風",
|
||||
trainIcon: "http://www.trainfrontview.net/b/s2700.png",
|
||||
trainIcon: "https://storage.haruk.in/s2700.png",
|
||||
infoUrl: "http://jr-shikoku.co.jp/01_trainbus/vehicle-info/nanpu.html",
|
||||
trainNumDistance: 30,
|
||||
info: "しまんとと併結 / 2700系で運転",
|
||||
};
|
||||
@ -180,7 +201,8 @@ export const customTrainDataDetector = (TrainNumber: string) => {
|
||||
return {
|
||||
type: "LTDEXP",
|
||||
trainName: "南風",
|
||||
trainIcon: "http://www.trainfrontview.net/b/s2700.png",
|
||||
trainIcon: "https://storage.haruk.in/s2700.png",
|
||||
infoUrl: "http://jr-shikoku.co.jp/01_trainbus/vehicle-info/nanpu.html",
|
||||
trainNumDistance: 30,
|
||||
info: "うずしおと併結 / 2700系で運転",
|
||||
};
|
||||
@ -199,7 +221,8 @@ export const customTrainDataDetector = (TrainNumber: string) => {
|
||||
return {
|
||||
type: "LTDEXP",
|
||||
trainName: "南風",
|
||||
trainIcon: "http://www.trainfrontview.net/b/s2700.png",
|
||||
trainIcon: "https://storage.haruk.in/s2700.png",
|
||||
infoUrl: "http://jr-shikoku.co.jp/01_trainbus/vehicle-info/nanpu.html",
|
||||
trainNumDistance: 30,
|
||||
info: "2700系で運転",
|
||||
};
|
||||
@ -210,22 +233,30 @@ export const customTrainDataDetector = (TrainNumber: string) => {
|
||||
return {
|
||||
type: "LTDEXP",
|
||||
trainName: "南風",
|
||||
trainIcon: "http://www.trainfrontview.net/f/s2700apr.png",
|
||||
trainIcon: `https://n8n.haruk.in/webhook/dosan-anpanman-pictures.png?trainNum=${TrainNumber}&day=${dayjs().format(
|
||||
"yyyy-MM-DD"
|
||||
)}`,
|
||||
infoUrl: "https://www.jr-eki.com/aptrain/naani/dosan/train.html",
|
||||
trainNumDistance: 30,
|
||||
info: "うずしおと連結 / アンパンマン列車で運転",
|
||||
};
|
||||
case "32D":
|
||||
case "36D":
|
||||
case "44D":
|
||||
case "48D":
|
||||
case "56D":
|
||||
case "33D":
|
||||
case "37D":
|
||||
case "45D":
|
||||
case "49D":
|
||||
case "57D":
|
||||
return {
|
||||
type: "LTDEXP",
|
||||
trainName: "南風",
|
||||
trainIcon: "http://www.trainfrontview.net/f/s2700apr.png",
|
||||
trainIcon: `https://n8n.haruk.in/webhook/dosan-anpanman-pictures.png?trainNum=${TrainNumber}&day=${dayjs().format(
|
||||
"yyyy-MM-DD"
|
||||
)}`,
|
||||
infoUrl: "https://www.jr-eki.com/aptrain/naani/dosan/train.html",
|
||||
trainNumDistance: 30,
|
||||
info: "アンパンマン列車で運転",
|
||||
};
|
||||
@ -239,7 +270,9 @@ export const customTrainDataDetector = (TrainNumber: string) => {
|
||||
return {
|
||||
type: "LTDEXP",
|
||||
trainName: "うずしお",
|
||||
trainIcon: "http://www.trainfrontview.net/b/s2700_uzu.png",
|
||||
trainIcon: "https://storage.haruk.in/s2700_uzu.png",
|
||||
infoUrl:
|
||||
"http://jr-shikoku.co.jp/01_trainbus/vehicle-info/uzushio.html",
|
||||
trainNumDistance: 5000,
|
||||
info: "南風と併結 / 高松-宇多津間進行方向逆転 / 2700系で運転",
|
||||
};
|
||||
@ -255,7 +288,9 @@ export const customTrainDataDetector = (TrainNumber: string) => {
|
||||
return {
|
||||
type: "LTDEXP",
|
||||
trainName: "うずしお",
|
||||
trainIcon: "http://www.trainfrontview.net/b/s2700_uzu.png",
|
||||
trainIcon: "https://storage.haruk.in/s2700_uzu.png",
|
||||
infoUrl:
|
||||
"http://jr-shikoku.co.jp/01_trainbus/vehicle-info/uzushio.html",
|
||||
trainNumDistance: 3000,
|
||||
info: "2700系で運転",
|
||||
};
|
||||
@ -273,7 +308,9 @@ export const customTrainDataDetector = (TrainNumber: string) => {
|
||||
return {
|
||||
type: "LTDEXP",
|
||||
trainName: "うずしお",
|
||||
trainIcon: "http://www.trainfrontview.net/b/s2700_uzu.png",
|
||||
trainIcon: "https://storage.haruk.in/s2700_uzu.png",
|
||||
infoUrl:
|
||||
"http://jr-shikoku.co.jp/01_trainbus/vehicle-info/uzushio.html",
|
||||
trainNumDistance: 3000,
|
||||
info: "2700系で運転",
|
||||
};
|
||||
@ -292,7 +329,9 @@ export const customTrainDataDetector = (TrainNumber: string) => {
|
||||
return {
|
||||
type: "LTDEXP",
|
||||
trainName: "うずしお",
|
||||
trainIcon: "http://www.trainfrontview.net/b/s2600.png",
|
||||
trainIcon: "https://storage.haruk.in/s2600.png",
|
||||
infoUrl:
|
||||
"http://jr-shikoku.co.jp/01_trainbus/vehicle-info/uzushio.html",
|
||||
trainNumDistance: 3000,
|
||||
info: "2600系で運転",
|
||||
};
|
||||
@ -303,7 +342,9 @@ export const customTrainDataDetector = (TrainNumber: string) => {
|
||||
return {
|
||||
type: "LTDEXP",
|
||||
trainName: "うずしお",
|
||||
trainIcon: "http://www.trainfrontview.net/b/s185tu_uzu.png",
|
||||
trainIcon: "https://storage.haruk.in/s185tu_uzu.png",
|
||||
infoUrl:
|
||||
"http://jr-shikoku.co.jp/01_trainbus/vehicle-info/uzushio.html",
|
||||
trainNumDistance: 3000,
|
||||
info: "キハ185系で運転",
|
||||
};
|
||||
@ -380,7 +421,8 @@ export const customTrainDataDetector = (TrainNumber: string) => {
|
||||
return {
|
||||
type: "Rapid",
|
||||
trainName: "マリンライナー",
|
||||
trainIcon: "http://www.trainfrontview.net/b/s5001.png",
|
||||
trainIcon: "https://storage.haruk.in/s5001.png",
|
||||
infoUrl: "http://jr-shikoku.co.jp/01_trainbus/vehicle-info/marine.html",
|
||||
trainNumDistance: 3100,
|
||||
info: "",
|
||||
};
|
||||
@ -392,7 +434,8 @@ export const customTrainDataDetector = (TrainNumber: string) => {
|
||||
return {
|
||||
type: "Rapid",
|
||||
trainName: "マリンライナー",
|
||||
trainIcon: "http://www.trainfrontview.net/b/s5001k.png",
|
||||
trainIcon: "https://storage.haruk.in/s5001k.png",
|
||||
infoUrl: "http://jr-shikoku.co.jp/01_trainbus/vehicle-info/marine.html",
|
||||
trainNumDistance: 3100,
|
||||
info: "",
|
||||
};
|
||||
@ -403,7 +446,9 @@ export const customTrainDataDetector = (TrainNumber: string) => {
|
||||
return {
|
||||
type: "NightLTDEXP",
|
||||
trainName: "サンライズ瀬戸",
|
||||
trainIcon: "http://www.trainfrontview.net/b/w285.png",
|
||||
trainIcon: "https://storage.haruk.in/w285.png",
|
||||
infoUrl:
|
||||
"https://www.jr-odekake.net/train/sunriseseto_izumo/index.html",
|
||||
trainNumDistance: null,
|
||||
info: "",
|
||||
};
|
||||
@ -412,7 +457,9 @@ export const customTrainDataDetector = (TrainNumber: string) => {
|
||||
return {
|
||||
type: "NightLTDEXP",
|
||||
trainName: "サンライズ瀬戸",
|
||||
trainIcon: "http://www.trainfrontview.net/b/w285.png",
|
||||
trainIcon: "https://storage.haruk.in/w285.png",
|
||||
infoUrl:
|
||||
"https://www.jr-odekake.net/train/sunriseseto_izumo/index.html",
|
||||
trainNumDistance: null,
|
||||
info: "琴平延長運転日",
|
||||
};
|
||||
@ -446,7 +493,8 @@ export const customTrainDataDetector = (TrainNumber: string) => {
|
||||
return {
|
||||
type: "LTDEXP",
|
||||
trainName: "宇和海",
|
||||
trainIcon: "http://www.trainfrontview.net/b/s2000_uwa.png",
|
||||
trainIcon: "https://storage.haruk.in/s2000_uwa.png",
|
||||
infoUrl: "http://jr-shikoku.co.jp/01_trainbus/vehicle-info/uwakai.html",
|
||||
trainNumDistance: 1050,
|
||||
info: "2000系で運転",
|
||||
};
|
||||
@ -462,7 +510,8 @@ export const customTrainDataDetector = (TrainNumber: string) => {
|
||||
return {
|
||||
type: "LTDEXP",
|
||||
trainName: "宇和海",
|
||||
trainIcon: "http://www.trainfrontview.net/f/s2002a.png",
|
||||
trainIcon: "https://storage.haruk.in/s2002a.png",
|
||||
infoUrl: "https://www.jr-eki.com/aptrain/naani/yosan/train.html",
|
||||
trainNumDistance: 1050,
|
||||
info: "アンパン列車で運転",
|
||||
};
|
||||
@ -474,7 +523,9 @@ export const customTrainDataDetector = (TrainNumber: string) => {
|
||||
return {
|
||||
type: "LTDEXP",
|
||||
trainName: "しまんと",
|
||||
trainIcon: "http://www.trainfrontview.net/b/s2700_smn.png",
|
||||
trainIcon: "https://storage.haruk.in/s2700_smn.png",
|
||||
infoUrl:
|
||||
"http://jr-shikoku.co.jp/01_trainbus/vehicle-info/shimanto.html",
|
||||
trainNumDistance: 2000,
|
||||
info: "2700系で運転",
|
||||
};
|
||||
@ -485,7 +536,9 @@ export const customTrainDataDetector = (TrainNumber: string) => {
|
||||
return {
|
||||
type: "LTDEXP",
|
||||
trainName: "しまんと",
|
||||
trainIcon: "http://www.trainfrontview.net/b/s2700_smn.png",
|
||||
trainIcon: "https://storage.haruk.in/s2000_smn.png",
|
||||
infoUrl:
|
||||
"http://jr-shikoku.co.jp/01_trainbus/vehicle-info/shimanto.html",
|
||||
trainNumDistance: 2000,
|
||||
info: "南風と併結 / 2700系で運転",
|
||||
};
|
||||
@ -502,7 +555,9 @@ export const customTrainDataDetector = (TrainNumber: string) => {
|
||||
return {
|
||||
type: "LTDEXP",
|
||||
trainName: "あしずり",
|
||||
trainIcon: "http://www.trainfrontview.net/b/s2000_asi.png",
|
||||
trainIcon: "https://storage.haruk.in/s2000_asi.png",
|
||||
infoUrl:
|
||||
"http://jr-shikoku.co.jp/01_trainbus/vehicle-info/ashizuri.html",
|
||||
trainNumDistance: 2070,
|
||||
info: "2000系で運転",
|
||||
};
|
||||
@ -518,7 +573,9 @@ export const customTrainDataDetector = (TrainNumber: string) => {
|
||||
return {
|
||||
type: "LTDEXP",
|
||||
trainName: "あしずり",
|
||||
trainIcon: "http://www.trainfrontview.net/b/s2700_asi.png",
|
||||
trainIcon: "https://storage.haruk.in/s2700_asi.png",
|
||||
infoUrl:
|
||||
"http://jr-shikoku.co.jp/01_trainbus/vehicle-info/ashizuri.html",
|
||||
trainNumDistance: 2070,
|
||||
info: "2700系で運転",
|
||||
};
|
||||
@ -538,7 +595,9 @@ export const customTrainDataDetector = (TrainNumber: string) => {
|
||||
return {
|
||||
type: "LTDEXP",
|
||||
trainName: "剣山",
|
||||
trainIcon: "http://www.trainfrontview.net/b/s185tu.png",
|
||||
trainIcon: "https://storage.haruk.in/s185tu.png",
|
||||
infoUrl:
|
||||
"http://jr-shikoku.co.jp/01_trainbus/vehicle-info/tsurugisan.html",
|
||||
trainNumDistance: 4000,
|
||||
info: "キハ185系で運転",
|
||||
};
|
||||
@ -549,7 +608,8 @@ export const customTrainDataDetector = (TrainNumber: string) => {
|
||||
return {
|
||||
type: "LTDEXP",
|
||||
trainName: "むろと",
|
||||
trainIcon: "http://www.trainfrontview.net/b/s185_mrt.png",
|
||||
trainIcon: "https://storage.haruk.in/s185_mrt.png",
|
||||
infoUrl: "http://jr-shikoku.co.jp/01_trainbus/vehicle-info/muroto.html",
|
||||
trainNumDistance: 5050,
|
||||
info: "キハ185系で運転",
|
||||
};
|
||||
@ -560,7 +620,9 @@ export const customTrainDataDetector = (TrainNumber: string) => {
|
||||
return {
|
||||
type: "LTDEXP",
|
||||
trainName: "よしのがわトロッコ",
|
||||
trainIcon: "http://www.trainfrontview.net/f/s185to_ai.png",
|
||||
trainIcon: "https://storage.haruk.in/s185to_ai.png",
|
||||
infoUrl:
|
||||
"http://jr-shikoku.co.jp/01_trainbus/event_train/yoshino_torokko.html",
|
||||
trainNumDistance: null,
|
||||
info: "",
|
||||
};
|
||||
@ -574,7 +636,9 @@ export const customTrainDataDetector = (TrainNumber: string) => {
|
||||
return {
|
||||
type: "LTDEXP",
|
||||
trainName: "アンパンマントロッコ",
|
||||
trainIcon: "http://www.trainfrontview.net/f/s32to4.png",
|
||||
trainIcon: "https://storage.haruk.in/s32to4.png",
|
||||
infoUrl:
|
||||
"https://www.jr-eki.com/aptrain/naani/torokko_seto/jikoku.html",
|
||||
trainNumDistance: null,
|
||||
info: "",
|
||||
};
|
||||
@ -582,12 +646,21 @@ export const customTrainDataDetector = (TrainNumber: string) => {
|
||||
//伊予灘ものがたり
|
||||
case "8091D":
|
||||
case "8093D":
|
||||
return {
|
||||
type: "LTDEXP",
|
||||
trainName: "伊予灘ものがたり",
|
||||
trainIcon: "https://storage.haruk.in/s185iyor.png",
|
||||
infoUrl: "https://iyonadamonogatari.com/",
|
||||
trainNumDistance: null,
|
||||
info: "",
|
||||
};
|
||||
case "8092D":
|
||||
case "8094D":
|
||||
return {
|
||||
type: "LTDEXP",
|
||||
trainName: "伊予灘ものがたり",
|
||||
trainIcon: "http://www.trainfrontview.net/b/s185iyoy.png",
|
||||
trainIcon: "https://storage.haruk.in/s185iyoy.png",
|
||||
infoUrl: "https://iyonadamonogatari.com/",
|
||||
trainNumDistance: null,
|
||||
info: "",
|
||||
};
|
||||
@ -598,7 +671,8 @@ export const customTrainDataDetector = (TrainNumber: string) => {
|
||||
return {
|
||||
type: "LTDEXP",
|
||||
trainName: "四国まんなか千年ものがたり",
|
||||
trainIcon: "http://www.trainfrontview.net/b/s185mm1.png",
|
||||
trainIcon: "https://storage.haruk.in/s185mm1.png",
|
||||
infoUrl: "https://www.jr-shikoku.co.jp/sennenmonogatari/",
|
||||
trainNumDistance: null,
|
||||
info: "",
|
||||
};
|
||||
@ -611,19 +685,35 @@ export const customTrainDataDetector = (TrainNumber: string) => {
|
||||
return {
|
||||
type: "LTDEXP",
|
||||
trainName: "時代の夜明けのものがたり",
|
||||
trainIcon: "http://www.trainfrontview.net/b/s185ym1.png",
|
||||
trainIcon: "https://storage.haruk.in/s185ym1.png",
|
||||
infoUrl: "https://www.jr-shikoku.co.jp/yoakenomonogatari/index.html",
|
||||
trainNumDistance: null,
|
||||
info: "",
|
||||
};
|
||||
|
||||
default:
|
||||
return {
|
||||
type: "Normal",
|
||||
trainName: "",
|
||||
trainIcon: null,
|
||||
trainNumDistance: null,
|
||||
info: null,
|
||||
};
|
||||
if (
|
||||
new RegExp(/^4[1-9]\d\d[DM]$/).test(TrainNumber) ||
|
||||
new RegExp(/^5[1-7]\d\d[DM]$/).test(TrainNumber) ||
|
||||
TrainNumber === "3621D"
|
||||
)
|
||||
return {
|
||||
type: "OneMan",
|
||||
trainName: "",
|
||||
trainIcon: null,
|
||||
infoUrl: null,
|
||||
trainNumDistance: null,
|
||||
info: null,
|
||||
};
|
||||
else
|
||||
return {
|
||||
type: "Normal",
|
||||
trainName: "",
|
||||
trainIcon: null,
|
||||
infoUrl: null,
|
||||
trainNumDistance: null,
|
||||
info: null,
|
||||
};
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
@ -73,23 +73,27 @@ export const EachData: FC<Props> = (props) => {
|
||||
|
||||
const getTrainDataFromCurrentTrain = (trainNum: string) => {
|
||||
const customTrainData = customTrainDataDetector(d.train);
|
||||
if (customTrainData.type != "Normal") return customTrainData;
|
||||
const currentTrainData = currentTrain.filter((a) => a.num == trainNum);
|
||||
if (currentTrainData.length == 0) return customTrainData;
|
||||
else if (currentTrainData[0].Type.includes("rapid:")) {
|
||||
const typeText = currentTrainData[0].Type.split(":");
|
||||
const returnData = {
|
||||
type: "Rapid",
|
||||
trainName: typeText[1].replace("\r", ""),
|
||||
trainIcon: null,
|
||||
trainNumDistance: null,
|
||||
info: "",
|
||||
};
|
||||
return returnData;
|
||||
switch (customTrainData.type) {
|
||||
case "Normal":
|
||||
case "OneMan":
|
||||
const currentTrainData = currentTrain.filter((a) => a.num == trainNum);
|
||||
if (currentTrainData.length == 0) return customTrainData;
|
||||
else if (currentTrainData[0].Type.includes("rapid:")) {
|
||||
const typeText = currentTrainData[0].Type.split(":");
|
||||
const returnData = {
|
||||
type: "Rapid",
|
||||
trainName: typeText[1].replace("\r", ""),
|
||||
trainIcon: null,
|
||||
trainNumDistance: null,
|
||||
info: "",
|
||||
};
|
||||
return returnData;
|
||||
}
|
||||
return customTrainData;
|
||||
default:
|
||||
return customTrainData;
|
||||
}
|
||||
return customTrainData;
|
||||
};
|
||||
|
||||
const [train, setTrain] = useState(getTrainDataFromCurrentTrain(d.train));
|
||||
useEffect(() => {
|
||||
setTrain(getTrainDataFromCurrentTrain(d.train));
|
||||
|
10
howto.js
10
howto.js
@ -2,11 +2,17 @@ import React from "react";
|
||||
import { View } from "react-native";
|
||||
import { WebView } from "react-native-webview";
|
||||
import { BigButton } from "./components/atom/BigButton";
|
||||
import { useNavigation } from "@react-navigation/native";
|
||||
export default ({ navigation: { navigate }, route }) => {
|
||||
const { info, goTo, useShow } = route.params;
|
||||
const { goBack } = useNavigation();
|
||||
const onExit = () => {
|
||||
navigate(goTo || "Apps");
|
||||
useShow && useShow();
|
||||
if(goTo != "NearTrainDiagramView") {
|
||||
navigate(goTo || "Apps");
|
||||
useShow && useShow();
|
||||
} else {
|
||||
goBack();
|
||||
}
|
||||
};
|
||||
return (
|
||||
<View style={styles}>
|
||||
|
@ -12,6 +12,7 @@ type trainTypeString =
|
||||
| "寝台特急"
|
||||
| "臨時"
|
||||
| "普通列車"
|
||||
| "普通列車(ワンマン)"
|
||||
| "その他";
|
||||
type trainTypeDataString = "rapid" | "express" | "normal";
|
||||
type getTrainType = (d: nameString) => {
|
||||
@ -29,6 +30,8 @@ export const getTrainType: getTrainType = (nameString) => {
|
||||
return { color: "red", name: "寝台特急", data: "express" };
|
||||
case "SPCL":
|
||||
return { color: "blue", name: "臨時", data: "normal" };
|
||||
case "OneMan":
|
||||
return { color: "white", name: "普通列車(ワンマン)", data: "normal" };
|
||||
case "Normal":
|
||||
return { color: "white", name: "普通列車", data: "normal" };
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user