mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-08 22:50:33 +00:00
e81ab0a5ea
Removes what would block a later switch to Vue's vapor mode: `vue-chartjs` and the `SvgIcon` render function are virtual DOM components, and `v-memo` has no vapor equivalent. This does not adopt vapor mode, which will be stable in upcoming Vue 3.6. `vue-chartjs` was a thin wrapper over chart.js, so a local `ChartCanvas.vue` replaces it. Chart data and options move into computed values to keep their object identity, which is what `v-memo` was compensating for. `chartjs-adapter-dayjs-4` is moved first-party, just ~40 lines that are easy to maintain.
48 lines
1.5 KiB
Vue
48 lines
1.5 KiB
Vue
<script lang="ts" setup>
|
|
import SvgIcon from './SvgIcon.vue';
|
|
import {getIssueColorClass, getIssueIcon} from '../features/issue.ts';
|
|
import {computed} from 'vue';
|
|
import type {Issue} from '../types.ts';
|
|
|
|
const props = defineProps<{
|
|
issue?: Issue | null,
|
|
renderedLabels?: string,
|
|
errorMessage?: string,
|
|
}>();
|
|
|
|
const createdAt = computed(() => {
|
|
if (!props.issue) return '';
|
|
return new Date(props.issue.created_at).toLocaleDateString(undefined, {year: 'numeric', month: 'short', day: 'numeric'});
|
|
});
|
|
|
|
const body = computed(() => {
|
|
if (!props.issue) return '';
|
|
const body = props.issue.body.replace(/\n+/g, ' ');
|
|
return body.length > 85 ? `${body.substring(0, 85)}…` : body;
|
|
});
|
|
</script>
|
|
|
|
<template>
|
|
<div class="tw-p-4">
|
|
<div v-if="issue" class="tw-flex tw-flex-col tw-gap-2">
|
|
<div class="tw-text-12">
|
|
<a :href="issue.repository.html_url" class="muted">{{ issue.repository.full_name }}</a>
|
|
on {{ createdAt }}
|
|
</div>
|
|
<div class="flex-text-block">
|
|
<svg-icon :name="getIssueIcon(issue)" :class="getIssueColorClass(issue)"/>
|
|
<a :href="issue.html_url" class="issue-title tw-font-semibold tw-break-anywhere muted">
|
|
{{ issue.title }}
|
|
<span class="index">#{{ issue.number }}</span>
|
|
</a>
|
|
</div>
|
|
<div v-if="body">{{ body }}</div>
|
|
<!-- eslint-disable-next-line vue/no-v-html -->
|
|
<div v-if="issue.labels.length" v-html="renderedLabels"/>
|
|
</div>
|
|
<div v-else>
|
|
{{ errorMessage }}
|
|
</div>
|
|
</div>
|
|
</template>
|