From 4dccffa0ba89a69744b62e69d4f4870fec220fa1 Mon Sep 17 00:00:00 2001 From: kiharu3112 Date: Sun, 7 Jul 2024 16:33:15 +0900 Subject: [PATCH 01/10] =?UTF-8?q?feat:=E5=AF=BE=E5=BF=9C=E3=81=97=E3=81=A6?= =?UTF-8?q?=E3=81=AA=E3=81=84=E3=83=96=E3=83=A9=E3=82=A6=E3=82=B6=E3=81=A7?= =?UTF-8?q?=E8=AD=A6=E5=91=8A=E3=82=92=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- i18n/locales/en.json | 4 +- i18n/locales/ja.json | 4 +- src/components/UnsupportedBrowserModal.tsx | 43 ++++++++++++++++++++++ src/pages/home.tsx | 10 +++++ 4 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 src/components/UnsupportedBrowserModal.tsx diff --git a/i18n/locales/en.json b/i18n/locales/en.json index a57eba6..3ec04b0 100644 --- a/i18n/locales/en.json +++ b/i18n/locales/en.json @@ -22,5 +22,7 @@ "書き込みツール": "kaniwriter", "参考資料": "Reference", "ソースコードを表示": "Show source code", - "ソースコードを非表示": "Hide source code" + "ソースコードを非表示": "Hide source code", + "このブラウザはサポートされていません": "This Browser is Not Supported", + "対応するブラウザを使ってください": "Your current browser does not support some of the features of this website.\nTo use all the features of this site, please use a desktop browser like Google Chrome or Microsoft Edge.\nMobile browsers and some other desktop browsers are not supported.\n Thank you for your understanding." } diff --git a/i18n/locales/ja.json b/i18n/locales/ja.json index ef9af6a..8d988a1 100644 --- a/i18n/locales/ja.json +++ b/i18n/locales/ja.json @@ -22,5 +22,7 @@ "書き込みツール": "書き込みツール", "参考資料": "参考資料", "ソースコードを表示": "ソースコードを表示", - "ソースコードを非表示": "ソースコードを非表示" + "ソースコードを非表示": "ソースコードを非表示", + "このブラウザはサポートされていません": "このブラウザはサポートされていません", + "対応するブラウザを使ってください": "お使いのブラウザではこのウェブサイトの一部機能が正しく動作しません。\nこのサイトのすべての機能を利用するためには、パソコンのGoogle ChromeやMicrosoft Edgeなどのブラウザを使用してください。\nモバイルのブラウザや一部のパソコン用ブラウザでは対応していないため、ご注意ください。" } diff --git a/src/components/UnsupportedBrowserModal.tsx b/src/components/UnsupportedBrowserModal.tsx new file mode 100644 index 0000000..69f0093 --- /dev/null +++ b/src/components/UnsupportedBrowserModal.tsx @@ -0,0 +1,43 @@ +import { Modal, ModalClose, Sheet } from "@mui/joy"; +import { Typography } from "@mui/material"; +import { useState } from "react"; +import { useTranslation } from "react-i18next"; + +export const UnsupportedBrowserModal = () => { + const [open, setOpen] = useState(true); + const [t] = useTranslation(); + + return ( + setOpen(false)} + sx={{ + width: "90%", + minWidth: "500px", + m: "auto", + alignContent: "center", + }} + > + + + {t("このブラウザはサポートされていません")} + + + + + {t("対応するブラウザを使ってください")} + + + + ); +}; diff --git a/src/pages/home.tsx b/src/pages/home.tsx index c3001ae..d358dd1 100644 --- a/src/pages/home.tsx +++ b/src/pages/home.tsx @@ -29,6 +29,7 @@ import { Version, useVersions } from "hooks/useVersions"; import { useCompile } from "hooks/useCompile"; import { CompileStatusCard } from "components/CompileStatusCard"; import { useTranslation } from "react-i18next"; +import { UnsupportedBrowserModal } from "components/UnsupportedBrowserModal"; const targets = [ { @@ -71,6 +72,9 @@ export const Home = () => { const [versions, getVersionsStatus] = useVersions(); const [compileStatus, sourceCode, compile] = useCompile(id, setCode); + // 対応するブラウザかの判定(対応してればtrue) + const [supported, setsupported] = useState(false); + const read = useCallback(async () => { const res = await connector.startListen(); console.log(res); @@ -163,8 +167,14 @@ export const Home = () => { i18n.changeLanguage(locale); }, [i18n]); + // WebSerialAPIに対応するブラウザかどうかを確認する + useEffect(() => { + setsupported(("serial" in navigator)); + }, []) + return ( <> + {!supported && } Date: Sun, 1 Dec 2024 23:30:19 +0900 Subject: [PATCH 02/10] =?UTF-8?q?chore:=E6=96=87=E8=A8=80=E3=81=AE?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E3=81=A8=E3=80=81=E4=B8=8D=E8=A6=81=E3=81=AA?= =?UTF-8?q?useState=E3=82=92=E6=B6=88=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- i18n/locales/en.json | 2 +- i18n/locales/ja.json | 2 +- src/pages/home.tsx | 7 +------ 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/i18n/locales/en.json b/i18n/locales/en.json index 3ec04b0..fefe038 100644 --- a/i18n/locales/en.json +++ b/i18n/locales/en.json @@ -24,5 +24,5 @@ "ソースコードを表示": "Show source code", "ソースコードを非表示": "Hide source code", "このブラウザはサポートされていません": "This Browser is Not Supported", - "対応するブラウザを使ってください": "Your current browser does not support some of the features of this website.\nTo use all the features of this site, please use a desktop browser like Google Chrome or Microsoft Edge.\nMobile browsers and some other desktop browsers are not supported.\n Thank you for your understanding." + "対応するブラウザを使ってください": "Your current browser does not support some of the features of this website.\nTo use all the features of this site, please use a desktop browser like Google Chrome or Microsoft Edge." } diff --git a/i18n/locales/ja.json b/i18n/locales/ja.json index 8d988a1..77fd0cb 100644 --- a/i18n/locales/ja.json +++ b/i18n/locales/ja.json @@ -24,5 +24,5 @@ "ソースコードを表示": "ソースコードを表示", "ソースコードを非表示": "ソースコードを非表示", "このブラウザはサポートされていません": "このブラウザはサポートされていません", - "対応するブラウザを使ってください": "お使いのブラウザではこのウェブサイトの一部機能が正しく動作しません。\nこのサイトのすべての機能を利用するためには、パソコンのGoogle ChromeやMicrosoft Edgeなどのブラウザを使用してください。\nモバイルのブラウザや一部のパソコン用ブラウザでは対応していないため、ご注意ください。" + "対応するブラウザを使ってください": "お使いのブラウザではこのウェブサイトの一部機能が正しく動作しません。\nこのサイトのすべての機能を利用するためには、パソコンのGoogle ChromeやMicrosoft Edgeなどのブラウザを使用してください。" } diff --git a/src/pages/home.tsx b/src/pages/home.tsx index d358dd1..858a827 100644 --- a/src/pages/home.tsx +++ b/src/pages/home.tsx @@ -72,9 +72,6 @@ export const Home = () => { const [versions, getVersionsStatus] = useVersions(); const [compileStatus, sourceCode, compile] = useCompile(id, setCode); - // 対応するブラウザかの判定(対応してればtrue) - const [supported, setsupported] = useState(false); - const read = useCallback(async () => { const res = await connector.startListen(); console.log(res); @@ -168,9 +165,7 @@ export const Home = () => { }, [i18n]); // WebSerialAPIに対応するブラウザかどうかを確認する - useEffect(() => { - setsupported(("serial" in navigator)); - }, []) + const supported = "serial" in navigator; return ( <> From 97508369da35f1488a9f3adb0da11053050f9d17 Mon Sep 17 00:00:00 2001 From: Miharup <74781355+kiharu3112@users.noreply.github.com> Date: Sun, 1 Dec 2024 23:36:10 +0900 Subject: [PATCH 03/10] =?UTF-8?q?chore:=E3=83=95=E3=82=A9=E3=83=BC?= =?UTF-8?q?=E3=83=9E=E3=83=83=E3=83=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/home.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/home.tsx b/src/pages/home.tsx index 2b61012..a1a327f 100644 --- a/src/pages/home.tsx +++ b/src/pages/home.tsx @@ -22,13 +22,13 @@ import { CompilerSelector } from "components/CompilerSelector"; import { ControlButton } from "components/ControlButton"; import { Log } from "components/Log"; import { SourceCodeTab } from "components/SourceCodeTab"; +import { UnsupportedBrowserModal } from "components/UnsupportedBrowserModal"; import { useCompile } from "hooks/useCompile"; import { useQuery } from "hooks/useQuery"; import { Version, useVersions } from "hooks/useVersions"; import { MrubyWriterConnector, Target } from "libs/mrubyWriterConnector"; import { isTarget } from "libs/utility"; import { useTranslation } from "react-i18next"; -import { UnsupportedBrowserModal } from "components/UnsupportedBrowserModal"; import ESP32 from "/images/ESP32.png"; import RBoard from "/images/Rboard.png"; From 972de0b1a67b135b96e310aabca68fc1f2731725 Mon Sep 17 00:00:00 2001 From: Miharup <74781355+kiharu3112@users.noreply.github.com> Date: Mon, 2 Dec 2024 12:47:17 +0900 Subject: [PATCH 04/10] Update src/components/UnsupportedBrowserModal.tsx Co-authored-by: tufusa --- src/components/UnsupportedBrowserModal.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/UnsupportedBrowserModal.tsx b/src/components/UnsupportedBrowserModal.tsx index 69f0093..8d3ad2d 100644 --- a/src/components/UnsupportedBrowserModal.tsx +++ b/src/components/UnsupportedBrowserModal.tsx @@ -20,10 +20,10 @@ export const UnsupportedBrowserModal = () => { > {t("このブラウザはサポートされていません")} From a4be5e44062c0e3d43d715d8a9d4033fadde0053 Mon Sep 17 00:00:00 2001 From: Miharup <74781355+kiharu3112@users.noreply.github.com> Date: Tue, 10 Dec 2024 14:02:12 +0900 Subject: [PATCH 05/10] =?UTF-8?q?chore:=E3=83=A2=E3=83=BC=E3=83=80?= =?UTF-8?q?=E3=83=AB=E3=81=AE=E8=AD=A6=E5=91=8A=E6=96=87=E3=82=92=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- i18n/locales/en.json | 2 +- i18n/locales/ja.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/i18n/locales/en.json b/i18n/locales/en.json index 2b7359f..b169e2c 100644 --- a/i18n/locales/en.json +++ b/i18n/locales/en.json @@ -27,5 +27,5 @@ "クリックして閉じる": "Click to close", "コマンド": "Command", "このブラウザはサポートされていません": "This Browser is Not Supported", - "対応するブラウザを使ってください": "Your current browser does not support some of the features of this website.\nTo use all the features of this site, please use a desktop browser like Google Chrome or Microsoft Edge." + "対応するブラウザを使ってください": "Your current browser does not support some of the features of this website.\nTo use all the features of this site, please use a desktop version of Google Chrome or Microsoft Edge." } diff --git a/i18n/locales/ja.json b/i18n/locales/ja.json index 5f6a014..c64346c 100644 --- a/i18n/locales/ja.json +++ b/i18n/locales/ja.json @@ -27,5 +27,5 @@ "クリックして閉じる": "クリックして閉じる", "コマンド": "コマンド", "このブラウザはサポートされていません": "このブラウザはサポートされていません", - "対応するブラウザを使ってください": "お使いのブラウザではこのウェブサイトの一部機能が正しく動作しません。\nこのサイトのすべての機能を利用するためには、パソコンのGoogle ChromeやMicrosoft Edgeなどのブラウザを使用してください。" + "対応するブラウザを使ってください": "お使いのブラウザではこのウェブサイトの一部機能が正しく動作しません。\nこのサイトのすべての機能を利用するためには、デスクトップ版のGoogle ChromeもしくはMicrosoft Edgeを使用してください。" } From 82ad87160520d845658482cdab8a4d5ab7562f38 Mon Sep 17 00:00:00 2001 From: Miharup <74781355+kiharu3112@users.noreply.github.com> Date: Tue, 10 Dec 2024 14:17:55 +0900 Subject: [PATCH 06/10] =?UTF-8?q?chore:=E5=AF=BE=E5=BF=9C=E3=81=97?= =?UTF-8?q?=E3=81=A6=E3=81=84=E3=81=AA=E3=81=84=E3=83=96=E3=83=A9=E3=82=A6?= =?UTF-8?q?=E3=82=B6=E3=81=AE=E3=83=A2=E3=83=BC=E3=83=80=E3=83=AB=E8=A1=A8?= =?UTF-8?q?=E7=A4=BA=E3=83=AD=E3=82=B8=E3=83=83=E3=82=AF=E3=82=92=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/UnsupportedBrowserModal.tsx | 16 ++++++++-------- src/pages/home.tsx | 5 +---- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/components/UnsupportedBrowserModal.tsx b/src/components/UnsupportedBrowserModal.tsx index 69f0093..5c10c14 100644 --- a/src/components/UnsupportedBrowserModal.tsx +++ b/src/components/UnsupportedBrowserModal.tsx @@ -2,11 +2,11 @@ import { Modal, ModalClose, Sheet } from "@mui/joy"; import { Typography } from "@mui/material"; import { useState } from "react"; import { useTranslation } from "react-i18next"; - +// WebSerialAPIに対応するブラウザかどうかを確認して対応してなかったら警告を出す export const UnsupportedBrowserModal = () => { - const [open, setOpen] = useState(true); + const supported = "serial" in navigator; + const [open, setOpen] = useState(!supported); const [t] = useTranslation(); - return ( { > {t("このブラウザはサポートされていません")} {t("対応するブラウザを使ってください")} diff --git a/src/pages/home.tsx b/src/pages/home.tsx index a1a327f..5084c19 100644 --- a/src/pages/home.tsx +++ b/src/pages/home.tsx @@ -226,12 +226,9 @@ export const Home = () => { i18n.changeLanguage(locale); }, [i18n]); - // WebSerialAPIに対応するブラウザかどうかを確認する - const supported = "serial" in navigator; - return ( <> - {!supported && } + Date: Tue, 10 Dec 2024 14:18:53 +0900 Subject: [PATCH 07/10] =?UTF-8?q?chore:prettier=E3=82=B3=E3=83=9E=E3=83=B3?= =?UTF-8?q?=E3=83=89=E3=82=92package.json=E3=81=8B=E3=82=89=E5=89=8A?= =?UTF-8?q?=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index 9ccda87..e3698f6 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,6 @@ "build": "tsc && vite build", "build:ceres": "tsc && NODE_OPTIONS=--max-old-space-size=4096 vite build --mode ceres", "preview": "vite preview", - "prettier": "prettier --write \"src/**/*.{js,jsx,ts,tsx,json,md}\"", "check": "biome check --write", "check:ci": "biome ci && tsc -p . --noEmit" }, From 6b90e6d4bc13fa4fdb2a194a7e1c6bc5c1b22381 Mon Sep 17 00:00:00 2001 From: Miharup <74781355+kiharu3112@users.noreply.github.com> Date: Tue, 10 Dec 2024 14:43:16 +0900 Subject: [PATCH 08/10] =?UTF-8?q?chore:UnsupportedBrowserModal=E3=82=B3?= =?UTF-8?q?=E3=83=B3=E3=83=9D=E3=83=BC=E3=83=8D=E3=83=B3=E3=83=88=E3=81=AB?= =?UTF-8?q?defaultOpen=E3=83=97=E3=83=AD=E3=83=91=E3=83=86=E3=82=A3?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0=E3=81=97=E3=80=81=E3=83=96=E3=83=A9?= =?UTF-8?q?=E3=82=A6=E3=82=B6=E3=81=AE=E3=82=B5=E3=83=9D=E3=83=BC=E3=83=88?= =?UTF-8?q?=E7=8A=B6=E6=B3=81=E3=81=AB=E5=9F=BA=E3=81=A5=E3=81=84=E3=81=A6?= =?UTF-8?q?=E3=83=A2=E3=83=BC=E3=83=80=E3=83=AB=E3=81=AE=E5=88=9D=E6=9C=9F?= =?UTF-8?q?=E8=A1=A8=E7=A4=BA=E3=82=92=E5=88=B6=E5=BE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/UnsupportedBrowserModal.tsx | 12 ++++++++---- src/pages/home.tsx | 4 +++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/components/UnsupportedBrowserModal.tsx b/src/components/UnsupportedBrowserModal.tsx index 5c10c14..35f6ee1 100644 --- a/src/components/UnsupportedBrowserModal.tsx +++ b/src/components/UnsupportedBrowserModal.tsx @@ -2,10 +2,14 @@ import { Modal, ModalClose, Sheet } from "@mui/joy"; import { Typography } from "@mui/material"; import { useState } from "react"; import { useTranslation } from "react-i18next"; -// WebSerialAPIに対応するブラウザかどうかを確認して対応してなかったら警告を出す -export const UnsupportedBrowserModal = () => { - const supported = "serial" in navigator; - const [open, setOpen] = useState(!supported); +interface UnsupportedBrowserModalProps { + defaultOpen: boolean; +} + +export const UnsupportedBrowserModal = ({ + defaultOpen, +}: UnsupportedBrowserModalProps) => { + const [open, setOpen] = useState(defaultOpen); const [t] = useTranslation(); return ( { i18n.changeLanguage(locale); }, [i18n]); + // WebSerialAPIに対応するブラウザかどうかを確認 + const isSupported = "serial" in navigator; return ( <> - + Date: Tue, 10 Dec 2024 15:26:32 +0900 Subject: [PATCH 09/10] =?UTF-8?q?chore:UnsupportedBrowserModal=E3=82=B3?= =?UTF-8?q?=E3=83=B3=E3=83=9D=E3=83=BC=E3=83=8D=E3=83=B3=E3=83=88=E3=81=AB?= =?UTF-8?q?disableAutoFocus=E3=83=97=E3=83=AD=E3=83=91=E3=83=86=E3=82=A3?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/UnsupportedBrowserModal.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/UnsupportedBrowserModal.tsx b/src/components/UnsupportedBrowserModal.tsx index 35f6ee1..bc98763 100644 --- a/src/components/UnsupportedBrowserModal.tsx +++ b/src/components/UnsupportedBrowserModal.tsx @@ -15,6 +15,7 @@ export const UnsupportedBrowserModal = ({ setOpen(false)} + disableAutoFocus sx={{ width: "90%", minWidth: "500px", From dfbdaa8820af24fdd3d25560064fc89489cc0aec Mon Sep 17 00:00:00 2001 From: Miharup <74781355+kiharu3112@users.noreply.github.com> Date: Tue, 10 Dec 2024 16:01:45 +0900 Subject: [PATCH 10/10] =?UTF-8?q?chore:UnsupportedBrowserModal=E3=82=B3?= =?UTF-8?q?=E3=83=B3=E3=83=9D=E3=83=BC=E3=83=8D=E3=83=B3=E3=83=88=E3=81=AE?= =?UTF-8?q?=E6=9C=80=E5=A4=A7=E5=B9=85=E3=82=92=E8=A8=AD=E5=AE=9A=E3=81=97?= =?UTF-8?q?=E3=80=81=E3=83=95=E3=82=A9=E3=83=B3=E3=83=88=E3=82=B5=E3=82=A4?= =?UTF-8?q?=E3=82=BA=E3=82=92=E5=A4=89=E6=9B=B4=20=E5=B9=85=E3=81=8C?= =?UTF-8?q?=E7=8B=AD=E3=81=84=E7=92=B0=E5=A2=83=E3=81=A7=E3=83=86=E3=82=AD?= =?UTF-8?q?=E3=82=B9=E3=83=88=E3=81=A8=C3=97=E3=82=A2=E3=82=A4=E3=82=B3?= =?UTF-8?q?=E3=83=B3=E3=81=8C=E9=87=8D=E3=81=AA=E3=81=A3=E3=81=A6=E3=81=97?= =?UTF-8?q?=E3=81=BE=E3=81=86=E3=81=9F=E3=82=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/UnsupportedBrowserModal.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/UnsupportedBrowserModal.tsx b/src/components/UnsupportedBrowserModal.tsx index bc98763..4be1f39 100644 --- a/src/components/UnsupportedBrowserModal.tsx +++ b/src/components/UnsupportedBrowserModal.tsx @@ -21,12 +21,13 @@ export const UnsupportedBrowserModal = ({ minWidth: "500px", m: "auto", alignContent: "center", + maxWidth: "60rem", }} >