整体UI调整
This commit is contained in:
@@ -7,6 +7,7 @@ import { useEffect, useState, type ReactNode } from "react";
|
||||
import { openAppDownload, useAppDownloadHref } from "@/components/download/download-dialog";
|
||||
import { footerNavItems } from "@/components/layout/footer-nav-items";
|
||||
import type { AppTranslationInfo, ConfigInfo, TranslationCategory, TranslationInfo } from "@/lib/api/types";
|
||||
import { OFFICIAL_TG_HANDLE, OFFICIAL_TG_URL } from "@/lib/seo/metadata";
|
||||
|
||||
import { resolveAboutPlatformHref, resolveNavHref } from "./nav-href";
|
||||
import { categoryHref, isNavActive } from "./nav-utils";
|
||||
@@ -21,54 +22,18 @@ function withDividers(items: ReactNode[], divider: string) {
|
||||
);
|
||||
}
|
||||
|
||||
/** 仅接口有值才展示,不造假数据 */
|
||||
function buildContacts(config?: ConfigInfo | null) {
|
||||
const email = config?.gmailAddr?.trim();
|
||||
const business = config?.telegram?.trim();
|
||||
const group = config?.tgGroup?.trim() || config?.telegramAdd?.trim();
|
||||
const items: { key: string; node: ReactNode }[] = [];
|
||||
|
||||
if (email) {
|
||||
items.push({
|
||||
key: "email",
|
||||
node: (
|
||||
<a href={`mailto:${email}`} className="text-xs leading-[18px] text-[#615970]">
|
||||
E-mail:{email}
|
||||
</a>
|
||||
),
|
||||
});
|
||||
}
|
||||
if (business) {
|
||||
items.push({
|
||||
key: "business",
|
||||
node: (
|
||||
<a href={business} target="_blank" rel="noopener noreferrer" className="text-xs leading-[18px] text-[#615970]">
|
||||
商务合作: 立即联系
|
||||
</a>
|
||||
),
|
||||
});
|
||||
}
|
||||
if (group) {
|
||||
items.push({
|
||||
key: "group",
|
||||
node: (
|
||||
<a href={group} target="_blank" rel="noopener noreferrer" className="text-xs leading-[18px] text-[#615970]">
|
||||
官方群: 立即加入
|
||||
</a>
|
||||
),
|
||||
});
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
function buildSocials(config?: ConfigInfo | null) {
|
||||
const telegram = config?.tgGroup?.trim() || config?.telegramAdd?.trim() || config?.telegram?.trim();
|
||||
const twitter = config?.twitterAddr?.trim();
|
||||
return [
|
||||
telegram ? { label: "Telegram", icon: "/images/footer_tg.svg", href: telegram } : null,
|
||||
twitter ? { label: "X", icon: "/images/footer_x.svg", href: twitter } : null,
|
||||
].filter(Boolean) as { label: string; icon: string; href: string }[];
|
||||
}
|
||||
/** 联系方式只保留官方 TG */
|
||||
const contacts = [
|
||||
{
|
||||
key: "tg",
|
||||
node: (
|
||||
<a href={OFFICIAL_TG_URL} target="_blank" rel="noopener noreferrer" className="text-xs leading-[18px] text-[#615970]">
|
||||
官方TG:{OFFICIAL_TG_HANDLE}
|
||||
</a>
|
||||
),
|
||||
},
|
||||
];
|
||||
const socials = [{ label: "Telegram", icon: "/images/footer_tg.svg", href: OFFICIAL_TG_URL }];
|
||||
|
||||
function InfoNavLink({ item, onClose }: { item: TranslationInfo; onClose: () => void }) {
|
||||
const href = resolveAboutPlatformHref(item);
|
||||
@@ -93,7 +58,6 @@ export function MobileMenu({
|
||||
onClose,
|
||||
categoryList,
|
||||
bottonTranslations,
|
||||
config,
|
||||
}: {
|
||||
open: boolean;
|
||||
onClose: () => void;
|
||||
@@ -107,8 +71,6 @@ export function MobileMenu({
|
||||
// 仅渲染接口 bottonTranslations,不补自定义项
|
||||
const bottomNavLinks = footerNavItems(bottonTranslations);
|
||||
const downloadHref = useAppDownloadHref();
|
||||
const contacts = buildContacts(config);
|
||||
const socials = buildSocials(config);
|
||||
|
||||
useEffect(() => {
|
||||
if (!open) return;
|
||||
@@ -148,8 +110,8 @@ export function MobileMenu({
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
<Link href="/" onClick={onClose} aria-label="海角社区" className="shrink-0">
|
||||
<img src="/logo.svg" alt="海角社区" className="h-[62px] w-[137px]" />
|
||||
<Link href="/" onClick={onClose} aria-label="黄果黑料" className="shrink-0">
|
||||
<img src="/logo.svg" alt="黄果黑料" className="h-[62px] w-[137px]" />
|
||||
</Link>
|
||||
|
||||
<nav className="flex w-full flex-col gap-[11px]" aria-label="主导航">
|
||||
@@ -244,16 +206,6 @@ export function MobileMenu({
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
<Link
|
||||
href="/profile"
|
||||
onClick={onClose}
|
||||
aria-current={pathname === "/profile" || pathname.startsWith("/profile/") ? "page" : undefined}
|
||||
className={`flex h-11 shrink-0 items-center rounded-[9px] bg-white/10 px-[18px] text-base leading-[22px] font-medium ${
|
||||
pathname === "/profile" || pathname.startsWith("/profile/") ? "text-[#F12B9E]" : "text-white/90"
|
||||
}`}
|
||||
>
|
||||
我的
|
||||
</Link>
|
||||
</nav>
|
||||
|
||||
{bottomNavLinks.length ? (
|
||||
|
||||
Reference in New Issue
Block a user