feat: integrate StringFilter into PlatformFilterBar and PurchaseFilterBar

This commit is contained in:
2026-06-10 17:52:20 +02:00
parent 5d6646d8ac
commit ab94617f06
+24 -44
View File
@@ -1190,7 +1190,9 @@ def PurchaseFilterBar(
infinite_value = _parse_bool_nullable(existing, "infinite") infinite_value = _parse_bool_nullable(existing, "infinite")
needs_price_update_value = _parse_bool_nullable(existing, "needs_price_update") needs_price_update_value = _parse_bool_nullable(existing, "needs_price_update")
price_currency_value = existing.get("price_currency", {}).get("value", "") price_currency_value = existing.get("price_currency", {}).get("value", "")
price_currency_modifier = existing.get("price_currency", {}).get("modifier", "EQUALS")
converted_currency_value = existing.get("converted_currency", {}).get("value", "") converted_currency_value = existing.get("converted_currency", {}).get("value", "")
converted_currency_modifier = existing.get("converted_currency", {}).get("modifier", "EQUALS")
date_purchased_min, date_purchased_max = _parse_range(existing, "date_purchased") date_purchased_min, date_purchased_max = _parse_range(existing, "date_purchased")
date_refunded_min, date_refunded_max = _parse_range(existing, "date_refunded") date_refunded_min, date_refunded_max = _parse_range(existing, "date_refunded")
@@ -1264,32 +1266,20 @@ def PurchaseFilterBar(
children=[ children=[
_filter_field( _filter_field(
"Original Currency", "Original Currency",
Input( StringFilter(
attributes=[ input_name_prefix="filter-price_currency",
("type", "text"), value=price_currency_value,
("name", "filter-price_currency"), modifier=price_currency_modifier,
("value", price_currency_value), placeholder="e.g. USD, EUR",
("placeholder", "e.g. USD, EUR"),
(
"class",
"w-full rounded border-default-medium p-2 bg-neutral-secondary-medium text-body",
),
],
), ),
), ),
_filter_field( _filter_field(
"Converted Currency", "Converted Currency",
Input( StringFilter(
attributes=[ input_name_prefix="filter-converted_currency",
("type", "text"), value=converted_currency_value,
("name", "filter-converted_currency"), modifier=converted_currency_modifier,
("value", converted_currency_value), placeholder="e.g. USD, EUR",
("placeholder", "e.g. USD, EUR"),
(
"class",
"w-full rounded border-default-medium p-2 bg-neutral-secondary-medium text-body",
),
],
), ),
), ),
], ],
@@ -1393,7 +1383,9 @@ def PlatformFilterBar(
existing = _filter_parse(filter_json) existing = _filter_parse(filter_json)
name_value = existing.get("name", {}).get("value", "") name_value = existing.get("name", {}).get("value", "")
name_modifier = existing.get("name", {}).get("modifier", "EQUALS")
group_value = existing.get("group", {}).get("value", "") group_value = existing.get("group", {}).get("value", "")
group_modifier = existing.get("group", {}).get("modifier", "EQUALS")
fields = [ fields = [
Div( Div(
@@ -1401,32 +1393,20 @@ def PlatformFilterBar(
children=[ children=[
_filter_field( _filter_field(
"Platform Name", "Platform Name",
Input( StringFilter(
attributes=[ input_name_prefix="filter-name",
("type", "text"), value=name_value,
("name", "filter-name"), modifier=name_modifier,
("value", name_value), placeholder="e.g. Nintendo Switch",
("placeholder", "e.g. Nintendo Switch"),
(
"class",
"w-full rounded border-default-medium p-2 bg-neutral-secondary-medium text-body",
),
],
), ),
), ),
_filter_field( _filter_field(
"Platform Group", "Platform Group",
Input( StringFilter(
attributes=[ input_name_prefix="filter-group",
("type", "text"), value=group_value,
("name", "filter-group"), modifier=group_modifier,
("value", group_value), placeholder="e.g. Nintendo",
("placeholder", "e.g. Nintendo"),
(
"class",
"w-full rounded border-default-medium p-2 bg-neutral-secondary-medium text-body",
),
],
), ),
), ),
], ],