aboutsummaryrefslogtreecommitdiffstats
path: root/src/components
diff options
context:
space:
mode:
authorLibravatar MCMXC <16797721+mcmxcdev@users.noreply.github.com>2023-07-26 19:58:46 -0600
committerLibravatar Vijay Aravamudhan <vraravam@users.noreply.github.com>2023-07-27 15:14:11 +0530
commit998d229d2978ea4418cb5dab3390b8901f0c2cb3 (patch)
tree3f0932493d4e6cdd24d50fb407c5eda913b3a360 /src/components
parent6.4.1-nightly.13 [skip ci] (diff)
downloadferdium-app-998d229d2978ea4418cb5dab3390b8901f0c2cb3.tar.gz
ferdium-app-998d229d2978ea4418cb5dab3390b8901f0c2cb3.tar.zst
ferdium-app-998d229d2978ea4418cb5dab3390b8901f0c2cb3.zip
chore: upgrade mobx-react-form to latest
- upgrade mobx-react-form from v3 to v6 - remove stub mobx-react-form.d.ts since the dependency is written in TS now - remove as any cast for new Form invocation in invite.tsx - reuse Error component in Radio.tsx to get validation error message in red - use FieldInterface type for field property instead of typeof Field in Radio.tsx
Diffstat (limited to 'src/components')
-rw-r--r--src/components/auth/Invite.tsx3
-rw-r--r--src/components/ui/Radio.tsx11
2 files changed, 8 insertions, 6 deletions
diff --git a/src/components/auth/Invite.tsx b/src/components/auth/Invite.tsx
index 4f2cb19fe..0d39d861a 100644
--- a/src/components/auth/Invite.tsx
+++ b/src/components/auth/Invite.tsx
@@ -86,8 +86,7 @@ class Invite extends Component<IProps, IState> {
86 }, 86 },
87 }, 87 },
88 }), 88 }),
89 // TODO: [TS DEBT] need to fix this type once mobx-react-form is updated to next version 89 ],
90 ] as any,
91 }, 90 },
92 }); 91 });
93 } 92 }
diff --git a/src/components/ui/Radio.tsx b/src/components/ui/Radio.tsx
index b5be64c5d..1f41deedc 100644
--- a/src/components/ui/Radio.tsx
+++ b/src/components/ui/Radio.tsx
@@ -1,10 +1,11 @@
1import { Component } from 'react'; 1import { Component } from 'react';
2import { observer } from 'mobx-react'; 2import { observer } from 'mobx-react';
3import { Field } from 'mobx-react-form';
4import classnames from 'classnames'; 3import classnames from 'classnames';
4import FieldInterface from 'mobx-react-form/lib/models/FieldInterface';
5import Error from './error';
5 6
6type Props = { 7type Props = {
7 field: typeof Field; 8 field: FieldInterface;
8 className: string; 9 className: string;
9 focus: boolean; 10 focus: boolean;
10 showLabel: boolean; 11 showLabel: boolean;
@@ -47,7 +48,8 @@ class Radio extends Component<Props> {
47 </label> 48 </label>
48 )} 49 )}
49 <div className="franz-form__radio-wrapper"> 50 <div className="franz-form__radio-wrapper">
50 {field.options.map(type => ( 51 {/* @ts-expect-error Property 'map' does not exist on type 'OptionsModel'. */}
52 {field.options?.map(type => (
51 <label 53 <label
52 key={type.value} 54 key={type.value}
53 htmlFor={`${field.id}-${type.value}`} 55 htmlFor={`${field.id}-${type.value}`}
@@ -68,7 +70,8 @@ class Radio extends Component<Props> {
68 </label> 70 </label>
69 ))} 71 ))}
70 </div> 72 </div>
71 {field.error && <div className="franz-form__error">{field.error}</div>} 73
74 {field.error && <Error message={field.error} />}
72 </div> 75 </div>
73 ); 76 );
74 } 77 }