refactor: improves readability

This commit is contained in:
QiShaoXuan 2022-08-03 18:02:28 +08:00
parent 7b543ec2c1
commit c347878f23
2 changed files with 10 additions and 10 deletions

View File

@ -57,15 +57,15 @@ const isValueBelongOption = (
option: KanbanGroup option: KanbanGroup
) => { ) => {
switch (propertyValue.type) { switch (propertyValue.type) {
case PropertyType.Select: { case PropertyType.Select || PropertyType.Status: {
return propertyValue.value === option.id; return propertyValue.value === option.id;
} }
case PropertyType.MultiSelect: { case PropertyType.MultiSelect: {
return propertyValue.value.some(i => i === option.id); return propertyValue.value.some(i => i === option.id);
} }
case PropertyType.Status: { // case PropertyType.Status: {
return propertyValue.value === option.id; // return propertyValue.value === option.id;
} // }
// case PropertyType.Text: { // case PropertyType.Text: {
// TOTODO:DO support this type // TOTODO:DO support this type
// } // }

View File

@ -276,12 +276,12 @@ export const getRecastItemValue = (block: RecastItem | AsyncBlock) => {
const isSelectLikeProperty = ( const isSelectLikeProperty = (
metaProperty?: RecastMetaProperty metaProperty?: RecastMetaProperty
): metaProperty is SelectProperty | MultiSelectProperty => { ): metaProperty is SelectProperty | MultiSelectProperty | StatusProperty => {
return !( return (
!metaProperty || metaProperty &&
(metaProperty.type !== PropertyType.Status && (metaProperty.type === PropertyType.Status ||
metaProperty.type !== PropertyType.Select && metaProperty.type === PropertyType.Select ||
metaProperty.type !== PropertyType.MultiSelect) metaProperty.type === PropertyType.MultiSelect)
); );
}; };