mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-07 13:23:15 +00:00
Show connected icon when files or notion is indexed
This commit is contained in:
@@ -378,8 +378,8 @@ export default function SettingsView() {
|
|||||||
initialUserConfig?.is_phone_number_verified
|
initialUserConfig?.is_phone_number_verified
|
||||||
? PhoneNumberValidationState.Verified
|
? PhoneNumberValidationState.Verified
|
||||||
: initialUserConfig?.phone_number
|
: initialUserConfig?.phone_number
|
||||||
? PhoneNumberValidationState.SendOTP
|
? PhoneNumberValidationState.SendOTP
|
||||||
: PhoneNumberValidationState.Setup,
|
: PhoneNumberValidationState.Setup,
|
||||||
);
|
);
|
||||||
setName(initialUserConfig?.given_name);
|
setName(initialUserConfig?.given_name);
|
||||||
setNotionToken(initialUserConfig?.notion_token ?? null);
|
setNotionToken(initialUserConfig?.notion_token ?? null);
|
||||||
@@ -748,18 +748,18 @@ export default function SettingsView() {
|
|||||||
)) ||
|
)) ||
|
||||||
(userConfig.subscription_state ===
|
(userConfig.subscription_state ===
|
||||||
"unsubscribed" && (
|
"unsubscribed" && (
|
||||||
<>
|
<>
|
||||||
<p className="text-xl">Futurist</p>
|
<p className="text-xl">Futurist</p>
|
||||||
<p className="text-gray-400">
|
<p className="text-gray-400">
|
||||||
Subscription <b>ends</b> on{" "}
|
Subscription <b>ends</b> on{" "}
|
||||||
<b>
|
<b>
|
||||||
{
|
{
|
||||||
userConfig.subscription_renewal_date
|
userConfig.subscription_renewal_date
|
||||||
}
|
}
|
||||||
</b>
|
</b>
|
||||||
</p>
|
</p>
|
||||||
</>
|
</>
|
||||||
)) ||
|
)) ||
|
||||||
(userConfig.subscription_state === "expired" && (
|
(userConfig.subscription_state === "expired" && (
|
||||||
<>
|
<>
|
||||||
<p className="text-xl">Free Plan</p>
|
<p className="text-xl">Free Plan</p>
|
||||||
@@ -773,17 +773,17 @@ export default function SettingsView() {
|
|||||||
</b>
|
</b>
|
||||||
</p>
|
</p>
|
||||||
)) || (
|
)) || (
|
||||||
<p className="text-gray-400">
|
<p className="text-gray-400">
|
||||||
Check{" "}
|
Check{" "}
|
||||||
<a
|
<a
|
||||||
href="https://khoj.dev/pricing"
|
href="https://khoj.dev/pricing"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
>
|
>
|
||||||
pricing page
|
pricing page
|
||||||
</a>{" "}
|
</a>{" "}
|
||||||
to compare plans.
|
to compare plans.
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
))}
|
))}
|
||||||
</CardContent>
|
</CardContent>
|
||||||
@@ -800,20 +800,20 @@ export default function SettingsView() {
|
|||||||
)) ||
|
)) ||
|
||||||
(userConfig.subscription_state ==
|
(userConfig.subscription_state ==
|
||||||
"unsubscribed" && (
|
"unsubscribed" && (
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
className="text-primary/80 hover:text-primary"
|
className="text-primary/80 hover:text-primary"
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
setSubscription("resubscribe")
|
setSubscription("resubscribe")
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<ArrowCircleUp
|
<ArrowCircleUp
|
||||||
weight="bold"
|
weight="bold"
|
||||||
className="h-5 w-5 mr-2"
|
className="h-5 w-5 mr-2"
|
||||||
/>
|
/>
|
||||||
Resubscribe
|
Resubscribe
|
||||||
</Button>
|
</Button>
|
||||||
)) || (
|
)) || (
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
className="text-primary/80 hover:text-primary"
|
className="text-primary/80 hover:text-primary"
|
||||||
@@ -848,6 +848,11 @@ export default function SettingsView() {
|
|||||||
<CardHeader className="flex flex-row text-2xl">
|
<CardHeader className="flex flex-row text-2xl">
|
||||||
<Laptop className="h-8 w-8 mr-2" />
|
<Laptop className="h-8 w-8 mr-2" />
|
||||||
Files
|
Files
|
||||||
|
{
|
||||||
|
userConfig.enabled_content_source.computer && (
|
||||||
|
<CheckCircle className="h-6 w-6 ml-auto text-green-500" weight="fill" />
|
||||||
|
)
|
||||||
|
}
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent className="overflow-hidden pb-12 text-gray-400">
|
<CardContent className="overflow-hidden pb-12 text-gray-400">
|
||||||
Manage your synced files
|
Manage your synced files
|
||||||
@@ -890,11 +895,11 @@ export default function SettingsView() {
|
|||||||
Manage
|
Manage
|
||||||
</>
|
</>
|
||||||
)) || (
|
)) || (
|
||||||
<>
|
<>
|
||||||
<Plugs className="h-5 w-5 inline mr-1" />
|
<Plugs className="h-5 w-5 inline mr-1" />
|
||||||
Connect
|
Connect
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
@@ -910,13 +915,15 @@ export default function SettingsView() {
|
|||||||
<CardHeader className="text-xl flex flex-row">
|
<CardHeader className="text-xl flex flex-row">
|
||||||
<NotionLogo className="h-7 w-7 mr-2" />
|
<NotionLogo className="h-7 w-7 mr-2" />
|
||||||
Notion
|
Notion
|
||||||
|
{
|
||||||
|
userConfig.enabled_content_source.notion && (
|
||||||
|
<CheckCircle className="h-6 w-6 ml-auto text-green-500" weight="fill" />
|
||||||
|
)
|
||||||
|
}
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent className="grid gap-4">
|
<CardContent className="grid gap-4">
|
||||||
<p className="text-gray-400">
|
<p className="text-gray-400">
|
||||||
Sync your Notion pages. See the{" "}
|
Sync your Notion workspace.
|
||||||
<a href="https://docs.khoj.dev/data-sources/notion_integration/">
|
|
||||||
setup instructions
|
|
||||||
</a>
|
|
||||||
</p>
|
</p>
|
||||||
{!userConfig.notion_oauth_url && (
|
{!userConfig.notion_oauth_url && (
|
||||||
<Input
|
<Input
|
||||||
@@ -931,7 +938,7 @@ export default function SettingsView() {
|
|||||||
{
|
{
|
||||||
/* Show connect to notion button if notion oauth url setup and user disconnected*/
|
/* Show connect to notion button if notion oauth url setup and user disconnected*/
|
||||||
userConfig.notion_oauth_url &&
|
userConfig.notion_oauth_url &&
|
||||||
!userConfig.enabled_content_source.notion ? (
|
!userConfig.enabled_content_source.notion ? (
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
size="sm"
|
size="sm"
|
||||||
@@ -945,35 +952,35 @@ export default function SettingsView() {
|
|||||||
Connect
|
Connect
|
||||||
</Button>
|
</Button>
|
||||||
) : /* Show sync button if user connected to notion and API key unchanged */
|
) : /* Show sync button if user connected to notion and API key unchanged */
|
||||||
userConfig.enabled_content_source.notion &&
|
userConfig.enabled_content_source.notion &&
|
||||||
notionToken === userConfig.notion_token ? (
|
notionToken === userConfig.notion_token ? (
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={() => syncContent("notion")}
|
onClick={() => syncContent("notion")}
|
||||||
>
|
>
|
||||||
<ArrowsClockwise className="h-5 w-5 inline mr-1" />
|
<ArrowsClockwise className="h-5 w-5 inline mr-1" />
|
||||||
Sync
|
Sync
|
||||||
</Button>
|
</Button>
|
||||||
) : /* Show set API key button notion oauth url not set setup */
|
) : /* Show set API key button notion oauth url not set setup */
|
||||||
!userConfig.notion_oauth_url ? (
|
!userConfig.notion_oauth_url ? (
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={saveNotionToken}
|
onClick={saveNotionToken}
|
||||||
disabled={
|
disabled={
|
||||||
notionToken === userConfig.notion_token
|
notionToken === userConfig.notion_token
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<FloppyDisk className="h-5 w-5 inline mr-1" />
|
<FloppyDisk className="h-5 w-5 inline mr-1" />
|
||||||
{(userConfig.enabled_content_source
|
{(userConfig.enabled_content_source
|
||||||
.notion &&
|
.notion &&
|
||||||
"Update API Key") ||
|
"Update API Key") ||
|
||||||
"Set API Key"}
|
"Set API Key"}
|
||||||
</Button>
|
</Button>
|
||||||
) : (
|
) : (
|
||||||
<></>
|
<></>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
@@ -1188,18 +1195,18 @@ export default function SettingsView() {
|
|||||||
Chat on Whatsapp
|
Chat on Whatsapp
|
||||||
{(numberValidationState ===
|
{(numberValidationState ===
|
||||||
PhoneNumberValidationState.Verified && (
|
PhoneNumberValidationState.Verified && (
|
||||||
<CheckCircle
|
<CheckCircle
|
||||||
weight="bold"
|
weight="bold"
|
||||||
className="h-4 w-4 ml-1 text-green-400"
|
className="h-4 w-4 ml-1 text-green-400"
|
||||||
/>
|
/>
|
||||||
)) ||
|
)) ||
|
||||||
(numberValidationState !==
|
(numberValidationState !==
|
||||||
PhoneNumberValidationState.Setup && (
|
PhoneNumberValidationState.Setup && (
|
||||||
<ExclamationMark
|
<ExclamationMark
|
||||||
weight="bold"
|
weight="bold"
|
||||||
className="h-4 w-4 ml-1 text-yellow-400"
|
className="h-4 w-4 ml-1 text-yellow-400"
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent className="grid gap-4">
|
<CardContent className="grid gap-4">
|
||||||
<p className="text-gray-400">
|
<p className="text-gray-400">
|
||||||
@@ -1228,85 +1235,85 @@ export default function SettingsView() {
|
|||||||
/>
|
/>
|
||||||
{numberValidationState ===
|
{numberValidationState ===
|
||||||
PhoneNumberValidationState.VerifyOTP && (
|
PhoneNumberValidationState.VerifyOTP && (
|
||||||
<>
|
<>
|
||||||
<p>{`Enter the OTP sent to your number: ${phoneNumber}`}</p>
|
<p>{`Enter the OTP sent to your number: ${phoneNumber}`}</p>
|
||||||
<InputOTP
|
<InputOTP
|
||||||
autoFocus={true}
|
autoFocus={true}
|
||||||
maxLength={6}
|
maxLength={6}
|
||||||
value={otp || ""}
|
value={otp || ""}
|
||||||
onChange={setOTP}
|
onChange={setOTP}
|
||||||
onComplete={() =>
|
onComplete={() =>
|
||||||
setNumberValidationState(
|
setNumberValidationState(
|
||||||
PhoneNumberValidationState.VerifyOTP,
|
PhoneNumberValidationState.VerifyOTP,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<InputOTPGroup>
|
<InputOTPGroup>
|
||||||
<InputOTPSlot index={0} />
|
<InputOTPSlot index={0} />
|
||||||
<InputOTPSlot index={1} />
|
<InputOTPSlot index={1} />
|
||||||
<InputOTPSlot index={2} />
|
<InputOTPSlot index={2} />
|
||||||
<InputOTPSlot index={3} />
|
<InputOTPSlot index={3} />
|
||||||
<InputOTPSlot index={4} />
|
<InputOTPSlot index={4} />
|
||||||
<InputOTPSlot index={5} />
|
<InputOTPSlot index={5} />
|
||||||
</InputOTPGroup>
|
</InputOTPGroup>
|
||||||
</InputOTP>
|
</InputOTP>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
<CardFooter className="flex flex-wrap gap-4">
|
<CardFooter className="flex flex-wrap gap-4">
|
||||||
{(numberValidationState ===
|
{(numberValidationState ===
|
||||||
PhoneNumberValidationState.VerifyOTP && (
|
PhoneNumberValidationState.VerifyOTP && (
|
||||||
<Button variant="outline" onClick={verifyOTP}>
|
<Button variant="outline" onClick={verifyOTP}>
|
||||||
Verify
|
Verify
|
||||||
</Button>
|
</Button>
|
||||||
)) || (
|
)) || (
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
disabled={
|
disabled={
|
||||||
!phoneNumber ||
|
!phoneNumber ||
|
||||||
(phoneNumber === userConfig.phone_number &&
|
(phoneNumber === userConfig.phone_number &&
|
||||||
numberValidationState ===
|
numberValidationState ===
|
||||||
PhoneNumberValidationState.Verified) ||
|
PhoneNumberValidationState.Verified) ||
|
||||||
!isValidPhoneNumber(phoneNumber)
|
!isValidPhoneNumber(phoneNumber)
|
||||||
}
|
}
|
||||||
onClick={sendOTP}
|
onClick={sendOTP}
|
||||||
>
|
>
|
||||||
{!userConfig.phone_number ? (
|
{!userConfig.phone_number ? (
|
||||||
<>
|
<>
|
||||||
<Plugs className="inline mr-2" />
|
<Plugs className="inline mr-2" />
|
||||||
Setup Whatsapp
|
Setup Whatsapp
|
||||||
</>
|
</>
|
||||||
) : !phoneNumber ||
|
) : !phoneNumber ||
|
||||||
(phoneNumber === userConfig.phone_number &&
|
(phoneNumber === userConfig.phone_number &&
|
||||||
numberValidationState ===
|
numberValidationState ===
|
||||||
PhoneNumberValidationState.Verified) ||
|
PhoneNumberValidationState.Verified) ||
|
||||||
!isValidPhoneNumber(phoneNumber) ? (
|
!isValidPhoneNumber(phoneNumber) ? (
|
||||||
<>
|
<>
|
||||||
<PlugsConnected className="inline mr-2 text-green-400" />
|
<PlugsConnected className="inline mr-2 text-green-400" />
|
||||||
Switch Number
|
Switch Number
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
Send OTP{" "}
|
Send OTP{" "}
|
||||||
<ArrowRight
|
<ArrowRight
|
||||||
className="inline ml-2"
|
className="inline ml-2"
|
||||||
weight="bold"
|
weight="bold"
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
{numberValidationState ===
|
{numberValidationState ===
|
||||||
PhoneNumberValidationState.Verified && (
|
PhoneNumberValidationState.Verified && (
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
onClick={() => disconnectNumber()}
|
onClick={() => disconnectNumber()}
|
||||||
>
|
>
|
||||||
<CloudSlash className="h-5 w-5 mr-2" />
|
<CloudSlash className="h-5 w-5 mr-2" />
|
||||||
Disconnect
|
Disconnect
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
</CardFooter>
|
</CardFooter>
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user