Skip to content

Commit 4f25e45

Browse files
committed
feat(site): put a monitor preview in the hero and tighten the design
Rebuild the homepage around one concrete product moment instead of a text-only first screen, and fix the craft issues around it. - add MonitorCard: a watched URL, a detected change and the email it sent, with bilingual copy in hero.preview - split the hero into copy and preview, and state what the product does in the H1 instead of repeating the wordmark - adopt the logo colours: navy accent for actions and figures, gold kept to a single signal dot on the change row - drop uppercase tracked labels, 600 headings, decorative arrows and nav icons; one lucide size at stroke 1.5 - move spacing onto a section rhythm and align nav, main and footer on one horizontal inset - unify radii, add tabular figures, focus-visible rings and named colour transitions - remove the unused @base-ui/react dependency
1 parent ac83247 commit 4f25e45

17 files changed

Lines changed: 304 additions & 267 deletions

‎App.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ const App = ({ lang, pathname }: AppProps) => {
1919
<div className="min-h-screen bg-background text-text">
2020
<SiteMeta content={content} pathname={pathname} />
2121
<Navbar lang={lang} pathname={pathname} />
22-
<main className="px-4 pb-10 pt-4 sm:px-6 lg:px-8">
23-
<div className="mx-auto flex w-full max-w-6xl flex-col gap-4">
22+
<main className="px-5 pb-16 sm:px-8">
23+
<div className="mx-auto w-full max-w-6xl">
2424
<Hero content={content} />
2525
<Projects content={content} />
2626
<GettingStarted content={content} />

‎README.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[中文首页](https://webmonitor.github.io/) · [English](https://webmonitor.github.io/en/) · [使用文档](https://webmonitor.github.io/docs/) · [组织主页](https://github.com/webmonitor)
44

5-
本仓库维护 WebMonitor 的中英文首页与部署文档。网站由 React、TypeScript、Vite 和 Base UI 构建,构建时预渲染为静态 HTML,通过 GitHub Pages 发布;不运行监控任务,也不保存应用账户或凭据。
5+
本仓库维护 WebMonitor 的中英文首页与部署文档。网站由 React、TypeScript 和 Vite 构建,构建时预渲染为静态 HTML,通过 GitHub Pages 发布;不运行监控任务,也不保存应用账户或凭据。
66

77
## 页面与语言
88

@@ -52,6 +52,7 @@ docker pull ghcr.io/webmonitor/webmonitor:1.0.3
5252
| `config/routes.ts` | 路由、语言与切换链接 |
5353
| `config/site.ts` | 组织、演示和 Logo 等共享 URL |
5454
| `components/Navbar.tsx`、`components/Hero.tsx` | 顶部导航与首页文字入口;首页保留在线体验、源码操作,文档通过导航进入 |
55+
| `components/MonitorCard.tsx` | 首屏用代码绘制的监控预览:一次变化与它发出的邮件,内容取自 `content/*.ts` 的 `hero.preview` |
5556
| `components/DocsPage.tsx` | 按内容数据渲染文档、表格、代码和目录 |
5657
| `components/Projects.tsx`、`components/GettingStarted.tsx` | 产品、资源与安装区块;快速开始保留两组命令,操作与存储说明在完整文档中 |
5758
| `components/Rich.tsx` | 行内代码与强调文本 |

‎components/CodeBlock.tsx‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ interface CodeBlockProps {
55
}
66

77
const CodeBlock = ({ title, code, hint }: CodeBlockProps) => (
8-
<div className="min-w-0 space-y-2">
9-
{title && <p className="text-xs font-medium uppercase tracking-[0.18em] text-muted">{title}</p>}
10-
<pre className="w-full overflow-x-auto rounded-sm border border-line bg-surface p-4 font-mono text-xs leading-7 text-text">
8+
<div className="min-w-0">
9+
{title && <p className="mb-2 text-sm text-text">{title}</p>}
10+
<pre className="overflow-x-auto rounded-lg border border-line bg-raised px-4 py-3 font-mono text-xs leading-6 text-text">
1111
<code>{code}</code>
1212
</pre>
13-
{hint && <p className="text-xs leading-6 text-muted">{hint}</p>}
13+
{hint && <p className="mt-2 text-xs leading-6 text-muted">{hint}</p>}
1414
</div>
1515
);
1616

‎components/DocsPage.tsx‎

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,24 @@
11
import { Fragment } from 'react';
22
import type { ReactNode } from 'react';
3-
import { Separator } from '@base-ui/react';
43
import { ArrowUpRight } from 'lucide-react';
54
import type { DocBlock, SiteContent } from '../content/types';
65
import CodeBlock from './CodeBlock';
76
import Rich from './Rich';
87

98
const DocSection = ({ id, title, children }: { id: string; title: string; children: ReactNode }) => (
10-
<section id={id} className="scroll-mt-6 space-y-4">
11-
<div className="space-y-2">
12-
<h2 className="text-xl font-semibold tracking-tight text-text">{title}</h2>
13-
<Separator className="h-px w-full bg-line" />
14-
</div>
15-
<div className="space-y-4 text-sm leading-7 text-muted">{children}</div>
9+
<section id={id} className="scroll-mt-6">
10+
<h2 className="border-b border-line pb-3 text-lg font-medium text-text">{title}</h2>
11+
<div className="mt-5 space-y-4 text-sm leading-7 text-secondary">{children}</div>
1612
</section>
1713
);
1814

1915
const DocTable = ({ head, rows }: { head: string[]; rows: string[][] }) => (
2016
<div className="w-full overflow-x-auto">
21-
<table className="w-full min-w-[520px] border-collapse text-sm">
17+
<table className="w-full min-w-[520px] border-collapse text-sm tabular-nums">
2218
<thead>
2319
<tr>
2420
{head.map((cell) => (
25-
<th
26-
key={cell}
27-
className="border-b border-line py-2 pr-4 text-left text-xs font-medium uppercase tracking-[0.14em] text-muted"
28-
>
21+
<th key={cell} className="border-b border-line py-2 pr-4 text-left text-xs font-normal text-muted">
2922
<Rich text={cell} />
3023
</th>
3124
))}
@@ -37,7 +30,7 @@ const DocTable = ({ head, rows }: { head: string[]; rows: string[][] }) => (
3730
{row.map((cell, index) => (
3831
<td
3932
key={`${row[0]}-${index}`}
40-
className="border-b border-line/60 py-2 pr-4 align-top leading-6 text-muted first:whitespace-nowrap first:text-text"
33+
className="border-b border-line/60 py-3 pr-4 align-top leading-6 text-secondary first:whitespace-nowrap first:text-text"
4134
>
4235
<Rich text={cell} />
4336
</td>
@@ -75,7 +68,7 @@ const DocBlockView = ({ block }: { block: DocBlock }) => {
7568
return <CodeBlock title={block.title} code={block.code} hint={block.hint} />;
7669
case 'note':
7770
return (
78-
<div className="rounded-sm border border-line bg-surface px-4 py-3 text-xs leading-6 text-muted">
71+
<div className="rounded-lg border border-line bg-surface px-4 py-3 text-xs leading-6 text-muted">
7972
<Rich text={block.text} />
8073
</div>
8174
);
@@ -86,10 +79,10 @@ const DocBlockView = ({ block }: { block: DocBlock }) => {
8679
href={block.href}
8780
target="_blank"
8881
rel="noreferrer"
89-
className="inline-flex items-center gap-1 underline decoration-line underline-offset-4 transition hover:text-text"
82+
className="inline-flex items-center gap-1 text-text underline decoration-line underline-offset-4 transition-colors hover:decoration-text"
9083
>
9184
{block.label}
92-
<ArrowUpRight className="h-3.5 w-3.5" />
85+
<ArrowUpRight aria-hidden strokeWidth={1.5} className="h-4 w-4 text-muted" />
9386
</a>
9487
</p>
9588
);
@@ -100,23 +93,23 @@ const DocsPage = ({ content }: { content: SiteContent }) => {
10093
const { docs } = content;
10194

10295
return (
103-
<main className="px-4 pb-12 pt-4 sm:px-6 lg:px-8">
96+
<main className="px-5 pb-20 sm:px-8">
10497
<div className="mx-auto w-full max-w-6xl">
105-
<div className="space-y-3 border-b border-line pb-6 pt-4">
106-
<h1 className="text-4xl font-semibold tracking-tight text-text sm:text-5xl">{docs.heading}</h1>
107-
<p className="max-w-2xl text-sm leading-7 text-muted sm:text-base">
98+
<div className="border-b border-line pb-8 pt-16 lg:pt-20">
99+
<h1 className="text-3xl font-medium text-text sm:text-4xl">{docs.heading}</h1>
100+
<p className="mt-3 max-w-2xl text-base leading-8 text-secondary">
108101
<Rich text={docs.intro} />
109102
</p>
110103
</div>
111104

112-
<div className="grid gap-10 pt-6 lg:grid-cols-[200px_minmax(0,1fr)] lg:gap-12">
113-
<aside className="lg:sticky lg:top-6 lg:self-start">
105+
<div className="grid gap-10 pt-10 lg:grid-cols-[200px_minmax(0,1fr)] lg:gap-16">
106+
<aside className="lg:sticky lg:top-8 lg:self-start">
114107
<nav aria-label={docs.contents}>
115-
<p className="mb-3 text-xs font-medium uppercase tracking-[0.28em] text-muted">{docs.contents}</p>
116-
<ul className="space-y-1.5 text-sm">
108+
<p className="mb-2 text-xs text-muted">{docs.contents}</p>
109+
<ul className="space-y-2 border-l border-line pl-4 text-sm">
117110
{docs.sections.map(({ id, title }) => (
118111
<li key={id}>
119-
<a href={`#${id}`} className="text-muted transition hover:text-text">
112+
<a href={`#${id}`} className="text-muted transition-colors hover:text-text">
120113
{title}
121114
</a>
122115
</li>
@@ -125,7 +118,7 @@ const DocsPage = ({ content }: { content: SiteContent }) => {
125118
</nav>
126119
</aside>
127120

128-
<article className="min-w-0 space-y-10">
121+
<article className="min-w-0 max-w-[46rem] space-y-12">
129122
{docs.sections.map((section) => (
130123
<Fragment key={section.id}>
131124
<DocSection id={section.id} title={section.title}>

‎components/Footer.tsx‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,15 @@ import type { SiteContent } from '../content/types';
33

44
const Footer = ({ content }: { content: SiteContent }) => {
55
return (
6-
<footer className="px-4 pb-8 pt-1 text-sm text-muted sm:px-6 lg:px-8">
7-
<div className="mx-auto flex w-full max-w-6xl flex-col gap-3 border-t border-line/80 px-1 py-4 sm:flex-row sm:items-center sm:justify-between sm:px-0">
6+
<footer className="px-5 pb-10 sm:px-8">
7+
<div className="mx-auto flex w-full max-w-6xl flex-col gap-2 border-t border-line pt-6 text-xs text-muted sm:flex-row sm:items-center sm:justify-between">
88
<p>{content.footerTagline}</p>
9-
<a href={shared.githubUrl} target="_blank" rel="noreferrer" className="transition hover:text-text">
9+
<a
10+
href={shared.githubUrl}
11+
target="_blank"
12+
rel="noreferrer"
13+
className="font-mono transition-colors hover:text-text"
14+
>
1015
{content.footerLink}
1116
</a>
1217
</div>

‎components/GettingStarted.tsx‎

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { Separator } from '@base-ui/react';
21
import type { SiteContent } from '../content/types';
32
import CodeBlock from './CodeBlock';
43

@@ -10,17 +9,22 @@ const GettingStarted = ({ content }: GettingStartedProps) => {
109
const { sections, quickStart } = content;
1110

1211
return (
13-
<section className="space-y-5 py-2">
14-
<div className="space-y-2">
15-
<h2 className="text-2xl font-semibold tracking-tight text-text">{sections.startTitle}</h2>
16-
<p className="text-sm leading-7 text-muted">{sections.startDescription}</p>
12+
<section className="border-t border-line py-16 lg:py-20">
13+
<div className="max-w-2xl">
14+
<h2 className="text-2xl font-medium text-text">{sections.startTitle}</h2>
15+
<p className="mt-3 text-sm leading-7 text-muted">{sections.startDescription}</p>
1716
</div>
1817

19-
<Separator className="h-px w-full bg-line" />
18+
<div className="mt-10 divide-y divide-line/70 border-t border-line">
19+
<div className="grid gap-4 py-6 sm:grid-cols-[176px_1fr] sm:gap-8 lg:grid-cols-[224px_1fr] lg:gap-12">
20+
<h3 className="text-[15px] font-medium text-text">WebMonitor-Agent</h3>
21+
<CodeBlock code={quickStart.agent.join('\n')} />
22+
</div>
2023

21-
<div className="grid gap-8 lg:grid-cols-2 lg:gap-12">
22-
<CodeBlock title="WebMonitor-Agent" code={quickStart.agent.join('\n')} />
23-
<CodeBlock title="WebMonitor" code={quickStart.legacy.join('\n')} />
24+
<div className="grid gap-4 py-6 sm:grid-cols-[176px_1fr] sm:gap-8 lg:grid-cols-[224px_1fr] lg:gap-12">
25+
<h3 className="text-[15px] font-medium text-text">WebMonitor</h3>
26+
<CodeBlock code={quickStart.legacy.join('\n')} />
27+
</div>
2428
</div>
2529
</section>
2630
);

‎components/Hero.tsx‎

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,49 @@
11
import { ArrowUpRight } from 'lucide-react';
22
import { shared } from '../config/site';
33
import type { SiteContent } from '../content/types';
4+
import MonitorCard from './MonitorCard';
45

56
interface HeroProps {
67
content: SiteContent;
78
}
89

910
const Hero = ({ content }: HeroProps) => {
10-
return (
11-
<section className="border-b border-line pb-5">
12-
<div className="py-4">
13-
<div className="space-y-6">
14-
<div className="space-y-3">
15-
<p className="text-xs font-medium uppercase tracking-[0.3em] text-muted">{content.hero.eyebrow}</p>
16-
<h1 className="text-4xl font-semibold tracking-tight text-text sm:text-5xl">{content.hero.title}</h1>
17-
<p className="max-w-2xl text-sm leading-7 text-muted sm:text-base">{content.hero.intro}</p>
18-
</div>
11+
const { hero } = content;
1912

20-
<div className="flex flex-wrap items-center gap-3">
21-
<a
22-
href={shared.demoUrl}
23-
target="_blank"
24-
rel="noreferrer"
25-
className="inline-flex items-center gap-2 border-b border-text pb-1 text-sm font-medium text-text"
26-
>
27-
{content.hero.primary}
28-
<ArrowUpRight className="h-4 w-4" />
29-
</a>
30-
<a
31-
href={shared.githubUrl}
32-
target="_blank"
33-
rel="noreferrer"
34-
className="inline-flex items-center gap-2 border-b border-transparent pb-1 text-sm text-muted transition hover:border-line hover:text-text"
35-
>
36-
{content.hero.secondary}
37-
<ArrowUpRight className="h-4 w-4" />
38-
</a>
39-
</div>
13+
return (
14+
<section className="grid items-center gap-12 border-b border-line pb-14 pt-16 lg:grid-cols-12 lg:gap-16 lg:pb-20 lg:pt-24">
15+
<div className="rise lg:col-span-6">
16+
<p className="text-sm text-muted">{hero.eyebrow}</p>
17+
<h1 className="mt-4 text-4xl leading-[1.15] text-text sm:text-5xl sm:leading-[1.08] sm:tracking-[-0.01em] lg:text-6xl lg:leading-[1.04] lg:tracking-[-0.02em]">
18+
{hero.headline}
19+
</h1>
20+
<p className="mt-6 max-w-md text-base leading-8 text-secondary">{hero.intro}</p>
4021

22+
<div className="mt-8 flex flex-wrap items-center gap-x-6 gap-y-3">
23+
<a
24+
href={shared.demoUrl}
25+
target="_blank"
26+
rel="noreferrer"
27+
className="inline-flex h-11 items-center gap-2 rounded-lg bg-accent px-5 text-sm font-medium text-surface transition-colors hover:bg-accentDeep"
28+
>
29+
{hero.primary}
30+
<ArrowUpRight strokeWidth={1.5} className="h-4 w-4" />
31+
</a>
32+
<a
33+
href={shared.githubUrl}
34+
target="_blank"
35+
rel="noreferrer"
36+
className="inline-flex h-11 items-center gap-2 text-sm text-muted transition-colors hover:text-text"
37+
>
38+
{hero.secondary}
39+
<ArrowUpRight strokeWidth={1.5} className="h-4 w-4" />
40+
</a>
4141
</div>
4242
</div>
43+
44+
<div className="rise rise-2 lg:col-span-6">
45+
<MonitorCard preview={hero.preview} />
46+
</div>
4347
</section>
4448
);
4549
};

‎components/MonitorCard.tsx‎

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import { Mail } from 'lucide-react';
2+
import type { SiteContent } from '../content/types';
3+
4+
interface MonitorCardProps {
5+
preview: SiteContent['hero']['preview'];
6+
}
7+
8+
const MonitorCard = ({ preview }: MonitorCardProps) => (
9+
<div className="w-full rounded-2xl border border-line bg-surface shadow-card">
10+
<div className="flex items-center justify-between gap-4 border-b border-line px-5 py-4">
11+
<p className="text-xs text-muted">
12+
{preview.label} <span className="tabular-nums text-text">{preview.counter}</span>
13+
</p>
14+
<p className="font-mono text-xs tabular-nums text-muted">
15+
{preview.lastCheck} {preview.lastCheckTime}
16+
</p>
17+
</div>
18+
19+
<div className="space-y-1 px-5 py-4">
20+
<p className="truncate font-mono text-sm text-text">{preview.url}</p>
21+
<p className="truncate font-mono text-xs text-muted">
22+
{preview.interval} · {preview.selector}
23+
</p>
24+
</div>
25+
26+
<div className="border-t border-line px-5 py-4">
27+
<div className="flex items-center gap-2">
28+
<span aria-hidden className="h-1.5 w-1.5 shrink-0 rounded-full bg-signal" />
29+
<p className="text-sm text-text">{preview.change}</p>
30+
<p className="ml-auto font-mono text-xs tabular-nums text-muted">{preview.changeTime}</p>
31+
</div>
32+
33+
<div className="mt-3 flex items-baseline gap-3">
34+
<span className="font-mono text-sm tabular-nums text-muted line-through decoration-line">{preview.before}</span>
35+
<span aria-hidden className="font-mono text-sm text-muted">→</span>
36+
<span className="font-mono text-2xl tabular-nums text-accent">{preview.after}</span>
37+
</div>
38+
<p className="mt-1 text-xs text-muted">{preview.changeNote}</p>
39+
</div>
40+
41+
<div className="border-t border-line px-5 py-4">
42+
<div className="flex items-center gap-2 text-xs text-muted">
43+
<Mail aria-hidden strokeWidth={1.5} className="h-4 w-4 shrink-0" />
44+
<span>{preview.emailLabel}</span>
45+
<span aria-hidden className="h-3 w-px bg-line" />
46+
<span className="truncate font-mono">{preview.emailTo}</span>
47+
</div>
48+
<p className="mt-1 truncate text-sm text-text">{preview.emailSubject}</p>
49+
</div>
50+
</div>
51+
);
52+
53+
export default MonitorCard;

0 commit comments

Comments
 (0)