Commit 1a7329fa authored by tom's avatar tom

fix FormFieldSelect default values

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