Skip to content

Commit c0675b7

Browse files
committed
Fix has-not-subscribed not being selected
1 parent 4de2643 commit c0675b7

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

template/app/src/admin/dashboards/users/UsersTable.tsx

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,9 @@ const UsersTable = () => {
9191
</div>
9292
<select
9393
onChange={(e) => {
94-
const selectedValue = e.target.value == '' ? null : e.target.value;
94+
const selectedValue = e.target.value == 'has_not_subscribed' ? null : e.target.value;
9595

96+
console.log(selectedValue);
9697
if (selectedValue === 'clear-all') {
9798
setSubcriptionStatusFilter([]);
9899
} else {
@@ -109,15 +110,15 @@ const UsersTable = () => {
109110
id='status-filter'
110111
className='absolute top-0 left-0 z-20 h-full w-full bg-white opacity-0'
111112
>
112-
<option value='clear-all'>Clear all</option>
113-
<option key='has-not-subscribed' value=''>
114-
has not subscribed
115-
</option>
116-
{[...Object.values(SubscriptionStatus)].map((status) => (
117-
<option key={status} value={status}>
118-
{status}
119-
</option>
120-
))}
113+
<option value='select-filters'>Select filters</option>
114+
{[...Object.values(SubscriptionStatus), null]
115+
.filter((status) => !subscriptionStatusFilter.includes(status))
116+
.map((status) => {
117+
const extendedStatus = status ?? 'has_not_subscribed'
118+
return <option key={extendedStatus} value={extendedStatus}>
119+
{extendedStatus}
120+
</option>
121+
})}
121122
</select>
122123
<span className='absolute top-1/2 right-4 z-10 -translate-y-1/2'>
123124
<ChevronDownIcon />
@@ -220,7 +221,7 @@ const UsersTable = () => {
220221
</div>
221222
</div>
222223
);
223-
}
224+
};
224225

225226
function ChevronDownIcon() {
226227
return (

0 commit comments

Comments
 (0)