diff --git a/components/ActionSheetComponents/EachTrainInfo/LandscapeTrainInfo.js b/components/ActionSheetComponents/EachTrainInfo/LandscapeTrainInfo.js index 8538b65..96b8152 100644 --- a/components/ActionSheetComponents/EachTrainInfo/LandscapeTrainInfo.js +++ b/components/ActionSheetComponents/EachTrainInfo/LandscapeTrainInfo.js @@ -33,7 +33,7 @@ export const LandscapeTrainInfo = (props) => { stickyHeaderIndices={[1]} scrollEventThrottle={16} onScroll={(d) => { - console.log(d.nativeEvent.contentOffset.y); + // Handle scroll events }} > diff --git a/components/ActionSheetComponents/EachTrainInfoCore/trainIconStatus.tsx b/components/ActionSheetComponents/EachTrainInfoCore/trainIconStatus.tsx index 2612f7f..ed642e9 100644 --- a/components/ActionSheetComponents/EachTrainInfoCore/trainIconStatus.tsx +++ b/components/ActionSheetComponents/EachTrainInfoCore/trainIconStatus.tsx @@ -51,7 +51,6 @@ export const TrainIconStatus: FC = ({ data, navigate, from }) => { ) .then((d) => d.json()) .then((d) => { - console.log(d); if (d.trainStatus == "〇") { //setAnpanmanStatus({name:"checkmark-circle-outline",color:"blue"}); } else if (d.trainStatus == "▲") { @@ -76,7 +75,6 @@ export const TrainIconStatus: FC = ({ data, navigate, from }) => { ) .then((d) => d.json()) .then((d) => { - console.log(d); if (d.trainStatus == "〇") { //setAnpanmanStatus({name:"checkmark-circle-outline",color:"blue"}); } else if (d.trainStatus == "▲") { diff --git a/components/ActionSheetComponents/StationDeteilView.js b/components/ActionSheetComponents/StationDeteilView.js index b4a4626..3cfffd2 100644 --- a/components/ActionSheetComponents/StationDeteilView.js +++ b/components/ActionSheetComponents/StationDeteilView.js @@ -18,6 +18,7 @@ import { TrainBusButton } from "./StationDeteilView/TrainBusButton"; import { 駅構内図 } from "./StationDeteilView/StationInsideMapButton"; import { WebSiteButton } from "./StationDeteilView/WebSiteButton"; import { StationTimeTableButton } from "./StationDeteilView/StationTimeTableButton"; +import { StationTrainPositionButton } from "./StationDeteilView/StationTrainPositionButton"; export const StationDeteilView = (props) => { if (!props.payload) return <>; @@ -104,16 +105,23 @@ export const StationDeteilView = (props) => { } /> - {currentStation[0].JrHpUrl && - currentStation[0].StationNumber != "M12" && ( - <駅構内図 //児島例外/ - navigate={navigate} - goTo={goTo} - useShow={useShow} - address={currentStation[0].JrHpUrl} - onExit={onExit} - /> - )} + + + {currentStation[0].JrHpUrl && + currentStation[0].StationNumber != "M12" && ( + <駅構内図 //児島例外/ + navigate={navigate} + goTo={goTo} + useShow={useShow} + address={currentStation[0].JrHpUrl} + onExit={onExit} + /> + )} + {!currentStation[0].JrHpUrl || ( { useShow={useShow} /> )} - + {!trainBus || ( = (props) => { alignContent: "center", alignItems: "center", margin: 2, + flex: 1, }} onPress={() => { navigate("howto", { info, goTo, useShow }); diff --git a/components/ActionSheetComponents/StationDeteilView/StationTrainPositionButton.tsx b/components/ActionSheetComponents/StationDeteilView/StationTrainPositionButton.tsx new file mode 100644 index 0000000..dcc0a84 --- /dev/null +++ b/components/ActionSheetComponents/StationDeteilView/StationTrainPositionButton.tsx @@ -0,0 +1,54 @@ +import { FC } from "react"; +import { TouchableOpacity, View, Text, Linking } from "react-native"; +import { useStationList } from "@/stateBox/useStationList"; +import { useCurrentTrain } from "@/stateBox/useCurrentTrain"; +import AntDesign from "react-native-vector-icons/AntDesign"; +type Props = { + stationNumber: string; + onExit: () => void; + navigate?: (screen: string, params: { screen: string }) => void; +}; +export const StationTrainPositionButton: FC = (props) => { + const { stationNumber, onExit, navigate } = props; + const { + inject, + } = useCurrentTrain(); + const { getInjectJavascriptAddress } = useStationList(); + return ( + { + navigate("positions", { screen: "Apps" }); + const script = getInjectJavascriptAddress(stationNumber); + inject(script); + onExit(); + }} + > + + + + 走行位置に移動 + + + + ); +}; diff --git a/components/Menu/Carousel/CarouselBox.tsx b/components/Menu/Carousel/CarouselBox.tsx index 51fbe47..d093f8e 100644 --- a/components/Menu/Carousel/CarouselBox.tsx +++ b/components/Menu/Carousel/CarouselBox.tsx @@ -29,8 +29,7 @@ export const CarouselBox = ({ useEffect(() => { if (!carouselBadgeScrollViewRef.current) return; - const scrollToIndex = listIndex * (width / listUpStation.length) + 10; - console.log("scrollToIndex", scrollToIndex); + const scrollToIndex = (dotButton ? 28 : 22) * listIndex - (width / 2) + (dotButton ? 28 : 22) - 5; carouselBadgeScrollViewRef.current.scrollTo({ x: scrollToIndex, animated: true, diff --git a/components/Settings/FavoliteSettings/FavoiliteSettingsItem.js b/components/Settings/FavoliteSettings/FavoiliteSettingsItem.js index 51ba766..cdc84f8 100644 --- a/components/Settings/FavoliteSettings/FavoiliteSettingsItem.js +++ b/components/Settings/FavoliteSettings/FavoiliteSettingsItem.js @@ -8,7 +8,6 @@ import { AS } from "../../../storageControl"; export const FavoriteSettingsItem = ({ currentStation }) => { const lineIDs = []; const EachIDs = []; - console.log(currentStation); currentStation.forEach((d) => { if (!d.StationNumber) return; const textArray = d.StationNumber.split(""); diff --git a/menu.js b/menu.js index e5c34af..ff730fc 100644 --- a/menu.js +++ b/menu.js @@ -178,18 +178,30 @@ export default function Menu(props) { const returnData = []; Object.keys(lineList_LineWebID).forEach((d, indexBase) => { originalStationList[d].forEach((D, index) => { - if (isSearchMode && isSearchMode != stationIDPair[lineList_LineWebID[d]]) return; + if ( + isSearchMode && + isSearchMode != stationIDPair[lineList_LineWebID[d]] + ) + return; const latlng = [D.lat, D.lng]; if (latlng.length == 0) return null; - if(D.StationNumber == undefined) { + if (D.StationNumber == undefined) { return null; } returnData.push([D]); }); }); + if (mapMode) { + mapsRef?.current.fitToCoordinates( + listUpStation.map((d) => ({ + latitude: parseFloat(d[0].lat), + longitude: parseFloat(d[0].lng), + })), + { edgePadding: { top: 80, bottom: 120, left: 50, right: 50 } } // Add margin values here + ); + } setListUpStation(returnData); - } - else if (stationListMode == "position") { + } else if (stationListMode == "position") { setListUpStation(nearPositionStation.filter((d) => d != undefined)); } else { setListUpStation(favoriteStation.filter((d) => d != undefined)); @@ -200,12 +212,16 @@ export default function Menu(props) { setListIndex(0); return; } + if (listUpStation.length == 1) { + setListIndex(0); + return; + } if (listUpStation[listIndex] == undefined) { const count = listIndex - 1; setMapMode(false); setListIndex(count); } - }, [listIndex, nearPositionStation, listUpStation]); + }, [listIndex, nearPositionStation, listUpStation, isSearchMode]); useEffect(() => { if (originalStationList == undefined) return; if (listUpStation.length == 0) return; @@ -258,7 +274,6 @@ export default function Menu(props) { }} onScrollBeginDrag={onScrollBeginDrag} onScrollEndDrag={(e) => { - console.log(e.nativeEvent.velocity); if (e.nativeEvent.contentOffset.y < mapHeight - 80) { if (scrollStartPosition > e.nativeEvent.contentOffset.y) { goToMap(); diff --git a/stateBox/useCurrentTrain.js b/stateBox/useCurrentTrain.js index 2d5d8e2..15f6b44 100644 --- a/stateBox/useCurrentTrain.js +++ b/stateBox/useCurrentTrain.js @@ -15,7 +15,7 @@ const initialState = { currentTrainLoading: "loading", setCurrentTrainLoading: () => {}, getCurrentTrain: () => {}, - inject: () => {}, + inject: (i) => {}, }; const CurrentTrainContext = createContext(initialState); diff --git a/stateBox/useStationList.tsx b/stateBox/useStationList.tsx index 4a0d10a..7073735 100644 --- a/stateBox/useStationList.tsx +++ b/stateBox/useStationList.tsx @@ -92,7 +92,6 @@ export const StationListProvider: FC = ({ children }) => { return; } if (x.StationNumber == StationNumber) { - console.log(originalStationList[d]); if (!x.MyStation) findNearStations = true; else bootStationList.push({ line: lineName, station: x }); }