🔒 SSR UPDATE

This commit is contained in:
NEO 2024-04-21 02:55:19 +08:00
parent 23f82d956a
commit cb44d3db8b
31 changed files with 991 additions and 210 deletions

View file

@ -7,7 +7,7 @@ import type { PaletteOption } from './command-palette.types';
const isModalOpen = ref(false);
const inputRef = ref();
const router = useRouter();
const isMac = computed(() => window.navigator.userAgent.toLowerCase().includes('mac'));
const isMac = computed(() => true);
const commandPaletteStore = useCommandPaletteStore();
const { searchPrompt, filteredSearchResult } = storeToRefs(commandPaletteStore);

View file

@ -1,4 +1,6 @@
<script setup lang="ts">
import CSelect from '@/ui/c-select/c-select.vue';
const { availableLocales, locale } = useI18n();
const localesLong: Record<string, string> = {
@ -21,7 +23,7 @@ const localeOptions = computed(() =>
</script>
<template>
<c-select
<CSelect
v-model:value="locale"
:options="localeOptions"
placeholder="Select a language"

View file

@ -1,5 +1,5 @@
import _ from 'lodash';
import type Plausible from 'plausible-tracker';
// import type Plausible from 'plausible-tracker';
import { inject } from 'vue';
export { createTrackerService, useTracker };
@ -7,21 +7,21 @@ export { createTrackerService, useTracker };
function createTrackerService({ plausible }: { plausible: ReturnType<typeof Plausible> }) {
return {
trackEvent({ eventName }: { eventName: string }) {
plausible.trackEvent(eventName);
// plausible.trackEvent(eventName);
},
};
}
function useTracker() {
const plausible: ReturnType<typeof Plausible> | undefined = inject('plausible');
// const plausible: ReturnType<any> | undefined = inject('plausible');
//
// if (_.isNil(plausible)) {
// throw new TypeError('Plausible must be instantiated');
// }
if (_.isNil(plausible)) {
throw new TypeError('Plausible must be instantiated');
}
const tracker = createTrackerService({ plausible });
// const tracker = createTrackerService({ plausible });
return {
tracker,
tracker: () => {},
};
}