diff --git a/src/config/const.ts b/src/config/const.ts new file mode 100644 index 0000000..e71343d --- /dev/null +++ b/src/config/const.ts @@ -0,0 +1,2 @@ +export const MANABA_COURSES_LIST_URL = + 'https://manaba.tsukuba.ac.jp/ct/home_course?chglistformat=list' diff --git a/src/content-scripts/manabaMainUI.tsx b/src/content-scripts/manabaMainUI.tsx index be06aad..b087d3e 100644 --- a/src/content-scripts/manabaMainUI.tsx +++ b/src/content-scripts/manabaMainUI.tsx @@ -7,6 +7,7 @@ import { MainTheme } from '../uiTheme' import BlackListSetting from '../ui/BlackListSetting' import { readStorage, writeStorage } from '../background/utils' import useSWR from 'swr' +import { MANABA_COURSES_LIST_URL } from '../config/const' const App = () => { const [progress, setProgress] = useState(0) @@ -14,6 +15,7 @@ const App = () => { const [importingText, setImportingText] = useState('') const [editBlackList, setEditBlackList] = useState(false) + const [showCaution, setShowCaution] = useState(false) useEffect(() => { const listener = (request: Message) => { @@ -36,6 +38,25 @@ const App = () => { mutate: updateBlackListFeatureNotify, } = useSWR('special-notify:black-list-feature', readStorage) + const handleGoingCourseListButtonClick = () => { + window.location.href = MANABA_COURSES_LIST_URL + } + + const handleSettingButtonClick = async () => { + if (window.location.href === MANABA_COURSES_LIST_URL) { + setEditBlackList(true) + await writeStorage('special-notify:black-list-feature', true) + updateBlackListFeatureNotify(true) + } else { + setShowCaution(true) + } + } + + const handleNoLongerDisplayButtonClick = async () => { + await writeStorage('special-notify:black-list-feature', true) + updateBlackListFeatureNotify(true) + } + return ( {!editBlackList && ( @@ -46,10 +67,28 @@ const App = () => { action={} /> )} + +

+ この機能は + Manabaのコース一覧ページ + でのみ使用できます +

+ + } + action={ + + } + /> {editBlackList && (
フィルタ設定中
@@ -66,19 +105,20 @@ const App = () => { {!blackListFeatureNotify && ( { - setEditBlackList(true) - await writeStorage('special-notify:black-list-feature', true) - updateBlackListFeatureNotify(true) - }} - > - 設定する - + <> + + + } /> )} diff --git a/src/popup/settingSection.tsx b/src/popup/settingSection.tsx index d5b70b9..2b7828d 100644 --- a/src/popup/settingSection.tsx +++ b/src/popup/settingSection.tsx @@ -35,6 +35,7 @@ const SettingSection: React.FC = () => { フィルタの設定

授業ごとや、カテゴリごとに同期するものを選択できます

+

この機能はManabaのコース一覧ページでのみ使用できます