Compare commits

...

3 Commits

Author SHA1 Message Date
Hördle Bot
28d14ff099 chore: bump version to v0.1.5.0 2025-12-03 15:12:50 +01:00
Hördle Bot
b1493b44bf Game: Share-Button unter Rating platziert und kurz erläutert 2025-12-03 15:03:32 +01:00
Hördle Bot
b8a803b76e Songs-API: robuste Behandlung möglicher verwaister SpecialSong-Relationen 2025-12-03 14:56:40 +01:00
5 changed files with 22 additions and 9 deletions

View File

@@ -103,9 +103,11 @@ export async function GET(request: NextRequest) {
visibleSongs = songs.filter(song => { visibleSongs = songs.filter(song => {
const songGenreIds = song.genres.map(g => g.id); const songGenreIds = song.genres.map(g => g.id);
// `song.specials` ist hier ein Array von SpecialSong mit Relation `special`, // `song.specials` ist hier ein Array von SpecialSong mit Relation `special`.
// wir nutzen konsistent die Special-ID. // Es kann theoretisch verwaiste Einträge ohne `special` geben → defensiv optional chainen.
const songSpecialIds = song.specials.map(ss => ss.special.id); const songSpecialIds = song.specials
.map(ss => ss.special?.id)
.filter((id): id is number => typeof id === 'number');
// Songs ohne Genres/Specials sind immer sichtbar // Songs ohne Genres/Specials sind immer sichtbar
if (songGenreIds.length === 0 && songSpecialIds.length === 0) { if (songGenreIds.length === 0 && songSpecialIds.length === 0) {
@@ -131,7 +133,10 @@ export async function GET(request: NextRequest) {
activations: song.puzzles.length, activations: song.puzzles.length,
puzzles: song.puzzles, puzzles: song.puzzles,
genres: song.genres, genres: song.genres,
specials: song.specials.map(ss => ss.special), // Nur Specials mit existierender Relation durchreichen, um undefinierte Einträge zu vermeiden.
specials: song.specials
.map(ss => ss.special)
.filter((s): s is any => !!s),
averageRating: song.averageRating, averageRating: song.averageRating,
ratingCount: song.ratingCount, ratingCount: song.ratingCount,
excludeFromGlobal: song.excludeFromGlobal, excludeFromGlobal: song.excludeFromGlobal,

View File

@@ -519,14 +519,20 @@ export default function Game({ dailyPuzzle, genre = null, isSpecial = false, max
</audio> </audio>
</div> </div>
<div style={{ marginBottom: '1rem' }}> <div style={{ marginBottom: '1.25rem' }}>
<StarRating onRate={handleRatingSubmit} hasRated={hasRated} /> <StarRating onRate={handleRatingSubmit} hasRated={hasRated} />
</div> </div>
<div style={{ marginBottom: '1.25rem', textAlign: 'center' }}>
<p style={{ fontSize: '0.85rem', color: 'var(--muted-foreground)', marginBottom: '0.5rem' }}>
{t('shareExplanation')}
</p>
<button onClick={handleShare} className="btn-primary">
{shareText}
</button>
</div>
{statistics && <Statistics statistics={statistics} />} {statistics && <Statistics statistics={statistics} />}
<button onClick={handleShare} className="btn-primary" style={{ marginTop: '1rem' }}>
{shareText}
</button>
</div> </div>
)} )}
</main> </main>

View File

@@ -41,6 +41,7 @@
"comeBackTomorrow": "Komm morgen zurück für ein neues Lied.", "comeBackTomorrow": "Komm morgen zurück für ein neues Lied.",
"theSongWas": "Das Lied war:", "theSongWas": "Das Lied war:",
"score": "Punkte", "score": "Punkte",
"shareExplanation": "Teile dein Ergebnis mit Freund:innen so hilfst du, Hördle bekannter zu machen.",
"scoreBreakdown": "Punkteaufschlüsselung", "scoreBreakdown": "Punkteaufschlüsselung",
"albumCover": "Album-Cover", "albumCover": "Album-Cover",
"released": "Veröffentlicht", "released": "Veröffentlicht",

View File

@@ -41,6 +41,7 @@
"comeBackTomorrow": "Come back tomorrow for a new song.", "comeBackTomorrow": "Come back tomorrow for a new song.",
"theSongWas": "The song was:", "theSongWas": "The song was:",
"score": "Score", "score": "Score",
"shareExplanation": "Share your result with friends your support helps Hördle grow.",
"scoreBreakdown": "Score Breakdown", "scoreBreakdown": "Score Breakdown",
"albumCover": "Album Cover", "albumCover": "Album Cover",
"released": "Released", "released": "Released",

View File

@@ -1,6 +1,6 @@
{ {
"name": "hoerdle", "name": "hoerdle",
"version": "0.1.4.11", "version": "0.1.5.0",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "next dev", "dev": "next dev",