managarten/apps-archived/mukke/apps/mobile/components/AlbumGrid.tsx
Till JS 7a56699d45 feat(mukke): rename LightWrite to Mukke and add music library, player, playlists
Combines LightWrite (beat/lyrics editor) and Mukke (iOS music player) into
a single web-based music workspace app. Archives the old Mukke mobile app.

- Rename: @lightwrite/* → @mukke/*, all branding, configs, Dockerfiles
- New DB schemas: songs, playlists, playlist_songs + songId FK on projects
- New backend modules: SongModule, PlaylistModule, LibraryModule
- New web: app shell with sidebar, library (songs/albums/artists/genres),
  web player (queue/shuffle/repeat/MediaSession), playlists, search,
  upload, dashboard, album/artist/genre detail pages
- Auth: add forgot-password + reset-password pages, extend auth store
- Tests: 40 backend unit tests (song, playlist, library services)
- Config: env generation, MinIO bucket, docker-compose prod, cloudflare
- Docs: update CLAUDE.md, auth guidelines with SvelteKit checklist

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 09:55:56 +01:00

75 lines
2 KiB
TypeScript

import { Ionicons } from '@expo/vector-icons';
import { useRouter } from 'expo-router';
import { FlatList, Image, Pressable, Text, View, useWindowDimensions } from 'react-native';
import type { Album } from '~/types';
import { useTheme } from '~/utils/themeContext';
import { EmptyState } from './EmptyState';
interface AlbumGridProps {
albums: Album[];
}
export function AlbumGrid({ albums }: AlbumGridProps) {
const router = useRouter();
const { colors } = useTheme();
const { width } = useWindowDimensions();
const itemSize = (width - 48) / 2;
if (albums.length === 0) {
return (
<EmptyState
icon="disc-outline"
title="Keine Alben"
message="Importierte Songs werden nach Alben gruppiert."
/>
);
}
return (
<FlatList
data={albums}
keyExtractor={(item) => item.name}
numColumns={2}
contentContainerStyle={{ padding: 12, paddingBottom: 100 }}
columnWrapperStyle={{ gap: 12 }}
ItemSeparatorComponent={() => <View style={{ height: 16 }} />}
renderItem={({ item }) => (
<Pressable
onPress={() => router.push(`/album/${encodeURIComponent(item.name)}`)}
style={{ width: itemSize }}
>
{item.coverArtPath ? (
<Image
source={{ uri: item.coverArtPath }}
style={{ width: itemSize, height: itemSize, borderRadius: 8 }}
/>
) : (
<View
style={{
width: itemSize,
height: itemSize,
borderRadius: 8,
backgroundColor: colors.backgroundTertiary,
alignItems: 'center',
justifyContent: 'center',
}}
>
<Ionicons name="disc-outline" size={48} color={colors.textTertiary} />
</View>
)}
<Text
style={{ fontSize: 14, fontWeight: '600', color: colors.text, marginTop: 6 }}
numberOfLines={1}
>
{item.name}
</Text>
<Text style={{ fontSize: 12, color: colors.textSecondary }} numberOfLines={1}>
{item.artist || 'Unbekannt'} · {item.songCount} Songs
</Text>
</Pressable>
)}
/>
);
}