Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup feature flags #5190

Merged
merged 16 commits into from
Oct 8, 2024
5 changes: 5 additions & 0 deletions .changeset/eight-actors-smile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"saleor-dashboard": patch
---

Enable by default feature flag for discount rules. Remove feature flags for product and order expression filters, so that expression filter will always show. Cleanup dead code after remove feature flags.
2 changes: 1 addition & 1 deletion .featureFlags/discounts-rules.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: discounts_rules
displayName: Discounts rules
enabled: false
enabled: true
payload: "default"
visible: true
---
Expand Down
38 changes: 5 additions & 33 deletions .featureFlags/generated.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
// @ts-nocheck

import L19499 from "./images/discounts-list.png"
import I59669 from "./images/improved_refunds.png"
import M04994 from "./images/order-filters.png"
import C77988 from "./images/filters.png"
import R80834 from "./images/discounts-list.png"
import E27647 from "./images/improved_refunds.png"

const discounts_rules = () => (<><p><img src={L19499} alt="Discount rules"/></p>
const discounts_rules = () => (<><p><img src={R80834} alt="Discount rules"/></p>
<p>Apply the new discounts rules to narrow your promotions audience.
Set up conditions and channels that must be fulfilled to apply defined reward.</p>
</>)
const improved_refunds = () => (<><p><img src={I59669} alt="Improved refunds"/></p>
const improved_refunds = () => (<><p><img src={E27647} alt="Improved refunds"/></p>
<h3 id="enable-the-enhanced-refund-feature-to-streamline-your-refund-process">Enable the enhanced refund feature to streamline your refund process:</h3>
<ul>
<li><p>• Choose between automatic calculations based on selected items or enter refund amounts directly for overcharges and custom adjustments.</p>
Expand All @@ -18,14 +16,6 @@ const improved_refunds = () => (<><p><img src={I59669} alt="Improved refunds"/><
</li>
</ul>

</>)
const order_filters = () => (<><p><img src={M04994} alt="new filters"/></p>
<p>Experience the new look and enhanced abilities of new orders filtering mechanism.
Easily combine any criteria you want, and quickly browse their values.</p>
</>)
const product_filters = () => (<><p><img src={C77988} alt="new filters"/></p>
<p>Experience the new look and enhanced abilities of new fitering mechanism.
Easily combine any criteria you want, and quickly browse their values.</p>
</>)

export const AVAILABLE_FLAGS = [{
Expand All @@ -34,7 +24,7 @@ export const AVAILABLE_FLAGS = [{
component: discounts_rules,
visible: true,
content: {
enabled: false,
enabled: true,
payload: "default",
}
},{
Expand All @@ -46,22 +36,4 @@ export const AVAILABLE_FLAGS = [{
enabled: true,
payload: "default",
}
},{
name: "order_filters",
displayName: "Orders filtering",
component: order_filters,
visible: true,
content: {
enabled: true,
payload: "default",
}
},{
name: "product_filters",
displayName: "Products filtering",
component: product_filters,
visible: true,
content: {
enabled: true,
payload: "default",
}
}] as const;
12 changes: 0 additions & 12 deletions .featureFlags/order-filters.md

This file was deleted.

12 changes: 0 additions & 12 deletions .featureFlags/product-filters.md

This file was deleted.

64 changes: 0 additions & 64 deletions locale/defaultMessages.json
Original file line number Diff line number Diff line change
Expand Up @@ -848,10 +848,6 @@
"context": "navigator command mode description",
"string": "Search Command"
},
"3Z8972": {
"context": "product",
"string": "Stock quantity"
},
"3a5wL8": {
"string": "Active"
},
Expand Down Expand Up @@ -1316,10 +1312,6 @@
"context": "order history message",
"string": "Note was added to the order"
},
"6Y1nQd": {
"context": "product is visible",
"string": "Visible"
},
"6aBkJm": {
"context": "section header",
"string": "Authorization"
Expand Down Expand Up @@ -2058,10 +2050,6 @@
"BvGp1I": {
"string": "between"
},
"Bx367s": {
"context": "product is hidden",
"string": "Hidden"
},
"By5ZBp": {
"context": "header",
"string": "Hello there, {userName}"
Expand Down Expand Up @@ -3314,10 +3302,6 @@
"context": "csv file exporting has finished, header",
"string": "Exporting CSV finished"
},
"JUQwne": {
"context": "order",
"string": "Gift Card"
},
"JV+EiM": {
"context": "voucher value",
"string": "Value"
Expand All @@ -3330,10 +3314,6 @@
"context": "button",
"string": "Create Menu"
},
"JYvf8/": {
"context": "is preorder",
"string": "Preorder"
},
"Ja7gHc": {
"context": "button",
"string": "Edit"
Expand Down Expand Up @@ -3490,10 +3470,6 @@
"context": "quantity of fulfilled products",
"string": "Quantity to fulfill"
},
"Kgxlsf": {
"context": "order",
"string": "Paid with Gift Card"
},
"KkufwD": {
"string": "No voucher codes found"
},
Expand Down Expand Up @@ -4251,10 +4227,6 @@
"Pyjarj": {
"string": "This shipping rate has no postal codes assigned"
},
"PzXIXh": {
"context": "order",
"string": "Customer"
},
"Q/Nbku": {
"context": "product field",
"string": "Type"
Expand Down Expand Up @@ -4689,10 +4661,6 @@
"context": "product filter label",
"string": "Product"
},
"Sna+WK": {
"context": "product status",
"string": "Out Of Stock"
},
"SpngiS": {
"context": "sale status",
"string": "Status"
Expand Down Expand Up @@ -5856,10 +5824,6 @@
"context": "draft created from replace products list title",
"string": "Products replaced"
},
"a4qX2+": {
"context": "order",
"string": "Created"
},
"a55zOn": {
"context": "section header",
"string": "Data privacy"
Expand Down Expand Up @@ -6128,10 +6092,6 @@
"context": "voucher requirement",
"string": "Minimal order value"
},
"biAxKR": {
"context": "click and collect",
"string": "Click&Collect"
},
"biDgQS": {
"context": "button, opens modal to create transaction in order",
"string": "Manual transaction"
Expand Down Expand Up @@ -6421,10 +6381,6 @@
"context": "products export type label",
"string": "products"
},
"diOQm7": {
"context": "product status",
"string": "Available"
},
"dnbJKr": {
"string": "This transaction doesn't have any events"
},
Expand Down Expand Up @@ -6725,10 +6681,6 @@
"fzpXvv": {
"string": "Are you sure you want to remove {email} avatar?"
},
"g+GAf4": {
"context": "product visibility",
"string": "Visibility"
},
"g/BrOt": {
"string": "Url has invalid format"
},
Expand Down Expand Up @@ -7521,10 +7473,6 @@
"context": "table head",
"string": "Variant Name"
},
"lJP1iw": {
"context": "order",
"string": "Channel"
},
"lJXkFS": {
"context": "discount name",
"string": "Discount name"
Expand Down Expand Up @@ -8056,10 +8004,6 @@
"pAwBtz": {
"string": "Reward value"
},
"pBTTtU": {
"context": "product kind",
"string": "Product Kind"
},
"pC6/1z": {
"string": "Invalid manifest format"
},
Expand Down Expand Up @@ -8115,10 +8059,6 @@
"paa4m0": {
"string": "Successfully created product type"
},
"pbGIUg": {
"context": "sales channel",
"string": "Channel"
},
"phAZoj": {
"string": "Collection"
},
Expand Down Expand Up @@ -8464,10 +8404,6 @@
"context": "limit voucher",
"string": "Limit of Uses"
},
"s5v6m0": {
"context": "order",
"string": "Gift Card ordered"
},
"s6lW8R": {
"context": "option label",
"string": "Change address"
Expand Down
85 changes: 47 additions & 38 deletions src/components/AppLayout/ListFilters/ListFilters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,56 +8,65 @@ import { FiltersSelect } from "./components/FiltersSelect";
import { LegacyFiltersPresetsAlert } from "./components/LegacyFiltersPresetsAlert";
import SearchInput from "./components/SearchInput";

export interface ListFiltersProps<TKeys extends string = string>
export interface NewFilterProps extends SearchPageProps {
type: "expression-filter";
searchPlaceholder: string;
actions?: ReactNode;
}

interface OldFiltersProps<TKeys extends string = string>
extends FilterProps<TKeys>,
SearchPageProps {
type?: "old-filter-select";
searchPlaceholder: string;
errorMessages?: FilterErrorMessages<TKeys>;
filterStructure: IFilter<TKeys>;
actions?: ReactNode;
filtersEnabled?: boolean;
filterStructure?: IFilter<TKeys>;
errorMessages?: FilterErrorMessages<TKeys>;
}

export type ListFiltersProps<TKeys extends string = string> =
| NewFilterProps
| OldFiltersProps<TKeys>;

export const ListFilters = <TFilterKeys extends string = string>({
currencySymbol,
filterStructure,
initialSearch,
searchPlaceholder,
onSearchChange,
onFilterChange,
onFilterAttributeFocus,
errorMessages,
actions,
filtersEnabled,
}: ListFiltersProps<TFilterKeys>) => (
<>
{filtersEnabled && <LegacyFiltersPresetsAlert />}
<Box display="grid" __gridTemplateColumns="auto 1fr" gap={4} paddingBottom={2} paddingX={6}>
<Box display="flex" alignItems="center" gap={4}>
{filtersEnabled ? (
<ExpressionFilters data-test-id="filters-button" />
) : (
<FiltersSelect<TFilterKeys>
errorMessages={errorMessages}
menu={filterStructure}
currencySymbol={currencySymbol}
onFilterAdd={onFilterChange}
onFilterAttributeFocus={onFilterAttributeFocus}
/>
)}
<Box __width="320px">
<SearchInput
initialSearch={initialSearch}
placeholder={searchPlaceholder}
onSearchChange={onSearchChange}
/>
...props
}: ListFiltersProps<TFilterKeys>) => {
const isExpressionFilter = props.type === "expression-filter";

return (
<>
{isExpressionFilter && <LegacyFiltersPresetsAlert />}
<Box display="grid" __gridTemplateColumns="auto 1fr" gap={4} paddingBottom={2} paddingX={6}>
<Box display="flex" alignItems="center" gap={4}>
{isExpressionFilter ? (
<ExpressionFilters data-test-id="filters-button" />
) : (
<FiltersSelect<TFilterKeys>
errorMessages={props.errorMessages}
menu={props.filterStructure!}
currencySymbol={props.currencySymbol}
onFilterAdd={props.onFilterChange!}
onFilterAttributeFocus={props.onFilterAttributeFocus}
/>
)}
<Box __width="320px">
<SearchInput
initialSearch={initialSearch}
placeholder={searchPlaceholder}
onSearchChange={onSearchChange}
/>
</Box>
</Box>
<Box display="flex" justifyContent="flex-end">
{actions}
</Box>
</Box>
<Box display="flex" justifyContent="flex-end">
{actions}
</Box>
</Box>
</>
);
</>
);
};

ListFilters.displayName = "FilterBar";
Loading
Loading