Skip to content

Commit 1f8ad64

Browse files
committed
resolve build warnings
1 parent 2db2bc4 commit 1f8ad64

File tree

6 files changed

+26
-30
lines changed

6 files changed

+26
-30
lines changed

src/app/(dashboard)/dashboard/elements/page.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ import {Suspense} from "react";
33
import {Box} from "@mantine/core";
44
import {withPermissions} from "@/components/with-authorization";
55
import {DashboardBreadcrumbs} from "@/features/breadcrumbs/components/breadcrumbs";
6-
import {
7-
ArticlesTable,
8-
ArticlesTableSkeleton,
9-
} from "@/features/articles/components/articles-table";
106
import {APP_PATHS} from "@/lib/app-paths";
117
import {ElementsTable, ElementsTableSkeleton} from "@/features/dashboard/elements/components/elements-table";
128

src/components/query-client-provider.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"use client";
22
import { ReactNode } from "react";
3-
import { useRouter } from "next/navigation";
43
import {
54
QueryClient,
65
QueryClientProvider as RQProvider,
@@ -28,8 +27,8 @@ function messageFor(status: number) {
2827
}
2928
}
3029

31-
function handleError(err: any, router?: ReturnType<typeof useRouter>) {
32-
const status = err.response.status;
30+
function handleError(err: any) {
31+
const status = err.response?.status;
3332
if (status) {
3433
notifications.show({
3534
title: `خطا ${err.status}`,
@@ -46,15 +45,15 @@ function handleError(err: any, router?: ReturnType<typeof useRouter>) {
4645
}
4746
}
4847

49-
function createQueryClient(router: ReturnType<typeof useRouter>) {
48+
function createQueryClient() {
5049
return new QueryClient({
5150
queryCache: new QueryCache({
52-
onError: (err) => handleError(err, router),
51+
onError: (err) => handleError(err),
5352
}),
5453
mutationCache: new MutationCache({
5554
onError: (err, _vars, _ctx, mutation) => {
5655
// Let a mutation-specific onError override the global one
57-
if (!mutation.options.onError) handleError(err, router);
56+
if (!mutation.options.onError) handleError(err);
5857
},
5958
}),
6059
defaultOptions: {
@@ -70,8 +69,7 @@ function createQueryClient(router: ReturnType<typeof useRouter>) {
7069
type Props = { children: ReactNode };
7170

7271
export function QueryClientProvider({ children }: Props) {
73-
const router = useRouter();
74-
const queryClient = createQueryClient(router);
72+
const queryClient = createQueryClient();
7573

7674
return (
7775
<RQProvider client={queryClient}>{children}</RQProvider>

src/features/code-highlight/CodeHighlight.tsx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,23 @@ import {notifications} from "@mantine/notifications";
1111
import { encode, decode } from 'js-base64';
1212
import './code-highlight.css';
1313

14+
const b64 = {
15+
enc: (input: string) => {
16+
const cleaned = input
17+
.replace(/\u00A0/g, ' ')
18+
.replace(/\r\n/g, '\n');
19+
20+
return encode(cleaned);
21+
},
22+
dec: (str: string) => {
23+
return decode(str);
24+
},
25+
};
26+
1427
function CodeHighlight({ code, language, executable }) {
1528
const [output, setOutput] = useState("");
1629
const [running, setRunning] = useState(false);
1730

18-
const b64 = {
19-
enc: (input) => {
20-
const cleaned = input
21-
.replace(/\u00A0/g, ' ')
22-
.replace(/\r\n/g, '\n');
23-
24-
return encode(cleaned);
25-
},
26-
dec: (str) => {
27-
return decode(str);
28-
},
29-
};
30-
3131
const runCode = useCallback(() => {
3232
if (running) return;
3333

@@ -84,7 +84,7 @@ function CodeHighlight({ code, language, executable }) {
8484
setOutput(`WebSocket error: ${err}`);
8585
setRunning(false);
8686
});
87-
}, [code, language, running]);
87+
}, [code, running, executable]);
8888

8989
return (
9090
<Box

src/features/dashboard/elements/actions/delete-element.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export async function deleteElement(
1616
await privateDalDriver.delete(`/dashboard/elements/${id}`);
1717
revalidatePath(APP_PATHS.dashboard.elements.index);
1818
return true;
19-
} catch(e) {
19+
} catch {
2020
return false;
2121
}
2222
}

src/features/dashboard/elements/components/element-upsert-form/element-upsert-form.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export function ElementUpsertForm({ element }: Props) {
5656
JSON.parse(value);
5757
setJsonError(null);
5858
return true;
59-
} catch (e: any) {
59+
} catch {
6060
setJsonError("JSON نامعتبر است");
6161
return false;
6262
}
@@ -80,7 +80,7 @@ export function ElementUpsertForm({ element }: Props) {
8080
}
8181
};
8282

83-
const handleSubmit = async (formData: FormData) => {
83+
const handleSubmit = async () => {
8484
if (!validateJson(jsonValue)) {
8585
alert('Invalid json')
8686
return;

src/features/home-page/components/featured-articles/featured-articles.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ import {
66
List,
77
ThemeIcon,
88
ListItem,
9-
Title, Divider, Group, Button,
9+
Title,
10+
Group,
11+
Button,
1012
} from "@mantine/core";
1113
import {VerticalArticleCard} from "../article-card-vertical";
1214
import classes from "./featured-articles.module.css";

0 commit comments

Comments
 (0)