Skip to content

Commit 7a81999

Browse files
author
hywax
committed
feat: new prop target for config behaviour
1 parent feea7fe commit 7a81999

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

Diff for: components/service/base/Index.vue

+3-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ import type { BaseService } from '~/types'
3131
import { useServiceData } from '~/composables/services'
3232
3333
const props = defineProps<BaseService>()
34-
const target = computed(() => props.target || '_blank')
34+
35+
const { $settings } = useNuxtApp()
36+
const target = computed(() => props.target || $settings.behaviour.target)
3537
3638
// Right now, queries for "base" are only needed for statuses.
3739
// When the situation will change it is necessary to remove/add condition for "immediate"

Diff for: server/utils/config.ts

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ export function getDefaultConfig(): CompleteConfig {
1919
lang: 'en',
2020
theme: 'system',
2121
checkUpdates: true,
22+
behaviour: {
23+
target: '_blank',
24+
},
2225
services: [],
2326
}
2427
}

Diff for: types/config.d.ts

+5
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,15 @@ export interface ServicesGroup {
55
items: BaseService[]
66
}
77

8+
export interface Behaviour {
9+
target?: '_blank' | '_self' | '_parent' | '_top'
10+
}
11+
812
export interface Config {
913
title?: string
1014
lang: 'en' | 'ru'
1115
theme?: 'system' | 'light' | 'dark' | 'deep' | 'sepia'
16+
behaviour?: Behaviour
1217
services: ServicesGroup[]
1318
checkUpdates: boolean
1419
}

0 commit comments

Comments
 (0)