diff --git a/src/Popup/Components/Page.tsx b/src/Popup/Components/Page.tsx new file mode 100644 index 0000000..2233197 --- /dev/null +++ b/src/Popup/Components/Page.tsx @@ -0,0 +1,24 @@ +import { Box } from 'theme-ui' + +interface PageProps { + isCurrentTab: boolean + title: string + children: React.ReactNode +} + +const Page = ({ isCurrentTab, title, children }: PageProps) => { + return ( + + + {title} + + {children} + + ) +} + +export default Page diff --git a/src/Popup/Pages/AutofillPage/index.tsx b/src/Popup/Pages/AutofillPage/index.tsx index da028b1..e677a59 100644 --- a/src/Popup/Pages/AutofillPage/index.tsx +++ b/src/Popup/Pages/AutofillPage/index.tsx @@ -1,5 +1,6 @@ // import { useState, useEffect } from 'react' -import { Box } from 'theme-ui' +// import { Box } from 'theme-ui' +import Page from '../../Components/Page' interface SystemPageProps { tab: string @@ -21,15 +22,9 @@ const AutofillPage = ({ tab }: SystemPageProps) => { // }, []) return ( - - - Autofill Options - - + + hello + ) } diff --git a/src/Popup/Pages/CurrentPage/index.tsx b/src/Popup/Pages/CurrentPage/index.tsx index d3b18f1..b38813b 100644 --- a/src/Popup/Pages/CurrentPage/index.tsx +++ b/src/Popup/Pages/CurrentPage/index.tsx @@ -1,4 +1,5 @@ -import { Box } from 'theme-ui' +// import { Box } from 'theme-ui' +import Page from '../../Components/Page' interface CurrentPageProps { tab: string @@ -6,15 +7,9 @@ interface CurrentPageProps { const CurrentPage = ({ tab }: CurrentPageProps) => { return ( - - - Current Info - - + + hello + ) } diff --git a/src/Popup/Pages/OtherOptionsPage/index.tsx b/src/Popup/Pages/OtherOptionsPage/index.tsx index e743004..2ada690 100644 --- a/src/Popup/Pages/OtherOptionsPage/index.tsx +++ b/src/Popup/Pages/OtherOptionsPage/index.tsx @@ -1,8 +1,5 @@ -import { useState, useEffect, ChangeEvent } from 'react' -import { Box, Label, Radio, Flex, Input, Select, Divider } from 'theme-ui' -import userAgents from '../../../utils/userAgents' -import detachDebugger from '../../../utils/detachDebugger' import SettingsCheckBox from '../SettingsPage/SettingsCheckBox' +import Page from '../../Components/Page' interface OtherOptionsPageProps { tab: string @@ -10,14 +7,7 @@ interface OtherOptionsPageProps { const OtherOptionsPage = ({ tab }: OtherOptionsPageProps) => { return ( - - - Other Options - + @@ -27,7 +17,7 @@ const OtherOptionsPage = ({ tab }: OtherOptionsPageProps) => { - + ) } diff --git a/src/Popup/Pages/SettingsPage/index.tsx b/src/Popup/Pages/SettingsPage/index.tsx index 81c773f..0a12565 100644 --- a/src/Popup/Pages/SettingsPage/index.tsx +++ b/src/Popup/Pages/SettingsPage/index.tsx @@ -1,6 +1,5 @@ -import { useState, useEffect } from 'react' -import { Box, Label, Select } from 'theme-ui' -import setWebRtcPolicy from '../WebRtcPage/handleWebRtcPolicy' +import { Label, Select } from 'theme-ui' +import Page from '../../Components/Page' import SettingsCheckBox from './SettingsCheckBox' interface SystemPageProps { @@ -8,38 +7,8 @@ interface SystemPageProps { } const SettingsPage = ({ tab }: SystemPageProps) => { - const [isWebRtcDisabled, setIsWebRtcDisabled] = useState(false) - - useEffect(() => { - chrome.storage.local.get(['isWebRtcDisabled'], (storage) => { - storage.isWebRtcDisabled && setIsWebRtcDisabled(storage.isWebRtcDisabled) - }) - }, []) - - chrome.privacy.network.webRTCIPHandlingPolicy.onChange.addListener(function ( - details - ) { - if (details.value === 'disable_non_proxied_udp') { - setIsWebRtcDisabled(true) - } else { - setIsWebRtcDisabled(false) - } - }) - return ( - - - Settings - - {/* */} + @@ -63,7 +32,7 @@ const SettingsPage = ({ tab }: SystemPageProps) => { ))} */} - + ) } diff --git a/src/Popup/Pages/SystemPage/index.tsx b/src/Popup/Pages/SystemPage/index.tsx index 65360b9..82eb13c 100644 --- a/src/Popup/Pages/SystemPage/index.tsx +++ b/src/Popup/Pages/SystemPage/index.tsx @@ -1,5 +1,6 @@ import { useState, useEffect, ChangeEvent } from 'react' -import { Box, Flex, Label, Radio, Select } from 'theme-ui' +import { Flex, Label, Radio, Select } from 'theme-ui' +import Page from '../../Components/Page' import DebouncedInput from '../../Components/DebouncedInput' import detachDebugger from '../../../utils/detachDebugger' import countryLocales from '../../../utils/countryLocales' @@ -113,14 +114,7 @@ const SystemPage = ({ tab, ipData }: SystemPageProps) => { } return ( - - - System Data - + { setValue={setLongitude} onChange={changeInputText} /> - + ) } diff --git a/src/Popup/Pages/UserAgentPage/index.tsx b/src/Popup/Pages/UserAgentPage/index.tsx index 6e96b55..384a7a3 100644 --- a/src/Popup/Pages/UserAgentPage/index.tsx +++ b/src/Popup/Pages/UserAgentPage/index.tsx @@ -3,6 +3,7 @@ import { Box, Label, Radio, Flex, Select } from 'theme-ui' import DebouncedInput from '../../Components/DebouncedInput' import userAgents from '../../../utils/userAgents' import detachDebugger from '../../../utils/detachDebugger' +import Page from '../../Components/Page' interface UserAgentPageProps { tab: string @@ -74,14 +75,7 @@ const UserAgentPage = ({ tab }: UserAgentPageProps) => { } return ( - - - User Agent - + { setValue={setUserAgent} onChange={changeUserAgent} /> - + ) } diff --git a/src/Popup/Pages/WebRtcPage/index.tsx b/src/Popup/Pages/WebRtcPage/index.tsx index 1eb075c..dad4d1e 100644 --- a/src/Popup/Pages/WebRtcPage/index.tsx +++ b/src/Popup/Pages/WebRtcPage/index.tsx @@ -1,5 +1,5 @@ import { useState, useEffect, ChangeEvent } from 'react' -import { Box } from 'theme-ui' +import Page from '../../Components/Page' import handleWebRtcPolicy from './handleWebRtcPolicy' import RadioButton from './RadioButton' @@ -22,14 +22,7 @@ const WebRtcPage = ({ tab }: SystemPageProps) => { } return ( - - - WebRTC Policy - + { webRtcPolicy={webRtcPolicy} onChange={changeRadioValue} /> - + ) }