Commit d787162c authored by tom's avatar tom

mobile view

parent 57f86b50
...@@ -73,11 +73,11 @@ const TokenInfoForm = ({ address }: Props) => { ...@@ -73,11 +73,11 @@ const TokenInfoForm = ({ address }: Props) => {
const fieldProps = { control }; const fieldProps = { control };
return ( return (
<form noValidate onSubmit={ onSubmit }> <form noValidate onSubmit={ onSubmit } autoComplete="off">
<div>Requests are sent to a moderator for review and approval. This process can take several days.</div> <div>Requests are sent to a moderator for review and approval. This process can take several days.</div>
<Grid mt={ 8 } gridTemplateColumns="1fr 1fr" columnGap={ 5 } rowGap={ 5 }> <Grid mt={ 8 } gridTemplateColumns={{ base: '1fr', lg: '1fr 1fr' }} columnGap={ 5 } rowGap={ 5 }>
<GridItem colSpan={ 2 }> <GridItem colSpan={{ base: 1, lg: 2 }}>
<TokenInfoFieldAddress { ...fieldProps }/> <TokenInfoFieldAddress { ...fieldProps }/>
</GridItem> </GridItem>
<TokenInfoFieldRequesterName { ...fieldProps }/> <TokenInfoFieldRequesterName { ...fieldProps }/>
...@@ -90,10 +90,10 @@ const TokenInfoForm = ({ address }: Props) => { ...@@ -90,10 +90,10 @@ const TokenInfoForm = ({ address }: Props) => {
<TokenInfoFieldProjectWebsite { ...fieldProps }/> <TokenInfoFieldProjectWebsite { ...fieldProps }/>
<TokenInfoFieldDocs { ...fieldProps }/> <TokenInfoFieldDocs { ...fieldProps }/>
<TokenInfoFieldSupport { ...fieldProps }/> <TokenInfoFieldSupport { ...fieldProps }/>
<GridItem colSpan={ 2 }> <GridItem colSpan={{ base: 1, lg: 2 }}>
<TokenInfoFieldIconUrl { ...fieldProps } trigger={ trigger }/> <TokenInfoFieldIconUrl { ...fieldProps } trigger={ trigger }/>
</GridItem> </GridItem>
<GridItem colSpan={ 2 }> <GridItem colSpan={{ base: 1, lg: 2 }}>
<TokenInfoFieldProjectDescription { ...fieldProps }/> <TokenInfoFieldProjectDescription { ...fieldProps }/>
</GridItem> </GridItem>
...@@ -112,7 +112,7 @@ const TokenInfoForm = ({ address }: Props) => { ...@@ -112,7 +112,7 @@ const TokenInfoForm = ({ address }: Props) => {
<TokenInfoFormSectionHeader>Price data</TokenInfoFormSectionHeader> <TokenInfoFormSectionHeader>Price data</TokenInfoFormSectionHeader>
<TokenInfoFieldPriceTicker { ...fieldProps } name="ticker_coin_market_cap" label="CoinMarketCap URL"/> <TokenInfoFieldPriceTicker { ...fieldProps } name="ticker_coin_market_cap" label="CoinMarketCap URL"/>
<TokenInfoFieldPriceTicker { ...fieldProps } name="ticker_coin_gecko" label="CoinGecko URL"/> <TokenInfoFieldPriceTicker { ...fieldProps } name="ticker_coin_gecko" label="CoinGecko URL"/>
<GridItem colSpan={ 2 }> <GridItem colSpan={{ base: 1, lg: 2 }}>
<TokenInfoFieldPriceTicker { ...fieldProps } name="ticker_defi_llama" label="DefiLlama URL "/> <TokenInfoFieldPriceTicker { ...fieldProps } name="ticker_defi_llama" label="DefiLlama URL "/>
</GridItem> </GridItem>
</Grid> </Grid>
......
...@@ -7,7 +7,7 @@ interface Props { ...@@ -7,7 +7,7 @@ interface Props {
const TokenInfoFormSectionHeader = ({ children }: Props) => { const TokenInfoFormSectionHeader = ({ children }: Props) => {
return ( return (
<GridItem colSpan={ 2 } fontFamily="heading" fontSize="lg" fontWeight={ 500 } mt={ 3 }> <GridItem colSpan={{ base: 1, lg: 2 }} fontFamily="heading" fontSize="lg" fontWeight={ 500 } mt={ 3 }>
{ children } { children }
</GridItem> </GridItem>
); );
......
...@@ -18,7 +18,7 @@ const TokenInfoIconPreview = ({ url, onError, onLoad, isInvalid }: Props) => { ...@@ -18,7 +18,7 @@ const TokenInfoIconPreview = ({ url, onError, onLoad, isInvalid }: Props) => {
return ( return (
<Center <Center
boxSize="80px" boxSize={{ base: '60px', lg: '80px' }}
flexShrink={ 0 } flexShrink={ 0 }
borderWidth="2px" borderWidth="2px"
borderColor={ url ? borderColorActive : borderColor } borderColor={ url ? borderColorActive : borderColor }
...@@ -28,9 +28,9 @@ const TokenInfoIconPreview = ({ url, onError, onLoad, isInvalid }: Props) => { ...@@ -28,9 +28,9 @@ const TokenInfoIconPreview = ({ url, onError, onLoad, isInvalid }: Props) => {
borderRadius="base" borderRadius="base"
src={ url } src={ url }
alt="Token logo preview" alt="Token logo preview"
boxSize={ 12 } boxSize={{ base: 10, lg: 12 }}
objectFit="cover" objectFit="cover"
fallback={ url && !isInvalid ? <Skeleton boxSize={ 12 }/> : <TokenLogoPlaceholder boxSize={ 12 }/> } fallback={ url && !isInvalid ? <Skeleton boxSize={{ base: 10, lg: 12 }}/> : <TokenLogoPlaceholder boxSize={{ base: 10, lg: 12 }}/> }
onError={ onError } onError={ onError }
onLoad={ onLoad } onLoad={ onLoad }
/> />
......
...@@ -14,7 +14,7 @@ interface Props { ...@@ -14,7 +14,7 @@ interface Props {
const TokenInfoFieldAddress = ({ control }: Props) => { const TokenInfoFieldAddress = ({ control }: Props) => {
const renderControl = React.useCallback(({ field }: {field: ControllerRenderProps<Fields, 'address'>}) => { const renderControl = React.useCallback(({ field }: {field: ControllerRenderProps<Fields, 'address'>}) => {
return ( return (
<FormControl variant="floating" id={ field.name } isRequired size="lg"> <FormControl variant="floating" id={ field.name } isRequired size={{ base: 'md', lg: 'lg' }}>
<Input <Input
{ ...field } { ...field }
required required
......
...@@ -16,7 +16,7 @@ interface Props { ...@@ -16,7 +16,7 @@ interface Props {
const TokenInfoFieldDocs = ({ control, isReadOnly }: Props) => { const TokenInfoFieldDocs = ({ control, isReadOnly }: Props) => {
const renderControl: ControllerProps<Fields, 'docs'>['render'] = React.useCallback(({ field, fieldState, formState }) => { const renderControl: ControllerProps<Fields, 'docs'>['render'] = React.useCallback(({ field, fieldState, formState }) => {
return ( return (
<FormControl variant="floating" id={ field.name } size="lg"> <FormControl variant="floating" id={ field.name } size={{ base: 'md', lg: 'lg' }}>
<Input <Input
{ ...field } { ...field }
isInvalid={ Boolean(fieldState.error) } isInvalid={ Boolean(fieldState.error) }
......
...@@ -54,7 +54,7 @@ const TokenInfoFieldIconUrl = ({ control, isReadOnly, trigger }: Props) => { ...@@ -54,7 +54,7 @@ const TokenInfoFieldIconUrl = ({ control, isReadOnly, trigger }: Props) => {
return ( return (
<Flex columnGap={ 5 }> <Flex columnGap={ 5 }>
<FormControl variant="floating" id={ field.name } size="lg" isRequired> <FormControl variant="floating" id={ field.name } size={{ base: 'md', lg: 'lg' }} isRequired>
<Input <Input
{ ...field } { ...field }
onBlur={ handleBlur } onBlur={ handleBlur }
......
...@@ -18,7 +18,7 @@ interface Props { ...@@ -18,7 +18,7 @@ interface Props {
const TokenInfoFieldPriceTicker = ({ control, isReadOnly, name, label }: Props) => { const TokenInfoFieldPriceTicker = ({ control, isReadOnly, name, label }: Props) => {
const renderControl: ControllerProps<Fields, typeof name>['render'] = React.useCallback(({ field, fieldState, formState }) => { const renderControl: ControllerProps<Fields, typeof name>['render'] = React.useCallback(({ field, fieldState, formState }) => {
return ( return (
<FormControl variant="floating" id={ field.name } size="lg"> <FormControl variant="floating" id={ field.name } size={{ base: 'md', lg: 'lg' }}>
<Input <Input
{ ...field } { ...field }
isInvalid={ Boolean(fieldState.error) } isInvalid={ Boolean(fieldState.error) }
......
...@@ -15,7 +15,7 @@ interface Props { ...@@ -15,7 +15,7 @@ interface Props {
const TokenInfoFieldProjectDescription = ({ control, isReadOnly }: Props) => { const TokenInfoFieldProjectDescription = ({ control, isReadOnly }: Props) => {
const renderControl: ControllerProps<Fields, 'project_description'>['render'] = React.useCallback(({ field, fieldState, formState }) => { const renderControl: ControllerProps<Fields, 'project_description'>['render'] = React.useCallback(({ field, fieldState, formState }) => {
return ( return (
<FormControl variant="floating" id={ field.name } size="lg" isRequired> <FormControl variant="floating" id={ field.name } size={{ base: 'md', lg: 'lg' }} isRequired>
<Textarea <Textarea
{ ...field } { ...field }
required required
......
...@@ -16,7 +16,7 @@ interface Props { ...@@ -16,7 +16,7 @@ interface Props {
const TokenInfoFieldProjectEmail = ({ control, isReadOnly }: Props) => { const TokenInfoFieldProjectEmail = ({ control, isReadOnly }: Props) => {
const renderControl: ControllerProps<Fields, 'project_email'>['render'] = React.useCallback(({ field, fieldState, formState }) => { const renderControl: ControllerProps<Fields, 'project_email'>['render'] = React.useCallback(({ field, fieldState, formState }) => {
return ( return (
<FormControl variant="floating" id={ field.name } isRequired size="lg"> <FormControl variant="floating" id={ field.name } isRequired size={{ base: 'md', lg: 'lg' }}>
<Input <Input
{ ...field } { ...field }
required required
......
...@@ -16,7 +16,7 @@ const TokenInfoFieldProjectName = ({ control, isReadOnly }: Props) => { ...@@ -16,7 +16,7 @@ const TokenInfoFieldProjectName = ({ control, isReadOnly }: Props) => {
const renderControl: ControllerProps<Fields, 'project_name'>['render'] = React.useCallback(({ field, fieldState, formState }) => { const renderControl: ControllerProps<Fields, 'project_name'>['render'] = React.useCallback(({ field, fieldState, formState }) => {
return ( return (
<FormControl variant="floating" id={ field.name } size="lg"> <FormControl variant="floating" id={ field.name } size={{ base: 'md', lg: 'lg' }}>
<Input <Input
{ ...field } { ...field }
isInvalid={ Boolean(fieldState.error) } isInvalid={ Boolean(fieldState.error) }
......
...@@ -5,6 +5,7 @@ import { Controller } from 'react-hook-form'; ...@@ -5,6 +5,7 @@ import { Controller } from 'react-hook-form';
import type { Fields } from '../types'; import type { Fields } from '../types';
import type { TokenInfoApplicationConfig } from 'types/api/account'; import type { TokenInfoApplicationConfig } from 'types/api/account';
import useIsMobile from 'lib/hooks/useIsMobile';
import FancySelect from 'ui/shared/FancySelect/FancySelect'; import FancySelect from 'ui/shared/FancySelect/FancySelect';
interface Props { interface Props {
...@@ -14,6 +15,8 @@ interface Props { ...@@ -14,6 +15,8 @@ interface Props {
} }
const TokenInfoFieldProjectSector = ({ control, isReadOnly, config }: Props) => { const TokenInfoFieldProjectSector = ({ control, isReadOnly, config }: Props) => {
const isMobile = useIsMobile();
const options = React.useMemo(() => { const options = React.useMemo(() => {
return config.map((option) => ({ label: option, value: option })); return config.map((option) => ({ label: option, value: option }));
}, [ config ]); }, [ config ]);
...@@ -24,13 +27,13 @@ const TokenInfoFieldProjectSector = ({ control, isReadOnly, config }: Props) => ...@@ -24,13 +27,13 @@ const TokenInfoFieldProjectSector = ({ control, isReadOnly, config }: Props) =>
<FancySelect <FancySelect
{ ...field } { ...field }
options={ options } options={ options }
size="lg" size={ isMobile ? 'md' : 'lg' }
placeholder="Project industry" placeholder="Project industry"
isDisabled={ formState.isSubmitting || isReadOnly } isDisabled={ formState.isSubmitting || isReadOnly }
error={ fieldState.error } error={ fieldState.error }
/> />
); );
}, [ isReadOnly, options ]); }, [ isReadOnly, options, isMobile ]);
return ( return (
<Controller <Controller
......
...@@ -16,7 +16,7 @@ interface Props { ...@@ -16,7 +16,7 @@ interface Props {
const TokenInfoFieldProjectWebsite = ({ control, isReadOnly }: Props) => { const TokenInfoFieldProjectWebsite = ({ control, isReadOnly }: Props) => {
const renderControl: ControllerProps<Fields, 'project_website'>['render'] = React.useCallback(({ field, fieldState, formState }) => { const renderControl: ControllerProps<Fields, 'project_website'>['render'] = React.useCallback(({ field, fieldState, formState }) => {
return ( return (
<FormControl variant="floating" id={ field.name } size="lg" isRequired> <FormControl variant="floating" id={ field.name } size={{ base: 'md', lg: 'lg' }} isRequired>
<Input <Input
{ ...field } { ...field }
isInvalid={ Boolean(fieldState.error) } isInvalid={ Boolean(fieldState.error) }
......
...@@ -16,7 +16,7 @@ interface Props { ...@@ -16,7 +16,7 @@ interface Props {
const TokenInfoFieldRequesterEmail = ({ control, isReadOnly }: Props) => { const TokenInfoFieldRequesterEmail = ({ control, isReadOnly }: Props) => {
const renderControl: ControllerProps<Fields, 'requester_email'>['render'] = React.useCallback(({ field, fieldState, formState }) => { const renderControl: ControllerProps<Fields, 'requester_email'>['render'] = React.useCallback(({ field, fieldState, formState }) => {
return ( return (
<FormControl variant="floating" id={ field.name } isRequired size="lg"> <FormControl variant="floating" id={ field.name } isRequired size={{ base: 'md', lg: 'lg' }}>
<Input <Input
{ ...field } { ...field }
required required
......
...@@ -15,7 +15,7 @@ interface Props { ...@@ -15,7 +15,7 @@ interface Props {
const TokenInfoFieldRequesterName = ({ control, isReadOnly }: Props) => { const TokenInfoFieldRequesterName = ({ control, isReadOnly }: Props) => {
const renderControl: ControllerProps<Fields, 'requester_name'>['render'] = React.useCallback(({ field, fieldState, formState }) => { const renderControl: ControllerProps<Fields, 'requester_name'>['render'] = React.useCallback(({ field, fieldState, formState }) => {
return ( return (
<FormControl variant="floating" id={ field.name } isRequired size="lg"> <FormControl variant="floating" id={ field.name } isRequired size={{ base: 'md', lg: 'lg' }}>
<Input <Input
{ ...field } { ...field }
required required
......
...@@ -45,7 +45,7 @@ interface Props { ...@@ -45,7 +45,7 @@ interface Props {
const TokenInfoFieldSocialLink = ({ control, isReadOnly, name }: Props) => { const TokenInfoFieldSocialLink = ({ control, isReadOnly, name }: Props) => {
const renderControl: ControllerProps<Fields, typeof name>['render'] = React.useCallback(({ field, fieldState, formState }) => { const renderControl: ControllerProps<Fields, typeof name>['render'] = React.useCallback(({ field, fieldState, formState }) => {
return ( return (
<FormControl variant="floating" id={ field.name } size="lg" sx={{ '.chakra-input__group input': { pr: '60px' } }}> <FormControl variant="floating" id={ field.name } size={{ base: 'md', lg: 'lg' }} sx={{ '.chakra-input__group input': { pr: '60px' } }}>
<InputGroup> <InputGroup>
<Input <Input
{ ...field } { ...field }
......
...@@ -18,7 +18,7 @@ const TokenInfoFieldSupport = ({ control, isReadOnly }: Props) => { ...@@ -18,7 +18,7 @@ const TokenInfoFieldSupport = ({ control, isReadOnly }: Props) => {
const renderControl: ControllerProps<Fields, 'support'>['render'] = React.useCallback(({ field, fieldState, formState }) => { const renderControl: ControllerProps<Fields, 'support'>['render'] = React.useCallback(({ field, fieldState, formState }) => {
return ( return (
<FormControl variant="floating" id={ field.name } size="lg"> <FormControl variant="floating" id={ field.name } size={{ base: 'md', lg: 'lg' }}>
<Input <Input
{ ...field } { ...field }
isInvalid={ Boolean(fieldState.error) } isInvalid={ Boolean(fieldState.error) }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment