Commit 1a7329fa authored by tom's avatar tom

fix FormFieldSelect default values

parent 16185d52
...@@ -24,6 +24,7 @@ export const recipe = defineRecipe({ ...@@ -24,6 +24,7 @@ export const recipe = defineRecipe({
whiteSpace: 'nowrap', whiteSpace: 'nowrap',
}, },
_autofill: { _autofill: {
// TODO @tom2drum: fix webkit autofill color
// FIXME: this is not working // FIXME: this is not working
// WebkitTextFillColor: '{colors.input.fg}', // WebkitTextFillColor: '{colors.input.fg}',
}, },
......
...@@ -126,7 +126,7 @@ const PublicTagsSubmitFieldTag = ({ index, isDisabled, errors, onAddClick, onRem ...@@ -126,7 +126,7 @@ const PublicTagsSubmitFieldTag = ({ index, isDisabled, errors, onAddClick, onRem
<Flex flexDir="column" alignItems="flex-start" mt={ 10 } rowGap={ 2 }> <Flex flexDir="column" alignItems="flex-start" mt={ 10 } rowGap={ 2 }>
<EntityTag data={{ <EntityTag data={{
name: field.name || 'Tag name', name: field.name || 'Tag name',
tagType: field.type[0].value, tagType: field.type[0],
meta: { meta: {
tagUrl: field.url, tagUrl: field.url,
bgColor: field.bgColor && colorValidator(field.bgColor) === true ? field.bgColor : undefined, bgColor: field.bgColor && colorValidator(field.bgColor) === true ? field.bgColor : undefined,
...@@ -137,7 +137,7 @@ const PublicTagsSubmitFieldTag = ({ index, isDisabled, errors, onAddClick, onRem ...@@ -137,7 +137,7 @@ const PublicTagsSubmitFieldTag = ({ index, isDisabled, errors, onAddClick, onRem
ordinal: 0, ordinal: 0,
}}/> }}/>
<chakra.span color="text.secondary" fontSize="sm"> <chakra.span color="text.secondary" fontSize="sm">
{ tagTypes?.find(({ type }) => type === field.type[0].value)?.description } { tagTypes?.find(({ type }) => type === field.type[0])?.description }
</chakra.span> </chakra.span>
</Flex> </Flex>
) } ) }
......
...@@ -24,7 +24,7 @@ const PublicTagsSubmitFieldTags = ({ tagTypes }: Props) => { ...@@ -24,7 +24,7 @@ const PublicTagsSubmitFieldTags = ({ tagTypes }: Props) => {
const handleAddFieldClick = React.useCallback((index: number) => { const handleAddFieldClick = React.useCallback((index: number) => {
insert(index + 1, { insert(index + 1, {
name: '', name: '',
type: [ { label: 'Name', value: 'name' } ], type: [ 'name' ],
url: undefined, url: undefined,
bgColor: undefined, bgColor: undefined,
textColor: undefined, textColor: undefined,
......
import type { AddressMetadataTagType } from 'types/api/addressMetadata'; import type { AddressMetadataTagType } from 'types/api/addressMetadata';
import type { SelectOption } from 'toolkit/chakra/select';
export interface FormFields { export interface FormFields {
requesterName: string; requesterName: string;
requesterEmail: string; requesterEmail: string;
...@@ -14,7 +12,7 @@ export interface FormFields { ...@@ -14,7 +12,7 @@ export interface FormFields {
export interface FormFieldTag { export interface FormFieldTag {
name: string; name: string;
type: Array<SelectOption<AddressMetadataTagType>>; type: Array<AddressMetadataTagType>;
url: string | undefined; url: string | undefined;
bgColor: string | undefined; bgColor: string | undefined;
textColor: string | undefined; textColor: string | undefined;
......
...@@ -19,7 +19,7 @@ export function convertFormDataToRequestsBody(data: FormFields): Array<SubmitReq ...@@ -19,7 +19,7 @@ export function convertFormDataToRequestsBody(data: FormFields): Array<SubmitReq
companyWebsite: data.companyWebsite, companyWebsite: data.companyWebsite,
address: address.hash, address: address.hash,
name: tag.name, name: tag.name,
tagType: tag.type[0].value, tagType: tag.type[0],
description: data.description, description: data.description,
meta: pickBy({ meta: pickBy({
bgColor: tag.bgColor, bgColor: tag.bgColor,
...@@ -37,7 +37,7 @@ export function convertFormDataToRequestsBody(data: FormFields): Array<SubmitReq ...@@ -37,7 +37,7 @@ export function convertFormDataToRequestsBody(data: FormFields): Array<SubmitReq
export function convertTagApiFieldsToFormFields(tag: Pick<SubmitRequestBody, 'name' | 'tagType' | 'meta'>): FormFieldTag { export function convertTagApiFieldsToFormFields(tag: Pick<SubmitRequestBody, 'name' | 'tagType' | 'meta'>): FormFieldTag {
return { return {
name: tag.name, name: tag.name,
type: [ { label: tag.tagType, value: tag.tagType } ], type: [ tag.tagType ],
url: tag.meta.tagUrl, url: tag.meta.tagUrl,
bgColor: tag.meta.bgColor, bgColor: tag.meta.bgColor,
textColor: tag.meta.textColor, textColor: tag.meta.textColor,
...@@ -104,7 +104,7 @@ export function getFormDefaultValues(query: Route['query'], userInfo: UserInfo | ...@@ -104,7 +104,7 @@ export function getFormDefaultValues(query: Route['query'], userInfo: UserInfo |
requesterEmail: getQueryParamString(query?.requesterEmail) || userInfo?.email || undefined, requesterEmail: getQueryParamString(query?.requesterEmail) || userInfo?.email || undefined,
companyName: getQueryParamString(query?.companyName), companyName: getQueryParamString(query?.companyName),
companyWebsite: getQueryParamString(query?.companyWebsite), companyWebsite: getQueryParamString(query?.companyWebsite),
tags: [ { name: '', type: [ { label: 'Name', value: 'name' as const } ] } ], tags: [ { name: '', type: [ 'name' as const ] } ],
}; };
} }
......
...@@ -35,7 +35,6 @@ const FormFieldSelect = < ...@@ -35,7 +35,6 @@ const FormFieldSelect = <
field.onBlur(); field.onBlur();
}, [ field ]); }, [ field ]);
// TODO @tom2drum: fix initial value is not displayed in the select
return ( return (
<SelectRoot <SelectRoot
ref={ field.ref } ref={ field.ref }
......
...@@ -19,6 +19,7 @@ import AuthModalScreenSelectMethod from './screens/AuthModalScreenSelectMethod'; ...@@ -19,6 +19,7 @@ import AuthModalScreenSelectMethod from './screens/AuthModalScreenSelectMethod';
import AuthModalScreenSuccessEmail from './screens/AuthModalScreenSuccessEmail'; import AuthModalScreenSuccessEmail from './screens/AuthModalScreenSuccessEmail';
import AuthModalScreenSuccessWallet from './screens/AuthModalScreenSuccessWallet'; import AuthModalScreenSuccessWallet from './screens/AuthModalScreenSuccessWallet';
// TODO @tom2drum: check login flow
const feature = config.features.account; const feature = config.features.account;
interface Props { interface Props {
......
import type { SelectOption } from 'toolkit/chakra/select';
export interface Fields extends SocialLinkFields, TickerUrlFields { export interface Fields extends SocialLinkFields, TickerUrlFields {
address: string; address: string;
token_name: string; token_name: string;
requester_name: string; requester_name: string;
requester_email: string; requester_email: string;
project_name?: string; project_name?: string;
project_sector: Array<SelectOption> | null; project_sector: Array<string> | null;
project_email: string; project_email: string;
project_website: string; project_website: string;
project_description: string; project_description: string;
......
...@@ -12,7 +12,7 @@ export function getFormDefaultValues(address: string, tokenName: string, applica ...@@ -12,7 +12,7 @@ export function getFormDefaultValues(address: string, tokenName: string, applica
requester_name: application.requesterName, requester_name: application.requesterName,
requester_email: application.requesterEmail, requester_email: application.requesterEmail,
project_name: application.projectName, project_name: application.projectName,
project_sector: application.projectSector ? [ { value: application.projectSector, label: application.projectSector } ] : null, project_sector: application.projectSector ? [ application.projectSector ] : null,
project_email: application.projectEmail, project_email: application.projectEmail,
project_website: application.projectWebsite, project_website: application.projectWebsite,
project_description: application.projectDescription || '', project_description: application.projectDescription || '',
...@@ -52,7 +52,7 @@ export function prepareRequestBody(data: Fields): Omit<TokenInfoApplication, 'id ...@@ -52,7 +52,7 @@ export function prepareRequestBody(data: Fields): Omit<TokenInfoApplication, 'id
projectDescription: data.project_description, projectDescription: data.project_description,
projectEmail: data.project_email, projectEmail: data.project_email,
projectName: data.project_name, projectName: data.project_name,
projectSector: data.project_sector?.[0]?.value, projectSector: data.project_sector?.[0],
projectWebsite: data.project_website, projectWebsite: data.project_website,
reddit: data.reddit, reddit: data.reddit,
requesterEmail: data.requester_email, requesterEmail: data.requester_email,
......
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