- บทความจากหลังบ้าน: /for-film-lovers, /for-cinemas (ArticlePage + ArticleEditor แบบบล็อกย่อหน้า/รูป) - แชร์: ปุ่มบนการ์ดและท้ายหน้ารายละเอียด · ลิงก์ย่อ /c/<slug> (302) · ธีมแก้วตาม DESIGN.md - PWA: manifest/sw/offline + ถอดการล็อกซูม (WCAG 1.4.4) + touch target ≥44px - แอนิเมชัน reveal: IntersectionObserver + gate ด้วย html.fx-motion · เคารพ prefers-reduced-motion - ค้นหา: normalize/ตัดวรรณยุกต์ + AND หลายคำ + จัดอันดับ · รองรับ /?q= จาก SearchAction - SEO: pageMeta (canonical/OG/Twitter) + JSON-LD (WebSite/Organization/BreadcrumbList/MovieTheater/Article) - ไม่ฝังโดเมนในโค้ด: origin มาจาก request (x-forwarded-host/proto) ทั้ง canonical, sitemap, robots, ลิงก์แชร์ - กัน AI: robots.txt (Nitro route, บล็อก AI 21 ตัว) + ai.txt + OG image 1200x630 - เอกสาร: README สรุปโปรเจกต์, DESIGN.md (motion/PWA/SEO/ข้อมูล), architecture.html, admin-guide - tests: 135 ผ่าน (16 ไฟล์)
168 lines
6.4 KiB
TypeScript
168 lines
6.4 KiB
TypeScript
import { IconArrowBackUp } from "@tabler/icons-react";
|
|
import { Link } from "react-router";
|
|
|
|
import { footerIcon } from "@/components/site/footer-icons";
|
|
import { Reveal } from "@/components/site/Reveal";
|
|
import { SiteShell } from "@/components/site/SiteShell";
|
|
import { useReveal } from "@/hooks/use-reveal";
|
|
import { APP_TITLE } from "@/lib/app-config";
|
|
import { useContent } from "@/lib/content-context";
|
|
import { COLORS } from "@/lib/design-tokens";
|
|
import { useI18n } from "@/lib/i18n";
|
|
import { DEFAULT_LOCALE, MESSAGES } from "@/lib/i18n/messages";
|
|
import { resolvePageOrigin } from "@/lib/page-origin";
|
|
import { breadcrumbJsonLd, originFromMatches, pageMeta } from "@/lib/seo";
|
|
|
|
const HEAD_MESSAGES = MESSAGES[DEFAULT_LOCALE];
|
|
|
|
/** meta() ของ route ลูกอ่าน origin ที่ root loader หาไว้ (ไม่ฝังโดเมน) */
|
|
type MetaArgs = { matches?: Array<{ id?: string; data?: unknown }> };
|
|
|
|
export async function loader({ request }: { request: Request }) {
|
|
return { origin: resolvePageOrigin(request) };
|
|
}
|
|
|
|
export function meta({ loaderData }: { loaderData?: { origin?: string } }) {
|
|
const origin = loaderData?.origin ?? "";
|
|
const title = `${HEAD_MESSAGES.about.title} — AlterFlixHub`;
|
|
const description = HEAD_MESSAGES.about.lead;
|
|
return [
|
|
...pageMeta({ origin, title, description, path: "/about" }),
|
|
...breadcrumbJsonLd(origin, [
|
|
{ name: "หน้าแรก", path: "/" },
|
|
{ name: HEAD_MESSAGES.about.title, path: "/about" },
|
|
]),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* หนึ่งบล็อกของเนื้อหา — ค่อย ๆ โผล่เมื่อเลื่อนมาถึง
|
|
* ใช้ hook บน <article> ตรง ๆ (ไม่ห่อ div) เพื่อให้ break-inside-avoid ของ
|
|
* คอลัมน์ (lg:columns-2) ยังทำงานถูกต้อง
|
|
*/
|
|
function AboutBlock({
|
|
section,
|
|
index,
|
|
}: {
|
|
section: { heading: string; body: string };
|
|
index: number;
|
|
}) {
|
|
const { ref, revealed, style } = useReveal<HTMLElement>((index % 2) * 80);
|
|
|
|
return (
|
|
<article
|
|
ref={ref}
|
|
data-reveal="rise"
|
|
data-revealed={revealed ? "" : undefined}
|
|
style={{ ...style, border: `1px solid ${COLORS.border}` }}
|
|
className="mb-8 flex break-inside-avoid flex-col gap-5 rounded-xl bg-[#1B1B1B]/70 p-7 backdrop-blur-sm transition-colors duration-300 hover:bg-[#1B1B1B] md:p-8"
|
|
>
|
|
<div className="flex items-center gap-3">
|
|
<span
|
|
className="flex size-12 shrink-0 items-center justify-center rounded-full text-sm font-semibold text-[#D47272]"
|
|
style={{
|
|
background: "rgba(143,8,8,0.16)",
|
|
border: "1px solid rgba(169,38,38,0.45)",
|
|
}}
|
|
aria-hidden="true"
|
|
>
|
|
{String(index + 1).padStart(2, "0")}
|
|
</span>
|
|
<h2 className="text-2xl font-semibold leading-[1.3]">
|
|
{section.heading}
|
|
</h2>
|
|
</div>
|
|
<p className="font-content text-[17px] leading-[1.95] text-[#C7C7C7] md:text-[18px]">
|
|
{section.body}
|
|
</p>
|
|
</article>
|
|
);
|
|
}
|
|
|
|
/**
|
|
* หน้า "เกี่ยวกับเรา" — เนื้อหามาจากหลังบ้าน (data/content) แยกตามภาษา
|
|
* ภาษาภาพเดียวกับหน้าแรก/หน้ารายละเอียด: กรอบ 1440 + px-[108px], การ์ดขอบโทน #332B2B,
|
|
* chip แดง, ตัวเลขในวงกลมไล่แสง (glowSoft) และไอคอนโซเชียลชุดเดียวกับ footer
|
|
*/
|
|
export default function AboutRoute() {
|
|
const { messages, locale } = useI18n();
|
|
const { site, about } = useContent();
|
|
const content = about[locale];
|
|
|
|
return (
|
|
<SiteShell variant="detail">
|
|
<main className="relative z-10 mx-auto flex w-full max-w-[1440px] flex-col gap-10 px-5 pb-16 pt-4 md:px-[108px] md:pt-6">
|
|
<Reveal kind="fade">
|
|
<Link
|
|
to="/"
|
|
className="inline-flex w-fit items-center gap-2 text-xl font-medium transition hover:text-[#D47272]"
|
|
>
|
|
<IconArrowBackUp size={24} />
|
|
{messages.nav.home}
|
|
</Link>
|
|
</Reveal>
|
|
|
|
<Reveal delay={40} className="flex flex-col gap-4">
|
|
<h1 className="text-[32px] font-bold leading-[1.3] md:text-[40px]">
|
|
{content.title}
|
|
</h1>
|
|
<p className="font-content max-w-[860px] text-[19px] leading-[1.8] text-[#C4C4C4] md:text-[21px]">
|
|
{content.lead}
|
|
</p>
|
|
</Reveal>
|
|
|
|
<section className="gap-6 lg:columns-2">
|
|
{content.sections.map((section, index) => (
|
|
<AboutBlock
|
|
key={`${section.heading}-${index}`}
|
|
section={section}
|
|
index={index}
|
|
/>
|
|
))}
|
|
</section>
|
|
|
|
<Reveal kind="fade">
|
|
<section
|
|
className="flex flex-col gap-6 rounded-xl p-6 backdrop-blur-sm lg:flex-row lg:items-center lg:justify-between"
|
|
style={{
|
|
border: "1px solid rgba(169,38,38,0.45)",
|
|
background:
|
|
"linear-gradient(180deg, rgba(143,8,8,0.18) 0%, rgba(27,27,27,0.85) 65%, rgba(13,13,13,0.7) 100%)",
|
|
}}
|
|
>
|
|
<div className="flex flex-col gap-3">
|
|
<h2 className="text-2xl font-semibold leading-[1.3]">
|
|
{content.contactHeading}
|
|
</h2>
|
|
<p className="font-content max-w-[720px] text-[16px] leading-[1.9] text-[#C4C4C4] md:text-[17px]">
|
|
{content.contactNote}
|
|
</p>
|
|
</div>
|
|
|
|
{site.footer.length > 0 ? (
|
|
<div className="flex flex-wrap items-center gap-2">
|
|
{site.footer.map((item) => {
|
|
const Icon = footerIcon(item.icon_name);
|
|
return (
|
|
<a
|
|
key={item.id}
|
|
href={item.href}
|
|
aria-label={item.label}
|
|
title={item.label}
|
|
target="_blank"
|
|
rel="noreferrer"
|
|
className="flex size-11 items-center justify-center rounded-full bg-white/90 text-[#0D0D0D] transition hover:bg-white"
|
|
>
|
|
<Icon size={20} />
|
|
</a>
|
|
);
|
|
})}
|
|
</div>
|
|
) : null}
|
|
</section>
|
|
</Reveal>
|
|
</main>
|
|
</SiteShell>
|
|
);
|
|
}
|