Skip to content

Commit eda540c

Browse files
committed
refactor: improve code formatting and readability across multiple components
1 parent 09214e1 commit eda540c

6 files changed

Lines changed: 33 additions & 30 deletions

File tree

‎client-nachweise/src/app/nachweis/[id]/page.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ export default async function NachweisPage({ params }: Props) {
1717
<NachweisViewer id={id} />
1818
</div>
1919
);
20-
}
20+
}

‎client-nachweise/src/components/core/ConfirmDeleteDialog.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ export default function ConfirmDeleteDialog(props: {
4545
setOpen(false);
4646
} catch (error) {
4747
console.error(error);
48-
const errorMessage = error instanceof Error ? error.message : String(error);
48+
const errorMessage =
49+
error instanceof Error ? error.message : String(error);
4950
setError(errorMessage);
5051
showToast(
5152
t('nachweis.deleteError') || t('nachweis.errorMessage'),

‎client-nachweise/src/components/core/DeleteConfirmModal.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ export default function DeleteConfirmModal<T = unknown>(props: {
5656
setOpen(false);
5757
setInput('');
5858
} catch (error) {
59-
const errorMessage = error instanceof Error ? error.message : String(error);
59+
const errorMessage =
60+
error instanceof Error ? error.message : String(error);
6061
setError(errorMessage);
6162
} finally {
6263
setSaving(false);

‎client-nachweise/src/components/core/LanguageSwitcher.tsx‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
1+
'use client';
12

2-
"use client";
3-
4-
import { useTranslation } from "@/context/LanguageContext";
5-
import { Button } from "../ui/button";
3+
import { useTranslation } from '@/context/LanguageContext';
4+
import { Button } from '../ui/button';
65

76
export function LanguageSwitcher() {
87
const { locale, setLocale } = useTranslation();
98

109
const toggleLocale = () => {
11-
setLocale(locale === "de" ? "en" : "de");
10+
setLocale(locale === 'de' ? 'en' : 'de');
1211
};
1312

1413
return (
1514
<Button variant="outline" size="icon" onClick={toggleLocale}>
16-
1715
{locale.toUpperCase()}
1816
</Button>
1917
);

‎client-nachweise/src/components/core/NativeSelect.tsx‎

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
1-
21
import * as React from 'react';
32
import { cn } from '@/lib/utils';
43
import { ChevronDownIcon } from 'lucide-react';
54

6-
type NativeSelectProps = React.SelectHTMLAttributes<HTMLSelectElement>;
5+
type NativeSelectProps =
6+
React.SelectHTMLAttributes<HTMLSelectElement>;
77

8-
const NativeSelect = React.forwardRef<HTMLSelectElement, NativeSelectProps>(
9-
({ className, children, ...props }, ref) => {
10-
return (
11-
<div className={cn('relative', className)}>
12-
<select
13-
className={cn(
14-
'flex h-10 w-full appearance-none rounded-md border border-input bg-transparent pl-3 pr-8 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50'
15-
)}
16-
ref={ref}
17-
{...props}
18-
>
19-
{children}
20-
</select>
21-
<ChevronDownIcon className="absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 opacity-50 pointer-events-none" />
22-
</div>
23-
);
24-
}
25-
);
8+
const NativeSelect = React.forwardRef<
9+
HTMLSelectElement,
10+
NativeSelectProps
11+
>(({ className, children, ...props }, ref) => {
12+
return (
13+
<div className={cn('relative', className)}>
14+
<select
15+
className={cn(
16+
'flex h-10 w-full appearance-none rounded-md border border-input bg-transparent pl-3 pr-8 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50'
17+
)}
18+
ref={ref}
19+
{...props}
20+
>
21+
{children}
22+
</select>
23+
<ChevronDownIcon className="absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 opacity-50 pointer-events-none" />
24+
</div>
25+
);
26+
});
2627

2728
NativeSelect.displayName = 'NativeSelect';
2829

‎client-nachweise/src/features/user/UserView.tsx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,9 @@ export default function UserView() {
486486
e
487487
);
488488
const errData = e as {
489-
response?: { data?: { message?: string } };
489+
response?: {
490+
data?: { message?: string };
491+
};
490492
message?: string;
491493
};
492494
const errMsg =

0 commit comments

Comments
 (0)