Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
ClementNumericite committed Dec 13, 2024
2 parents 4bbf0a3 + 746ef0e commit 9c0cf32
Show file tree
Hide file tree
Showing 9 changed files with 172 additions and 247 deletions.
19 changes: 19 additions & 0 deletions webapp/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
## [0.73.21](https://github.com/SocialGouv/carte-jeune-engage/compare/v0.73.20...v0.73.21) (2024-12-13)

### Bug Fixes

- remove crisp component from all pages ([156b1e1](https://github.com/SocialGouv/carte-jeune-engage/commit/156b1e183fa00a12e1273390e3289aae35b658e3))

## [0.73.20](https://github.com/SocialGouv/carte-jeune-engage/compare/v0.73.19...v0.73.20) (2024-12-05)

### Bug Fixes

- desactivate reminder auchan and offer user preferences notifications and group offer activated reminder by user instead by offer ([d52879d](https://github.com/SocialGouv/carte-jeune-engage/commit/d52879d1f07bcbbd4711457fac499ba02691e44e))
- remove unused import ([fe1bb94](https://github.com/SocialGouv/carte-jeune-engage/commit/fe1bb94cc13ee929b93fd8270523e6cbd0403518))

## [0.73.19](https://github.com/SocialGouv/carte-jeune-engage/compare/v0.73.18...v0.73.19) (2024-12-04)

### Bug Fixes

- return back button offer from url ([f969374](https://github.com/SocialGouv/carte-jeune-engage/commit/f969374c2aab4ead6e125c43aa6ccfda8e48289c))

## [0.73.18](https://github.com/SocialGouv/carte-jeune-engage/compare/v0.73.17...v0.73.18) (2024-12-04)

### 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.73.18",
"version": "0.73.21",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down
124 changes: 47 additions & 77 deletions webapp/src/components/modals/IssueModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,18 @@ import {
Button,
Center,
} from "@chakra-ui/react";
import dynamic from "next/dynamic";
import { useState } from "react";
import {
HiMiniChatBubbleOvalLeftEllipsis,
HiEnvelope,
HiPhone,
HiChevronRight,
HiMiniPaperAirplane,
HiCheckCircle,
} from "react-icons/hi2";
import { IconType } from "react-icons/lib";
import { useAuth } from "~/providers/Auth";
import { api } from "~/utils/api";
import ConditionalLink from "../ConditionalLink";

const CRISP_TOKEN = process.env.NEXT_PUBLIC_CRISP_TOKEN as string;

const defaultIssueCases = [
"Le prix avec la réduction ne correspond pas",
"Autre chose",
Expand Down Expand Up @@ -178,10 +173,6 @@ type IssueModalProps = IssueModalOrder | IssueModalCoupon;

const IssueModal = (props: IssueModalProps) => {
const { isOpen, onClose, kind } = props;
const { user } = useAuth();
const CrispWithNoSSR = dynamic(() => import("../support/Crisp"));

const [isOpenCrisp, setIsOpenCrisp] = useState(false);

const id = kind === "order" ? props.order_id : props.coupon_id;

Expand All @@ -203,74 +194,53 @@ const IssueModal = (props: IssueModalProps) => {
];

return (
<>
<Modal isOpen={isOpen} onClose={onClose} isCentered={kind === "coupon"}>
<ModalOverlay />
{!isOpenCrisp && (
<ModalContent
mx={2.5}
mt={kind == "order" ? 5 : "auto"}
borderRadius="2.5xl"
>
<ModalCloseButton size="lg" top={4} right={4} />
<ModalBody display="flex" flexDir="column" px={9} pb={16} pt={4}>
<OrderIssueContent kind={kind} id={id} issues={issues} />
<Divider my={6} />
<Flex direction="column" gap={4}>
<ItemLink
onClick={() => setIsOpenCrisp(true)}
icon={HiMiniChatBubbleOvalLeftEllipsis}
text="Discutez avec nous en direct"
/>
{kind === "order" && (
<>
<Text
my={2}
fontSize={14}
fontWeight={500}
textAlign="center"
color="disabled"
>
ou
</Text>
<ItemLink
href="telto:0472402828"
icon={HiPhone}
text="04 72 40 28 28"
/>
<ItemLink
href="mailto:[email protected]"
icon={HiEnvelope}
text="[email protected]"
/>
<Flex direction="column" gap={4} fontSize={"sm"}>
<Text
fontWeight={500}
textAlign="center"
color="disabled"
>
Disponible du lundi au vendredi de
<br />
09h à 12h30 puis de 14h à 17h30
</Text>
</Flex>
</>
)}
</Flex>
</ModalBody>
</ModalContent>
)}
</Modal>
{isOpenCrisp && user && (
<CrispWithNoSSR
crispToken={CRISP_TOKEN}
user={user}
onClose={() => {
setIsOpenCrisp(false);
}}
/>
)}
</>
<Modal isOpen={isOpen} onClose={onClose} isCentered={kind === "coupon"}>
<ModalOverlay />
<ModalContent
mx={2.5}
mt={kind == "order" ? 5 : "auto"}
borderRadius="2.5xl"
>
<ModalCloseButton size="lg" top={4} right={4} />
<ModalBody display="flex" flexDir="column" px={9} pb={16} pt={4}>
<OrderIssueContent kind={kind} id={id} issues={issues} />
<Divider my={6} />
<Flex direction="column" gap={4}>
{/* <ItemLink
onClick={() => setIsOpenCrisp(true)}
icon={HiMiniChatBubbleOvalLeftEllipsis}
text="Discutez avec nous en direct"
/>
<Text
my={2}
fontSize={14}
fontWeight={500}
textAlign="center"
color="disabled"
>
ou
</Text> */}
<ItemLink
href="telto:0472402828"
icon={HiPhone}
text="04 72 40 28 28"
/>
<ItemLink
href="mailto:[email protected]"
icon={HiEnvelope}
text="[email protected]"
/>
<Flex direction="column" gap={4} fontSize={"sm"}>
<Text fontWeight={500} textAlign="center" color="disabled">
Disponible du lundi au vendredi de
<br />
09h à 12h30 puis de 14h à 17h30
</Text>
</Flex>
</Flex>
</ModalBody>
</ModalContent>
</Modal>
);
};

Expand Down
157 changes: 67 additions & 90 deletions webapp/src/components/modals/ObizOrderProcessModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,10 @@ import { OfferIncluded } from "~/server/api/routers/offer";
import { OfferArticle } from "~/server/types";
import { api } from "~/utils/api";
import LayoutOrderStatus from "../obiz/LayoutOrderStatus";
import { HiMiniShieldCheck, HiQuestionMarkCircle } from "react-icons/hi2";
import { HiMiniShieldCheck } from "react-icons/hi2";
import { formatter2Digits } from "~/utils/tools";
import { useRouter } from "next/router";
import PartnerImage from "../ui/PartnerImage";
import dynamic from "next/dynamic";
import { useAuth } from "~/providers/Auth";

const CRISP_TOKEN = process.env.NEXT_PUBLIC_CRISP_TOKEN as string;

const ObizOfferVariableContent = ({
step,
Expand Down Expand Up @@ -223,11 +219,7 @@ export default function ObizOrderProcessModal(
) {
const { isOpen, onClose, onRedirectPayment, offerId } = props;
const router = useRouter();
const { user } = useAuth();

const CrispWithNoSSR = dynamic(() => import("../support/Crisp"));

const [isOpenCrisp, setIsOpenCrisp] = useState(false);
const [amount, setAmount] = useState(0);
const [step, setStep] = useState<Steps>("amount");
const [selectedArticles, setSelectedArticles] = useState<
Expand Down Expand Up @@ -265,90 +257,75 @@ export default function ObizOrderProcessModal(
<>
<Modal isOpen={isOpen} onClose={onClose} size="full">
<ModalOverlay />
{!isOpenCrisp && (
<ModalContent>
<ModalBody display="flex" flexDir="column" px={8}>
{step !== "payment" && (
<Flex mt={8} alignItems="center">
<Box mr={4}>
<BackButton
onClick={() =>
step == "amount" ? onClose() : setStep("amount")
}
/>
</Box>
<PartnerImage
partner={offer.partner}
width={42}
height={42}
/>
<Flex flexDir="column" gap={0.5} ml={2}>
<Text fontSize={14} fontWeight={500}>
{offer.partner.name}
</Text>
<Text fontSize={12} fontWeight={800}>
{offer.title} {offer.subtitle ?? ""}
</Text>
</Flex>
<Icon
as={HiQuestionMarkCircle}
w={6}
h={6}
ml="auto"
color="disabled"
onClick={() => setIsOpenCrisp(true)}
<ModalContent>
<ModalBody display="flex" flexDir="column" px={8}>
{step !== "payment" && (
<Flex mt={8} alignItems="center">
<Box mr={4}>
<BackButton
onClick={() =>
step == "amount" ? onClose() : setStep("amount")
}
/>
</Box>
<PartnerImage partner={offer.partner} width={42} height={42} />
<Flex flexDir="column" gap={0.5} ml={2}>
<Text fontSize={14} fontWeight={500}>
{offer.partner.name}
</Text>
<Text fontSize={12} fontWeight={800}>
{offer.title} {offer.subtitle ?? ""}
</Text>
</Flex>
)}
<ObizOfferVariableContent
step={step}
setStep={setStep}
amount={amount}
setAmount={setAmount}
offer={offer}
articles={availableArticles}
createOrder={() => {
if (
availableArticles.length === 1 &&
availableArticles[0].kind === "variable_price"
) {
createTestOrder({
offer_id: offer.id,
article_references: [
{
reference: availableArticles[0].reference,
quantity: 1,
},
],
input_value: amount - (amount * discount) / 100,
input_value_public: amount,
});
} else {
createTestOrder({
offer_id: offer.id,
article_references: selectedArticles.map((article) => ({
reference: article.article.reference,
quantity: article.quantity,
})),
});
}
}}
selectedArticles={selectedArticles}
setSelectedArticles={setSelectedArticles}
/>
</ModalBody>
</ModalContent>
)}
{/* <Icon
as={HiQuestionMarkCircle}
w={6}
h={6}
ml="auto"
color="disabled"
onClick={() => setIsOpenCrisp(true)}
/> */}
</Flex>
)}
<ObizOfferVariableContent
step={step}
setStep={setStep}
amount={amount}
setAmount={setAmount}
offer={offer}
articles={availableArticles}
createOrder={() => {
if (
availableArticles.length === 1 &&
availableArticles[0].kind === "variable_price"
) {
createTestOrder({
offer_id: offer.id,
article_references: [
{
reference: availableArticles[0].reference,
quantity: 1,
},
],
input_value: amount - (amount * discount) / 100,
input_value_public: amount,
});
} else {
createTestOrder({
offer_id: offer.id,
article_references: selectedArticles.map((article) => ({
reference: article.article.reference,
quantity: article.quantity,
})),
});
}
}}
selectedArticles={selectedArticles}
setSelectedArticles={setSelectedArticles}
/>
</ModalBody>
</ModalContent>
</Modal>
{isOpenCrisp && user && (
<CrispWithNoSSR
crispToken={CRISP_TOKEN}
user={user}
onClose={() => {
setIsOpenCrisp(false);
}}
/>
)}
</>
);
}
Loading

0 comments on commit 9c0cf32

Please sign in to comment.