mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-02 13:18:18 +00:00
Temporarily remove the OTP feature on the settings page while we fix our number
This commit is contained in:
@@ -1173,146 +1173,6 @@ export default function SettingsView() {
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="section grid gap-8">
|
||||
<div id="clients" className="text-2xl">
|
||||
Clients
|
||||
</div>
|
||||
<div className="cards flex flex-col flex-wrap gap-8">
|
||||
{!userConfig.anonymous_mode && <ApiKeyCard />}
|
||||
<Card className={`${cardClassName} lg:w-2/3`}>
|
||||
<CardHeader className="text-xl flex flex-row">
|
||||
<WhatsappLogo className="h-7 w-7 mr-2" />
|
||||
Chat on Whatsapp
|
||||
{(numberValidationState ===
|
||||
PhoneNumberValidationState.Verified && (
|
||||
<CheckCircle
|
||||
weight="bold"
|
||||
className="h-4 w-4 ml-1 text-green-400"
|
||||
/>
|
||||
)) ||
|
||||
(numberValidationState !==
|
||||
PhoneNumberValidationState.Setup && (
|
||||
<ExclamationMark
|
||||
weight="bold"
|
||||
className="h-4 w-4 ml-1 text-yellow-400"
|
||||
/>
|
||||
))}
|
||||
</CardHeader>
|
||||
<CardContent className="grid gap-4">
|
||||
<p className="text-gray-400">
|
||||
Connect your number to chat with Khoj on
|
||||
WhatsApp. Learn more about the integration{" "}
|
||||
<a href="https://docs.khoj.dev/clients/whatsapp">
|
||||
here
|
||||
</a>
|
||||
.
|
||||
</p>
|
||||
<div>
|
||||
<IntlTelInput
|
||||
initialValue={phoneNumber || ""}
|
||||
onChangeNumber={setPhoneNumber}
|
||||
disabled={
|
||||
numberValidationState ===
|
||||
PhoneNumberValidationState.VerifyOTP
|
||||
}
|
||||
initOptions={{
|
||||
separateDialCode: true,
|
||||
initialCountry: "af",
|
||||
utilsScript:
|
||||
"https://assets.khoj.dev/intl-tel-input%4023.8.0_build_js_utils.js",
|
||||
containerClass: `${styles.phoneInput}`,
|
||||
}}
|
||||
/>
|
||||
{numberValidationState ===
|
||||
PhoneNumberValidationState.VerifyOTP && (
|
||||
<>
|
||||
<p>{`Enter the OTP sent to your number: ${phoneNumber}`}</p>
|
||||
<InputOTP
|
||||
autoFocus={true}
|
||||
maxLength={6}
|
||||
value={otp || ""}
|
||||
onChange={setOTP}
|
||||
onComplete={() =>
|
||||
setNumberValidationState(
|
||||
PhoneNumberValidationState.VerifyOTP,
|
||||
)
|
||||
}
|
||||
>
|
||||
<InputOTPGroup>
|
||||
<InputOTPSlot index={0} />
|
||||
<InputOTPSlot index={1} />
|
||||
<InputOTPSlot index={2} />
|
||||
<InputOTPSlot index={3} />
|
||||
<InputOTPSlot index={4} />
|
||||
<InputOTPSlot index={5} />
|
||||
</InputOTPGroup>
|
||||
</InputOTP>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</CardContent>
|
||||
<CardFooter className="flex flex-wrap gap-4">
|
||||
{(numberValidationState ===
|
||||
PhoneNumberValidationState.VerifyOTP && (
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={verifyOTP}
|
||||
>
|
||||
Verify
|
||||
</Button>
|
||||
)) || (
|
||||
<Button
|
||||
variant="outline"
|
||||
disabled={
|
||||
!phoneNumber ||
|
||||
(phoneNumber ===
|
||||
userConfig.phone_number &&
|
||||
numberValidationState ===
|
||||
PhoneNumberValidationState.Verified) ||
|
||||
!isValidPhoneNumber(phoneNumber)
|
||||
}
|
||||
onClick={sendOTP}
|
||||
>
|
||||
{!userConfig.phone_number ? (
|
||||
<>
|
||||
<Plugs className="inline mr-2" />
|
||||
Setup Whatsapp
|
||||
</>
|
||||
) : !phoneNumber ||
|
||||
(phoneNumber ===
|
||||
userConfig.phone_number &&
|
||||
numberValidationState ===
|
||||
PhoneNumberValidationState.Verified) ||
|
||||
!isValidPhoneNumber(phoneNumber) ? (
|
||||
<>
|
||||
<PlugsConnected className="inline mr-2 text-green-400" />
|
||||
Switch Number
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
Send OTP{" "}
|
||||
<ArrowRight
|
||||
className="inline ml-2"
|
||||
weight="bold"
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
)}
|
||||
{numberValidationState ===
|
||||
PhoneNumberValidationState.Verified && (
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={() => disconnectNumber()}
|
||||
>
|
||||
<CloudSlash className="h-5 w-5 mr-2" />
|
||||
Disconnect
|
||||
</Button>
|
||||
)}
|
||||
</CardFooter>
|
||||
</Card>
|
||||
</div>
|
||||
</div>
|
||||
<div className="section grid gap-8">
|
||||
<div id="clients" className="text-2xl">
|
||||
Account
|
||||
|
||||
Reference in New Issue
Block a user