Skip to content

Commit 65758ec

Browse files
committed
refactor(appstore): migrate app discover section to Vue 3
Signed-off-by: Ferdinand Thiessen <[email protected]>
1 parent f38d73d commit 65758ec

File tree

12 files changed

+382
-505
lines changed

12 files changed

+382
-505
lines changed

apps/appstore/src/constants/AppDiscoverTypes.ts renamed to apps/appstore/src/apps-discover.d.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
/**
1+
/*!
22
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
55

6-
/**
7-
* Currently known types of app discover section elements
8-
*/
9-
export const APP_DISCOVER_KNOWN_TYPES = ['post', 'showcase', 'carousel'] as const
10-
116
/**
127
* Helper for localized values
138
*/

apps/appstore/src/components/AppStoreDiscover/AppLink.vue

Lines changed: 0 additions & 98 deletions
This file was deleted.

apps/appstore/src/components/AppStoreDiscover/AppStoreDiscoverSection.vue

Lines changed: 0 additions & 124 deletions
This file was deleted.

apps/appstore/src/components/AppStoreDiscover/AppType.vue renamed to apps/appstore/src/components/DiscoverType/DiscoverTypeApp.vue

Lines changed: 51 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,8 @@
33
- SPDX-License-Identifier: AGPL-3.0-or-later
44
-->
55
<template>
6-
<AppItem
7-
v-if="app"
8-
:app="app"
9-
category="discover"
10-
class="app-discover-app"
11-
inline
12-
:list-view="false" />
136
<a
14-
v-else
7+
v-if="!app"
158
class="app-discover-app app-discover-app__skeleton"
169
:href="appStoreLink"
1710
target="_blank"
@@ -24,14 +17,32 @@
2417
<span class="skeleton-element" />
2518
<span class="skeleton-element" />
2619
</a>
20+
21+
<article v-else class="app-discover-app">
22+
<AppImage class="app-discover-app__image" :app="app" />
23+
<div class="app-discover-app__wrapper">
24+
<h3 class="app-discover-app__name">
25+
<AppLink :href="`app:${app.id}`">
26+
{{ app.name }}
27+
</AppLink>
28+
</h3>
29+
<p>{{ app.summary }}</p>
30+
<AppScore
31+
v-if="app.ratingNumThresholdReached"
32+
class="app-discover-app__score"
33+
:score="app.score" />
34+
</div>
35+
</article>
2736
</template>
2837

2938
<script setup lang="ts">
30-
import type { IAppDiscoverApp } from '../../constants/AppDiscoverTypes.ts'
39+
import type { IAppDiscoverApp } from '../../apps-discover.d.ts'
3140
3241
import { computed } from 'vue'
33-
import AppItem from '../AppList/AppItem.vue'
34-
import { useAppsStore } from '../../store/apps-store.ts'
42+
import AppImage from '../AppImage.vue'
43+
import AppLink from '../AppLink.vue'
44+
import AppScore from '../AppScore.vue'
45+
import { useAppsStore } from '../../store/apps.ts'
3546
3647
const props = defineProps<{
3748
modelValue: IAppDiscoverApp
@@ -40,16 +51,42 @@ const props = defineProps<{
4051
const store = useAppsStore()
4152
const app = computed(() => store.getAppById(props.modelValue.appId))
4253
43-
const appStoreLink = computed(() => props.modelValue.appId ? `https://apps.nextcloud.com/apps/${props.modelValue.appId}` : '#')
54+
const appStoreLink = computed(() => props.modelValue.appId
55+
? `https://apps.nextcloud.com/apps/${props.modelValue.appId}`
56+
: '#')
4457
</script>
4558

4659
<style scoped lang="scss">
4760
.app-discover-app {
48-
width: 100% !important; // full with of the showcase item
61+
border-radius: var(--border-radius-element);
62+
display: flex;
63+
flex-direction: column;
64+
overflow: hidden;
65+
width: 100% !important;
4966
5067
&:hover {
5168
background: var(--color-background-hover);
52-
border-radius: var(--border-radius-rounded);
69+
}
70+
71+
&__image {
72+
height: 96px;
73+
width: 100%;
74+
}
75+
76+
&__name {
77+
margin-block: 0.5rem;
78+
font-size: 1.2rem;
79+
}
80+
81+
&__score {
82+
margin-top: auto;
83+
}
84+
85+
&__wrapper {
86+
display: flex;
87+
flex-direction: column;
88+
padding: calc(2 * var(--default-grid-baseline));
89+
padding-top: 0px;
5390
}
5491
5592
&__skeleton {

0 commit comments

Comments
 (0)