Merge branch 'main' into credits

This commit is contained in:
javayhu 2025-05-27 23:47:41 +08:00
commit 443f01769c
8 changed files with 27 additions and 7 deletions

View File

@ -12,6 +12,7 @@ import StatsSection from '@/components/blocks/stats/stats';
import TestimonialsSection from '@/components/blocks/testimonials/testimonials';
import { NewsletterCard } from '@/components/newsletter/newsletter-card';
import DiscordWidget from '@/components/shared/discord-widget';
import { websiteConfig } from '@/config/website';
import { constructMetadata } from '@/lib/metadata';
import { getUrlWithLocale } from '@/lib/urls/urls';
import type { Metadata } from 'next';
@ -32,7 +33,7 @@ export async function generateMetadata({
return constructMetadata({
title: t('title'),
description: t('description'),
canonicalUrl: getUrlWithLocale('/', locale),
canonicalUrl: getUrlWithLocale('', locale),
});
}
@ -74,7 +75,7 @@ export default async function HomePage(props: HomePageProps) {
<NewsletterCard />
<DiscordWidget />
{websiteConfig.features.enableDiscordWidget && <DiscordWidget />}
</div>
</>
);

View File

@ -26,7 +26,7 @@ export async function generateMetadata({
return constructMetadata({
title: category + ' | ' + t('title'),
description: t('description'),
canonicalUrl: getUrlWithLocale('/blocks/${category}', locale),
canonicalUrl: getUrlWithLocale(`/blocks/${category}`, locale),
});
}

View File

@ -34,7 +34,7 @@ export async function generateMetadata({
return constructMetadata({
title: `${category.name} | ${t('title')}`,
description: category.description,
canonicalUrl: getUrlWithLocale('/blog/category/${slug}', locale),
canonicalUrl: getUrlWithLocale(`/blog/category/${slug}`, locale),
});
}

View File

@ -100,6 +100,7 @@ export async function generateMetadata({
title: `${post.title} | ${t('title')}`,
description: post.description,
canonicalUrl: getUrlWithLocale(post.slug, locale),
image: post.image,
});
}

View File

@ -10,8 +10,10 @@ import {
SidebarMenu,
SidebarMenuButton,
SidebarMenuItem,
useSidebar,
} from '@/components/ui/sidebar';
import { getSidebarLinks } from '@/config/sidebar-config';
import { websiteConfig } from '@/config/website';
import { LocaleLink } from '@/i18n/navigation';
import { authClient } from '@/lib/auth-client';
import { Routes } from '@/routes';
@ -31,6 +33,7 @@ export function DashboardSidebar({
const [mounted, setMounted] = useState(false);
const { data: session, isPending } = authClient.useSession();
const currentUser = session?.user;
const { state } = useSidebar();
// console.log('sidebar currentUser:', currentUser);
const sidebarLinks = getSidebarLinks();
@ -73,8 +76,10 @@ export function DashboardSidebar({
{/* Only show UI components when not in loading state */}
{!isPending && mounted && (
<>
{/* show upgrade card if user is not a member */}
{currentUser && <UpgradeCard />}
{/* show upgrade card if user is not a member, and sidebar is not collapsed */}
{currentUser &&
state !== 'collapsed' &&
websiteConfig.features.enableUpgradeCard && <UpgradeCard />}
{/* show user profile if user is logged in */}
{currentUser && <SidebarUser user={currentUser} />}

View File

@ -32,6 +32,10 @@ export const websiteConfig: WebsiteConfig = {
youtube: 'https://mksaas.link/youtube',
},
},
features: {
enableDiscordWidget: true,
enableUpgradeCard: true,
},
routes: {
defaultLoginRedirect: '/dashboard',
},

View File

@ -37,7 +37,7 @@ export function constructMetadata({
url: canonicalUrl,
title,
description,
siteName: title,
siteName: defaultMessages.Metadata.name,
images: [ogImageUrl.toString()],
},
twitter: {

View File

@ -5,6 +5,7 @@ import type { ReactNode } from 'react';
*/
export type WebsiteConfig = {
metadata: MetadataConfig;
features: FeaturesConfig;
routes: RoutesConfig;
analytics: AnalyticsConfig;
auth: AuthConfig;
@ -60,6 +61,14 @@ export interface SocialConfig {
telegram?: string;
}
/**
* Website features
*/
export interface FeaturesConfig {
enableDiscordWidget?: boolean; // Whether to enable the discord widget
enableUpgradeCard?: boolean; // Whether to enable the upgrade card in the sidebar
}
/**
* Routes configuration
*/