From 8a49fe3681b91a49b44305f766cb5626d7d1c3a4 Mon Sep 17 00:00:00 2001 From: Benedikt Kulmann Date: Thu, 1 Aug 2024 11:39:22 +0200 Subject: [PATCH] feat: add basic client side search to app listing --- packages/web-app-app-store/package.json | 5 ++ .../src/components/AppTile.vue | 37 ++++++++++-- .../actions/useAppActionsDownload.ts | 2 +- .../web-app-app-store/src/piniaStores/apps.ts | 3 +- packages/web-app-app-store/src/types.ts | 3 +- .../web-app-app-store/src/views/AppList.vue | 58 +++++++++++++++++-- pnpm-lock.yaml | 9 +++ 7 files changed, 105 insertions(+), 12 deletions(-) diff --git a/packages/web-app-app-store/package.json b/packages/web-app-app-store/package.json index f71f3a11005..a7d3ce71e33 100644 --- a/packages/web-app-app-store/package.json +++ b/packages/web-app-app-store/package.json @@ -5,13 +5,18 @@ "description": "ownCloud app store", "license": "AGPL-3.0", "devDependencies": { + "@types/mark.js": "8.11.12", "web-test-helpers": "workspace:*" }, + "dependencies": { + "mark.js": "^8.11.1" + }, "peerDependencies": { "@ownclouders/web-client": "workspace:*", "@ownclouders/web-pkg": "workspace:*", "axios": "1.6.8", "design-system": "workspace:@ownclouders/design-system@*", + "fuse.js": "6.6.2", "lodash-es": "4.17.21", "pinia": "2.1.7", "vue-concurrency": "5.0.1", diff --git a/packages/web-app-app-store/src/components/AppTile.vue b/packages/web-app-app-store/src/components/AppTile.vue index c4788b1f710..ce0df9e5513 100644 --- a/packages/web-app-app-store/src/components/AppTile.vue +++ b/packages/web-app-app-store/src/components/AppTile.vue @@ -6,8 +6,25 @@
-

{{ app.name }}

-

{{ app.subtitle }}

+
+

{{ app.name }}

+ + v{{ app.mostRecentVersion.version }} + +
+

{{ app.subtitle }}

+
+
+ + {{ tag }} +
{ return [downloadAppAction] }) + + const emitSearchTerm = (term: string) => { + emit('search', term) + } + return { - actions + actions, + emitSearchTerm } } }) @@ -73,6 +97,11 @@ export default defineComponent({ justify-content: space-between; height: 100%; + .app-tags { + display: flex; + gap: 0.5rem; + } + .app-actions { display: flex; justify-content: flex-start; diff --git a/packages/web-app-app-store/src/composables/actions/useAppActionsDownload.ts b/packages/web-app-app-store/src/composables/actions/useAppActionsDownload.ts index bac9c903fe9..237a3b5d97b 100644 --- a/packages/web-app-app-store/src/composables/actions/useAppActionsDownload.ts +++ b/packages/web-app-app-store/src/composables/actions/useAppActionsDownload.ts @@ -16,7 +16,7 @@ export const useAppActionsDownload = () => { return $gettext('Download') }, handler: (options?) => { - const version = options.app.versions[0] + const version = options.app.mostRecentVersion const filename = version.filename || version.url.split('/').pop() triggerDownloadWithFilename(version.url, filename) }, diff --git a/packages/web-app-app-store/src/piniaStores/apps.ts b/packages/web-app-app-store/src/piniaStores/apps.ts index aa22b3e1138..ce07ab6e53b 100644 --- a/packages/web-app-app-store/src/piniaStores/apps.ts +++ b/packages/web-app-app-store/src/piniaStores/apps.ts @@ -18,7 +18,8 @@ export const useAppsStore = defineStore(`${APPID}-apps`, () => { return appsList.apps.map((app) => { return { ...app, - repository: repo + repository: repo, + mostRecentVersion: app.versions[0] } }) } catch (e) { diff --git a/packages/web-app-app-store/src/types.ts b/packages/web-app-app-store/src/types.ts index 9a4587fe47a..ca3468f8249 100644 --- a/packages/web-app-app-store/src/types.ts +++ b/packages/web-app-app-store/src/types.ts @@ -48,7 +48,8 @@ export const RawAppSchema = z.object({ }) export const AppSchema = RawAppSchema.extend({ - repository: AppStoreRepositorySchema + repository: AppStoreRepositorySchema, + mostRecentVersion: AppVersionSchema }) export type App = z.infer diff --git a/packages/web-app-app-store/src/views/AppList.vue b/packages/web-app-app-store/src/views/AppList.vue index 8a5cd6b8691..ea062cfd93e 100644 --- a/packages/web-app-app-store/src/views/AppList.vue +++ b/packages/web-app-app-store/src/views/AppList.vue @@ -1,22 +1,36 @@