️ feat: make the default status to undefined

This commit is contained in:
Wahyu Kurniawan 2024-03-06 11:17:08 +07:00
parent 18dde52c9a
commit 80097a32ac
No known key found for this signature in database
GPG Key ID: 040A1549143A8E33
2 changed files with 13 additions and 11 deletions

View File

@ -22,7 +22,7 @@ export enum StatusOptions {
export interface FilterValue {
searchedBranch: string;
status: StatusOptions;
status: StatusOptions | string;
updateAtRange?: Value;
}
@ -64,13 +64,11 @@ const FilterForm = ({ value, onChange }: FilterFormProps) => {
}
};
const statusOptions = Object.values(StatusOptions)
.map((status) => ({
label: status,
value: status,
leftIcon: getOptionIcon(status),
}))
.filter((status) => status.value !== StatusOptions.ALL_STATUS);
const statusOptions = Object.values(StatusOptions).map((status) => ({
label: status,
value: status,
leftIcon: getOptionIcon(status),
}));
const handleReset = () => {
setSearchedBranch('');
@ -104,11 +102,15 @@ const FilterForm = ({ value, onChange }: FilterFormProps) => {
options={statusOptions}
clearable
placeholder="All status"
value={{ label: selectedStatus, value: selectedStatus }}
value={
selectedStatus
? { label: selectedStatus, value: selectedStatus }
: undefined
}
onChange={(item) =>
setSelectedStatus((item as SelectOption).value as StatusOptions)
}
onClear={() => setSelectedStatus(StatusOptions.ALL_STATUS)}
onClear={() => setSelectedStatus('')}
/>
</div>
</div>

View File

@ -14,7 +14,7 @@ import { RefreshIcon } from 'components/shared/CustomIcon';
const DEFAULT_FILTER_VALUE: FilterValue = {
searchedBranch: '',
status: StatusOptions.ALL_STATUS,
status: '',
};
const FETCH_DEPLOYMENTS_INTERVAL = 5000;