Skip to content

Commit

Permalink
chore: fix typescript issues
Browse files Browse the repository at this point in the history
  • Loading branch information
stafyniaksacha committed Nov 30, 2023
1 parent 8c2fe67 commit e8f47b2
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 31 deletions.
8 changes: 4 additions & 4 deletions components/AppFooter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const year = new Date().getFullYear()
>
<span class="flex-none flex flex-row items-center">
<NuxtLink
v-if="appConfig.stylo.footer.logo.src"
v-if="appConfig.stylo?.footer?.logo?.src"
class="flex title-font font-medium items-center lg:justify-start justify-center text-muted-800 dark:text-muted-100 mr-4 pr-4 border-r border-muted-300 dark:border-muted-600/60"
to="/"
>
Expand All @@ -36,7 +36,7 @@ const year = new Date().getFullYear()
/>
</NuxtLink>
<p
v-if="appConfig.stylo.footer.copyright.enabled"
v-if="appConfig.stylo.footer?.copyright?.enabled"
class="font-sans text-sm text-muted-500 dark:text-muted-400"
>
© {{ year }}
Expand All @@ -52,7 +52,7 @@ const year = new Date().getFullYear()
</span>
<span class="flex items-center gap-x-6">
<p
v-for="link in appConfig.stylo.footer.links"
v-for="link in appConfig.stylo?.footer?.links"
:key="link.href"
class="text-sm text-muted-600 dark:text-muted-300"
>
Expand All @@ -70,7 +70,7 @@ const year = new Date().getFullYear()
class="grow inline-flex gap-1 lg:ml-auto justify-center sm:justify-end mt-2 sm:mt-0"
>
<NuxtLink
v-for="social in appConfig.stylo.footer.social"
v-for="social in appConfig.stylo?.footer?.social"
:key="social.href"
:to="social.href"
:title="social.title"
Expand Down
2 changes: 1 addition & 1 deletion components/AppFooterAction.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const appConfig = useAppConfig()
</script>

<template>
<div class="app-section bg-white dark:bg-muted-1000">
<div v-if="appConfig.stylo.footer?.action" class="app-section bg-white dark:bg-muted-1000">
<div class="app-container">
<div class="relative">
<div class="text-center mb-8">
Expand Down
2 changes: 1 addition & 1 deletion components/AppLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const appConfig = useAppConfig()
<div>
<slot />
</div>
<AppFooterAction v-if="appConfig.stylo.footer.action.enabled" />
<AppFooterAction v-if="appConfig.stylo.footer?.action?.enabled" />
<AppFooter />
</div>
</template>
12 changes: 6 additions & 6 deletions components/AppNavbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ const { data: navigation } = await useAsyncData('navigation', () =>
class="shrink-0 flex gap-2 items-center justify-center pb-1"
>
<img
v-if="appConfig.stylo.header.logo.src"
v-if="appConfig.stylo.header.logo?.src"
class="block dark:hidden h-9 lg:h-10"
:src="appConfig.stylo.header.logo.src"
:alt="appConfig.stylo.header.logo.alt"
/>
<img
v-if="
appConfig.stylo.header.logo.srcDark ||
appConfig.stylo.header.logo.src
appConfig.stylo.header.logo?.srcDark ||
appConfig.stylo.header.logo?.src
"
class="hidden dark:block h-9 lg:h-10"
:src="
Expand Down Expand Up @@ -132,15 +132,15 @@ const { data: navigation } = await useAsyncData('navigation', () =>
<NuxtLink to="/">
<div class="shrink-0 flex items-center">
<img
v-if="appConfig.stylo.header.logo.src"
v-if="appConfig.stylo.header?.logo?.src"
class="block dark:hidden h-10 w-10"
:src="appConfig.stylo.header.logo.src"
:alt="appConfig.stylo.header.logo.alt"
/>
<img
v-if="
appConfig.stylo.header.logo.srcDark ||
appConfig.stylo.header.logo.src
appConfig.stylo.header?.logo?.srcDark ||
appConfig.stylo.header?.logo?.src
"
class="hidden dark:block h-10 w-10"
:src="
Expand Down
7 changes: 2 additions & 5 deletions composables/useAsyncAuthorMeta.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import type { MaybeComputedRef } from '@vueuse/core'
import type { AuthorPage } from '../types'

export function useAsyncAuthorMeta(path: MaybeComputedRef<string | undefined>) {
const _path = computed(() => {
return typeof path === 'function' ? path() : isRef(path) ? path.value : path
})
export function useAsyncAuthorMeta(path: MaybeRefOrGetter<string | undefined>) {
const _path = toRef(path)

return useAsyncData(
`author-meta-${_path.value}`,
Expand Down
7 changes: 2 additions & 5 deletions composables/useAsyncCategoryMeta.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import type { MaybeComputedRef } from '@vueuse/core'
import type { CategoryPage } from '../types'

export function useAsyncCategoryMeta(
path: MaybeComputedRef<string | undefined>
path: MaybeRefOrGetter<string | undefined>
) {
const _path = computed(() => {
return typeof path === 'function' ? path() : isRef(path) ? path.value : path
})
const _path = toRef(path)

return useAsyncData(
`category-meta-${_path.value}`,
Expand Down
11 changes: 2 additions & 9 deletions composables/useAsyncTagsMeta.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
import type { MaybeComputedRef } from '@vueuse/core'
import type { TagPage } from '../types'

export function useAsyncTagsMeta(
paths: MaybeComputedRef<string[] | undefined>
paths: MaybeRefOrGetter<string[] | undefined>
) {
const _paths = computed(() => {
return typeof paths === 'function'
? paths()
: isRef(paths)
? paths.value
: paths
})
const _paths = toRef(paths)

return useAsyncData(
`tags-meta-${_paths.value?.join('-')}`,
Expand Down
15 changes: 15 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@
"license": "MIT",
"main": "./nuxt.config.ts",
"packageManager": "[email protected]",
"files": [
"components",
"composables",
"layouts",
"server",
"styles",
"types",
"utils",
"app.vue",
"app.config.ts",
"nuxt.schema.ts",
"nuxt.config.ts",
"tailwind.config.cjs",
"tokens.config.ts"
],
"scripts": {
"dev": "nuxi prepare & nuxi dev .blog",
"dev:starter": "nuxi prepare & nuxi dev .starter",
Expand Down
1 change: 1 addition & 0 deletions server/plugins/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import getReadingTime from 'reading-time'
import { toString } from 'mdast-util-to-string'

export default defineNitroPlugin((nitroApp) => {
// @ts-ignore
nitroApp.hooks.hook('content:file:afterParse', (file) => {
if (file._id.endsWith('.md')) {
const textOnPage = toString(file.body)
Expand Down

0 comments on commit e8f47b2

Please sign in to comment.