diff --git a/frontend/pages/welcome.js b/frontend/pages/welcome.js index f5b8c643..d861a770 100644 --- a/frontend/pages/welcome.js +++ b/frontend/pages/welcome.js @@ -23,6 +23,7 @@ import { AccordionButton, AccordionPanel, AccordionIcon, + Divider, } from "@chakra-ui/react"; import StepProgress from "../src/components/StepProgress"; import { ArrowLeftIcon, ArrowRightIcon } from "@chakra-ui/icons"; @@ -95,7 +96,7 @@ const Welcome = () => { { { { { )} {showSubscriptionForm && ( - <> - {`Let's add new subscription!`} + + + {`Let's add new subscription!`} - + )} {!showSubscriptionForm && ( - - - - ); -}; - -export default NewSubscription; diff --git a/frontend/src/components/NewSubscription.js b/frontend/src/components/NewSubscription.js index fa5efd72..259f8319 100644 --- a/frontend/src/components/NewSubscription.js +++ b/frontend/src/components/NewSubscription.js @@ -1,4 +1,4 @@ -import React, { useState, useEffect, useCallback, Fragment } from "react"; +import React, { useState, useEffect, useCallback } from "react"; import { useSubscriptions } from "../core/hooks"; import { Input, @@ -12,7 +12,6 @@ import { Spinner, IconButton, ButtonGroup, - Spacer, Flex, } from "@chakra-ui/react"; import RadioCard from "./RadioCard"; @@ -33,7 +32,7 @@ const _NewSubscription = ({ const [color, setColor] = useState(makeColor()); const { handleSubmit, errors, register } = useForm({}); const { typesCache, createSubscription } = useSubscriptions(); - // const { handleSubmit, errors, register } = useForm({}); + const [radioState, setRadioState] = useState( initialType ?? "ethereum_blockchain" ); @@ -46,31 +45,19 @@ const _NewSubscription = ({ const [subscriptionAdressFormatRadio, setsubscriptionAdressFormatRadio] = useState("input:address"); - let { getRootProps, getRadioProps } = useRadioGroup({ + let { getRadioProps } = useRadioGroup({ name: "type", defaultValue: radioState, onChange: setRadioState, }); - let { - getRootProps: getRootPropsSubscription, - getRadioProps: getRadioPropsSubscription, - } = useRadioGroup({ + let { getRadioProps: getRadioPropsSubscription } = useRadioGroup({ name: "subscription", defaultValue: subscriptionAdressFormatRadio, onChange: setsubscriptionAdressFormatRadio, }); - console.log( - useRadioGroup({ - name: "subscription1", - onChange: setsubscriptionAdressFormatRadio, - }) - ); - const group = getRootProps(); - - const subscriptionAddressTypeGroup = getRootPropsSubscription(); useEffect(() => { if (setIsLoading) { @@ -101,7 +88,13 @@ const _NewSubscription = ({ type: isFreeOption ? "ethereum_blockchain" : radioState, }); }, - [createSubscription, isFreeOption, color, radioState] + [ + createSubscription, + isFreeOption, + color, + radioState, + subscriptionAdressFormatRadio, + ] ); if (typesCache.isLoading) return ; @@ -123,8 +116,16 @@ const _NewSubscription = ({ return (
- - + + Source: + {/* position must be relative otherwise radio boxes add strange spacing on selection */} + {typesCache.data.map((type) => { const radio = getRadioProps({ value: type.id, @@ -135,72 +136,88 @@ const _NewSubscription = ({ }); return ( - - {type.name} + + {type.name.slice(9, type.name.length)} ); })} - - - - - {search(radioState, typesCache.data).choices.map( - (addition_selects) => { - console.log(typeof addition_selects); - const radio = getRadioPropsSubscription({ - value: addition_selects, - isDisabled: addition_selects.startsWith("tag"), - }); - return ( - - {mapper[addition_selects]} - - ); - } - )} - - + + + {/* position must be relative otherwise radio boxes add strange spacing on selection */} + + {search(radioState, typesCache.data).choices.length > 0 && ( + Type: + )} + {search(radioState, typesCache.data).choices.map( + (addition_selects) => { + const radio = getRadioPropsSubscription({ + value: addition_selects, + isDisabled: addition_selects.startsWith("tag"), + }); + return ( + + {mapper[addition_selects]} + + ); + } + )} + {subscriptionAdressFormatRadio.startsWith("input") && radioState != "ethereum_whalewatch" && ( - - - - {errors?.address && errors?.address.message} - - + + + + + {errors?.address && errors?.address.message} + + + )} - null} - > - - {errors?.subscription_type && errors?.subscription_type.message} - - + + null} + > {!isModal ? ( - - - - Label color - {" "} + + + Label color + {" "} + - + - + - + diff --git a/frontend/src/components/RadioCard.js b/frontend/src/components/RadioCard.js index c6cc46cb..17882fdd 100644 --- a/frontend/src/components/RadioCard.js +++ b/frontend/src/components/RadioCard.js @@ -1,5 +1,5 @@ import React from "react"; -import { useRadio, Box, Flex } from "@chakra-ui/react"; +import { useRadio, Box, Flex, Tooltip, Image } from "@chakra-ui/react"; const RadioCard = (props) => { const { getInputProps, getCheckboxProps } = useRadio(props); @@ -8,38 +8,48 @@ const RadioCard = (props) => { const checkbox = getCheckboxProps(); return ( - - - - {props.children} - - + ); }; -// const RadioCard = chakra(RadioCard_); export default RadioCard; diff --git a/frontend/src/components/stream-cards/EthereumWhalewatch.js b/frontend/src/components/stream-cards/EthereumWhalewatch.js index c412a8d0..b1f5cb31 100644 --- a/frontend/src/components/stream-cards/EthereumWhalewatch.js +++ b/frontend/src/components/stream-cards/EthereumWhalewatch.js @@ -21,7 +21,7 @@ import { useToast } from "../../core/hooks"; import { useSubscriptions } from "../../core/hooks"; import moment from "moment"; import { AiOutlineMonitor } from "react-icons/ai"; -import NewSubscription from "../NewModalSubscripton"; +import NewSubscription from "../NewSubscription"; const EthereumWhalewatchCard_ = ({ entry,