mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-10 16:22:38 +02:00
chore: linting
This commit is contained in:
parent
0201fd319d
commit
5c8769508f
11 changed files with 71 additions and 61 deletions
|
|
@ -4,7 +4,14 @@ import { CircleSlash2 } from "lucide-react";
|
|||
import Link from "next/link";
|
||||
import { useParams } from "next/navigation";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardFooter,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@/components/ui/card";
|
||||
|
||||
export default function PurchaseCancelPage() {
|
||||
const params = useParams();
|
||||
|
|
@ -16,7 +23,9 @@ export default function PurchaseCancelPage() {
|
|||
<CardHeader className="text-center">
|
||||
<CircleSlash2 className="mx-auto h-10 w-10 text-muted-foreground" />
|
||||
<CardTitle className="text-2xl">Checkout canceled</CardTitle>
|
||||
<CardDescription>No charge was made and your current pages are unchanged.</CardDescription>
|
||||
<CardDescription>
|
||||
No charge was made and your current pages are unchanged.
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="text-center text-sm text-muted-foreground">
|
||||
You can return to the pricing options and try again whenever you're ready.
|
||||
|
|
|
|||
|
|
@ -7,7 +7,14 @@ import { useParams } from "next/navigation";
|
|||
import { useEffect } from "react";
|
||||
import { USER_QUERY_KEY } from "@/atoms/user/user-query.atoms";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardFooter,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@/components/ui/card";
|
||||
|
||||
export default function PurchaseSuccessPage() {
|
||||
const params = useParams();
|
||||
|
|
|
|||
|
|
@ -17,9 +17,18 @@ import { stripeApiService } from "@/lib/apis/stripe-api.service";
|
|||
import { cn } from "@/lib/utils";
|
||||
|
||||
const STATUS_STYLES: Record<PagePurchaseStatus, { label: string; className: string }> = {
|
||||
completed: { label: "Completed", className: "bg-emerald-600 text-white border-transparent hover:bg-emerald-600" },
|
||||
pending: { label: "Pending", className: "bg-yellow-600 text-white border-transparent hover:bg-yellow-600" },
|
||||
failed: { label: "Failed", className: "bg-destructive text-white border-transparent hover:bg-destructive" },
|
||||
completed: {
|
||||
label: "Completed",
|
||||
className: "bg-emerald-600 text-white border-transparent hover:bg-emerald-600",
|
||||
},
|
||||
pending: {
|
||||
label: "Pending",
|
||||
className: "bg-yellow-600 text-white border-transparent hover:bg-yellow-600",
|
||||
},
|
||||
failed: {
|
||||
label: "Failed",
|
||||
className: "bg-destructive text-white border-transparent hover:bg-destructive",
|
||||
},
|
||||
};
|
||||
|
||||
function formatDate(iso: string): string {
|
||||
|
|
@ -82,9 +91,7 @@ export function PurchaseHistoryContent() {
|
|||
const style = STATUS_STYLES[p.status];
|
||||
return (
|
||||
<TableRow key={p.id}>
|
||||
<TableCell className="text-sm">
|
||||
{formatDate(p.created_at)}
|
||||
</TableCell>
|
||||
<TableCell className="text-sm">{formatDate(p.created_at)}</TableCell>
|
||||
<TableCell className="text-right tabular-nums text-sm">
|
||||
{p.pages_granted.toLocaleString()}
|
||||
</TableCell>
|
||||
|
|
@ -92,9 +99,7 @@ export function PurchaseHistoryContent() {
|
|||
{formatAmount(p)}
|
||||
</TableCell>
|
||||
<TableCell className="text-center">
|
||||
<Badge className={cn("text-[10px]", style.className)}>
|
||||
{style.label}
|
||||
</Badge>
|
||||
<Badge className={cn("text-[10px]", style.className)}>{style.label}</Badge>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -160,10 +160,7 @@ export const AllConnectorsTab: FC<AllConnectorsTabProps> = ({
|
|||
: [];
|
||||
|
||||
const accountCount = typeConnectors.length;
|
||||
const documentCount = getDocumentCountForConnector(
|
||||
connector.connectorType,
|
||||
documentTypeCounts
|
||||
);
|
||||
const documentCount = getDocumentCountForConnector(connector.connectorType, documentTypeCounts);
|
||||
const isIndexing = typeConnectors.some((c) => indexingConnectorIds?.has(c.id));
|
||||
|
||||
return (
|
||||
|
|
@ -199,18 +196,14 @@ export const AllConnectorsTab: FC<AllConnectorsTabProps> = ({
|
|||
)
|
||||
: undefined;
|
||||
|
||||
const documentCount = getDocumentCountForConnector(
|
||||
connector.connectorType,
|
||||
documentTypeCounts
|
||||
);
|
||||
const documentCount = getDocumentCountForConnector(connector.connectorType, documentTypeCounts);
|
||||
const isIndexing = actualConnector && indexingConnectorIds?.has(actualConnector.id);
|
||||
|
||||
const isMCP = connector.connectorType === EnumConnectorName.MCP_CONNECTOR;
|
||||
const mcpConnectorCount =
|
||||
isMCP && allConnectors
|
||||
? allConnectors.filter(
|
||||
(c: SearchSourceConnector) =>
|
||||
c.connector_type === EnumConnectorName.MCP_CONNECTOR
|
||||
(c: SearchSourceConnector) => c.connector_type === EnumConnectorName.MCP_CONNECTOR
|
||||
).length
|
||||
: undefined;
|
||||
|
||||
|
|
@ -231,9 +224,7 @@ export const AllConnectorsTab: FC<AllConnectorsTabProps> = ({
|
|||
connectorCount={mcpConnectorCount}
|
||||
isIndexing={isIndexing}
|
||||
onConnect={handleConnect}
|
||||
onManage={
|
||||
actualConnector && onManage ? () => onManage(actualConnector) : undefined
|
||||
}
|
||||
onManage={actualConnector && onManage ? () => onManage(actualConnector) : undefined}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
|
@ -241,9 +232,7 @@ export const AllConnectorsTab: FC<AllConnectorsTabProps> = ({
|
|||
const renderCrawlerCard = (crawler: CrawlerConnector) => {
|
||||
const isYouTube = crawler.id === "youtube-crawler";
|
||||
const isWebcrawler = crawler.id === "webcrawler-connector";
|
||||
const isConnected = crawler.connectorType
|
||||
? connectedTypes.has(crawler.connectorType)
|
||||
: false;
|
||||
const isConnected = crawler.connectorType ? connectedTypes.has(crawler.connectorType) : false;
|
||||
const isConnecting = connectingId === crawler.id;
|
||||
|
||||
const actualConnector =
|
||||
|
|
@ -283,9 +272,7 @@ export const AllConnectorsTab: FC<AllConnectorsTabProps> = ({
|
|||
documentCount={documentCount}
|
||||
isIndexing={isIndexing}
|
||||
onConnect={handleConnect}
|
||||
onManage={
|
||||
actualConnector && onManage ? () => onManage(actualConnector) : undefined
|
||||
}
|
||||
onManage={actualConnector && onManage ? () => onManage(actualConnector) : undefined}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -99,10 +99,7 @@ function StatusIcon({
|
|||
if (status === "background_sync") {
|
||||
return (
|
||||
<RefreshCw
|
||||
className={cn(
|
||||
"shrink-0 text-primary animate-[spin_3s_linear_infinite]",
|
||||
className
|
||||
)}
|
||||
className={cn("shrink-0 text-primary animate-[spin_3s_linear_infinite]", className)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,9 +54,7 @@ export function PageUsageDisplay({ pagesUsed, pagesLimit }: PageUsageDisplayProp
|
|||
<CreditCard className="h-3 w-3 shrink-0" />
|
||||
Buy Pages
|
||||
</span>
|
||||
<span className="text-[10px] font-medium text-muted-foreground">
|
||||
$1/1k
|
||||
</span>
|
||||
<span className="text-[10px] font-medium text-muted-foreground">$1/1k</span>
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -46,9 +46,7 @@ export function BuyPagesContent() {
|
|||
return (
|
||||
<div className="w-full space-y-3 text-center">
|
||||
<h2 className="text-xl font-bold tracking-tight">Buy Pages</h2>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Page purchases are temporarily unavailable.
|
||||
</p>
|
||||
<p className="text-sm text-muted-foreground">Page purchases are temporarily unavailable.</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -68,9 +66,7 @@ export function BuyPagesContent() {
|
|||
<div className="w-full space-y-5">
|
||||
<div className="text-center">
|
||||
<h2 className="text-xl font-bold tracking-tight">Buy Pages</h2>
|
||||
<p className="mt-1 text-sm text-muted-foreground">
|
||||
$1 per 1,000 pages, pay as you go
|
||||
</p>
|
||||
<p className="mt-1 text-sm text-muted-foreground">$1 per 1,000 pages, pay as you go</p>
|
||||
</div>
|
||||
|
||||
<div className="space-y-3">
|
||||
|
|
@ -118,7 +114,9 @@ export function BuyPagesContent() {
|
|||
</div>
|
||||
|
||||
<div className="flex items-center justify-between rounded-lg border bg-muted/30 px-3 py-2">
|
||||
<span className="text-sm font-medium tabular-nums">{totalPages.toLocaleString()} pages</span>
|
||||
<span className="text-sm font-medium tabular-nums">
|
||||
{totalPages.toLocaleString()} pages
|
||||
</span>
|
||||
<span className="text-sm font-semibold tabular-nums">${totalPrice}</span>
|
||||
</div>
|
||||
|
||||
|
|
@ -133,12 +131,12 @@ export function BuyPagesContent() {
|
|||
Redirecting
|
||||
</>
|
||||
) : (
|
||||
<>Buy {totalPages.toLocaleString()} Pages for ${totalPrice}</>
|
||||
<>
|
||||
Buy {totalPages.toLocaleString()} Pages for ${totalPrice}
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
<p className="text-center text-[11px] text-muted-foreground">
|
||||
Secure checkout via Stripe
|
||||
</p>
|
||||
<p className="text-center text-[11px] text-muted-foreground">Secure checkout via Stripe</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -8,10 +8,7 @@ import { useEffect, useState } from "react";
|
|||
import { toast } from "sonner";
|
||||
import { USER_QUERY_KEY } from "@/atoms/user/user-query.atoms";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
} from "@/components/ui/card";
|
||||
import { Card, CardContent } from "@/components/ui/card";
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
|
|
@ -98,7 +95,11 @@ export function MorePagesContent() {
|
|||
Limited offer. Schedule a meeting or email us to claim.
|
||||
</p>
|
||||
</div>
|
||||
<Button size="sm" className="bg-emerald-600 text-white hover:bg-emerald-700" onClick={() => setClaimOpen(true)}>
|
||||
<Button
|
||||
size="sm"
|
||||
className="bg-emerald-600 text-white hover:bg-emerald-700"
|
||||
onClick={() => setClaimOpen(true)}
|
||||
>
|
||||
Claim
|
||||
</Button>
|
||||
</CardContent>
|
||||
|
|
@ -133,7 +134,11 @@ export function MorePagesContent() {
|
|||
task.completed ? "bg-primary text-primary-foreground" : "bg-muted"
|
||||
)}
|
||||
>
|
||||
{task.completed ? <Check className="h-3.5 w-3.5" /> : <span className="text-xs font-semibold">+{task.pages_reward}</span>}
|
||||
{task.completed ? (
|
||||
<Check className="h-3.5 w-3.5" />
|
||||
) : (
|
||||
<span className="text-xs font-semibold">+{task.pages_reward}</span>
|
||||
)}
|
||||
</div>
|
||||
<p
|
||||
className={cn(
|
||||
|
|
@ -199,7 +204,8 @@ export function MorePagesContent() {
|
|||
<DialogHeader>
|
||||
<DialogTitle>Claim 6,000 Free Pages</DialogTitle>
|
||||
<DialogDescription>
|
||||
Send us an email to claim your free 6,000 pages. Include your account email and primary usecase for free pages.
|
||||
Send us an email to claim your free 6,000 pages. Include your account email and
|
||||
primary usecase for free pages.
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
<Button asChild className="w-full gap-2">
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ export function sanitizeHref(href?: string): string | undefined {
|
|||
candidate.startsWith("#")
|
||||
) {
|
||||
if (candidate.startsWith("//")) return undefined;
|
||||
// eslint-disable-next-line no-control-regex -- intentionally matching control characters
|
||||
// biome-ignore lint/suspicious/noControlCharactersInRegex: intentionally matching control characters
|
||||
if (/[\u0000-\u001F\u007F]/.test(candidate)) return undefined;
|
||||
return candidate;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,9 +13,13 @@ class StripeApiService {
|
|||
createCheckoutSession = async (
|
||||
request: CreateCheckoutSessionRequest
|
||||
): Promise<CreateCheckoutSessionResponse> => {
|
||||
return baseApiService.post("/api/v1/stripe/create-checkout-session", createCheckoutSessionResponse, {
|
||||
body: request,
|
||||
});
|
||||
return baseApiService.post(
|
||||
"/api/v1/stripe/create-checkout-session",
|
||||
createCheckoutSessionResponse,
|
||||
{
|
||||
body: request,
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
getPurchases = async (): Promise<GetPagePurchasesResponse> => {
|
||||
|
|
|
|||
|
|
@ -45,4 +45,3 @@ export const isSelfHosted = () => DEPLOYMENT_MODE === "self-hosted";
|
|||
|
||||
// Helper to check if running in cloud mode
|
||||
export const isCloud = () => DEPLOYMENT_MODE === "cloud";
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue