Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ClementNumericite committed Nov 19, 2024
2 parents 07d6e1b + 71887a7 commit 4a668b0
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 11 deletions.
13 changes: 13 additions & 0 deletions webapp/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
## [0.68.1](https://github.com/SocialGouv/carte-jeune-engage/compare/v0.68.0...v0.68.1) (2024-11-19)


### Bug Fixes

* wordings, icons and add missing one for condition blocks ([9fa391d](https://github.com/SocialGouv/carte-jeune-engage/commit/9fa391d414ee51703bd11a3c98b2086fba3ff919))

# [0.68.0](https://github.com/SocialGouv/carte-jeune-engage/compare/v0.67.2...v0.68.0) (2024-11-19)

### Features

- add crisp to help button ([0b08132](https://github.com/SocialGouv/carte-jeune-engage/commit/0b0813285b641ed051bc8dff3c14cc5b7d7755a0))

## [0.67.2](https://github.com/SocialGouv/carte-jeune-engage/compare/v0.67.1...v0.67.2) (2024-11-18)

### Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion webapp/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "webapp",
"version": "0.67.2",
"version": "0.68.1",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down
24 changes: 20 additions & 4 deletions webapp/src/components/offer/ConditionBlocksSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ import ReactIcon from "~/utils/dynamicIcon";
const disabledColor = theme.colors["disabled"] as string;

type ConditionBlocksSectionProps = {
offerConditionBlocks: { text: string; icon: string; isCrossed: boolean }[];
offerConditionBlocks: {
text: string;
icon: string;
slug: string;
isCrossed: boolean;
}[];
offerSource: Offer["source"];
};

Expand All @@ -18,23 +23,34 @@ const ConditionBlocksSection = ({
}: ConditionBlocksSectionProps) => {
return (
<Flex flexDir="column" gap={4} w="full" px={4}>
{offerConditionBlocks.map(({ text, icon, isCrossed }) => {
{offerConditionBlocks.map(({ text, icon, slug, isCrossed }) => {
return (
<Flex key={text} alignItems="center" w="full">
{typeof icon === "string" && (
{typeof icon === "string" && slug !== "one-time" ? (
<ReactIcon
icon={icon}
size={20}
color={!isCrossed ? "black" : disabledColor}
/>
) : (
<Text
fontSize="xl"
fontWeight={800}
color={!isCrossed ? "black" : disabledColor}
mt={-0.5}
>
x1
</Text>
)}
<Text
fontWeight={500}
textAlign="start"
ml={4}
w="70%"
color={!isCrossed ? "black" : "disabled"}
textDecor={!isCrossed ? "none" : "line-through"}
textDecor={!isCrossed ? "none" : "underline"}
textUnderlineOffset="-0.3em"
style={{ textDecorationSkipInk: "none" }}
>
{text}
</Text>
Expand Down
15 changes: 9 additions & 6 deletions webapp/src/payload/components/CustomSelectBlocksOfUse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const getItemsConditionBlocks = (source: Offer["source"]) => {
icon: "HiMiniEye",
},
{
text: "Offre utilisable à l'infini",
text: "Offre valable tout le temps",
slug: "all-time",
icon: "TiInfinity",
},
Expand Down Expand Up @@ -39,9 +39,14 @@ export const getItemsConditionBlocks = (source: Offer["source"]) => {
icon: "HiCreditCard",
},
{
text: "Cumulable avec d’autres bons",
text: "Cumulable avec plusieurs bons d'achat",
slug: "cumulative-with-other-codes",
icon: "BsCashStack",
icon: "HiSquare2Stack",
},
{
text: "Cumulable avec d'autres réductions",
slug: "cumulative-with-other-discounts",
icon: "HiMiniReceiptPercent",
},
];
};
Expand All @@ -54,9 +59,7 @@ export const CustomSelectConditionBlocks: React.FC<{ path: string }> = ({
{ label: string; value: string }[]
>([]);

const offerSource = useFormFields(([fields, _]) => fields.kind);

console.log("offerSource", offerSource);
const offerSource = useFormFields(([fields, _]) => fields.source);

React.useEffect(() => {
const tmpOptions = getItemsConditionBlocks(
Expand Down

0 comments on commit 4a668b0

Please sign in to comment.