Reverted all changes back to version f2ff524b1b

This commit is contained in:
[dyad]
2026-01-18 14:04:18 +01:00
parent 256097220a
commit 92d31b0051
17 changed files with 218 additions and 995 deletions

View File

@@ -1,55 +0,0 @@
import type { Metadata } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import "../globals.css";
import { ThemeProvider } from "@/components/theme-provider";
import { Toaster } from "@/components/ui/sonner";
import { Footer } from "@/components/footer";
import { NextIntlClientProvider } from "next-intl";
import { getMessages } from "next-intl/server";
const geistSans = Geist({
variable: "--font-geist-sans",
subsets: ["latin"],
});
const geistMono = Geist_Mono({
variable: "--font-geist-mono",
subsets: ["latin"],
});
export const metadata: Metadata = {
title: "Image Web Exporter",
description:
"Upload a picture, then export it in a different resolution and format.",
};
export default async function RootLayout({
children,
params: { locale },
}: Readonly<{
children: React.ReactNode;
params: { locale: string };
}>) {
const messages = await getMessages();
return (
<html lang={locale} suppressHydrationWarning>
<body
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
>
<NextIntlClientProvider messages={messages}>
<ThemeProvider
attribute="class"
defaultTheme="system"
enableSystem
disableTransitionOnChange
>
{children}
<Footer />
<Toaster />
</ThemeProvider>
</NextIntlClientProvider>
</body>
</html>
);
}

View File

@@ -1,54 +0,0 @@
import Link from "next/link";
import { Button } from "@/components/ui/button";
import { ArrowLeft } from "lucide-react";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { useTranslations } from "next-intl";
export default function PrivacyPage() {
const t = useTranslations("PrivacyPage");
return (
<div className="relative flex flex-col items-center min-h-screen p-4 sm:p-8 bg-gray-50 dark:bg-background">
<div className="w-full max-w-4xl mx-auto">
<Button asChild variant="ghost" className="mb-4 -ml-4">
<Link href="/">
<ArrowLeft className="mr-2 h-4 w-4" />
{t("back")}
</Link>
</Button>
<main className="w-full">
<Card>
<CardHeader>
<CardTitle className="text-3xl font-bold">{t("title")}</CardTitle>
</CardHeader>
<CardContent className="space-y-6 text-muted-foreground">
<div className="space-y-2">
<h3 className="font-semibold text-foreground">
{t("generalInfoTitle")}
</h3>
<p>{t("generalInfoText")}</p>
</div>
<div className="space-y-2">
<h3 className="font-semibold text-foreground">
{t("dataCollectionTitle")}
</h3>
<p>{t("dataCollectionText")}</p>
</div>
<div className="space-y-2">
<h3 className="font-semibold text-foreground">
{t("yourRightsTitle")}
</h3>
<p>{t("yourRightsText")}</p>
</div>
<div className="pt-4 border-t">
<h3 className="font-semibold text-foreground">
{t("disclaimerTitle")}
</h3>
<p className="text-sm">{t("disclaimerText")}</p>
</div>
</CardContent>
</Card>
</main>
</div>
</div>
);
}

View File

@@ -2,17 +2,15 @@ import { Changelog } from "@/components/changelog";
import Link from "next/link";
import { Button } from "@/components/ui/button";
import { ArrowLeft } from "lucide-react";
import { useTranslations } from "next-intl";
export default function ChangelogPage() {
const t = useTranslations("ChangelogPage");
return (
<div className="relative flex flex-col items-center min-h-screen p-4 sm:p-8 bg-gray-50 dark:bg-background font-[family-name:var(--font-geist-sans)]">
<div className="w-full max-w-4xl mx-auto">
<Button asChild variant="ghost" className="mb-4 -ml-4">
<Link href="/">
<ArrowLeft className="mr-2 h-4 w-4" />
{t("back")}
Back to Converter
</Link>
</Button>
</div>

View File

@@ -2,47 +2,43 @@ import Link from "next/link";
import { Button } from "@/components/ui/button";
import { ArrowLeft } from "lucide-react";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { useTranslations } from "next-intl";
export default function ImprintPage() {
const t = useTranslations("ImprintPage");
return (
<div className="relative flex flex-col items-center min-h-screen p-4 sm:p-8 bg-gray-50 dark:bg-background">
<div className="w-full max-w-4xl mx-auto">
<Button asChild variant="ghost" className="mb-4 -ml-4">
<Link href="/">
<ArrowLeft className="mr-2 h-4 w-4" />
{t("back")}
Back to Converter
</Link>
</Button>
<main className="w-full">
<Card>
<CardHeader>
<CardTitle className="text-3xl font-bold">{t("title")}</CardTitle>
<CardTitle className="text-3xl font-bold">Imprint</CardTitle>
</CardHeader>
<CardContent className="space-y-6 text-muted-foreground">
<p>{t("tmgInfo")}</p>
<p>
Information according to § 5 TMG (German Telemedia Act)
</p>
<div className="space-y-2">
<h3 className="font-semibold text-foreground">
{t("contactInfoTitle")}
</h3>
<p>{t("companyName")}</p>
<p>{t("addressLine1")}</p>
<p>{t("addressLine2")}</p>
<p>{t("email")}</p>
<p>{t("phone")}</p>
<h3 className="font-semibold text-foreground">Contact Information:</h3>
<p>[Your Company Name]</p>
<p>[Street Name & Number]</p>
<p>[Postal Code & City]</p>
<p>Email: [your-email@example.com]</p>
<p>Phone: [your-phone-number]</p>
</div>
<div className="space-y-2">
<h3 className="font-semibold text-foreground">
{t("representedByTitle")}
</h3>
<p>{t("representativeName")}</p>
<h3 className="font-semibold text-foreground">Represented by:</h3>
<p>[Your Name/CEO's Name]</p>
</div>
<div className="pt-4 border-t">
<h3 className="font-semibold text-foreground">
{t("disclaimerTitle")}
</h3>
<p className="text-sm">{t("disclaimerText")}</p>
<h3 className="font-semibold text-foreground">Disclaimer:</h3>
<p className="text-sm">
This is a sample imprint and not legally binding. Please replace the placeholder content with your own information and consult a legal professional to ensure compliance with all applicable laws.
</p>
</div>
</CardContent>
</Card>

46
src/app/layout.tsx Normal file
View File

@@ -0,0 +1,46 @@
import type { Metadata } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import "./globals.css";
import { ThemeProvider } from "@/components/theme-provider";
import { Toaster } from "@/components/ui/sonner";
import { Footer } from "@/components/footer";
const geistSans = Geist({
variable: "--font-geist-sans",
subsets: ["latin"],
});
const geistMono = Geist_Mono({
variable: "--font-geist-mono",
subsets: ["latin"],
});
export const metadata: Metadata = {
title: "Image Web Exporter",
description: "Upload a picture, then export it in a different resolution and format.",
};
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en" suppressHydrationWarning>
<body
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
>
<ThemeProvider
attribute="class"
defaultTheme="system"
enableSystem
disableTransitionOnChange
>
{children}
<Footer />
<Toaster />
</ThemeProvider>
</body>
</html>
);
}

View File

@@ -1,17 +1,15 @@
import { ImageConverter } from "@/components/image-converter";
import { useTranslations } from "next-intl";
export default function Home() {
const t = useTranslations("HomePage");
return (
<div className="relative flex flex-col items-center justify-center min-h-screen p-4 sm:p-8 bg-gray-50 dark:bg-background font-[family-name:var(--font-geist-sans)]">
<main className="flex flex-col items-center w-full max-w-6xl z-10">
<div className="text-center mb-8">
<h1 className="text-4xl font-bold tracking-tight text-gray-900 dark:text-gray-100 sm:text-5xl">
{t("title")}
Image Web Exporter
</h1>
<p className="mt-3 text-lg text-gray-600 dark:text-gray-400">
{t("description")}
Upload a picture, then export it in a different resolution and format.
</p>
</div>
<ImageConverter />

52
src/app/privacy/page.tsx Normal file
View File

@@ -0,0 +1,52 @@
import Link from "next/link";
import { Button } from "@/components/ui/button";
import { ArrowLeft } from "lucide-react";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
export default function PrivacyPage() {
return (
<div className="relative flex flex-col items-center min-h-screen p-4 sm:p-8 bg-gray-50 dark:bg-background">
<div className="w-full max-w-4xl mx-auto">
<Button asChild variant="ghost" className="mb-4 -ml-4">
<Link href="/">
<ArrowLeft className="mr-2 h-4 w-4" />
Back to Converter
</Link>
</Button>
<main className="w-full">
<Card>
<CardHeader>
<CardTitle className="text-3xl font-bold">Data Privacy Policy</CardTitle>
</CardHeader>
<CardContent className="space-y-6 text-muted-foreground">
<div className="space-y-2">
<h3 className="font-semibold text-foreground">1. General Information</h3>
<p>
This is a placeholder for your data privacy policy. It outlines how personal data is collected, used, and protected when you use this website.
</p>
</div>
<div className="space-y-2">
<h3 className="font-semibold text-foreground">2. Data Collection on This Website</h3>
<p>
All image processing happens directly in your browser. The images you upload are not sent to any server and are not stored by us. We do not collect any personal data from the images.
</p>
</div>
<div className="space-y-2">
<h3 className="font-semibold text-foreground">3. Your Rights</h3>
<p>
As no personal data is collected, rights regarding access, rectification, or erasure of personal data are not applicable in this context.
</p>
</div>
<div className="pt-4 border-t">
<h3 className="font-semibold text-foreground">Disclaimer:</h3>
<p className="text-sm">
This is a sample privacy policy and not legally binding. It is crucial to adapt this text to your specific data processing activities and to consult with a legal professional to ensure full GDPR compliance.
</p>
</div>
</CardContent>
</Card>
</main>
</div>
</div>
);
}

View File

@@ -4,18 +4,16 @@ import { Badge } from "@/components/ui/badge";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { cn } from "@/lib/utils";
import { changelogData } from "@/lib/changelog-data";
import { useTranslations } from "next-intl";
export function Changelog() {
const t = useTranslations("ChangelogPage");
return (
<div className="w-full max-w-4xl mx-auto py-12 px-4 sm:px-6 lg:px-8">
<div className="text-center mb-12">
<h1 className="text-4xl font-bold tracking-tight text-gray-900 dark:text-gray-100 sm:text-5xl">
{t("title")}
Changelog
</h1>
<p className="mt-3 text-lg text-gray-600 dark:text-gray-400">
{t("description")}
Tracking all the new features, improvements, and bug fixes.
</p>
</div>
<div className="space-y-8">

View File

@@ -2,11 +2,8 @@ import Link from "next/link";
import { Github, Twitter } from "lucide-react";
import { Button } from "@/components/ui/button";
import { changelogData } from "@/lib/changelog-data";
import { useTranslations } from "next-intl";
import LanguageSwitcher from "./language-switcher";
export function Footer() {
const t = useTranslations("Footer");
const latestVersion = changelogData[0]?.version;
return (
@@ -17,7 +14,6 @@ export function Footer() {
</div>
<div className="absolute left-1/2 top-1/2 flex -translate-x-1/2 -translate-y-1/2 items-center gap-1">
<LanguageSwitcher />
<Button variant="ghost" size="icon" asChild>
<Link href="https://github.com/" target="_blank" rel="noopener noreferrer" aria-label="GitHub">
<Github className="h-4 w-4" />
@@ -31,8 +27,8 @@ export function Footer() {
</div>
<div className="flex items-center gap-4 text-sm text-muted-foreground">
<Link href="/imprint" className="hover:text-primary transition-colors">{t("imprint")}</Link>
<Link href="/privacy" className="hover:text-primary transition-colors">{t("privacy")}</Link>
<Link href="/imprint" className="hover:text-primary transition-colors">Imprint</Link>
<Link href="/privacy" className="hover:text-primary transition-colors">Privacy</Link>
{latestVersion && (
<Link
href="/changelog"

View File

@@ -36,7 +36,14 @@ import {
TooltipProvider,
TooltipTrigger,
} from "@/components/ui/tooltip";
import { useTranslations } from "next-intl";
const aspectRatios = [
{ name: "Custom", value: "custom" },
{ name: "1:1 (Square)", value: "1/1" },
{ name: "4:3 (Standard)", value: "4/3" },
{ name: "3:2 (Photography)", value: "3/2" },
{ name: "16:9 (Widescreen)", value: "16/9" },
];
const initialSettings = {
width: "",
@@ -57,16 +64,6 @@ const initialSettings = {
};
export function ImageConverter() {
const t = useTranslations("ImageConverter");
const aspectRatios = [
{ name: t("aspectRatios.custom"), value: "custom" },
{ name: t("aspectRatios.square"), value: "1/1" },
{ name: t("aspectRatios.standard"), value: "4/3" },
{ name: t("aspectRatios.photography"), value: "3/2" },
{ name: t("aspectRatios.widescreen"), value: "16/9" },
];
const [images, setImages] = useState<File[]>([]);
const [previewUrls, setPreviewUrls] = useState<string[]>([]);
const [filenames, setFilenames] = useState<string[]>([]);
@@ -107,7 +104,7 @@ export function ImageConverter() {
);
if (imageFiles.length === 0) {
toast.error(t("toasts.noValidImages"));
toast.error("No valid image files found.");
return;
}
@@ -129,7 +126,7 @@ export function ImageConverter() {
setPreviewUrls(newPreviewUrls);
setFilenames(newFilenames);
toast.success(t("toasts.imagesAdded", { count: imageFiles.length }));
toast.success(`${imageFiles.length} image(s) added.`);
};
const handleImageChange = (e: ChangeEvent<HTMLInputElement>) => {
@@ -171,7 +168,7 @@ export function ImageConverter() {
setFilenames([]);
setWidth(initialSettings.width);
setHeight(initialSettings.height);
toast.info(t("toasts.allCleared"));
toast.info("All images cleared.");
};
const handleFilenameChange = (index: number, newName: string) => {
@@ -289,23 +286,23 @@ export function ImageConverter() {
document.body.removeChild(link);
resolve();
} else {
reject(new Error(t("toasts.errorProcessing", { filename: image.name })));
reject(new Error(`Could not process ${image.name}.`));
}
};
img.onerror = () => {
reject(new Error(t("toasts.errorLoading", { filename: image.name })));
reject(new Error(`Failed to load ${image.name} for conversion.`));
};
});
};
const handleConvertAndDownloadAll = async () => {
if (images.length === 0) {
toast.error(t("toasts.noImages"));
toast.error("Please upload images first.");
return;
}
setIsConverting(true);
toast.info(t("toasts.conversionStarting", { count: images.length }));
toast.info(`Starting conversion for ${images.length} images...`);
const conversionPromises = images.map((image, index) =>
convertAndDownload(image, previewUrls[index], index)
@@ -313,12 +310,12 @@ export function ImageConverter() {
try {
await Promise.all(conversionPromises);
toast.success(t("toasts.conversionSuccess", { count: images.length }));
toast.success(`Successfully exported all ${images.length} images!`);
} catch (error) {
if (error instanceof Error) {
toast.error(error.message);
} else {
toast.error(t("toasts.conversionError"));
toast.error("An unknown error occurred during conversion.");
}
} finally {
setIsConverting(false);
@@ -327,16 +324,16 @@ export function ImageConverter() {
const handleConvertAndDownloadSingle = async (index: number) => {
setConvertingIndex(index);
toast.info(t("toasts.singleConversionStarting", { filename: filenames[index] }));
toast.info(`Starting conversion for ${filenames[index]}...`);
try {
await convertAndDownload(images[index], previewUrls[index], index);
toast.success(t("toasts.singleConversionSuccess", { filename: filenames[index] }));
toast.success(`Successfully exported ${filenames[index]}!`);
} catch (error) {
if (error instanceof Error) {
toast.error(error.message);
} else {
toast.error(t("toasts.conversionError"));
toast.error("An unknown error occurred during conversion.");
}
} finally {
setConvertingIndex(null);
@@ -344,7 +341,7 @@ export function ImageConverter() {
};
const handleApplySettings = () => {
toast.info(t("toasts.settingsUpdated"));
toast.info("Settings updated and will be used for all downloads.");
};
const handleResetSettings = () => {
@@ -363,7 +360,7 @@ export function ImageConverter() {
setDefaultBaseName(initialSettings.defaultBaseName);
setScaleMode(initialSettings.scaleMode);
setObjectPosition(initialSettings.objectPosition);
toast.success(t("toasts.settingsReset"));
toast.success("All settings have been reset to their defaults.");
};
const handleAspectRatioChange = (value: string) => {
@@ -411,16 +408,16 @@ export function ImageConverter() {
const handleApplyDefaultBaseNameToAll = () => {
if (!defaultBaseName) {
toast.error(t("toasts.defaultBaseNameMissing"));
toast.error("Please enter a default base name to apply.");
return;
}
if (!hasImages) {
toast.info(t("toasts.uploadImagesFirst"));
toast.info("Upload some images first.");
return;
}
const newFilenames = filenames.map(() => defaultBaseName);
setFilenames(newFilenames);
toast.success(t("toasts.baseNameApplied", { name: defaultBaseName, count: images.length }));
toast.success(`Set base name to "${defaultBaseName}" for all ${images.length} images.`);
};
return (
@@ -430,7 +427,7 @@ export function ImageConverter() {
<Card>
<CardContent className="pt-6">
<div className="space-y-4">
<h3 className="text-lg font-medium">{t("uploadTitle")}</h3>
<h3 className="text-lg font-medium">Upload Images</h3>
<div
className={cn(
"w-full h-48 rounded-lg border-2 border-dashed flex items-center justify-center relative transition-colors cursor-pointer hover:border-primary/60",
@@ -443,8 +440,8 @@ export function ImageConverter() {
>
<div className="flex flex-col items-center justify-center text-center text-muted-foreground">
<Upload className="w-8 h-8 mb-2" />
<p className="font-semibold">{t("uploadInstructions")}</p>
<p className="text-xs text-muted-foreground mt-1">{t("uploadHint")}</p>
<p className="font-semibold">Click or drag and drop to upload</p>
<p className="text-xs text-muted-foreground mt-1">PNG, JPG, WEBP supported</p>
</div>
<Input type="file" ref={fileInputRef} onChange={handleImageChange} className="hidden" accept="image/*" multiple />
</div>
@@ -456,25 +453,25 @@ export function ImageConverter() {
<Card>
<CardHeader>
<div className="flex justify-between items-center">
<CardTitle>{t("uploadedImagesTitle")}</CardTitle>
<CardTitle>Uploaded Images</CardTitle>
<div className="flex items-center gap-2">
<Tooltip>
<TooltipTrigger asChild>
<Button variant="ghost" size="sm" onClick={handleClearAll} disabled={isConverting || convertingIndex !== null}><Trash2 className="mr-2 h-4 w-4" />{t("clearAll")}</Button>
<Button variant="ghost" size="sm" onClick={handleClearAll} disabled={isConverting || convertingIndex !== null}><Trash2 className="mr-2 h-4 w-4" />Clear All</Button>
</TooltipTrigger>
<TooltipContent>
<p>{t("clearAllTooltip")}</p>
<p>Remove all uploaded images.</p>
</TooltipContent>
</Tooltip>
<Tooltip>
<TooltipTrigger asChild>
<Button onClick={handleConvertAndDownloadAll} disabled={!hasImages || isConverting || convertingIndex !== null}>
<Download className="mr-2 h-4 w-4" />
{isConverting ? t("downloadAllConverting") : t("downloadAll", { count: images.length })}
{isConverting ? "Converting..." : `Download All (${images.length})`}
</Button>
</TooltipTrigger>
<TooltipContent>
<p>{t("downloadAllTooltip")}</p>
<p>Convert and download all images with the current settings.</p>
</TooltipContent>
</Tooltip>
</div>
@@ -488,7 +485,7 @@ export function ImageConverter() {
<div key={url} className="p-4 border rounded-lg flex items-center gap-4">
<img src={url} alt={`Preview ${index + 1}`} className="w-20 h-20 object-cover rounded-md shrink-0" />
<div className="flex-1 min-w-0">
<Label htmlFor={`filename-${index}`} className="text-xs text-muted-foreground">{t("baseNameLabel")}</Label>
<Label htmlFor={`filename-${index}`} className="text-xs text-muted-foreground">Base Name</Label>
<Input
id={`filename-${index}`}
value={filenames[index]}
@@ -496,7 +493,7 @@ export function ImageConverter() {
className="text-sm font-medium h-8 mt-1"
/>
<p className="text-xs text-muted-foreground truncate mt-1" title={`${finalFilename}.${format}`}>
{t("finalNameLabel", { filename: `${finalFilename}.${format}` })}
Final name: {finalFilename}.{format}
</p>
</div>
<div className="flex items-center shrink-0">
@@ -513,7 +510,7 @@ export function ImageConverter() {
</Button>
</TooltipTrigger>
<TooltipContent>
<p>{t("downloadSingleTooltip")}</p>
<p>Download this image</p>
</TooltipContent>
</Tooltip>
<Tooltip>
@@ -529,7 +526,7 @@ export function ImageConverter() {
</Button>
</TooltipTrigger>
<TooltipContent>
<p>{t("removeSingleTooltip")}</p>
<p>Remove this image</p>
</TooltipContent>
</Tooltip>
</div>
@@ -547,9 +544,9 @@ export function ImageConverter() {
<AccordionItem value="image-settings" className="border rounded-lg bg-card">
<AccordionTrigger className="p-6 hover:no-underline">
<div className="text-left">
<h3 className="text-lg font-medium leading-none">{t("imageSettingsTitle")}</h3>
<h3 className="text-lg font-medium leading-none">Image Settings</h3>
<p className="text-sm text-muted-foreground mt-1">
{t("imageSettingsDescription")}
Adjust resolution and scaling for all images.
</p>
</div>
</AccordionTrigger>
@@ -557,19 +554,19 @@ export function ImageConverter() {
<div className="space-y-4">
<div>
<div className="flex items-center gap-1.5">
<Label htmlFor="aspect-ratio">{t("aspectRatioLabel")}</Label>
<Label htmlFor="aspect-ratio">Aspect Ratio</Label>
<Tooltip>
<TooltipTrigger>
<HelpCircle className="h-4 w-4 text-muted-foreground" />
</TooltipTrigger>
<TooltipContent>
<p>{t("aspectRatioTooltip")}</p>
<p>Choose a preset aspect ratio or select 'Custom' to enter dimensions manually.</p>
</TooltipContent>
</Tooltip>
</div>
<Select value={aspectRatio} onValueChange={handleAspectRatioChange}>
<SelectTrigger id="aspect-ratio" className="mt-2">
<SelectValue placeholder={t("aspectRatioPlaceholder")} />
<SelectValue placeholder="Select aspect ratio" />
</SelectTrigger>
<SelectContent>
{aspectRatios.map((ratio) => (
@@ -583,17 +580,17 @@ export function ImageConverter() {
<div className="flex items-end gap-2">
<div className="space-y-2 flex-1">
<div className="flex items-center gap-1.5">
<Label htmlFor="width">{t("widthLabel")}</Label>
<Label htmlFor="width">Width (px)</Label>
<Tooltip>
<TooltipTrigger>
<HelpCircle className="h-4 w-4 text-muted-foreground" />
</TooltipTrigger>
<TooltipContent>
<p>{t("widthTooltip")}</p>
<p>Set the output width in pixels. Leave blank to use the original width.</p>
</TooltipContent>
</Tooltip>
</div>
<Input id="width" type="number" placeholder={t("widthPlaceholder")} value={width} onChange={handleWidthChange} />
<Input id="width" type="number" placeholder="Auto" value={width} onChange={handleWidthChange} />
</div>
<Tooltip>
<TooltipTrigger asChild>
@@ -602,34 +599,34 @@ export function ImageConverter() {
</Button>
</TooltipTrigger>
<TooltipContent>
<p>{t("swapDimensionsTooltip")}</p>
<p>Swap the entered width and height values.</p>
</TooltipContent>
</Tooltip>
<div className="space-y-2 flex-1">
<div className="flex items-center gap-1.5">
<Label htmlFor="height">{t("heightLabel")}</Label>
<Label htmlFor="height">Height (px)</Label>
<Tooltip>
<TooltipTrigger>
<HelpCircle className="h-4 w-4 text-muted-foreground" />
</TooltipTrigger>
<TooltipContent>
<p>{t("heightTooltip")}</p>
<p>Set the output height in pixels. Leave blank to use the original height.</p>
</TooltipContent>
</Tooltip>
</div>
<Input id="height" type="number" placeholder={t("heightPlaceholder")} value={height} onChange={handleHeightChange} />
<Input id="height" type="number" placeholder="Auto" value={height} onChange={handleHeightChange} />
</div>
</div>
<div className="flex items-center space-x-2 pt-2">
<Checkbox id="keep-orientation" checked={keepOrientation} onCheckedChange={(checked) => setKeepOrientation(Boolean(checked))} />
<Label htmlFor="keep-orientation" className="cursor-pointer flex items-center gap-1.5">
{t("keepOrientationLabel")}
Keep original orientation
<Tooltip>
<TooltipTrigger onClick={(e) => e.preventDefault()}>
<HelpCircle className="h-4 w-4 text-muted-foreground" />
</TooltipTrigger>
<TooltipContent>
<p>{t("keepOrientationTooltip")}</p>
<p>Automatically swaps width and height to match the original image's orientation.</p>
</TooltipContent>
</Tooltip>
</Label>
@@ -637,35 +634,35 @@ export function ImageConverter() {
</div>
<div className="mt-4 space-y-2">
<div className="flex items-center gap-1.5">
<Label htmlFor="scale-mode">{t("scalingLabel")}</Label>
<Label htmlFor="scale-mode">Scaling</Label>
<Tooltip>
<TooltipTrigger>
<HelpCircle className="h-4 w-4 text-muted-foreground" />
</TooltipTrigger>
<TooltipContent>
<p>{t("scalingTooltip")}</p>
<p>Determines how the image fits into the new dimensions.</p>
</TooltipContent>
</Tooltip>
</div>
<Select value={scaleMode} onValueChange={(value: 'fill' | 'cover' | 'contain') => setScaleMode(value)}>
<SelectTrigger id="scale-mode"><SelectValue placeholder={t("scalingPlaceholder")} /></SelectTrigger>
<SelectTrigger id="scale-mode"><SelectValue placeholder="Select scaling mode" /></SelectTrigger>
<SelectContent>
<SelectItem value="fill">{t("scalingOptions.fill")}</SelectItem>
<SelectItem value="cover">{t("scalingOptions.cover")}</SelectItem>
<SelectItem value="contain">{t("scalingOptions.contain")}</SelectItem>
<SelectItem value="fill">Fill (stretch to fit)</SelectItem>
<SelectItem value="cover">Cover (crop to fit)</SelectItem>
<SelectItem value="contain">Contain (letterbox)</SelectItem>
</SelectContent>
</Select>
</div>
{scaleMode !== 'fill' && (
<div className="mt-4 space-y-2">
<div className="flex items-center gap-1.5">
<Label>{t("positionLabel")}</Label>
<Label>Position</Label>
<Tooltip>
<TooltipTrigger>
<HelpCircle className="h-4 w-4 text-muted-foreground" />
</TooltipTrigger>
<TooltipContent>
<p>{t("positionTooltip")}</p>
<p>Sets the anchor point for 'Cover' or 'Contain' scaling.</p>
</TooltipContent>
</Tooltip>
</div>
@@ -678,8 +675,8 @@ export function ImageConverter() {
<AccordionItem value="filename-settings" className="border rounded-lg bg-card">
<AccordionTrigger className="p-6 hover:no-underline">
<div className="text-left">
<h3 className="text-lg font-medium leading-none">{t("filenameSettingsTitle")}</h3>
<p className="text-sm text-muted-foreground mt-1">{t("filenameSettingsDescription")}</p>
<h3 className="text-lg font-medium leading-none">Filename Settings</h3>
<p className="text-sm text-muted-foreground mt-1">Customize the output filenames.</p>
</div>
</AccordionTrigger>
<AccordionContent className="px-6 pb-6">
@@ -687,35 +684,35 @@ export function ImageConverter() {
<div className="flex items-center space-x-2">
<Switch id="use-default-base-name" checked={useDefaultBaseName} onCheckedChange={setUseDefaultBaseName} />
<Label htmlFor="use-default-base-name" className="flex items-center gap-1.5 cursor-pointer">
{t("useDefaultBaseNameLabel")}
Use default base name
<Tooltip>
<TooltipTrigger onClick={(e) => e.preventDefault()}>
<HelpCircle className="h-4 w-4 text-muted-foreground" />
</TooltipTrigger>
<TooltipContent>
<p>{t("useDefaultBaseNameTooltip")}</p>
<p>When enabled, all newly uploaded images will use the specified default base name.</p>
</TooltipContent>
</Tooltip>
</Label>
</div>
{useDefaultBaseName && (
<div className="space-y-2">
<Label htmlFor="default-base-name">{t("defaultBaseNameLabel")}</Label>
<Label htmlFor="default-base-name">Default base name</Label>
<div className="flex items-center gap-2">
<Input
id="default-base-name"
placeholder={t("defaultBaseNamePlaceholder")}
placeholder="e.g., new-york-trip"
value={defaultBaseName}
onChange={(e) => setDefaultBaseName(e.target.value)}
/>
<Tooltip>
<TooltipTrigger asChild>
<Button variant="outline" size="sm" onClick={handleApplyDefaultBaseNameToAll} disabled={!defaultBaseName || !hasImages}>
{t("applyToAll")}
Apply to all
</Button>
</TooltipTrigger>
<TooltipContent>
<p>{t("applyToAllTooltip")}</p>
<p>Apply this base name to all currently uploaded images.</p>
</TooltipContent>
</Tooltip>
</div>
@@ -723,42 +720,42 @@ export function ImageConverter() {
)}
<div className="space-y-2">
<div className="flex items-center gap-1.5">
<Label htmlFor="prefix">{t("prefixLabel")}</Label>
<Label htmlFor="prefix">Prefix</Label>
<Tooltip>
<TooltipTrigger>
<HelpCircle className="h-4 w-4 text-muted-foreground" />
</TooltipTrigger>
<TooltipContent>
<p>{t("prefixTooltip")}</p>
<p>Add text to the beginning of every filename.</p>
</TooltipContent>
</Tooltip>
</div>
<Input id="prefix" placeholder={t("prefixPlaceholder")} value={prefix} onChange={(e) => setPrefix(e.target.value)} />
<Input id="prefix" placeholder="e.g., travel-" value={prefix} onChange={(e) => setPrefix(e.target.value)} />
</div>
<div className="space-y-2">
<div className="flex items-center gap-1.5">
<Label htmlFor="suffix">{t("suffixLabel")}</Label>
<Label htmlFor="suffix">Suffix</Label>
<Tooltip>
<TooltipTrigger>
<HelpCircle className="h-4 w-4 text-muted-foreground" />
</TooltipTrigger>
<TooltipContent>
<p>{t("suffixTooltip")}</p>
<p>Add text to the end of every filename (before the number).</p>
</TooltipContent>
</Tooltip>
</div>
<Input id="suffix" placeholder={t("suffixPlaceholder")} value={suffix} onChange={(e) => setSuffix(e.target.value)} />
<Input id="suffix" placeholder="e.g., -edit" value={suffix} onChange={(e) => setSuffix(e.target.value)} />
</div>
<div className="flex items-center space-x-2 pt-2">
<Switch id="use-counter" checked={useCounter} onCheckedChange={setUseCounter} />
<Label htmlFor="use-counter" className="flex items-center gap-1.5 cursor-pointer">
{t("useCounterLabel")}
Add sequential number
<Tooltip>
<TooltipTrigger onClick={(e) => e.preventDefault()}>
<HelpCircle className="h-4 w-4 text-muted-foreground" />
</TooltipTrigger>
<TooltipContent>
<p>{t("useCounterTooltip")}</p>
<p>Append a numbered sequence to each filename.</p>
</TooltipContent>
</Tooltip>
</Label>
@@ -767,13 +764,13 @@ export function ImageConverter() {
<div className="grid grid-cols-2 gap-4 pt-2">
<div className="space-y-2">
<div className="flex items-center gap-1.5">
<Label htmlFor="counter-start">{t("counterStartLabel")}</Label>
<Label htmlFor="counter-start">Start number</Label>
<Tooltip>
<TooltipTrigger>
<HelpCircle className="h-4 w-4 text-muted-foreground" />
</TooltipTrigger>
<TooltipContent>
<p>{t("counterStartTooltip")}</p>
<p>The first number to use in the sequence.</p>
</TooltipContent>
</Tooltip>
</div>
@@ -787,13 +784,13 @@ export function ImageConverter() {
</div>
<div className="space-y-2">
<div className="flex items-center gap-1.5">
<Label htmlFor="counter-digits">{t("counterDigitsLabel")}</Label>
<Label htmlFor="counter-digits">Padding digits</Label>
<Tooltip>
<TooltipTrigger>
<HelpCircle className="h-4 w-4 text-muted-foreground" />
</TooltipTrigger>
<TooltipContent>
<p>{t("counterDigitsTooltip")}</p>
<p>Total number of digits for the counter, padded with leading zeros (e.g., 3 for 001).</p>
</TooltipContent>
</Tooltip>
</div>
@@ -814,43 +811,43 @@ export function ImageConverter() {
<AccordionItem value="quality-settings" className="border rounded-lg bg-card">
<AccordionTrigger className="p-6 hover:no-underline">
<div className="text-left">
<h3 className="text-lg font-medium leading-none">{t("qualitySettingsTitle")}</h3>
<p className="text-sm text-muted-foreground mt-1">{t("qualitySettingsDescription")}</p>
<h3 className="text-lg font-medium leading-none">Quality Settings</h3>
<p className="text-sm text-muted-foreground mt-1">Choose format and compression level.</p>
</div>
</AccordionTrigger>
<AccordionContent className="px-6 pb-6">
<div className="space-y-6">
<div className="space-y-2">
<div className="flex items-center gap-1.5">
<Label htmlFor="format">{t("formatLabel")}</Label>
<Label htmlFor="format">Format</Label>
<Tooltip>
<TooltipTrigger>
<HelpCircle className="h-4 w-4 text-muted-foreground" />
</TooltipTrigger>
<TooltipContent>
<p>{t("formatTooltip")}</p>
<p>Choose the output file format for the images.</p>
</TooltipContent>
</Tooltip>
</div>
<Select value={format} onValueChange={(value: "png" | "jpeg" | "webp") => setFormat(value)}>
<SelectTrigger id="format"><SelectValue placeholder={t("formatPlaceholder")} /></SelectTrigger>
<SelectTrigger id="format"><SelectValue placeholder="Select format" /></SelectTrigger>
<SelectContent>
<SelectItem value="png">{t("formatOptions.png")}</SelectItem>
<SelectItem value="jpeg">{t("formatOptions.jpeg")}</SelectItem>
<SelectItem value="webp">{t("formatOptions.webp")}</SelectItem>
<SelectItem value="png">PNG</SelectItem>
<SelectItem value="jpeg">JPEG</SelectItem>
<SelectItem value="webp">WEBP</SelectItem>
</SelectContent>
</Select>
</div>
<div className="space-y-2">
<div className="flex justify-between items-center">
<div className="flex items-center gap-1.5">
<Label htmlFor="quality">{t("qualityLabel")}</Label>
<Label htmlFor="quality">Quality</Label>
<Tooltip>
<TooltipTrigger>
<HelpCircle className="h-4 w-4 text-muted-foreground" />
</TooltipTrigger>
<TooltipContent>
<p>{t("qualityTooltip")}</p>
<p>Set compression quality for JPEG/WEBP. Higher is better quality but larger file size.</p>
</TooltipContent>
</Tooltip>
</div>
@@ -866,7 +863,7 @@ export function ImageConverter() {
disabled={format === 'png'}
/>
{format === 'png' && (
<p className="text-xs text-muted-foreground pt-1">{t("qualityDisabledTooltip")}</p>
<p className="text-xs text-muted-foreground pt-1">Quality slider is disabled for PNG (lossless format).</p>
)}
</div>
</div>
@@ -882,11 +879,11 @@ export function ImageConverter() {
variant="outline"
>
<RotateCcw className="mr-2 h-4 w-4" />
{t("reset")}
Reset
</Button>
</TooltipTrigger>
<TooltipContent>
<p>{t("resetTooltip")}</p>
<p>Reset all settings to their default values.</p>
</TooltipContent>
</Tooltip>
<Tooltip>
@@ -896,11 +893,11 @@ export function ImageConverter() {
className="w-full"
>
<Check className="mr-2 h-4 w-4" />
{t("apply")}
Apply
</Button>
</TooltipTrigger>
<TooltipContent>
<p>{t("applyTooltip")}</p>
<p>Confirm and apply all the settings above. This does not download the images.</p>
</TooltipContent>
</Tooltip>
</div>

View File

@@ -1,41 +0,0 @@
"use client";
import { useLocale } from "next-intl";
import { useRouter, usePathname } from "next-intl/client";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import { Button } from "@/components/ui/button";
import { Languages } from "lucide-react";
export default function LanguageSwitcher() {
const router = useRouter();
const pathname = usePathname();
const locale = useLocale();
const changeLocale = (nextLocale: string) => {
router.replace(pathname, { locale: nextLocale });
};
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="ghost" size="icon">
<Languages className="h-4 w-4" />
<span className="sr-only">Change language</span>
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="center">
<DropdownMenuItem onClick={() => changeLocale("en")} disabled={locale === "en"}>
English
</DropdownMenuItem>
<DropdownMenuItem onClick={() => changeLocale("de")} disabled={locale === "de"}>
Deutsch
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
);
}

View File

@@ -1,12 +0,0 @@
import {notFound} from 'next/navigation';
import {getRequestConfig} from 'next-intl/server';
const locales = ['en', 'de'];
export default getRequestConfig(async ({locale}) => {
if (!locales.includes(locale as any)) notFound();
return {
messages: (await import(`../messages/${locale}.json`)).default
};
});

View File

@@ -1,10 +0,0 @@
import createMiddleware from 'next-intl/middleware';
export default createMiddleware({
locales: ['en', 'de'],
defaultLocale: 'en'
});
export const config = {
matcher: ['/', '/(de|en)/:path*']
};