managarten/apps-archived/mukke/apps/mobile/app/(tabs)/search.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

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>
);
}