mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 19:21:10 +02:00
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>
79 lines
2 KiB
TypeScript
79 lines
2 KiB
TypeScript
import { Ionicons } from '@expo/vector-icons';
|
|
import { Stack } from 'expo-router';
|
|
import { useState, useCallback } from 'react';
|
|
import { View, TextInput } from 'react-native';
|
|
|
|
import { EmptyState } from '~/components/EmptyState';
|
|
import { SongList } from '~/components/SongList';
|
|
import { searchSongs } from '~/services/libraryService';
|
|
import type { Song } from '~/types';
|
|
import { useTheme } from '~/utils/themeContext';
|
|
|
|
export default function SearchScreen() {
|
|
const { colors } = useTheme();
|
|
const [query, setQuery] = useState('');
|
|
const [results, setResults] = useState<Song[]>([]);
|
|
const [hasSearched, setHasSearched] = useState(false);
|
|
|
|
const handleSearch = useCallback(async (text: string) => {
|
|
setQuery(text);
|
|
if (text.trim().length < 2) {
|
|
setResults([]);
|
|
setHasSearched(false);
|
|
return;
|
|
}
|
|
setHasSearched(true);
|
|
const songs = await searchSongs(text.trim());
|
|
setResults(songs);
|
|
}, []);
|
|
|
|
return (
|
|
<View style={{ flex: 1 }}>
|
|
<Stack.Screen options={{ title: 'Suche' }} />
|
|
|
|
<View
|
|
style={{
|
|
flexDirection: 'row',
|
|
alignItems: 'center',
|
|
backgroundColor: colors.backgroundTertiary,
|
|
borderRadius: 10,
|
|
margin: 16,
|
|
paddingHorizontal: 12,
|
|
}}
|
|
>
|
|
<Ionicons name="search" size={18} color={colors.textTertiary} />
|
|
<TextInput
|
|
value={query}
|
|
onChangeText={handleSearch}
|
|
placeholder="Songs, Künstler, Alben..."
|
|
placeholderTextColor={colors.textTertiary}
|
|
style={{
|
|
flex: 1,
|
|
paddingVertical: 10,
|
|
paddingHorizontal: 8,
|
|
fontSize: 16,
|
|
color: colors.text,
|
|
}}
|
|
autoCorrect={false}
|
|
clearButtonMode="while-editing"
|
|
/>
|
|
</View>
|
|
|
|
{!hasSearched ? (
|
|
<EmptyState
|
|
icon="search-outline"
|
|
title="Suche"
|
|
message="Suche nach Songs, Künstlern oder Alben."
|
|
/>
|
|
) : results.length === 0 ? (
|
|
<EmptyState
|
|
icon="search-outline"
|
|
title="Keine Ergebnisse"
|
|
message={`Keine Treffer für "${query}".`}
|
|
/>
|
|
) : (
|
|
<SongList songs={results} emptyTitle="Keine Ergebnisse" />
|
|
)}
|
|
</View>
|
|
);
|
|
}
|