Skip to content

Commit

Permalink
Clear data and fix the short link when the close button is clicked fr…
Browse files Browse the repository at this point in the history
…om new room.
  • Loading branch information
CherifAmine committed Aug 27, 2023
1 parent c70db95 commit 2e175fb
Show file tree
Hide file tree
Showing 3 changed files with 209 additions and 196 deletions.
9 changes: 5 additions & 4 deletions bbbeasy-frontend/src/components/AddLabelForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,14 @@ type formType = {
let addForm: FormInstance = null;

export const AddLabelForm = (props: Props) => {
const [initialColor, setInitialColor] = React.useState<string>('#fbbc0b');
const { defaultColor } = props;
const initialAddValues: formType = {
name: '',
description: '',
color: '#fbbc0b',
color: initialColor,
};
const [color, setColor] = React.useState<string>(defaultColor ? defaultColor : '#fbbc0b');
const [color, setColor] = React.useState<string>(defaultColor ? defaultColor : initialColor);
const dataContext = React.useContext(DataContext);
const [data, setData] = React.useState<LabelType[]>([]);
const [loading, setLoading] = React.useState<boolean>(false);
Expand Down Expand Up @@ -87,8 +88,8 @@ export const AddLabelForm = (props: Props) => {
};
const cancelAdd = () => {
props.close();

addForm?.resetFields();
setColor(initialColor);
};

const failedAdd = () => {
Expand All @@ -102,7 +103,7 @@ export const AddLabelForm = (props: Props) => {
centered
open={props.isModalShow}
onOk={handleAdd}
onCancel={props.close}
onCancel={cancelAdd}
footer={null}
maskClosable={true}
>
Expand Down
2 changes: 1 addition & 1 deletion bbbeasy-frontend/src/components/AddPresetForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export const AddPresetForm = (props: Props) => {
centered
open={props.isModalShow}
onOk={handleAdd}
onCancel={props.close}
onCancel={cancelAdd}
footer={null}
maskClosable={true}
>
Expand Down
Loading

0 comments on commit 2e175fb

Please sign in to comment.