added whitelist form
This commit is contained in:
parent
f2f99e3aba
commit
5424307e9e
1 changed files with 23 additions and 7 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
import React, { useState, useEffect } from 'react'
|
import React, { useState, useEffect } from 'react'
|
||||||
import { Box, Label, Input, Flex, Button, Close } from 'theme-ui'
|
import { Box, Label, Input, Flex, Button, Close, Field } from 'theme-ui'
|
||||||
import LocationInput from './LocationInput'
|
import LocationInput from './LocationInput'
|
||||||
import ConfigurationSelect from './ConfigurationSelect'
|
import ConfigurationSelect from './ConfigurationSelect'
|
||||||
import IPData from './IPData'
|
import IPData from './IPData'
|
||||||
|
|
@ -34,6 +34,17 @@ const WhitelistPage = ({ tab }: any) => {
|
||||||
chrome.storage.sync.set({ whitelist })
|
chrome.storage.sync.set({ whitelist })
|
||||||
}, [whitelist])
|
}, [whitelist])
|
||||||
|
|
||||||
|
const handleSubmit = (e: any) => {
|
||||||
|
e.preventDefault()
|
||||||
|
!whitelist.includes(e.target.url.value) &&
|
||||||
|
setWhitelist((prevWhitelist) => [...prevWhitelist, e.target.url.value])
|
||||||
|
// detachDebugger()
|
||||||
|
// chrome.storage.sync.set({ [type]: e.target.value })
|
||||||
|
// setCurrentUrl(e.target.value)
|
||||||
|
// chrome.storage.sync.set({ configuration: 'custom' })
|
||||||
|
// setConfiguration('custom')
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
|
|
@ -43,13 +54,18 @@ const WhitelistPage = ({ tab }: any) => {
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Box sx={{ fontSize: '20px', mb: '12px' }}>Whitelist</Box>
|
<Box sx={{ fontSize: '20px', mb: '12px' }}>Whitelist</Box>
|
||||||
<Flex>
|
<Flex as="form" onSubmit={(e) => handleSubmit(e)}>
|
||||||
<Input name="url" value={currentUrl} spellCheck="false" />
|
<Input
|
||||||
|
name="url"
|
||||||
|
defaultValue={currentUrl}
|
||||||
|
// onChange={changeTextValue}
|
||||||
|
spellCheck="false"
|
||||||
|
/>
|
||||||
<Button
|
<Button
|
||||||
onClick={() => {
|
// onClick={() => {
|
||||||
setWhitelist((prevWhitelist) => [...prevWhitelist, currentUrl])
|
// // setWhitelist((prevWhitelist) => [...prevWhitelist, currentUrl])
|
||||||
// detachDebugger()
|
// // detachDebugger()
|
||||||
}}
|
// }}
|
||||||
sx={{ height: '28px', flexShrink: 0, ml: '8px' }}
|
sx={{ height: '28px', flexShrink: 0, ml: '8px' }}
|
||||||
>
|
>
|
||||||
Add
|
Add
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue