aboutsummaryrefslogtreecommitdiffstats
path: root/apps/settings/src/components/AppStoreSidebar/AppReleasesTab.vue
blob: 68c5cb8b5ffa81da9398c43aa3a339f7e15788a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!--
  - SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
  - SPDX-License-Identifier: AGPL-3.0-or-later
-->
<template>
	<NcAppSidebarTab v-if="hasChangelog"
		id="changelog"
		:name="t('settings', 'Changelog')"
		:order="2">
		<template #icon>
			<NcIconSvgWrapper :path="mdiClockFast" :size="24" />
		</template>
		<div v-for="release in app.releases" :key="release.version" class="app-sidebar-tabs__release">
			<h2>{{ release.version }}</h2>
			<Markdown class="app-sidebar-tabs__release-text"
				:text="createChangelogFromRelease(release)" />
		</div>
	</NcAppSidebarTab>
</template>

<script setup lang="ts">
import type { IAppstoreApp, IAppstoreAppRelease } from '../../app-types.ts'

import { mdiClockFast } from '@mdi/js'
import { getLanguage, translate as t } from '@nextcloud/l10n'
import { computed } from 'vue'

import NcAppSidebarTab from '@nextcloud/vue/dist/Components/NcAppSidebarTab.js'
import NcIconSvgWrapper from '@nextcloud/vue/dist/Components/NcIconSvgWrapper.js'
import Markdown from '../Markdown.vue'

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const props = defineProps<{ app: IAppstoreApp }>()

const hasChangelog = computed(() => Object.values(props.app.releases?.[0]?.translations ?? {}).some(({ changelog }) => !!changelog))

const createChangelogFromRelease = (release: IAppstoreAppRelease) => release.translations?.[getLanguage()]?.changelog ?? release.translations?.en?.changelog ?? ''
</script>

<style scoped lang="scss">
.app-sidebar-tabs__release {
	h2 {
		border-bottom: 1px solid var(--color-border);
		font-size: 24px;
	}

	&-text {
		// Overwrite changelog heading styles
		:deep(h3) {
			font-size: 20px;
		}
		:deep(h4) {
			font-size: 17px;
		}
	}
}
</style>