enhance otp desktop screen styles
This commit is contained in:
@@ -22,6 +22,25 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.restaurantCoverContainer {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.restaurantCover {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.otpContentWrapper {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
.otpContainer {
|
.otpContainer {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
@@ -88,6 +107,68 @@
|
|||||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
|
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Desktop devices (min-width: 1025px) */
|
||||||
|
@media (min-width: 1025px) {
|
||||||
|
.otpPage {
|
||||||
|
padding: 0;
|
||||||
|
align-items: stretch;
|
||||||
|
max-width: 100%;
|
||||||
|
margin: 0;
|
||||||
|
height: 100vh;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.otpWrapper {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
height: 100vh;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 1920px;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.restaurantCoverContainer {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.restaurantCover {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
|
||||||
|
.otpContentWrapper {
|
||||||
|
background-color: var(--background);
|
||||||
|
padding: 60px 10vw;
|
||||||
|
border-radius: 0;
|
||||||
|
box-shadow: none;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
overflow-y: auto;
|
||||||
|
margin: 0 auto;
|
||||||
|
width: 100%;
|
||||||
|
height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.otpContainer {
|
||||||
|
max-width: 100%;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(.ant-app-rtl) .otpWrapper {
|
||||||
|
direction: rtl;
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(.ant-app-rtl) .otpWrapper {
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
}
|
||||||
|
|
||||||
.productContainer :global(.ant-radio-wrapper:last-child) {
|
.productContainer :global(.ant-radio-wrapper:last-child) {
|
||||||
width: 100% !important;
|
width: 100% !important;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,21 @@
|
|||||||
import { Button, Layout, Space, message } from "antd";
|
import { Button, Layout, Space, message } from "antd";
|
||||||
|
import ImageWithFallback from "components/ImageWithFallback";
|
||||||
import OtpIcon from "components/Icons/otpIcon.tsx";
|
import OtpIcon from "components/Icons/otpIcon.tsx";
|
||||||
import OtpInput from "components/OtpInput/OtpInput";
|
import OtpInput from "components/OtpInput/OtpInput";
|
||||||
|
import ProHeader from "components/ProHeader/ProHeader";
|
||||||
import ProText from "components/ProText";
|
import ProText from "components/ProText";
|
||||||
import ProTitle from "components/ProTitle";
|
import ProTitle from "components/ProTitle";
|
||||||
import { loginSuccess } from "features/auth/authSlice";
|
import { loginSuccess } from "features/auth/authSlice";
|
||||||
|
import useBreakPoint from "hooks/useBreakPoint";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useNavigate, useParams } from "react-router-dom";
|
import { useNavigate, useParams } from "react-router-dom";
|
||||||
import { useConfirmOtpMutation, useSendOtpMutation } from "redux/api/auth";
|
import { useConfirmOtpMutation, useSendOtpMutation } from "redux/api/auth";
|
||||||
|
import { useGetRestaurantDetailsQuery } from "redux/api/others";
|
||||||
import { useAppDispatch } from "redux/hooks";
|
import { useAppDispatch } from "redux/hooks";
|
||||||
import { ProGray1 } from "ThemeConstants";
|
import { ProGray1 } from "ThemeConstants";
|
||||||
|
import { default_image } from "utils/constants";
|
||||||
import styles from "./otp.module.css";
|
import styles from "./otp.module.css";
|
||||||
import ProHeader from "components/ProHeader/ProHeader";
|
|
||||||
import useBreakPoint from "hooks/useBreakPoint";
|
|
||||||
|
|
||||||
export default function OtpPage() {
|
export default function OtpPage() {
|
||||||
const { subdomain } = useParams();
|
const { subdomain } = useParams();
|
||||||
@@ -22,6 +25,9 @@ export default function OtpPage() {
|
|||||||
const [confirmOtp, { isLoading: isConfirmLoading }] = useConfirmOtpMutation();
|
const [confirmOtp, { isLoading: isConfirmLoading }] = useConfirmOtpMutation();
|
||||||
const [otp, setOtp] = useState<string>("");
|
const [otp, setOtp] = useState<string>("");
|
||||||
const { isTablet } = useBreakPoint();
|
const { isTablet } = useBreakPoint();
|
||||||
|
const { data: restaurant } = useGetRestaurantDetailsQuery(subdomain, {
|
||||||
|
skip: !subdomain,
|
||||||
|
});
|
||||||
const handleOtpSave = (otp: string) => {
|
const handleOtpSave = (otp: string) => {
|
||||||
try {
|
try {
|
||||||
setOtp(otp);
|
setOtp(otp);
|
||||||
@@ -35,58 +41,74 @@ export default function OtpPage() {
|
|||||||
<Layout className={styles.otpPage}>
|
<Layout className={styles.otpPage}>
|
||||||
{isTablet ? <ProHeader>{t("otp.verification")}</ProHeader> : null}
|
{isTablet ? <ProHeader>{t("otp.verification")}</ProHeader> : null}
|
||||||
|
|
||||||
<Layout.Content className={styles.otpWrapper}>
|
<div className={styles.otpWrapper}>
|
||||||
<div className={styles.otpContainer}>
|
{/* Restaurant Cover Image - Desktop Only */}
|
||||||
<OtpIcon />
|
<div className={styles.restaurantCoverContainer}>
|
||||||
|
<ImageWithFallback
|
||||||
<div className={styles.otpContent}>
|
src={restaurant?.restaurant_cover}
|
||||||
<ProTitle level={4} className={styles.otpTitle}>
|
fallbackSrc={default_image}
|
||||||
{t("otp.verification")}
|
alt={t("otp.restaurantCover")}
|
||||||
</ProTitle>
|
className={styles.restaurantCover}
|
||||||
<ProText style={{ color: ProGray1 }}>
|
width="100%"
|
||||||
{t("otp.enterThe4DigitCodeThatSentToYourPhoneNumber")}
|
height="100%"
|
||||||
</ProText>
|
preview={false}
|
||||||
<br />
|
/>
|
||||||
<ProText style={{ color: ProGray1 }}>
|
|
||||||
{localStorage.getItem("otp")}
|
|
||||||
</ProText>
|
|
||||||
</div>
|
|
||||||
<div className={styles.otpInputContainer}>
|
|
||||||
<Space size="small">
|
|
||||||
<OtpInput
|
|
||||||
length={5}
|
|
||||||
onComplete={handleOtpSave}
|
|
||||||
resendOtp={() =>
|
|
||||||
sendOtp({
|
|
||||||
phone: localStorage.getItem("userPhone") || "",
|
|
||||||
})
|
|
||||||
}
|
|
||||||
isLoading={isLoading || isConfirmLoading}
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
</div>
|
|
||||||
<Button
|
|
||||||
type="primary"
|
|
||||||
shape="round"
|
|
||||||
className={styles.otpButton}
|
|
||||||
disabled={!otp || otp.length < 5 || isConfirmLoading}
|
|
||||||
onClick={() => {
|
|
||||||
confirmOtp({
|
|
||||||
otp: otp,
|
|
||||||
phone: localStorage.getItem("userPhone"),
|
|
||||||
})
|
|
||||||
.unwrap()
|
|
||||||
.then((response) => {
|
|
||||||
dispatch(loginSuccess(response));
|
|
||||||
message.info(t("otp.confirmOTPSuccess"));
|
|
||||||
navigate(`/${subdomain}/menu`);
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{t("otp.continue")}
|
|
||||||
</Button>
|
|
||||||
</div>
|
</div>
|
||||||
</Layout.Content>
|
|
||||||
|
{/* OTP Form Container */}
|
||||||
|
<Layout.Content className={styles.otpContentWrapper}>
|
||||||
|
<div className={styles.otpContainer}>
|
||||||
|
<OtpIcon />
|
||||||
|
|
||||||
|
<div className={styles.otpContent}>
|
||||||
|
<ProTitle level={4} className={styles.otpTitle}>
|
||||||
|
{t("otp.verification")}
|
||||||
|
</ProTitle>
|
||||||
|
<ProText style={{ color: ProGray1 }}>
|
||||||
|
{t("otp.enterThe4DigitCodeThatSentToYourPhoneNumber")}
|
||||||
|
</ProText>
|
||||||
|
<br />
|
||||||
|
<ProText style={{ color: ProGray1 }}>
|
||||||
|
{localStorage.getItem("otp")}
|
||||||
|
</ProText>
|
||||||
|
</div>
|
||||||
|
<div className={styles.otpInputContainer}>
|
||||||
|
<Space size="small">
|
||||||
|
<OtpInput
|
||||||
|
length={5}
|
||||||
|
onComplete={handleOtpSave}
|
||||||
|
resendOtp={() =>
|
||||||
|
sendOtp({
|
||||||
|
phone: localStorage.getItem("userPhone") || "",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
isLoading={isLoading || isConfirmLoading}
|
||||||
|
/>
|
||||||
|
</Space>
|
||||||
|
</div>
|
||||||
|
<Button
|
||||||
|
type="primary"
|
||||||
|
shape="round"
|
||||||
|
className={styles.otpButton}
|
||||||
|
disabled={!otp || otp.length < 5 || isConfirmLoading}
|
||||||
|
onClick={() => {
|
||||||
|
confirmOtp({
|
||||||
|
otp: otp,
|
||||||
|
phone: localStorage.getItem("userPhone"),
|
||||||
|
})
|
||||||
|
.unwrap()
|
||||||
|
.then((response) => {
|
||||||
|
dispatch(loginSuccess(response));
|
||||||
|
message.info(t("otp.confirmOTPSuccess"));
|
||||||
|
navigate(`/${subdomain}/menu`);
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{t("otp.continue")}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</Layout.Content>
|
||||||
|
</div>
|
||||||
</Layout>
|
</Layout>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user