diff --git a/src/pages/Popup/HomePage.tsx b/src/pages/Popup/HomePage.tsx
index 2a27180..1f048a4 100644
--- a/src/pages/Popup/HomePage.tsx
+++ b/src/pages/Popup/HomePage.tsx
@@ -1,6 +1,6 @@
import React, { useState, useEffect } from 'react'
import { Box } from 'theme-ui'
-import DataInput from './DataInput'
+import LocationInput from './LocationInput'
import ConfigurationSelect from './ConfigurationSelect'
import IPData from './IPData'
import getIP from '../../utils/getIP'
@@ -33,28 +33,28 @@ const LocationPage = () => {
setConfiguration={setConfiguration}
/>
{configuration === 'match' && }
-
-
-
- >
}
-const DataInput = ({
+const LocationInput = ({
type,
title,
ip,
configuration,
setConfiguration,
-}: DataInputProps) => {
+}: LocationInputProps) => {
const [value, setValue] = useState('')
useEffect(() => {
@@ -58,4 +58,4 @@ const DataInput = ({
)
}
-export default DataInput
+export default LocationInput
diff --git a/src/pages/Popup/LocationPage.tsx b/src/pages/Popup/LocationPage.tsx
index 2a27180..1f048a4 100644
--- a/src/pages/Popup/LocationPage.tsx
+++ b/src/pages/Popup/LocationPage.tsx
@@ -1,6 +1,6 @@
import React, { useState, useEffect } from 'react'
import { Box } from 'theme-ui'
-import DataInput from './DataInput'
+import LocationInput from './LocationInput'
import ConfigurationSelect from './ConfigurationSelect'
import IPData from './IPData'
import getIP from '../../utils/getIP'
@@ -33,28 +33,28 @@ const LocationPage = () => {
setConfiguration={setConfiguration}
/>
{configuration === 'match' && }
-
-
-
-
diff --git a/src/pages/Popup/Popup.tsx b/src/pages/Popup/Popup.tsx
index 32cc49d..2c9403e 100644
--- a/src/pages/Popup/Popup.tsx
+++ b/src/pages/Popup/Popup.tsx
@@ -1,21 +1,19 @@
-import React, { useState, useEffect } from 'react'
+import React, { useState } from 'react'
import { ThemeProvider, Flex } from 'theme-ui'
import { theme } from '../../theme'
-import { Home, MapPin, Globe, Users, List } from 'react-feather'
+import { Home, MapPin, Globe, Command, List } from 'react-feather'
import TabItem from './TabItem'
import Page from './Page'
const Popup = () => {
- const [tab, setTab] = useState(0)
- useEffect(() => {
- console.log(tab)
- }, [tab])
+ const [tab, setTab] = useState(2)
+
return (
{
setTab(0)} />
setTab(1)} />
setTab(2)} />
- setTab(3)} />
- setTab(4)} />
+ setTab(3)} />
+ setTab(4)} />
diff --git a/src/pages/Popup/UserAgentPage.tsx b/src/pages/Popup/UserAgentPage.tsx
index 1be3575..cc195bf 100644
--- a/src/pages/Popup/UserAgentPage.tsx
+++ b/src/pages/Popup/UserAgentPage.tsx
@@ -1,24 +1,34 @@
import React, { useState, useEffect } from 'react'
-import { Box } from 'theme-ui'
-import DataInput from './DataInput'
-import ConfigurationSelect from './ConfigurationSelect'
-import getIP from '../../utils/getIP'
+import { Box, Label, Radio, Flex, Input } from 'theme-ui'
+import userAgents from '../../utils/userAgents'
+import detachDebugger from '../../utils/detachDebugger'
const LocationPage = () => {
- const [ip, setIP] = useState(null)
- const [configuration, setConfiguration] = useState('default')
+ const [type, setType] = useState('desktop')
+ const [userAgent, setUserAgent] = useState('')
+ // const [configuration, setConfiguration] = useState('default')
useEffect(() => {
- chrome.storage.sync.get(['configuration', 'ipData'], (result) => {
- result.configuration && setConfiguration(result.configuration)
- if (result.ipData) {
- setIP(result.ipData)
- } else {
- Promise.resolve(getIP()).then((ipData) => setIP(ipData))
- }
+ chrome.storage.sync.get(['type', 'userAgent'], (result) => {
+ result.type && setType(result.type)
+ result.userAgent && setUserAgent(result.userAgent)
})
}, [])
+ const changeType = (e: any) => {
+ detachDebugger()
+ chrome.storage.sync.set({ type: e.target.value })
+ setType(e.target.value)
+ }
+
+ const changeUserAgent = (e: any) => {
+ detachDebugger()
+ chrome.storage.sync.set({ userAgent: e.target.value })
+ chrome.storage.sync.set({ type: 'custom' })
+ setUserAgent(e.target.value)
+ setType('custom')
+ }
+
return (
{
}}
>
User Agent
-
+
+
+
+
+ {/*
- */}
+ {/*
-
-
-
+ /> */}
+
+
)
}
diff --git a/src/pages/Popup/UserAgentSelect.tsx b/src/pages/Popup/UserAgentSelect.tsx
new file mode 100644
index 0000000..e40bbf2
--- /dev/null
+++ b/src/pages/Popup/UserAgentSelect.tsx
@@ -0,0 +1,50 @@
+import React, { Dispatch, SetStateAction } from 'react'
+import { Label, Select } from 'theme-ui'
+import configurations from '../../utils/configurations'
+import detachDebugger from '../../utils/detachDebugger'
+
+interface ConfigurationSelectProps {
+ title: string
+ configuration: string
+ setConfiguration: Dispatch>
+}
+
+const ConfigurationSelect = ({
+ title,
+ configuration,
+ setConfiguration,
+}: ConfigurationSelectProps) => {
+ const changeConfiguration = (e: any) => {
+ detachDebugger()
+ chrome.storage.sync.set({
+ configuration: e.target.value,
+ })
+ setConfiguration(e.target.value)
+ }
+
+ return (
+ <>
+
+
+ >
+ )
+}
+
+export default ConfigurationSelect
diff --git a/src/theme.ts b/src/theme.ts
index 8b0d8fb..e96e71e 100644
--- a/src/theme.ts
+++ b/src/theme.ts
@@ -36,6 +36,9 @@ export const theme: Theme = {
outline: 'none',
},
},
+ // radio: {
+ // userSelect: 'none',
+ // },
},
buttons: {
primary: {
diff --git a/src/utils/userAgents.js b/src/utils/userAgents.ts
similarity index 100%
rename from src/utils/userAgents.js
rename to src/utils/userAgents.ts