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

fix(web): use product ID instead of generated slug #1873

Merged
merged 2 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion web/package/agama-web-ui.changes
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
-------------------------------------------------------------------
Wed Jan 8 15:16:51 UTC 2025 - David Diaz <[email protected]>

- Use product ID instead of slug to link labels and descriptions to
their corresponding radio inputs (gh#agama-project/agama#1873).

-------------------------------------------------------------------
Wed Jan 8 13:12:44 UTC 2025 - David Diaz <[email protected]>

- Show the cancel action at product selection page only when
a product is already selected (gh#agama-project/agama#1881).
a product is already selected (gh#agama-project/agama#1871).

-------------------------------------------------------------------
Fri Dec 20 12:53:41 UTC 2024 - David Diaz <[email protected]>
Expand Down
8 changes: 3 additions & 5 deletions web/src/components/product/ProductSelectionPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import { Center } from "~/components/layout";
import { useConfigMutation, useProduct } from "~/queries/software";
import pfTextStyles from "@patternfly/react-styles/css/utilities/Text/text";
import pfRadioStyles from "@patternfly/react-styles/css/components/Radio/radio";
import { slugify } from "~/utils";
import { sprintf } from "sprintf-js";
import { _ } from "~/i18n";
import { useNavigate } from "react-router-dom";
Expand All @@ -51,8 +50,7 @@ const ResponsiveGridItem = ({ children }) => (
);

const Option = ({ product, isChecked, onChange }) => {
const id = slugify(product.name);
const detailsId = `${id}-details`;
const detailsId = `${product.id}-details`;
const logoSrc = `assets/logos/${product.icon}`;
// TRANSLATORS: %s will be replaced by a product name. E.g., "openSUSE Tumbleweed"
const logoAltText = sprintf(_("%s logo"), product.name);
Expand All @@ -63,7 +61,7 @@ const Option = ({ product, isChecked, onChange }) => {
<CardBody>
<Split hasGutter>
<input
id={id}
id={product.id}
type="radio"
name="product"
className={pfRadioStyles.radioInput}
Expand All @@ -74,7 +72,7 @@ const Option = ({ product, isChecked, onChange }) => {
<img aria-hidden src={logoSrc} alt={logoAltText} />
<Stack hasGutter>
<label
htmlFor={id}
htmlFor={product.id}
className={`${pfTextStyles.fontSizeLg} ${pfTextStyles.fontWeightBold}`}
>
{product.name}
Expand Down
Loading