Skip to content

Commit

Permalink
添加统计更新logo
Browse files Browse the repository at this point in the history
  • Loading branch information
geektao1024 committed Nov 9, 2024
1 parent c4aaf77 commit a125b7f
Show file tree
Hide file tree
Showing 13 changed files with 99 additions and 103 deletions.
20 changes: 2 additions & 18 deletions layers/common/components/CommonFloatingButton.vue
Original file line number Diff line number Diff line change
@@ -1,24 +1,8 @@
<template>
<div class="fixed bottom-0 right-0 mt-4 p-4 ">
<div
class="flex justify-end gap-2"
>
<!-- github star button -->
<UButton
label="Star on GitHub"
icon="i-fa6-brands-github"
size="lg"
@click="onClick()"
/>
</div>
</div>
<!-- 整个组件可以注释掉或删除 -->
</template>

<script setup lang="ts">
// 保留类型导入以防其他地方使用
import { PlausibleEventName } from '~/layers/plausible/types';
function onClick(): void {
void navigateTo('https://github.com/timb-103/colormagic', { external: true });
sendPlausibleEvent(PlausibleEventName.GITHUB_BUTTON_FLOATING_CLICKED);
}
</script>
2 changes: 1 addition & 1 deletion layers/common/components/CommonFooter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ const toolsLinks = computed(() => [{
const moreLinks = computed(() => [
{
label: t('nav.contact'),
to: 'mailto:hello@colormagic.app'
to: 'mailto:hello@colormagic.club'
},
{
label: t('nav.suggestIdea'),
Expand Down
4 changes: 2 additions & 2 deletions layers/common/components/CommonFreeInfoCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
If you were a previous subscriber, we've canceled your subscription so there will be no more payments. If you
require a prorated refund please reach out to us on <a
class="text-primary underline"
href="mailto:hello@colormagic.app"
>hello@colormagic.app</a>.
href="mailto:hello@colormagic.club"
>hello@colormagic.club</a>.
</p>
<p>
We're going to be making some improvements over the coming future, as well as adding other
Expand Down
27 changes: 0 additions & 27 deletions layers/common/components/CommonNav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,36 +68,9 @@

<!-- right -->
<div class="flex items-center gap-2 sm:gap-4">
<UButton
icon="i-fa6-brands-github"
variant="ghost"
color="gray"
to="https://github.com/timb-103/colormagic"
class="hidden sm:flex"
/>

<!-- lang switcher-->
<CommonLangSwitcher />

<!-- login button -->
<ClientOnly>
<UButton
v-if="!user && !useRoute().path.includes('/login')"
label="Login"
color="primary"
to="/login"
/>

<!-- profile menu -->
<UDropdown
v-else-if="user"
:items="userItems"
:popper="{ placement: 'bottom-end' }"
>
<UButton icon="i-heroicons-user" />
</UDropdown>
</ClientOnly>

<!-- mobile bars button -->
<UButton
icon="i-heroicons-bars-3"
Expand Down
39 changes: 33 additions & 6 deletions layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
<!-- footer -->
<CommonFooter />

<!-- floating donate button -->
<CommonFloatingButton />

<!-- global notifications -->
<UNotifications>
<template #description="{ description }">
Expand All @@ -33,7 +30,30 @@
import { useLocalStorage } from '@vueuse/core';
const { siteUrl } = useRuntimeConfig().public;
const { path } = useRoute();
const route = useRoute();
const { locale, defaultLocale } = useI18n();
// 构建规范的 canonical URL
const canonicalUrl = computed(() => {
let path = route.path;
// 如果是默认语言,移除语言前缀
if (locale.value === defaultLocale && path.startsWith(`/${locale.value}`)) {
path = path.substring(locale.value.length + 1);
}
// 确保路径以 / 开头
if (!path.startsWith('/')) {
path = '/' + path;
}
// 移除尾部斜杠(除了首页)
if (path !== '/' && path.endsWith('/')) {
path = path.slice(0, -1);
}
return `${siteUrl}${path}`;
});
const head = useLocaleHead({
addDirAttribute: true,
Expand All @@ -45,12 +65,19 @@ useHead({
htmlAttrs: {
lang: head.value.htmlAttrs.lang
},
link: [...(head.value.link ?? [])],
link: [
// 添加 canonical 链接
{
rel: 'canonical',
href: canonicalUrl
},
...(head.value.link ?? [])
],
meta: [...(head.value.meta ?? [])]
});
useServerSeoMeta({
ogUrl: `${siteUrl}${path}`,
ogUrl: canonicalUrl,
ogType: 'website'
});
Expand Down
7 changes: 7 additions & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,12 @@ export default defineNuxtConfig({
flag: '🇮🇹'
}
]
},
plausible: {
domain: 'colormagic.club',
apiHost: 'https://plausible.io',
trackLocalhost: false,
autoPageviews: true,
autoOutboundTracking: true
}
});
8 changes: 8 additions & 0 deletions plausible.client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default defineNuxtPlugin(() => {
// 动态加载 Plausible 脚本
const script = document.createElement('script');
script.defer = true;
script.dataset.domain = 'colormagic.club';
script.src = 'https://plausible.io/js/script.outbound-links.js';
document.head.appendChild(script);
});
62 changes: 30 additions & 32 deletions public/img/HorizontalLogo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/img/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/img/favicon.ico
Binary file not shown.
Binary file modified public/img/icon-192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/img/icon-512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 16 additions & 17 deletions public/img/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a125b7f

Please sign in to comment.