Ui corrections #15
No files matched your search
+4
-66
@@ -3,6 +3,7 @@
|
|||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
|
|
||||||
import { Input } from "@/components/FormElements";
|
import { Input } from "@/components/FormElements";
|
||||||
|
import { Screens } from "@/components/DatabaseOverview";
|
||||||
|
|
||||||
interface Songbook {
|
interface Songbook {
|
||||||
id: number;
|
id: number;
|
||||||
@@ -88,71 +89,8 @@ export default function SenderPage() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<Screens.Songs
|
||||||
{/* LIEDERSUCHE */}
|
onSelectSong={(song) => sendID(String(song.song_id), String(song.songbook_id))}
|
||||||
<div className="p-4 sm:p-6 flex flex-col h-[500px]">
|
/>
|
||||||
<h2 className="text-lg font-semibold mb-3 flex items-center gap-2">
|
|
||||||
Liedersuche & Datenbank
|
|
||||||
</h2>
|
|
||||||
|
|
||||||
<div className="mb-4">
|
|
||||||
<Input.Text
|
|
||||||
type="text"
|
|
||||||
placeholder="Nach Songtitel oder Nummer suchen..."
|
|
||||||
value={song_search_name}
|
|
||||||
onChange={(e) => search(e.target.value)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* TABELLE */}
|
|
||||||
<div className="flex-1 overflow-auto border border-neutral-200 dark:border-neutral-800 rounded-lg bg-white dark:bg-black">
|
|
||||||
<table className="w-full text-left border-collapse text-sm">
|
|
||||||
<thead className="bg-neutral-100 dark:bg-neutral-900 sticky top-0 border-b border-neutral-200 dark:border-neutral-800 z-10">
|
|
||||||
<tr>
|
|
||||||
<th className="p-3 text-xs font-semibold text-neutral-600 dark:text-neutral-400 uppercase tracking-wider">Titel</th>
|
|
||||||
<th className="p-3 text-xs font-semibold text-neutral-600 dark:text-neutral-400 uppercase tracking-wider">Liederbuch</th>
|
|
||||||
<th className="p-3 text-xs font-semibold text-neutral-600 dark:text-neutral-400 uppercase tracking-wider text-center">Nummer</th>
|
|
||||||
<th className="p-3 text-xs font-semibold text-neutral-600 dark:text-neutral-400 uppercase tracking-wider text-right">Aktion</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody className="divide-y divide-neutral-200 dark:divide-neutral-800">
|
|
||||||
{searchResults.length === 0 ? (
|
|
||||||
<tr>
|
|
||||||
<td colSpan={4} className="p-8 text-center text-neutral-400 dark:text-neutral-500">Keine Lieder gefunden</td>
|
|
||||||
</tr>
|
|
||||||
) : (
|
|
||||||
searchResults.map((song) => {
|
|
||||||
const songBook = songbooks.find((book) => book.id === song.songbook_id);
|
|
||||||
return (
|
|
||||||
<tr key={`${song.songbook_id}-${song.song_id}`} className="hover:bg-neutral-100/60 dark:hover:bg-neutral-900/40 transition">
|
|
||||||
<td className="p-3 font-medium text-neutral-900 dark:text-white max-w-[180px] sm:max-w-none truncate">
|
|
||||||
{song.title}
|
|
||||||
<span className="block text-xs text-neutral-500 dark:text-neutral-400 sm:hidden mt-0.5">
|
|
||||||
{songBook ? songBook.name : "Unbekannt"}
|
|
||||||
</span>
|
|
||||||
</td>
|
|
||||||
<td className="p-3 text-neutral-700 dark:text-neutral-300 hidden sm:table-cell">
|
|
||||||
{songBook ? songBook.name : "Unbekannt"}
|
|
||||||
</td>
|
|
||||||
<td className="p-3 text-center font-mono text-blue-600 dark:text-blue-400 font-bold">
|
|
||||||
{song.song_number}
|
|
||||||
</td>
|
|
||||||
<td className="p-3 text-right">
|
|
||||||
<Input.Button
|
|
||||||
onClick={() => sendID(String(song.song_id), String(song.songbook_id))}
|
|
||||||
className="bg-white dark:bg-black hover:bg-blue-600 dark:hover:bg-blue-600 border border-neutral-300 dark:border-neutral-700 hover:border-blue-600 dark:hover:border-blue-500 hover:text-white font-medium rounded-md px-3 py-1.5 transition text-xs"
|
|
||||||
>
|
|
||||||
Anzeigen
|
|
||||||
</Input.Button>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
);
|
|
||||||
})
|
|
||||||
)}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
+20
-12
@@ -1,14 +1,22 @@
|
|||||||
import { ReactNode } from "react";
|
import { ReactNode, ComponentPropsWithoutRef } from "react";
|
||||||
|
|
||||||
export default function Card({title, children}: {title: string, children: ReactNode}) {
|
interface CardProps extends ComponentPropsWithoutRef<"section"> {
|
||||||
return (
|
title: string;
|
||||||
<section className="p-5 flex flex-col justify-between">
|
children: ReactNode;
|
||||||
<h2 className="text-lg font-semibold mb-4 flex items-center gap-2">
|
}
|
||||||
{title}
|
|
||||||
</h2>
|
export default function Card({ title, children, className = "", ...props }: CardProps) {
|
||||||
<div>
|
return (
|
||||||
{children}
|
<section
|
||||||
</div>
|
className={`p-5 flex flex-col justify-between ${className}`}
|
||||||
</section>
|
{...props}
|
||||||
);
|
>
|
||||||
|
<h2 className="text-lg font-semibold mb-4 flex items-center gap-2">
|
||||||
|
{title}
|
||||||
|
</h2>
|
||||||
|
<div className="flex-1 min-h-0 flex flex-col">
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
@@ -72,7 +72,7 @@ function Songs({onSelectSong}: SongsProps) {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card title="Alle Lieder">
|
<Card title="Alle Lieder" className="h-[500px]">
|
||||||
<div className="mb-4">
|
<div className="mb-4">
|
||||||
<Input.Text
|
<Input.Text
|
||||||
type="text"
|
type="text"
|
||||||
@@ -82,52 +82,52 @@ function Songs({onSelectSong}: SongsProps) {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{/* TABELLE */}
|
{/* TABELLE */}
|
||||||
<div className="flex-1 overflow-auto border border-neutral-200 dark:border-neutral-800 rounded-lg bg-white dark:bg-black">
|
<div className="flex-1 min-h-0 overflow-auto border border-neutral-200 dark:border-neutral-800 rounded-lg bg-white dark:bg-black">
|
||||||
<table className="w-full text-left border-collapse text-sm">
|
<table className="w-full text-left border-collapse text-sm">
|
||||||
<thead className="bg-neutral-100 dark:bg-neutral-900 sticky top-0 border-b border-neutral-200 dark:border-neutral-800 z-10">
|
<thead className="bg-neutral-100 dark:bg-neutral-900 sticky top-0 border-b border-neutral-200 dark:border-neutral-800 z-10">
|
||||||
<tr>
|
|
||||||
<th className="p-3 text-xs font-semibold text-neutral-600 dark:text-neutral-400 uppercase tracking-wider">Titel</th>
|
|
||||||
<th className="p-3 text-xs font-semibold text-neutral-600 dark:text-neutral-400 uppercase tracking-wider">Liederbuch</th>
|
|
||||||
<th className="p-3 text-xs font-semibold text-neutral-600 dark:text-neutral-400 uppercase tracking-wider text-center">Nummer</th>
|
|
||||||
<th className="p-3 text-xs font-semibold text-neutral-600 dark:text-neutral-400 uppercase tracking-wider text-right">Aktion</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody className="divide-y divide-neutral-200 dark:divide-neutral-800">
|
|
||||||
{searchResults.length === 0 ? (
|
|
||||||
<tr>
|
<tr>
|
||||||
<td colSpan={4} className="p-8 text-center text-neutral-400 dark:text-neutral-500">Keine Lieder gefunden</td>
|
<th className="p-3 text-xs font-semibold text-neutral-600 dark:text-neutral-400 uppercase tracking-wider">Titel</th>
|
||||||
|
<th className="p-3 text-xs font-semibold text-neutral-600 dark:text-neutral-400 uppercase tracking-wider">Liederbuch</th>
|
||||||
|
<th className="p-3 text-xs font-semibold text-neutral-600 dark:text-neutral-400 uppercase tracking-wider text-center">Nummer</th>
|
||||||
|
<th className="p-3 text-xs font-semibold text-neutral-600 dark:text-neutral-400 uppercase tracking-wider text-right">Aktion</th>
|
||||||
</tr>
|
</tr>
|
||||||
) : (
|
</thead>
|
||||||
searchResults.map((song) => {
|
<tbody className="divide-y divide-neutral-200 dark:divide-neutral-800">
|
||||||
const songBook = songbooks.find((book) => book.id === song.songbook_id);
|
{searchResults.length === 0 ? (
|
||||||
return (
|
<tr>
|
||||||
<tr key={`${song.songbook_id}-${song.song_id}`} className="hover:bg-neutral-100/60 dark:hover:bg-neutral-900/40 transition">
|
<td colSpan={4} className="p-8 text-center text-neutral-400 dark:text-neutral-500">Keine Lieder gefunden</td>
|
||||||
<td className="p-3 font-medium text-neutral-900 dark:text-white max-w-[180px] sm:max-w-none truncate">
|
|
||||||
{song.title}
|
|
||||||
<span className="block text-xs text-neutral-500 dark:text-neutral-400 sm:hidden mt-0.5">
|
|
||||||
{songBook ? songBook.name : "Unbekannt"}
|
|
||||||
</span>
|
|
||||||
</td>
|
|
||||||
<td className="p-3 text-neutral-700 dark:text-neutral-300 hidden sm:table-cell">
|
|
||||||
{songBook ? songBook.name : "Unbekannt"}
|
|
||||||
</td>
|
|
||||||
<td className="p-3 text-center font-mono text-blue-600 dark:text-blue-400 font-bold">
|
|
||||||
{song.song_number}
|
|
||||||
</td>
|
|
||||||
<td className="p-3 text-right">
|
|
||||||
<Input.Button
|
|
||||||
onClick={() => onSelectSong?.(song)}
|
|
||||||
className="bg-white dark:bg-black hover:bg-blue-600 dark:hover:bg-blue-600 border border-neutral-300 dark:border-neutral-700 hover:border-blue-600 dark:hover:border-blue-500 hover:text-white font-medium rounded-md px-3 py-1.5 transition text-xs"
|
|
||||||
>
|
|
||||||
Anzeigen
|
|
||||||
</Input.Button>
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
);
|
) : (
|
||||||
})
|
searchResults.map((song) => {
|
||||||
)}
|
const songBook = songbooks.find((book) => book.id === song.songbook_id);
|
||||||
</tbody>
|
return (
|
||||||
</table>
|
<tr key={`${song.songbook_id}-${song.song_id}`} className="hover:bg-neutral-100/60 dark:hover:bg-neutral-900/40 transition">
|
||||||
|
<td className="p-3 font-medium text-neutral-900 dark:text-white max-w-[180px] sm:max-w-none truncate">
|
||||||
|
{song.title}
|
||||||
|
<span className="block text-xs text-neutral-500 dark:text-neutral-400 sm:hidden mt-0.5">
|
||||||
|
{songBook ? songBook.name : "Unbekannt"}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
<td className="p-3 text-neutral-700 dark:text-neutral-300 hidden sm:table-cell">
|
||||||
|
{songBook ? songBook.name : "Unbekannt"}
|
||||||
|
</td>
|
||||||
|
<td className="p-3 text-center font-mono text-blue-600 dark:text-blue-400 font-bold">
|
||||||
|
{song.song_number}
|
||||||
|
</td>
|
||||||
|
<td className="p-3 text-right">
|
||||||
|
<Input.Button
|
||||||
|
onClick={() => onSelectSong?.(song)}
|
||||||
|
className="bg-white dark:bg-black hover:bg-blue-600 dark:hover:bg-blue-600 border border-neutral-300 dark:border-neutral-700 hover:border-blue-600 dark:hover:border-blue-500 hover:text-white font-medium rounded-md px-3 py-1.5 transition text-xs"
|
||||||
|
>
|
||||||
|
Anzeigen
|
||||||
|
</Input.Button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
);
|
||||||
|
})
|
||||||
|
)}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in new issue
Block a user