Skip to content

Commit

Permalink
Merge pull request #167 from SocialGouv/fix/remove-tmp-crisp
Browse files Browse the repository at this point in the history
fix: remove crisp component from all pages
  • Loading branch information
ClementNumericite authored Dec 13, 2024
2 parents aa3f4a6 + 156b1e1 commit f5f68ae
Show file tree
Hide file tree
Showing 6 changed files with 125 additions and 240 deletions.
5 changes: 2 additions & 3 deletions webapp/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
## [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))
- 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)

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 f5f68ae

Please sign in to comment.