From ca453bbff633c857cfe18d357c2157c112b9565c Mon Sep 17 00:00:00 2001 From: Andrew Simachev Date: Mon, 12 Feb 2024 12:08:22 +0100 Subject: [PATCH] update protocol --- dist/.gitignore | 3 +- src/ts/component/popup/page/usecase/list.tsx | 33 ++------------------ src/ts/lib/api/response.ts | 3 +- 3 files changed, 6 insertions(+), 33 deletions(-) diff --git a/dist/.gitignore b/dist/.gitignore index e60c27c89b..ef347b0d6c 100644 --- a/dist/.gitignore +++ b/dist/.gitignore @@ -27,4 +27,5 @@ nmh.log [0-9]*.js [0-9]*.js.map extension.crx -extension.pem \ No newline at end of file +extension.pem +extension.zip \ No newline at end of file diff --git a/src/ts/component/popup/page/usecase/list.tsx b/src/ts/component/popup/page/usecase/list.tsx index 4837081b66..1be037fb54 100644 --- a/src/ts/component/popup/page/usecase/list.tsx +++ b/src/ts/component/popup/page/usecase/list.tsx @@ -174,43 +174,14 @@ class PopupUsecasePageList extends React.Component { this.setState({ isLoading: true }); - /* C.GalleryDownloadIndex((message: any) => { commonStore.gallery = { - categories: message.categories || [], + categories: (message.categories || []).map(it => ({ ...it, name: this.categoryName(it.id) })), list: message.list || [], }; this.setState({ isLoading: false }); }); - */ - - this.tmpLoad(() => { - this.setState({ isLoading: false }); - }, () => { - this.setState({ isLoading: false }); - }); - }; - - tmpLoad (success: () => void, error: () => void): void { - $.ajax({ - url: 'https://tools.gallery.any.coop/app-index.json', - dataType: 'json', - success: (data: any) => { - commonStore.gallery = { - categories: (data.categories || []).map(it => ({ ...it, name: this.categoryName(it.id) })), - list: (data.experiences || []).map(it => ({ - ...it, - size: it.fileSize, - })), - }; - - success(); - }, - error: () => { - error(); - } - }); }; componentDidUpdate (): void { @@ -256,7 +227,7 @@ class PopupUsecasePageList extends React.Component { let items = commonStore.gallery.list || []; if (category) { - items = items.filter(it => category.experiences.includes(it.name)); + items = items.filter(it => category.list.includes(it.name)); }; if (filter) { diff --git a/src/ts/lib/api/response.ts b/src/ts/lib/api/response.ts index 73238bcece..38b1a658b5 100644 --- a/src/ts/lib/api/response.ts +++ b/src/ts/lib/api/response.ts @@ -427,7 +427,8 @@ export const GalleryDownloadIndex = (response: Rpc.Gallery.DownloadIndex.Respons return { categories: (response.getCategoriesList() || []).map((it: Rpc.Gallery.DownloadIndex.Response.Category) => { return { - name: it.getName(), + id: it.getId(), + icon: it.getIcon(), list: it.getExperiencesList() || [], }; }),