Skip to content

Commit

Permalink
feat: new prop target for config behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
hywax committed Jan 26, 2024
1 parent feea7fe commit 7a81999
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion components/service/base/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ import type { BaseService } from '~/types'
import { useServiceData } from '~/composables/services'
const props = defineProps<BaseService>()
const target = computed(() => props.target || '_blank')
const { $settings } = useNuxtApp()
const target = computed(() => props.target || $settings.behaviour.target)
// Right now, queries for "base" are only needed for statuses.
// When the situation will change it is necessary to remove/add condition for "immediate"
Expand Down
3 changes: 3 additions & 0 deletions server/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ export function getDefaultConfig(): CompleteConfig {
lang: 'en',
theme: 'system',
checkUpdates: true,
behaviour: {
target: '_blank',
},
services: [],
}
}
Expand Down
5 changes: 5 additions & 0 deletions types/config.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@ export interface ServicesGroup {
items: BaseService[]
}

export interface Behaviour {
target?: '_blank' | '_self' | '_parent' | '_top'
}

export interface Config {
title?: string
lang: 'en' | 'ru'
theme?: 'system' | 'light' | 'dark' | 'deep' | 'sepia'
behaviour?: Behaviour
services: ServicesGroup[]
checkUpdates: boolean
}
Expand Down

0 comments on commit 7a81999

Please sign in to comment.