Skip to content

Commit

Permalink
[ADDED] offline detector for every proceed button (#342)
Browse files Browse the repository at this point in the history
Signed-off-by: Zeeshan Mehboob <[email protected]>
  • Loading branch information
zesu22 authored Sep 9, 2024
1 parent f377acc commit 1b93758
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 37 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useCallback, useEffect, useRef, useState } from "react";
import { Detector } from "react-detect-offline";
import { useTranslation } from "react-i18next";

import { Button } from "~components/ui/button";
Expand Down Expand Up @@ -281,15 +282,19 @@ export const KycProviderList = ({
>
{t("cancel_button")}
</Button>
<Button
id="proceed-preview-button"
name="proceed-preview-button"
className="max-w-max px-[6rem] font-semibold sm:px-[2rem] xs:px-[1.5rem]"
onClick={handleContinue}
disabled={!selectedKycProvider}
>
{t("proceed_button")}
</Button>
<Detector
render={({ online }) => (
<Button
id="proceed-preview-button"
name="proceed-preview-button"
className="max-w-max px-[6rem] font-semibold sm:px-[2rem] xs:px-[1.5rem]"
onClick={handleContinue}
disabled={!online || !selectedKycProvider}
>
{t("proceed_button")}
</Button>
)}
/>
</div>
</StepFooter>
</Step>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useCallback, useEffect, useState } from "react";
import purify from "dompurify";
import i18next from "i18next";
import { Detector } from "react-detect-offline";
import { useTranslation } from "react-i18next";

import { ActionMessage } from "~components/ui/action-message";
Expand Down Expand Up @@ -189,17 +190,15 @@ export const TermsAndCondition = ({
)}
</StepContent>
<StepAlert>
<ActionMessage className="justify-start tnc-consent">
<ActionMessage className="tnc-consent justify-start">
<Checkbox
id="consent-button"
checked={agreeTerms}
onCheckedChange={changeAgreeTerms}
disabled={!termsAndCondition}
className="h-5 w-5 rounded-[2px] text-white data-[state=checked]:border-primary data-[state=checked]:bg-primary"
/>
<p className="ml-2 tnc-consent-text">
{t("agree_text")}
</p>
<p className="tnc-consent-text ml-2">{t("agree_text")}</p>
</ActionMessage>
</StepAlert>
<StepDivider />
Expand All @@ -214,15 +213,19 @@ export const TermsAndCondition = ({
>
{t("cancel_button")}
</Button>
<Button
id="proceed-tnc-button"
name="proceed-tnc-button"
className="w-full p-4 font-semibold"
onClick={handleContinue}
disabled={!agreeTerms}
>
{t("proceed_button")}
</Button>
<Detector
render={({ online }) => (
<Button
id="proceed-tnc-button"
name="proceed-tnc-button"
className="w-full p-4 font-semibold"
onClick={handleContinue}
disabled={!online || !agreeTerms}
>
{t("proceed_button")}
</Button>
)}
/>
</div>
</StepFooter>
</Step>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useCallback, useEffect, useState } from "react";
import Stepper from "@keyvaluesystems/react-stepper";
import { Detector } from "react-detect-offline";
import { useTranslation } from "react-i18next";
import { useNavigate } from "react-router-dom";

Expand Down Expand Up @@ -190,12 +191,17 @@ export const VerificationSteps = ({
>
{t("cancel")}
</Button>
<Button
className="px-[6rem] font-semibold sm:w-full sm:p-4"
onClick={handleContinue}
>
{t("proceed")}
</Button>
<Detector
render={({ online }) => (
<Button
className="px-[6rem] font-semibold sm:w-full sm:p-4"
onClick={handleContinue}
disabled={!online}
>
{t("proceed")}
</Button>
)}
/>
</div>
</StepFooter>
</Step>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useCallback, useEffect, useRef, useState } from "react";
import { Detector } from "react-detect-offline";
import { useTranslation } from "react-i18next";
import { useLocation } from "react-router-dom";
import Webcam from "react-webcam";
Expand Down Expand Up @@ -211,15 +212,19 @@ export const VideoPreview = ({
>
{t("cancel_button")}
</Button>
<Button
id="proceed-preview-button"
name="proceed-preview-button"
className="w-full p-4 font-semibold"
onClick={handleContinue}
disabled={!permissionGranted}
>
{t("proceed_button")}
</Button>
<Detector
render={({ online }) => (
<Button
id="proceed-preview-button"
name="proceed-preview-button"
className="w-full p-4 font-semibold"
onClick={handleContinue}
disabled={!online || !permissionGranted}
>
{t("proceed_button")}
</Button>
)}
/>
</div>
</StepFooter>
</Step>
Expand Down

0 comments on commit 1b93758

Please sign in to comment.