From bc3aca8c4183b4b7740bcbcacce8dfd9c9142e24 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Mon, 10 Mar 2025 17:48:51 +0000 Subject: [PATCH] =?UTF-8?q?=E8=A8=AD=E5=AE=9A=E7=94=BB=E9=9D=A2=E3=81=AE?= =?UTF-8?q?=E3=83=98=E3=83=83=E3=83=80=E3=83=BC=E3=82=92=E4=B8=80=E6=96=89?= =?UTF-8?q?=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/Settings/FavoriteSettings.js | 44 +------- components/Settings/LauncherIconSettings.js | 41 +------ components/Settings/LayoutSettings.js | 41 +------ components/Settings/NotificationSettings.js | 115 +++++--------------- components/Settings/SettingTopPage.js | 44 +------- components/Settings/WidgetSettings.js | 44 +------- components/atom/SheetHeaderItem.tsx | 48 ++++++++ 7 files changed, 97 insertions(+), 280 deletions(-) create mode 100644 components/atom/SheetHeaderItem.tsx diff --git a/components/Settings/FavoriteSettings.js b/components/Settings/FavoriteSettings.js index 4c4e0ec..9a08d43 100644 --- a/components/Settings/FavoriteSettings.js +++ b/components/Settings/FavoriteSettings.js @@ -4,51 +4,17 @@ import { useNavigation } from "@react-navigation/native"; import { useFavoriteStation } from "../../stateBox/useFavoriteStation"; import { CheckBox } from "react-native-elements"; import { FavoriteSettingsItem } from "./FavoliteSettings/FavoiliteSettingsItem"; +import { SheetHeaderItem } from "@/components/atom/SheetHeaderItem"; export const FavoriteSettings = () => { const { favoriteStation, setFavoriteStation } = useFavoriteStation(); const { goBack } = useNavigation(); return ( - - - - - - < 設定 - - - - - - - お気に入り設定 - - - + {favoriteStation.map((currentStation, index, array) => ( { const { goBack } = useNavigation(); @@ -21,45 +22,7 @@ export const LauncherIconSettings = ({ navigate }) => { const [currentIcon] = useState(getAppIconName()); return ( - - - - - - < 設定 - - - - - - - アイコン設定 - - - + {currentIcon ? ( <> diff --git a/components/Settings/LayoutSettings.js b/components/Settings/LayoutSettings.js index e92af7b..4020857 100644 --- a/components/Settings/LayoutSettings.js +++ b/components/Settings/LayoutSettings.js @@ -4,6 +4,7 @@ import { useNavigation } from "@react-navigation/native"; import { SwitchArea } from "../atom/SwitchArea"; import { CheckBox } from "react-native-elements"; import { TripleSwitchArea } from "../atom/TripleSwitchArea"; +import { SheetHeaderItem } from "../atom/SheetHeaderItem"; export const LayoutSettings = ({ navigate, @@ -25,45 +26,7 @@ export const LayoutSettings = ({ const { goBack } = useNavigation(); return ( - - - - - - < 設定 - - - - - - - レイアウト設定 - - - + { const { expoPushToken } = useNotification(); @@ -19,92 +20,36 @@ export const NotificationSettings = () => { AS.getItem("strangeTrain").then(setStrangeTrain); }, []); + const setRegister = () => { + fetch( + "https://n8n.haruk.in/webhook/jr-shikoku-notification-configurations", + { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + token: expoPushToken, + traInfoEX, + informations, + strangeTrain, + }), + } + ).then(() => { + Promise.all([ + AS.setItem("traInfoEX", traInfoEX.toString()), + AS.setItem("informations", informations.toString()), + AS.setItem("strangeTrain", strangeTrain.toString()), + ]).then(() => alert("通知の設定を保存、登録しました")); + }); + }; return ( - - - - - - < 設定 - - - - - - - 通知設定(β) - - - { - fetch( - "https://n8n.haruk.in/webhook/jr-shikoku-notification-configurations", - { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ - token: expoPushToken, - traInfoEX, - informations, - strangeTrain, - }), - } - ).then(() => { - Promise.all([ - AS.setItem("traInfoEX", traInfoEX.toString()), - AS.setItem("informations", informations.toString()), - AS.setItem("strangeTrain", strangeTrain.toString()), - ]).then(() => alert("通知の設定を保存、登録しました")); - }); - }} - style={{ - flexDirection: "column", - flex: 1, - }} - > - - - 登録実行 - - - - - + - - - navigation.goBack()} - style={{ - flexDirection: "column", - flex: 1, - }} - > - - - 閉じる - - - - - - - アプリの設定画面 - - - + navigation.goBack(), + }} /> diff --git a/components/Settings/WidgetSettings.js b/components/Settings/WidgetSettings.js index 25b2628..f5213e5 100644 --- a/components/Settings/WidgetSettings.js +++ b/components/Settings/WidgetSettings.js @@ -8,6 +8,7 @@ import { getInfoString } from "../AndroidWidget/InfoWidget"; import { AS } from "../../storageControl"; import { nameToWidget } from "../AndroidWidget/widget-task-handler"; import { ListItem } from "native-base"; +import { SheetHeaderItem } from "../atom/SheetHeaderItem"; export const WidgetSettings = ({ navigate }) => { const { JR_shikoku_train_info, Info_Widget } = nameToWidget; @@ -41,45 +42,10 @@ export const WidgetSettings = ({ navigate }) => { }, []); return ( - - - - - - < 設定 - - - - - - - ウィジェット設定 - - - + = (props) => { + const { LeftItem, RightItem, title } = props; + return ( + + + {LeftItem ? : <>} + + {title} + + {RightItem ? : <>} + + + ); +}; + +type SideItemProps = { + onPress: () => void; + title: string; + position: "left" | "right"; +}; +const SideItem: FC = ({ onPress, title, position }) => { + return ( + + + {title} + + + ); +};