aboutsummaryrefslogtreecommitdiffstats
path: root/apps/Radio/components/List.js
diff options
context:
space:
mode:
authorGravatar piotrruss <mail@pruss.it> 2023-04-19 23:34:33 +0200
committerGravatar piotrruss <mail@pruss.it> 2023-04-19 23:34:33 +0200
commitd32cd07f5e2dbe5f62618c939b8f6fd35b13d5ea (patch)
treedc8c2de52393e59023292c340c6805240e23b9c0 /apps/Radio/components/List.js
parent67c8fcea43e1be97f8f05f38846a55a288801729 (diff)
downloadmy_apps-d32cd07f5e2dbe5f62618c939b8f6fd35b13d5ea.tar.gz
my_apps-d32cd07f5e2dbe5f62618c939b8f6fd35b13d5ea.tar.bz2
my_apps-d32cd07f5e2dbe5f62618c939b8f6fd35b13d5ea.zip
Radio app fixes
Diffstat (limited to 'apps/Radio/components/List.js')
-rw-r--r--apps/Radio/components/List.js38
1 files changed, 22 insertions, 16 deletions
diff --git a/apps/Radio/components/List.js b/apps/Radio/components/List.js
index 73e1523..6f24df6 100644
--- a/apps/Radio/components/List.js
+++ b/apps/Radio/components/List.js
@@ -2,6 +2,7 @@ import { open } from 'helpers/windowActions'
import appList from 'configs/appList'
import useApps from 'hooks/useApps'
import fetchJson from 'helpers/fetchJson'
+import { Splash } from 'components'
import styles from '../styles/Radio.module.scss'
const play = async (title, station, apps, setApps, enqueue) => {
@@ -23,23 +24,28 @@ const List = ({ results, enqueue }) => {
return (
<div className={styles.list}>
<div>
- {results && results.length === 0 && <div>No results</div>}
- {results && results.length > 0 && (
- results.map(({ title, url, logo, genres, locations }) => (
- <div key={url} onClick={() => play(title, url, apps, setApps, enqueue)}>
- <img width={75} height={75} src={logo} loading="lazy" alt="title" />
- <div>
- <span>{ title }</span>
- <div>
- <span>{locations.join(', ')}</span>
- <div>
- {genres.map(g => <span>{g}</span>)}
+ {results === 'loading'
+ ? <Splash />
+ : <>
+ {results && results.length === 0 && <div>{t('radio_no_result')}</div>}
+ {results && results.length > 0 && (
+ results.map(({ title, url, logo, genres, locations }) => (
+ <div key={url} onClick={() => play(title, url, apps, setApps, enqueue)}>
+ <img width={75} height={75} src={logo} loading="lazy" alt="title" />
+ <div>
+ <span>{ title }</span>
+ <div>
+ <span>{locations.join(', ')}</span>
+ <div>
+ {genres.map(g => <span>{g}</span>)}
+ </div>
+ </div>
+ </div>
</div>
- </div>
- </div>
- </div>
- ))
- )}
+ ))
+ )}
+ </>
+ }
</div>
</div>
)