Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions studio/src/pages/claims/components/ClaimForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ const ClaimForm = ({ onCreate, data = {} }) => {
const [form] = Form.useForm();
const [valueChange, setValueChange] = React.useState(false);
const { Panel } = Collapse;
const [activeKey, setActiveKey] = React.useState(['1', '2']);
const [basicActiveKey, setBasicActiveKey] = React.useState(['1']);
const [sourcesActiveKey, setSourcesActiveKey] = React.useState(['1']);

const onReset = () => {
form.resetFields();
Expand Down Expand Up @@ -82,9 +83,7 @@ const ClaimForm = ({ onCreate, data = {} }) => {
data.checked_date = data.checked_date ? dayjs(data.checked_date) : null;
}

const handleCollapse = (props) => {
setActiveKey(props);
};


return (
<ConfigProvider
Expand Down Expand Up @@ -114,9 +113,9 @@ const ClaimForm = ({ onCreate, data = {} }) => {
onFinishFailed={(errors) => {
let name = errors.errorFields[0].name[0];
if (['claim', 'slug', 'claimant', 'rating'].includes(name)) {
setActiveKey(['1']);
setBasicActiveKey(['1']);
} else {
setActiveKey(['2']);
setSourcesActiveKey(['1']);
}
if (errors.errorFields[0].name[0] !== 'review_sources') {
}
Expand All @@ -142,8 +141,8 @@ const ClaimForm = ({ onCreate, data = {} }) => {
<Collapse
style={{ width: '100%', marginBottom: 16, background: '#f0f2f5', border: 0 }}
defaultActiveKey={['1']}
activeKey={activeKey && activeKey}
onChange={(props) => handleCollapse(props)}
activeKey={basicActiveKey}
onChange={(keys) => setBasicActiveKey(keys)}
expandIconPosition="right"
expandIcon={({ isActive }) => <Button>{isActive ? 'Close' : 'Expand'}</Button>}
>
Expand Down Expand Up @@ -239,8 +238,8 @@ const ClaimForm = ({ onCreate, data = {} }) => {
<Collapse
style={{ width: '100%', marginBottom: 16, background: '#f0f2f5', border: 0 }}
defaultActiveKey={['1']}
activeKey={activeKey && activeKey}
onChange={(props) => handleCollapse(props)}
activeKey={sourcesActiveKey}
onChange={(keys) => setSourcesActiveKey(keys)}
expandIconPosition="right"
expandIcon={({ isActive }) => <Button>{isActive ? 'Close' : 'Expand'}</Button>}
>
Expand Down