mirror of
https://github.com/karakeep-app/karakeep.git
synced 2025-12-12 20:35:52 +01:00
some fixes
This commit is contained in:
@@ -16,7 +16,7 @@ import { useBookmarkImport } from "@/lib/hooks/useBookmarkImport";
|
||||
import { useTranslation } from "@/lib/i18n/client";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { AlertCircle, Download, Loader2, Upload, X } from "lucide-react";
|
||||
import { AlertCircle, Download, Loader2, Upload } from "lucide-react";
|
||||
|
||||
import { Card, CardContent } from "../ui/card";
|
||||
import { toast } from "../ui/use-toast";
|
||||
@@ -132,7 +132,7 @@ function ExportButton() {
|
||||
|
||||
export function ImportExportRow() {
|
||||
const { t } = useTranslation();
|
||||
const { importProgress, quotaError, clearQuotaError, runUploadBookmarkFile } =
|
||||
const { importProgress, quotaError, runUploadBookmarkFile } =
|
||||
useBookmarkImport();
|
||||
|
||||
return (
|
||||
@@ -142,14 +142,6 @@ export function ImportExportRow() {
|
||||
<AlertCircle className="h-4 w-4" />
|
||||
<AlertTitle>Import Quota Exceeded</AlertTitle>
|
||||
<AlertDescription>{quotaError}</AlertDescription>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
className="absolute right-2 top-2 h-6 w-6 p-0"
|
||||
onClick={clearQuotaError}
|
||||
>
|
||||
<X className="h-4 w-4" />
|
||||
</Button>
|
||||
</Alert>
|
||||
)}
|
||||
<div className="grid gap-4 md:grid-cols-2">
|
||||
|
||||
@@ -68,9 +68,12 @@ export function useBookmarkImport() {
|
||||
const quotaUsage =
|
||||
await apiUtils.client.subscriptions.getQuotaUsage.query();
|
||||
|
||||
if (!quotaUsage.bookmarks.unlimited) {
|
||||
if (
|
||||
!quotaUsage.bookmarks.unlimited &&
|
||||
quotaUsage.bookmarks.quota !== null
|
||||
) {
|
||||
const remaining =
|
||||
quotaUsage.bookmarks.quota! - quotaUsage.bookmarks.used;
|
||||
quotaUsage.bookmarks.quota - quotaUsage.bookmarks.used;
|
||||
|
||||
if (remaining < bookmarkCount) {
|
||||
const errorMsg = `Cannot import ${bookmarkCount} bookmarks. You have ${remaining} bookmark${remaining === 1 ? "" : "s"} remaining in your quota of ${quotaUsage.bookmarks.quota}.`;
|
||||
|
||||
Reference in New Issue
Block a user