feat: port config store to pinia
This commit is contained in:
@ -108,15 +108,17 @@ import BaseButton from '@/components/base/BaseButton.vue'
|
||||
import MenuButton from '@/components/home/MenuButton.vue'
|
||||
|
||||
import {getListTitle} from '@/helpers/getListTitle'
|
||||
import {useConfigStore} from '@/stores/config'
|
||||
|
||||
const store = useStore()
|
||||
const configStore = useConfigStore()
|
||||
|
||||
const userInfo = computed(() => store.state.auth.info)
|
||||
const userAvatar = computed(() => store.state.auth.avatarUrl)
|
||||
const currentList = computed(() => store.state.currentList)
|
||||
const background = computed(() => store.state.background)
|
||||
const imprintUrl = computed(() => store.state.config.legal.imprintUrl)
|
||||
const privacyPolicyUrl = computed(() => store.state.config.legal.privacyPolicyUrl)
|
||||
const imprintUrl = computed(() => configStore.legal.imprintUrl)
|
||||
const privacyPolicyUrl = computed(() => configStore.legal.privacyPolicyUrl)
|
||||
const canWriteCurrentList = computed(() => store.state.currentList.maxRight > Rights.READ)
|
||||
const menuActive = computed(() => store.state.menuActive)
|
||||
|
||||
|
@ -77,7 +77,6 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import {ref, computed, watchEffect, type PropType} from 'vue'
|
||||
import {useStore} from '@/store'
|
||||
|
||||
import {getSavedFilterIdFromListId} from '@/helpers/savedFilter'
|
||||
import Dropdown from '@/components/misc/dropdown.vue'
|
||||
@ -85,6 +84,7 @@ import DropdownItem from '@/components/misc/dropdown-item.vue'
|
||||
import TaskSubscription from '@/components/misc/subscription.vue'
|
||||
import type {IList} from '@/modelTypes/IList'
|
||||
import type {ISubscription} from '@/modelTypes/ISubscription'
|
||||
import {useConfigStore} from '@/stores/config'
|
||||
|
||||
const props = defineProps({
|
||||
list: {
|
||||
@ -98,7 +98,7 @@ watchEffect(() => {
|
||||
subscription.value = props.list.subscription ?? null
|
||||
})
|
||||
|
||||
const store = useStore()
|
||||
const backgroundsEnabled = computed(() => store.state.config.enabledBackgroundProviders?.length > 0)
|
||||
const configStore = useConfigStore()
|
||||
const backgroundsEnabled = computed(() => configStore.enabledBackgroundProviders?.length > 0)
|
||||
const isSavedFilter = computed(() => getSavedFilterIdFromListId(props.list.id) > 0)
|
||||
</script>
|
||||
|
@ -8,14 +8,13 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {computed} from 'vue'
|
||||
import {useStore} from '@/store'
|
||||
|
||||
import BaseButton from '@/components/base/BaseButton.vue'
|
||||
import {useConfigStore} from '@/stores/config'
|
||||
|
||||
const store = useStore()
|
||||
const configStore = useConfigStore()
|
||||
|
||||
const imprintUrl = computed(() => store.state.config.legal.imprintUrl)
|
||||
const privacyPolicyUrl = computed(() => store.state.config.legal.privacyPolicyUrl)
|
||||
const imprintUrl = computed(() => configStore.legal.imprintUrl)
|
||||
const privacyPolicyUrl = computed(() => configStore.legal.privacyPolicyUrl)
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
@ -26,22 +26,23 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {computed} from 'vue'
|
||||
import {useRoute} from 'vue-router'
|
||||
import {useI18n} from 'vue-i18n'
|
||||
|
||||
import Logo from '@/components/home/Logo.vue'
|
||||
import Message from '@/components/misc/message.vue'
|
||||
import Legal from '@/components/misc/legal.vue'
|
||||
import ApiConfig from '@/components/misc/api-config.vue'
|
||||
import {useStore} from '@/store'
|
||||
import {computed} from 'vue'
|
||||
import {useRoute} from 'vue-router'
|
||||
import {useI18n} from 'vue-i18n'
|
||||
|
||||
import {useTitle} from '@/composables/useTitle'
|
||||
import {useConfigStore} from '@/stores/config'
|
||||
|
||||
const configStore = useConfigStore()
|
||||
const motd = computed(() => configStore.motd)
|
||||
|
||||
const route = useRoute()
|
||||
const store = useStore()
|
||||
const {t} = useI18n({useScope: 'global'})
|
||||
|
||||
const motd = computed(() => store.state.config.motd)
|
||||
|
||||
const title = computed(() => t(route.meta?.title as string || ''))
|
||||
useTitle(() => title.value)
|
||||
</script>
|
||||
|
@ -189,7 +189,6 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import {ref, watch, computed, shallowReactive} from 'vue'
|
||||
import {useStore} from '@/store'
|
||||
import {useI18n} from 'vue-i18n'
|
||||
|
||||
import {RIGHTS} from '@/constants/rights'
|
||||
@ -204,6 +203,7 @@ import {useCopyToClipboard} from '@/composables/useCopyToClipboard'
|
||||
import {success} from '@/message'
|
||||
import type {ListView} from '@/types/ListView'
|
||||
import {LIST_VIEWS} from '@/types/ListView'
|
||||
import {useConfigStore} from '@/stores/config'
|
||||
|
||||
const props = defineProps({
|
||||
listId: {
|
||||
@ -241,8 +241,8 @@ watch(
|
||||
{immediate: true},
|
||||
)
|
||||
|
||||
const store = useStore()
|
||||
const frontendUrl = computed(() => store.state.config.frontendUrl)
|
||||
const configStore = useConfigStore()
|
||||
const frontendUrl = computed(() => configStore.frontendUrl)
|
||||
|
||||
async function load(listId: IList['id']) {
|
||||
// If listId == 0 the list on the calling component wasn't already loaded, so we just bail out here
|
||||
|
@ -167,6 +167,7 @@ import type {ITask} from '@/modelTypes/ITask'
|
||||
import {uploadFile} from '@/helpers/attachments'
|
||||
import {success} from '@/message'
|
||||
import {formatDateLong, formatDateSince} from '@/helpers/time/formatDate'
|
||||
import {useConfigStore} from '@/stores/config'
|
||||
|
||||
const props = defineProps({
|
||||
taskId: {
|
||||
@ -180,6 +181,7 @@ const props = defineProps({
|
||||
|
||||
const {t} = useI18n({useScope: 'global'})
|
||||
const store = useStore()
|
||||
const configStore = useConfigStore()
|
||||
|
||||
const comments = ref<ITaskComment[]>([])
|
||||
|
||||
@ -196,7 +198,7 @@ const saving = ref<ITask['id'] | null>(null)
|
||||
|
||||
const userAvatar = computed(() => store.state.auth.info.getAvatarUrl(48))
|
||||
const currentUserId = computed(() => store.state.auth.info.id)
|
||||
const enabled = computed(() => store.state.config.taskCommentsEnabled)
|
||||
const enabled = computed(() => configStore.taskCommentsEnabled)
|
||||
const actions = computed(() => {
|
||||
if (!props.canWrite) {
|
||||
return {}
|
||||
|
Reference in New Issue
Block a user