From f320e3ee716581575ecccf116c2ade42edeaa22f Mon Sep 17 00:00:00 2001 From: josc146 Date: Tue, 6 Aug 2024 23:19:42 +0800 Subject: [PATCH] WIP, custom API Modes --- src/popup/Popup.jsx | 11 +++++++++-- src/popup/sections/GeneralPart.jsx | 17 +++++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/popup/Popup.jsx b/src/popup/Popup.jsx index e4d78bf..3b599fa 100644 --- a/src/popup/Popup.jsx +++ b/src/popup/Popup.jsx @@ -62,6 +62,7 @@ function Popup() { const [config, setConfig] = useState(defaultConfig) const [currentVersion, setCurrentVersion] = useState('') const [latestVersion, setLatestVersion] = useState('') + const [tabIndex, setTabIndex] = useState(0) const theme = useWindowTheme() const updateConfig = async (value) => { @@ -94,7 +95,13 @@ function Popup() { return (
- + { + setTabIndex(index) + }} + > {t('General')} {t('Feature Pages')} @@ -103,7 +110,7 @@ function Popup() { - + diff --git a/src/popup/sections/GeneralPart.jsx b/src/popup/sections/GeneralPart.jsx index 73e18a5..9f81583 100644 --- a/src/popup/sections/GeneralPart.jsx +++ b/src/popup/sections/GeneralPart.jsx @@ -27,10 +27,12 @@ import Browser from 'webextension-polyfill' import { languageList } from '../../config/language.mjs' import PropTypes from 'prop-types' import { config as menuConfig } from '../../content-script/menu-tools' +import { PencilIcon } from '@primer/octicons-react' GeneralPart.propTypes = { config: PropTypes.object.isRequired, updateConfig: PropTypes.func.isRequired, + setTabIndex: PropTypes.func.isRequired, } function formatDate(date) { @@ -86,7 +88,7 @@ async function checkBilling(apiKey, apiUrl) { } } -export function GeneralPart({ config, updateConfig }) { +export function GeneralPart({ config, updateConfig, setTabIndex }) { const { t, i18n } = useTranslation() const [balance, setBalance] = useState(null) const [apiModes, setApiModes] = useState([]) @@ -154,7 +156,18 @@ export function GeneralPart({ config, updateConfig }) {