fix: allow renaming custom field (#803)

* fix: allow renaming custom field

* style: change time-to-end icon
This commit is contained in:
Carlos Valente
2024-03-07 19:59:36 +01:00
committed by GitHub
parent d22cc48565
commit d59885fc20
2 changed files with 5 additions and 4 deletions
@@ -1,8 +1,8 @@
import { memo, useEffect, useState } from 'react';
import { Tooltip } from '@chakra-ui/react';
import { BiArrowToBottom } from '@react-icons/all-files/bi/BiArrowToBottom';
import { IoArrowDown } from '@react-icons/all-files/io5/IoArrowDown';
import { IoArrowUp } from '@react-icons/all-files/io5/IoArrowUp';
import { IoFlag } from '@react-icons/all-files/io5/IoFlag';
import { IoPeople } from '@react-icons/all-files/io5/IoPeople';
import { IoPlay } from '@react-icons/all-files/io5/IoPlay';
import { IoPlayForward } from '@react-icons/all-files/io5/IoPlayForward';
@@ -173,7 +173,7 @@ function TimerIcon(props: { type: TimerType; className: string }) {
return <IoTime className={className} />;
}
if (type === TimerType.TimeToEnd) {
return <BiArrowToBottom className={className} />;
return <IoFlag className={className} />
}
return <IoArrowDown className={className} />;
}
@@ -404,12 +404,13 @@ export const editCustomField = async (label: string, newField: Partial<CustomFie
throw new Error('Change of field type is not allowed');
}
persistedCustomFields[newField.label] = { ...existingField, ...newField };
if (existingField.label !== newField.label) {
delete persistedCustomFields[existingField.label];
customFieldChangelog[label] = newField.label;
}
persistedCustomFields[label] = { ...existingField, ...newField };
scheduleCustomFieldPersist(persistedCustomFields);
invalidateIfUsed(label);