Skip to content

Commit

Permalink
refactor(meta): removed meta mixin in favor of a composition approach
Browse files Browse the repository at this point in the history
  • Loading branch information
vimercati-samir committed Apr 13, 2022
1 parent 5cbd4f2 commit ee9eae1
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 21 deletions.
9 changes: 9 additions & 0 deletions components/compositions/useMeta.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const useMeta = () => {
const { $store } = useNuxtApp()

useHead({
title: $store.state.meta.title,
})
}

export default useMeta
11 changes: 0 additions & 11 deletions components/mixins/Meta/WithMeta.ts

This file was deleted.

7 changes: 5 additions & 2 deletions layouts/chat.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ import { MenuIcon } from 'satellite-lucide-icons'
import DroppableWrapper from '../components/ui/DroppableWrapper/DroppableWrapper.vue'
import { Touch } from '~/components/mixins/Touch'
import Layout from '~/components/mixins/Layouts/Layout'
import WithMeta from '~/components/mixins/Meta/WithMeta'
import useMeta from '~/components/compositions/useMeta'
import { MessagingTypesEnum } from '~/libraries/Enums/types/messaging-types'
import { hexToRGB } from '~/utilities/Colors'
Expand All @@ -116,8 +116,11 @@ export default Vue.extend({
MenuIcon,
DroppableWrapper,
},
mixins: [Touch, Layout, WithMeta],
mixins: [Touch, Layout],
middleware: ['authenticated'],
setup() {
const meta = useMeta()
},
data() {
return {
sidebar: !this.$device.isMobile,
Expand Down
6 changes: 4 additions & 2 deletions layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
</template>
<script lang="ts">
import Vue from 'vue'
import WithMeta from '~/components/mixins/Meta/WithMeta'
import useMeta from '~/components/compositions/useMeta'
export default Vue.extend({
mixins: [WithMeta],
setup() {
const meta = useMeta()
},
})
</script>
<style lang="less">
Expand Down
7 changes: 5 additions & 2 deletions layouts/files.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,18 @@ import { MenuIcon } from 'satellite-lucide-icons'
import { Touch } from '~/components/mixins/Touch'
import Layout from '~/components/mixins/Layouts/Layout'
import { hexToRGB } from '~/utilities/Colors'
import WithMeta from '~/components/mixins/Meta/WithMeta'
import useMeta from '~/components/compositions/useMeta'
export default Vue.extend({
name: 'FilesLayout',
components: {
MenuIcon,
},
mixins: [Touch, Layout, WithMeta],
mixins: [Touch, Layout],
middleware: 'authenticated',
setup() {
const meta = useMeta()
},
data() {
return {
sidebar: !this.$device.isMobile,
Expand Down
7 changes: 5 additions & 2 deletions layouts/friends.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,18 @@ import { MenuIcon } from 'satellite-lucide-icons'
import { Touch } from '~/components/mixins/Touch'
import Layout from '~/components/mixins/Layouts/Layout'
import { hexToRGB } from '~/utilities/Colors'
import WithMeta from '~/components/mixins/Meta/WithMeta'
import useMeta from '~/components/compositions/useMeta'
export default Vue.extend({
name: 'ChatLayout',
components: {
MenuIcon,
},
mixins: [Touch, Layout, WithMeta],
mixins: [Touch, Layout],
middleware: 'authenticated',
setup() {
const meta = useMeta()
},
data() {
return {
sidebar: !this.$device.isMobile,
Expand Down
7 changes: 5 additions & 2 deletions layouts/server.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,18 @@ import { MenuIcon } from 'satellite-lucide-icons'
import { Touch } from '~/components/mixins/Touch'
import Layout from '~/components/mixins/Layouts/Layout'
import { hexToRGB } from '~/utilities/Colors'
import WithMeta from '~/components/mixins/Meta/WithMeta'
import useMeta from '~/components/compositions/useMeta'
export default Vue.extend({
name: 'ServerLayout',
components: {
MenuIcon,
},
mixins: [Touch, Layout, WithMeta],
mixins: [Touch, Layout],
middleware: 'authenticated',
setup() {
const meta = useMeta()
},
data() {
return {
sidebar: !this.$device.isMobile,
Expand Down

0 comments on commit ee9eae1

Please sign in to comment.