fix(favs): Favoriten-Tab zeigt Count; Tab lädt weiterhin 'Alle' und filtert clientseitig statt API
This commit is contained in:
parent
b9295a9050
commit
71a531f102
1 changed files with 5 additions and 2 deletions
|
|
@ -36,7 +36,8 @@ export default function App() {
|
|||
useEffect(() => {
|
||||
(async () => {
|
||||
try {
|
||||
const s = await fetchSounds(query, activeFolder);
|
||||
const folderParam = activeFolder === '__favs__' ? '__all__' : activeFolder;
|
||||
const s = await fetchSounds(query, folderParam);
|
||||
setSounds(s.items);
|
||||
setTotal(s.total);
|
||||
setFolders(s.folders);
|
||||
|
|
@ -69,6 +70,8 @@ export default function App() {
|
|||
return sounds.filter((s) => s.name.toLowerCase().includes(q));
|
||||
}, [sounds, query]);
|
||||
|
||||
const favCount = useMemo(() => Object.values(favs).filter(Boolean).length, [favs]);
|
||||
|
||||
async function handlePlay(name: string, rel?: string) {
|
||||
setError(null);
|
||||
if (!selected) return setError('Bitte einen Voice-Channel auswählen');
|
||||
|
|
@ -139,7 +142,7 @@ export default function App() {
|
|||
type="button"
|
||||
onClick={() => setActiveFolder('__favs__')}
|
||||
>
|
||||
Favoriten
|
||||
Favoriten ({favCount})
|
||||
</button>
|
||||
{folders.map((f) => (
|
||||
<button
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue