Skip to content

Commit 4a7599c

Browse files
author
hywax
committed
docs: badge in version
1 parent d7d2274 commit 4a7599c

File tree

6 files changed

+24
-4
lines changed

6 files changed

+24
-4
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<template>
2+
<Badge v-if="visible" type="tip" :text="props.value" />
3+
</template>
4+
5+
<script setup lang="ts">
6+
import parse from 'semver/functions/parse'
7+
import { computed } from 'vue'
8+
import { getVersion } from '../utils'
9+
10+
const props = defineProps<{ value: string }>()
11+
12+
const visible = computed(() => {
13+
const a = parse(props.value)
14+
const b = parse(getVersion())
15+
16+
return ((b?.major * 10 + b?.minor) - (a?.major * 10 + a?.minor)) <= 5
17+
})
18+
</script>

docs/.vitepress/theme/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ import type { Theme } from 'vitepress'
33
import DefaultTheme from 'vitepress/theme'
44
import './custom.css'
55
import PreviewService from '../components/preview-service.vue'
6+
import InVersion from '../components/in-version.vue'
67

78
export default {
89
extends: DefaultTheme,
910
enhanceApp(ctx) {
1011
ctx.app.component('PreviewService', PreviewService)
12+
ctx.app.component('InVersion', InVersion)
1113

1214
yandexMetrika(ctx, {
1315
enabled: import.meta.env.MODE === 'production',

docs/reference/configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ If you want the system to be able to update itself, we recommend using [watchtow
5757

5858
A group of parameters responsible for the behavior of the application.
5959

60-
### Target
60+
### Target <in-version value="0.7.6" />
6161

6262
Поведение браузера при нажатии на сервис.
6363
С помощью этого свойства, можно сделать открытие сервиса в текущем или новом окне.

docs/ru/reference/configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ checkUpdates: true
5757

5858
Группа параметров отвечающих за поведение приложения.
5959

60-
### Target
60+
### Target <in-version value="0.7.6" />
6161

6262
Поведение браузера при нажатии на сервис.
6363
С помощью этого свойства, можно сделать открытие сервиса в текущем или новом окне.

docs/ru/services/base.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ description: Автоматизация дома
3131
link: https://home-assistant.home.local/
3232
```
3333
34-
## Target
34+
## Target <in-version value="0.7.6" />
3535
3636
Поведение браузера при нажатии на сервис.
3737
С помощью этого свойства, можно сделать открытие сервиса в текущем или новом окне.

docs/services/base.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ It is also used to check [status](#status) availability.
3131
link: https://home-assistant.home.local/
3232
```
3333
34-
## Target
34+
## Target <in-version value="0.7.6" />
3535
3636
Browser behavior when the service is clicked.
3737
With this property, you can make the service open in the current or a new window.

0 commit comments

Comments
 (0)