Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
edd33ab712 | ||
|
|
fde1f27745 | ||
|
|
583ef90a7b | ||
|
|
2fb484ad26 |
No files matched your search
@@ -46,3 +46,4 @@ songs.sqlite
|
|||||||
|
|
||||||
.gitignore
|
.gitignore
|
||||||
/lib/generated/prisma
|
/lib/generated/prisma
|
||||||
|
pnpm-lock.yaml
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
import { error } from "console";
|
import { error } from "console";
|
||||||
import Papa from "papaparse";
|
import Papa from "papaparse";
|
||||||
import { addSongToSongbook } from "@/lib/db/managing";
|
|
||||||
|
|
||||||
interface CSVRow {
|
interface CSVRow {
|
||||||
nummer: string;
|
nummer: string;
|
||||||
@@ -31,8 +30,8 @@ export async function uploadCSVAction(formData:FormData) {
|
|||||||
|
|
||||||
console.log("Data:", rows);
|
console.log("Data:", rows);
|
||||||
rows.forEach(row => {
|
rows.forEach(row => {
|
||||||
//console.log(`Nummer: ${row.number}, Titel: ${row.titel}`);
|
console.log(`Nummer: ${row.nummer}, Titel: ${row.titel}`);
|
||||||
addSongToSongbook(String(row.titel), Number(songbookId), String(row.nummer))
|
//addSongToSongbook(String(row.titel), Number(songbookId), String(row.nummer))
|
||||||
});
|
});
|
||||||
|
|
||||||
return { success: true, message: `${rows.length} Zeilen erfolgreich importiert.`};
|
return { success: true, message: `${rows.length} Zeilen erfolgreich importiert.`};
|
||||||
|
|||||||
+43
-32
@@ -9,7 +9,7 @@ import { Screens } from "@/components/DatabaseOverview";
|
|||||||
|
|
||||||
interface Songbook {
|
interface Songbook {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
title: string;
|
||||||
language: string;
|
language: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ interface Song {
|
|||||||
|
|
||||||
interface SongInfo {
|
interface SongInfo {
|
||||||
songbook_id: number;
|
songbook_id: number;
|
||||||
songbook_name: string;
|
songbook_title: string;
|
||||||
song_number: string;
|
song_number: string;
|
||||||
title: string;
|
title: string;
|
||||||
}
|
}
|
||||||
@@ -34,7 +34,7 @@ export default function AdminPage() {
|
|||||||
const [number, setNumber] = useState("");
|
const [number, setNumber] = useState("");
|
||||||
const [title, setTitle] = useState("");
|
const [title, setTitle] = useState("");
|
||||||
|
|
||||||
const [newBookName, setNewBookName] = useState("");
|
const [newBookTitle, setNewBookTitle] = useState("");
|
||||||
const [newBookLanguage, setNewBookLanguage] = useState("");
|
const [newBookLanguage, setNewBookLanguage] = useState("");
|
||||||
|
|
||||||
const [uploadStatus, setUploadStatus] = useState<string | null>(null);
|
const [uploadStatus, setUploadStatus] = useState<string | null>(null);
|
||||||
@@ -96,21 +96,34 @@ export default function AdminPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await fetch("/api/songs", {
|
// Create song
|
||||||
|
const res1 = await fetch("/api/songs", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
songbookId: Number(selectedSongbookId),
|
|
||||||
number: number,
|
|
||||||
title: title
|
title: title
|
||||||
})
|
})
|
||||||
});
|
})
|
||||||
if (res.ok) {
|
if (res1.ok) {
|
||||||
alert("Lied erfolgreich hinzugefügt!");
|
console.log("Lied erfolgreich erstellt!");
|
||||||
setNumber("");
|
|
||||||
setTitle("");
|
|
||||||
} else {
|
} else {
|
||||||
alert("Fehler beim Senden.");
|
console.log("Lied erstellen fehlgeschlagen!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attach song to songbook
|
||||||
|
const data = await res1.json()
|
||||||
|
const songId = data.song.id;
|
||||||
|
const res2 = await fetch(`/api/songbooks/${Number(selectedSongbookId)}/songs/${songId}`, {
|
||||||
|
method: "POST",
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
body: JSON.stringify({
|
||||||
|
number: number
|
||||||
|
})
|
||||||
|
})
|
||||||
|
if (res2.ok) {
|
||||||
|
console.log("Lied erfolgreich dem Liederbuch zugewiesen!");
|
||||||
|
} else {
|
||||||
|
console.log("Fehler");
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Failed sending current songID:", error);
|
console.error("Failed sending current songID:", error);
|
||||||
@@ -124,19 +137,17 @@ export default function AdminPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await fetch("/api/songs/attach", {
|
const res2 = await fetch(`/api/songbooks/${Number(selectedSongbookId)}/songs/${selectedSong.song_id}`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
songbookId: selectedSongbookId,
|
number: number
|
||||||
songId: selectedSong.song_id,
|
|
||||||
number: number,
|
|
||||||
})
|
})
|
||||||
});
|
})
|
||||||
if (res.ok) {
|
if (res2.ok) {
|
||||||
alert("Lied erfolgreich zum Liederbuch hinzugefügt!");
|
console.log("Lied erfolgreich dem Liederbuch zugewiesen!");
|
||||||
} else {
|
} else {
|
||||||
alert("Fehler beim Senden.");
|
console.log("Fehler");
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Failed sending current songID:", error);
|
console.error("Failed sending current songID:", error);
|
||||||
@@ -169,8 +180,8 @@ export default function AdminPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const addSongbook = async () => {
|
const addSongbook = async () => {
|
||||||
if (!newBookName) {
|
if (!newBookTitle) {
|
||||||
alert("Der Name des Liederbuches darf nicht leer sein!");
|
alert("Der Title des Liederbuches darf nicht leer sein!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,14 +189,14 @@ export default function AdminPage() {
|
|||||||
const res = await fetch("/api/songbooks", {
|
const res = await fetch("/api/songbooks", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({ name: newBookName, language: newBookLanguage })
|
body: JSON.stringify({ title: newBookTitle, language: newBookLanguage })
|
||||||
});
|
});
|
||||||
|
|
||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
const createdBook = await res.json();
|
const createdBook = await res.json();
|
||||||
setSongbooks([...songbooks, createdBook]);
|
setSongbooks([...songbooks, createdBook]);
|
||||||
alert("Liederbuch erfolgreich erstellt!");
|
alert("Liederbuch erfolgreich erstellt!");
|
||||||
setNewBookName("");
|
setNewBookTitle("");
|
||||||
setNewBookLanguage("");
|
setNewBookLanguage("");
|
||||||
} else {
|
} else {
|
||||||
alert("Failed adding songbook!");
|
alert("Failed adding songbook!");
|
||||||
@@ -215,8 +226,8 @@ export default function AdminPage() {
|
|||||||
<Input.Text
|
<Input.Text
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="z.B. Gesangbuch"
|
placeholder="z.B. Gesangbuch"
|
||||||
value={newBookName}
|
value={newBookTitle}
|
||||||
onChange={(e) => setNewBookName(e.target.value)}
|
onChange={(e) => setNewBookTitle(e.target.value)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@@ -248,7 +259,7 @@ export default function AdminPage() {
|
|||||||
<option value="">-- Bitte wählen --</option>
|
<option value="">-- Bitte wählen --</option>
|
||||||
{songbooks.map((book) => (
|
{songbooks.map((book) => (
|
||||||
<option key={book.id} value={String(book.id)}>
|
<option key={book.id} value={String(book.id)}>
|
||||||
{book.name}{book.language ? ` (${book.language})` : ""}
|
{book.title}{book.language ? ` (${book.language})` : ""}
|
||||||
</option>
|
</option>
|
||||||
))}
|
))}
|
||||||
</Input.Select>
|
</Input.Select>
|
||||||
@@ -290,7 +301,7 @@ export default function AdminPage() {
|
|||||||
<option value="">-- Bitte wählen --</option>
|
<option value="">-- Bitte wählen --</option>
|
||||||
{songbooks.map((book) => (
|
{songbooks.map((book) => (
|
||||||
<option key={book.id} value={String(book.id)}>
|
<option key={book.id} value={String(book.id)}>
|
||||||
{book.name}{book.language ? ` (${book.language})` : ""}
|
{book.title}{book.language ? ` (${book.language})` : ""}
|
||||||
</option>
|
</option>
|
||||||
))}
|
))}
|
||||||
</Input.Select>
|
</Input.Select>
|
||||||
@@ -335,7 +346,7 @@ export default function AdminPage() {
|
|||||||
<ul className="list-disc list-inside pl-2 text-xs text-neutral-400">
|
<ul className="list-disc list-inside pl-2 text-xs text-neutral-400">
|
||||||
{songInfos.map((info) => (
|
{songInfos.map((info) => (
|
||||||
<li key={info.songbook_id}>
|
<li key={info.songbook_id}>
|
||||||
{info.songbook_name} (Nr. {info.song_number})
|
{info.songbook_title} (Nr. {info.song_number})
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
@@ -356,7 +367,7 @@ export default function AdminPage() {
|
|||||||
<option value="">-- Bitte wählen --</option>
|
<option value="">-- Bitte wählen --</option>
|
||||||
{songbooks.map((book) => (
|
{songbooks.map((book) => (
|
||||||
<option key={book.id} value={String(book.id)}>
|
<option key={book.id} value={String(book.id)}>
|
||||||
{book.name}{book.language ? ` (${book.language})` : ""}
|
{book.title}{book.language ? ` (${book.language})` : ""}
|
||||||
</option>
|
</option>
|
||||||
))}
|
))}
|
||||||
</Input.Select>
|
</Input.Select>
|
||||||
@@ -390,7 +401,7 @@ export default function AdminPage() {
|
|||||||
{songInfos.length > 0 ? (
|
{songInfos.length > 0 ? (
|
||||||
songInfos.map((info) => (
|
songInfos.map((info) => (
|
||||||
<option key={info.songbook_id} value={String(info.songbook_id)}>
|
<option key={info.songbook_id} value={String(info.songbook_id)}>
|
||||||
{info.songbook_name} (Nr. {info.song_number})
|
{info.songbook_title} (Nr. {info.song_number})
|
||||||
</option>
|
</option>
|
||||||
))
|
))
|
||||||
): ""}
|
): ""}
|
||||||
|
|||||||
@@ -110,7 +110,10 @@ export async function POST(request: Request) {
|
|||||||
|
|
||||||
if (!res.success) {
|
if (!res.success) {
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
{ message: res.error },
|
{
|
||||||
|
message: res.error,
|
||||||
|
song: res.song
|
||||||
|
},
|
||||||
{ status: res.status }
|
{ status: res.status }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// @wikiCategory: Stream
|
// @wikiCategory: Stream
|
||||||
|
|
||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
import { getSong } from "@/lib/db/managing";
|
import { getSongById } from "@/lib/db/song";
|
||||||
|
|
||||||
let currentSong = {
|
let currentSong = {
|
||||||
songID: "",
|
songID: "",
|
||||||
@@ -19,23 +19,43 @@ export async function GET() {
|
|||||||
export async function POST(request: Request) {
|
export async function POST(request: Request) {
|
||||||
try {
|
try {
|
||||||
const data = await request.json();
|
const data = await request.json();
|
||||||
const songID = data.songID;
|
const { songID, songbookID } = data;
|
||||||
const songbookID = data.songbookID;
|
|
||||||
|
|
||||||
if (!songID || !songbookID) {
|
if (!songID || !songbookID) {
|
||||||
return NextResponse.json({ success: false, error: "Fields incomplete!" }, { status: 400 });
|
return NextResponse.json(
|
||||||
|
{ success: false, error: "Fields incomplete!" },
|
||||||
|
{ status: 400 }
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const song = await getSong(Number(songbookID), String(songID));
|
const result = await getSongById(songID);
|
||||||
|
|
||||||
if (song) {
|
if (result.success && result.song) {
|
||||||
currentSong = {
|
const song = result.song;
|
||||||
songID: String(songID),
|
|
||||||
songbook: song.songbook_name,
|
// looking for the songbook with matching ID
|
||||||
number: song.number,
|
const matchedBook = song.songBooks.find(
|
||||||
title: song.song_title,
|
(entry) => String(entry.book.id) === String(songbookID)
|
||||||
};
|
);
|
||||||
|
|
||||||
|
if (matchedBook) {
|
||||||
|
currentSong = {
|
||||||
|
songID: String(song.id),
|
||||||
|
songbook: matchedBook.book.title,
|
||||||
|
number: String(matchedBook.songNumber),
|
||||||
|
title: song.title,
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
// song does exist but not in the given songbook
|
||||||
|
currentSong = {
|
||||||
|
songID: "",
|
||||||
|
songbook: "",
|
||||||
|
number: "",
|
||||||
|
title: "",
|
||||||
|
};
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// song does not exist
|
||||||
currentSong = {
|
currentSong = {
|
||||||
songID: "",
|
songID: "",
|
||||||
songbook: "",
|
songbook: "",
|
||||||
@@ -43,10 +63,15 @@ export async function POST(request: Request) {
|
|||||||
title: "",
|
title: "",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
console.log(currentSong);
|
|
||||||
|
|
||||||
return NextResponse.json({ success: true });
|
console.log("Aktualisierter currentSong:", currentSong);
|
||||||
|
|
||||||
|
return NextResponse.json({ success: true, currentSong });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return NextResponse.json({ success: false, error: "Server-Fehler" }, { status: 500 });
|
console.error("API POST Error:", error);
|
||||||
|
return NextResponse.json(
|
||||||
|
{ success: false, error: "Server-Fehler" },
|
||||||
|
{ status: 500 }
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { useState, useEffect, ComponentPropsWithoutRef } from "react";
|
import { useState, useEffect, ComponentPropsWithoutRef } from "react";
|
||||||
|
|
||||||
import Card from "./Card"
|
import Card from "./Card";
|
||||||
import { Input } from "./FormElements"
|
import { Input } from "./FormElements";
|
||||||
|
|
||||||
interface SongsProps extends Omit<ComponentPropsWithoutRef<typeof Card>, "title" | "children"> {
|
interface SongsProps extends Omit<ComponentPropsWithoutRef<typeof Card>, "title" | "children"> {
|
||||||
onSelectSong?: (song: Song) => void;
|
onSelectSong?: (song: Song) => void;
|
||||||
@@ -9,7 +9,7 @@ interface SongsProps extends Omit<ComponentPropsWithoutRef<typeof Card>, "title"
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface Song {
|
interface Song {
|
||||||
song_id: number;
|
id: number;
|
||||||
songbook_id: number;
|
songbook_id: number;
|
||||||
song_number: string;
|
song_number: string;
|
||||||
title: string;
|
title: string;
|
||||||
@@ -17,43 +17,42 @@ interface Song {
|
|||||||
|
|
||||||
interface Songbook {
|
interface Songbook {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
title: string;
|
||||||
language: string;
|
language: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
function Songs({ actionName, onSelectSong, className = "", ...props }: SongsProps) {
|
function Songs({ actionName = "Auswählen", onSelectSong, className = "", ...props }: SongsProps) {
|
||||||
const [song_search_name, setSongSearchName] = useState("");
|
const [song_search_name, setSongSearchName] = useState("");
|
||||||
const [searchResults, setSearchResults] = useState<Song[]>([]);
|
const [searchResults, setSearchResults] = useState<Song[]>([]);
|
||||||
const [allSongs, setAllSongs] = useState<Song[]>([]);
|
const [allSongs, setAllSongs] = useState<Song[]>([]);
|
||||||
const [songbooks, setSongbooks] = useState<Songbook[]>([]);
|
const [songbooks, setSongbooks] = useState<Songbook[]>([]);
|
||||||
|
|
||||||
|
|
||||||
const search = (query: string) => {
|
const search = (query: string) => {
|
||||||
setSongSearchName(query);
|
setSongSearchName(query);
|
||||||
if (query.trim() !== "") {
|
if (query.trim() !== "") {
|
||||||
setSearchResults(
|
setSearchResults(
|
||||||
allSongs.filter((song) =>
|
allSongs.filter((song) =>
|
||||||
song.title.toLowerCase().includes(query.toLowerCase()) ||
|
song.title.toLowerCase().includes(query.toLowerCase()) ||
|
||||||
song.song_number.includes(query)
|
song.song_number.includes(query)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
setSearchResults(allSongs);
|
setSearchResults(allSongs);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const getSongslist = async () => {
|
const getSongslist = async () => {
|
||||||
try {
|
try {
|
||||||
const res = await fetch("/api/songs");
|
const res = await fetch("/api/songs");
|
||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
setAllSongs(data);
|
setAllSongs(data);
|
||||||
setSearchResults(data);
|
setSearchResults(data);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setAllSongs([]);
|
setAllSongs([]);
|
||||||
console.error("Failed fetching songslist!");
|
console.error("Failed fetching songslist!", error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -61,13 +60,14 @@ function Songs({ actionName, onSelectSong, className = "", ...props }: SongsProp
|
|||||||
try {
|
try {
|
||||||
const res = await fetch("/api/songbooks");
|
const res = await fetch("/api/songbooks");
|
||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
setSongbooks(data);
|
setSongbooks(data);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Loading songbooks failed: ", error);
|
console.error("Loading songbooks failed: ", error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
loadSongbooks();
|
loadSongbooks();
|
||||||
getSongslist();
|
getSongslist();
|
||||||
}, []);
|
}, []);
|
||||||
@@ -80,64 +80,66 @@ function Songs({ actionName, onSelectSong, className = "", ...props }: SongsProp
|
|||||||
>
|
>
|
||||||
<div className="mb-4">
|
<div className="mb-4">
|
||||||
<Input.Text
|
<Input.Text
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Nach Songtitel oder Nummer suchen..."
|
placeholder="Nach Songtitel oder Nummer suchen..."
|
||||||
value={song_search_name}
|
value={song_search_name}
|
||||||
onChange={(e) => search(e.target.value)}
|
onChange={(e) => search(e.target.value)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* TABELLE */}
|
{/* TABELLE */}
|
||||||
<div className="flex-1 min-h-0 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>
|
<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">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">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-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>
|
<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>
|
</thead>
|
||||||
<tbody className="divide-y divide-neutral-200 dark:divide-neutral-800">
|
<tbody className="divide-y divide-neutral-200 dark:divide-neutral-800">
|
||||||
{searchResults.length === 0 ? (
|
{searchResults.length === 0 ? (
|
||||||
<tr>
|
<tr>
|
||||||
<td colSpan={4} className="p-8 text-center text-neutral-400 dark:text-neutral-500">Keine Lieder gefunden</td>
|
<td colSpan={4} className="p-8 text-center text-neutral-400 dark:text-neutral-500">Keine Lieder gefunden</td>
|
||||||
</tr>
|
</tr>
|
||||||
) : (
|
) : (
|
||||||
searchResults.map((song) => {
|
searchResults.map((song) => {
|
||||||
const songBook = songbooks.find((book) => book.id === song.songbook_id);
|
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">
|
return (
|
||||||
<td className="p-3 font-medium text-neutral-900 dark:text-white max-w-[180px] sm:max-w-none truncate">
|
<tr key={`${song.songbook_id}-${song.id}`} className="hover:bg-neutral-100/60 dark:hover:bg-neutral-900/40 transition">
|
||||||
{song.title}
|
<td className="p-3 font-medium text-neutral-900 dark:text-white max-w-[180px] sm:max-w-none truncate">
|
||||||
<span className="block text-xs text-neutral-500 dark:text-neutral-400 sm:hidden mt-0.5">
|
{song.title}
|
||||||
{songBook ? songBook.name : "Unbekannt"}
|
<span className="block text-xs text-neutral-500 dark:text-neutral-400 sm:hidden mt-0.5">
|
||||||
</span>
|
{songBook ? songBook.title : "Unbekannt"}
|
||||||
</td>
|
</span>
|
||||||
<td className="p-3 text-neutral-700 dark:text-neutral-300 hidden sm:table-cell">
|
</td>
|
||||||
{songBook ? songBook.name : "Unbekannt"}
|
<td className="p-3 text-neutral-700 dark:text-neutral-300 hidden sm:table-cell">
|
||||||
</td>
|
{songBook ? songBook.title : "Unbekannt"}
|
||||||
<td className="p-3 text-center font-mono text-blue-600 dark:text-blue-400 font-bold">
|
</td>
|
||||||
{song.song_number}
|
<td className="p-3 text-center font-mono text-blue-600 dark:text-blue-400 font-bold">
|
||||||
</td>
|
{song.song_number}
|
||||||
<td className="p-3 text-right">
|
</td>
|
||||||
<Input.Button
|
<td className="p-3 text-right">
|
||||||
onClick={() => onSelectSong?.(song)}
|
<Input.Button
|
||||||
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"
|
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"
|
||||||
{actionName}
|
>
|
||||||
</Input.Button>
|
{actionName}
|
||||||
</td>
|
</Input.Button>
|
||||||
</tr>
|
</td>
|
||||||
);
|
</tr>
|
||||||
|
);
|
||||||
})
|
})
|
||||||
)}
|
)}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Screens = {
|
export const Screens = {
|
||||||
Songs: Songs,
|
Songs: Songs,
|
||||||
}
|
};
|
||||||
+5
-1
@@ -6,7 +6,11 @@
|
|||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
"lint": "eslint"
|
"lint": "eslint",
|
||||||
|
"postinstall": "prisma generate",
|
||||||
|
"predev": "prisma migrate deploy",
|
||||||
|
"prestart": "prisma migrate deploy",
|
||||||
|
"db:setup": "node -e \"require('fs').existsSync('.env')||require('fs').copyFileSync('example.env','.env')\" && prisma migrate deploy && prisma generate"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@prisma/adapter-better-sqlite3": "^7.9.1",
|
"@prisma/adapter-better-sqlite3": "^7.9.1",
|
||||||
|
|||||||
Reference in new issue
Block a user