1
0
mirror of https://github.com/uetchy/namae.git synced 2025-03-16 20:20:38 +09:00

fix: play store result

This commit is contained in:
uetchy 2022-04-13 15:24:26 +09:00
parent afa2e7d52e
commit 096ce42e20
3 changed files with 13 additions and 5 deletions

View File

@ -29,8 +29,8 @@ export default async function handler(
const apps = response[0][1][0][0][0].map((entry: any) => ({ const apps = response[0][1][0][0][0].map((entry: any) => ({
id: entry[12][0], id: entry[12][0],
name: entry[2], name: entry[2],
description: entry[4][1][1][1][1],
author: entry[4][0][0][0], author: entry[4][0][0][0],
rating: entry[6][0][2][1][1],
url: 'https://play.google.com' + entry[9][4][2], url: 'https://play.google.com' + entry[9][4][2],
})); }));
send(res, { result: apps.slice(0, 10) }); send(res, { result: apps.slice(0, 10) });

View File

@ -39,7 +39,11 @@ const Search: React.FC<{ query: string }> = ({ query }) => {
/> />
)) ))
) : ( ) : (
<Result title={t('noResult')} icon={<FaInfoCircle />} /> <Result
title={t('noResult')}
message={t('noResult')}
icon={<FaInfoCircle />}
/>
)} )}
</> </>
); );

View File

@ -13,8 +13,8 @@ const Search: React.FC<{ query: string }> = ({ query }) => {
result: Array<{ result: Array<{
id: string; id: string;
name: string; name: string;
description: string;
author: string; author: string;
rating: number;
url: string; url: string;
}>; }>;
}; };
@ -26,14 +26,18 @@ const Search: React.FC<{ query: string }> = ({ query }) => {
apps.map((app) => ( apps.map((app) => (
<Result <Result
title={app.name} title={app.name}
message={`Rating: ${app.rating}`} message={`${app.author}: ${app.description}`}
link={app.url} link={app.url}
icon={<IoMdAppstore />} icon={<IoMdAppstore />}
key={app.id} key={app.id}
/> />
)) ))
) : ( ) : (
<Result title={t('noResult')} icon={<FaInfoCircle />} /> <Result
title={t('noResult')}
message={t('noResult')}
icon={<FaInfoCircle />}
/>
)} )}
</> </>
); );