Showcase
Web browser
A browser window: tabs that open, close and load, an address bar with suggestions, bookmarks, downloads, a main menu, and History and Settings pages.
Source
Only the system's components and token utilities; the layout is Tailwind.
showcases/web-browser/App.tsx
1
/* A browser window: tabs that open, close and load; back, forward and reload; an address bar with2
* suggestions; bookmarks; downloads; a main menu; History and Settings pages. All state lives here,3
* the pieces are in toolbar.tsx and pages.tsx.4
*5
* Keyboard: Ctrl/⌘+L focuses the address bar. A real browser keeps Ctrl/⌘+T, W and Tab for itself,6
* so the window also answers to Alt+T (new tab), Alt+W (close), Alt+Shift+T (reopen), Alt+1…97
* (switch), Alt+Y (history); Ctrl+T, W and Tab still work where the host lets them through.8
* In the tab strip, arrows move between tabs and Delete closes the focused one (the Tabs' own).9
*10
* The layout: closable pill tabs in a header row over the toolbar, the bookmarks bar and the page.11
* The first icon of every row (a tab's favicon, Back, the first bookmark) stands on one line, 14px12
* from the window's edge. On a phone no strip: a tab-count button opens the open tabs as a sheet. */13
import { useEffect, useRef, useState, type KeyboardEvent, type MouseEvent } from "react";14
import { Progress, ScrollArea, Spinner, Tabs, Tooltip, Button } from "@fndn/react";15
import { Plus } from "@phosphor-icons/react";16
import { BOOKMARKS, CLI_DOWNLOAD, ENGINES, HISTORY, HOME, SETTINGS, VISITS, resolve, siteOf, type Visit } from "./data";17
import { Favicon, Page, type Settings } from "./pages";18
import { AddressBar, BookmarksBar, BrowserMenu, Downloads, NavButtons, TabSwitcher, suggestionsFor, useDownloads } from "./toolbar";19
20
type Tab = {21
id: string;22
/** The tab's own history: back and forward move `at` along it. */23
stack: string[];24
at: number;25
loading: boolean;26
/** The page on screen: the previous one stays until the next has loaded. */27
page: string;28
};29
30
const urlOf = (tab: Tab) => tab.stack[tab.at] ?? HOME;31
const now = () => new Date().toTimeString().slice(0, 5);32
let seq = 3;33
34
export default function App() {35
const [tabs, setTabs] = useState<Tab[]>([36
{ id: "t1", stack: ["harbor.dev/docs/getting-started"], at: 0, loading: false, page: "harbor.dev/docs/getting-started" },37
{ id: "t2", stack: ["status.harbor.dev"], at: 0, loading: false, page: "status.harbor.dev" },38
{ id: "t3", stack: ["fieldnotes.app/northwind/q4-planning"], at: 0, loading: false, page: "fieldnotes.app/northwind/q4-planning" },39
]);40
const [active, setActive] = useState("t1");41
const [closed, setClosed] = useState<Tab[]>([]);42
const [settings, setSettings] = useState<Settings>({ bookmarksBar: true, askWhereToSave: false, zoom: "100%", engine: ENGINES[0]!.value });43
const [bookmarks, setBookmarks] = useState(BOOKMARKS);44
const [visits, setVisits] = useState<Visit[]>(VISITS);45
const [downloads, setDownloads] = useDownloads();46
const [downloadsOpen, setDownloadsOpen] = useState(false);47
const [switcherOpen, setSwitcherOpen] = useState(false);48
const root = useRef<HTMLDivElement>(null);49
const timers = useRef(new Map<string, ReturnType<typeof setTimeout>>());50
useEffect(() => () => timers.current.forEach(clearTimeout), []);51
52
const tab = tabs.find((t) => t.id === active) ?? tabs[0]!;53
const url = urlOf(tab);54
const set = (patch: Partial<Settings>) => setSettings((s) => ({ ...s, ...patch }));55
const update = (id: string, change: (t: Tab) => Tab) => setTabs((all) => all.map((t) => (t.id === id ? change(t) : t)));56
57
/* a site "loads" for a moment (a spinner in its tab, a progress bar over the page; the previous58
* page stays until then); the browser's own pages (ui://) show at once */59
const local = (u: string) => u.startsWith("ui://");60
const load = (id: string, to: string) => {61
clearTimeout(timers.current.get(id));62
if (local(to)) return update(id, (t) => ({ ...t, loading: false, page: to }));63
update(id, (t) => ({ ...t, loading: true }));64
timers.current.set(id, setTimeout(() => update(id, (t) => ({ ...t, loading: false, page: urlOf(t) })), 450 + Math.random() * 500));65
};66
const navigate = (text: string) => {67
const to = resolve(text, settings.engine);68
update(tab.id, (t) => ({ ...t, stack: [...t.stack.slice(0, t.at + 1), to], at: t.at + 1 }));69
if (!local(to)) setVisits((v) => [{ url: to, time: now(), day: "today" }, ...v]);70
load(tab.id, to);71
};72
const step = (by: number) => {73
const at = Math.max(0, Math.min(tab.stack.length - 1, tab.at + by));74
update(tab.id, (t) => ({ ...t, at }));75
load(tab.id, tab.stack[at] ?? HOME);76
};77
const reload = () => load(tab.id, url);78
const stop = () => { clearTimeout(timers.current.get(tab.id)); update(tab.id, (t) => ({ ...t, loading: false, page: urlOf(t) })); };79
80
/* the address bar takes focus after the panel that holds it has rendered */81
const [focusTick, setFocusTick] = useState(0);82
const focusAddress = () => setFocusTick((n) => n + 1);83
useEffect(() => {84
if (!focusTick) return;85
const input = root.current?.querySelector<HTMLInputElement>("[data-slot=tabs-content]:not([hidden]) [data-slot=combobox-input]");86
input?.focus();87
input?.select();88
}, [focusTick]);89
90
/* a shortcut or Delete that removes the focused panel or tab hands focus to the window, so the91
* next shortcut still reaches it */92
const first = useRef(true);93
useEffect(() => {94
if (first.current) { first.current = false; return; }95
if (document.activeElement === document.body) root.current?.focus({ preventScroll: true });96
}, [tab.id, tabs.length]);97
98
const open = (to = HOME) => {99
const id = `t${++seq}`;100
setTabs((all) => [...all, { id, stack: [to], at: 0, loading: false, page: "" }]);101
setActive(id);102
load(id, to);103
if (to === HOME) focusAddress();104
};105
/* closing the last tab leaves a new tab page, as a window that stays open would. The Tabs have106
* already selected the neighbour (onValueChange) when they ask to close */107
const close = (id: string) => {108
const i = tabs.findIndex((t) => t.id === id);109
const gone = tabs[i];110
if (!gone) return;111
setClosed((c) => [gone, ...c]);112
const rest = tabs.filter((t) => t.id !== id);113
if (rest.length === 0) {114
const fresh = { id: `t${++seq}`, stack: [HOME], at: 0, loading: false, page: HOME };115
setTabs([fresh]);116
setActive(fresh.id);117
return;118
}119
setTabs(rest);120
if (id === active) setActive((rest[i] ?? rest[i - 1])!.id);121
};122
const reopen = (id = closed[0]?.id) => {123
const t = closed.find((c) => c.id === id);124
if (!t) return;125
setClosed((c) => c.filter((x) => x.id !== id));126
setTabs((all) => [...all, { ...t, page: "" }]);127
setActive(t.id);128
load(t.id, urlOf(t));129
};130
/* the browser's own pages open once: a second request switches to the open tab */131
const openPage = (to: string) => {132
const there = tabs.find((t) => urlOf(t) === to);133
if (there) setActive(there.id); else open(to);134
};135
136
const menu = (value: string) => {137
if (value === "new-tab") open();138
else if (value === "reopen") reopen();139
else if (value === "history") openPage(HISTORY);140
else if (value === "settings") openPage(SETTINGS);141
else if (value === "downloads") setDownloadsOpen(true);142
else if (value.startsWith("closed:")) reopen(value.slice(7));143
else if (value.startsWith("open:")) navigate(value.slice(5));144
};145
146
const shortcuts = (e: KeyboardEvent) => {147
const mod = e.ctrlKey || e.metaKey;148
const alt = e.altKey && !mod;149
const key = e.code;150
const run = (action: () => void) => { e.preventDefault(); action(); };151
if (mod && key === "KeyL") return run(focusAddress);152
if ((alt || mod) && !e.shiftKey && key === "KeyT") return run(() => open());153
if (alt && e.shiftKey && key === "KeyT") return run(() => reopen());154
if ((alt || mod) && key === "KeyW") return run(() => close(tab.id));155
if (alt && key === "KeyY") return run(() => openPage(HISTORY));156
if (alt && key === "KeyJ") return run(() => setDownloadsOpen(true));157
const digit = /^Digit[1-9]$/.test(key) ? Number(key.slice(5)) : /^[1-9]$/.test(e.key) ? Number(e.key) : 0;158
if (alt && digit) {159
const to = digit === 9 ? tabs[tabs.length - 1] : tabs[digit - 1];160
return to && run(() => setActive(to.id));161
}162
if (e.ctrlKey && key === "Tab") {163
const i = tabs.findIndex((t) => t.id === tab.id);164
return run(() => setActive(tabs[(i + (e.shiftKey ? -1 : 1) + tabs.length) % tabs.length]!.id));165
}166
};167
/* a middle click closes a tab, as in every browser */168
const auxClose = (e: MouseEvent) => {169
const trigger = (e.target as HTMLElement).closest<HTMLElement>("[data-slot=tabs-trigger]");170
if (e.button === 1 && trigger?.dataset.value) { e.preventDefault(); close(trigger.dataset.value); }171
};172
/* the Download link on the Getting started page: the toolbar's ring shows it arriving */173
const download = () => setDownloads((l) => [{ id: `dl${++seq}`, received: 0, ...CLI_DOWNLOAD }, ...l]);174
175
const site = siteOf(url);176
const bookmarked = bookmarks.some((b) => b.url === url);177
const zoom = parseInt(settings.zoom, 10) / 100;178
179
const tabInfo = tabs.map((t) => ({ id: t.id, url: urlOf(t), loading: t.loading }));180
/* the toolbar, the bookmarks bar and the page: the selected tab's panel, under the strip's line */181
const body = (182
<div className="flex h-full min-h-0 flex-col">183
<div className="flex items-center gap-0.5 px-2 py-1.5">184
<NavButtons canBack={tab.at > 0} canForward={tab.at < tab.stack.length - 1} loading={tab.loading} back={() => step(-1)} forward={() => step(1)} reload={reload} stop={stop} />185
<AddressBar186
url={url} secure={site.secure} bookmarked={bookmarked} go={navigate} suggestions={suggestionsFor(url, visits)} engine={settings.engine}187
onBookmark={(on) => setBookmarks((b) => (on ? [...b, { url, label: site.title.split(/ [·—:] /)[0]! }] : b.filter((x) => x.url !== url)))}188
/>189
<Downloads list={downloads} open={downloadsOpen} onOpenChange={setDownloadsOpen}190
onCancel={(id) => setDownloads((l) => l.filter((d) => d.id !== id))} onClear={() => setDownloads((l) => l.filter((d) => d.received < d.size))} />191
<TabSwitcher tabs={tabInfo} active={tab.id} open={switcherOpen} onOpenChange={setSwitcherOpen}192
select={(id) => { setActive(id); setSwitcherOpen(false); }} close={close} newTab={() => { setSwitcherOpen(false); open(); }} />193
<BrowserMenu closed={closed.map((t) => ({ id: t.id, url: urlOf(t) }))} bookmarks={bookmarks} bookmarksBar={settings.bookmarksBar} zoom={settings.zoom}194
onSelect={menu} onBookmarksBar={(on) => set({ bookmarksBar: on })} onZoom={(z) => set({ zoom: z })} />195
</div>196
{/* shown or hidden, the bar opens or closes its row (instant from the keyboard) */}197
<div className={`grid kbd-instant motion-size-reveal max-sm:hidden ${settings.bookmarksBar ? "grid-rows-[1fr]" : "grid-rows-[0fr]"}`}>198
<div className="min-h-0 overflow-hidden"><BookmarksBar bookmarks={bookmarks} go={navigate} /></div>199
</div>200
<div className="relative flex min-h-0 flex-1 flex-col border-t border-line">201
{tab.loading && <Progress className="absolute inset-x-0 top-0 z-1" size="sm" tone="accent" ariaLabel={`Loading ${site.title}`} />}202
<ScrollArea key={tab.page} className="min-h-0 flex-1" aria-label={siteOf(tab.page).title}>203
<div style={{ zoom }}>204
{tab.page && <Page url={tab.page} go={navigate} reload={reload} download={download} settings={settings} set={set} visits={visits} clearHistory={() => setVisits([])} />}205
</div>206
</ScrollArea>207
</div>208
</div>209
);210
211
return (212
<div ref={root} data-showcase="web-browser" tabIndex={-1} onKeyDown={shortcuts} onAuxClick={auxClose} className="flex h-full flex-col overflow-hidden bg-surface outline-none">213
<Tabs214
variant="pill"215
closable216
fill217
inHeader218
aria-label="Tabs"219
value={tab.id}220
onValueChange={setActive}221
onClose={close}222
closeLabel="Close tab"223
/* a phone shows no strip: the tab-count button in the toolbar opens the tabs as a sheet. The224
* header's 6px start inset puts the first favicon 14px from the edge, as Back and the first225
* bookmark */226
headerClass="h-9 gap-0.5 border-b border-line ps-1.5 pe-2 max-sm:hidden"227
end={228
<Tooltip content="New tab" shortcut="Alt+T">229
<Button variant="ghost" size="sm" square muted aria-label="New tab" icon={<Plus data-slot="icon" weight="bold" />} onClick={() => open()} className="shrink-0" />230
</Tooltip>231
}232
items={tabs.map((t) => ({233
value: t.id,234
label: siteOf(urlOf(t)).title,235
icon: t.loading ? <Spinner decorative /> : <Favicon url={urlOf(t)} />,236
content: t.id === tab.id ? body : null,237
}))}238
/>239
</div>240
);241
}1
/* The browser's data: the sites it can show, the bookmarks bar, the history and the downloads.2
* A page is addressed by its URL without the scheme, as the address bar shows it. */3
4
export type Site = {5
url: string;6
title: string;7
/** Favicon: two letters on a coloured square (an Avatar), or an internal page's icon. */8
mark: string;9
color: string;10
/** Served over https: the address bar shows a lock. */11
secure: boolean;12
};13
14
export const HOME = "ui://newtab";15
export const HISTORY = "ui://history";16
export const SETTINGS = "ui://settings";17
18
export const SITES: Site[] = [19
{ url: HOME, title: "New tab", mark: "", color: "", secure: true },20
{ url: HISTORY, title: "History", mark: "", color: "", secure: true },21
{ url: SETTINGS, title: "Settings", mark: "", color: "", secure: true },22
{ url: "harbor.dev/docs/getting-started", title: "Getting started · Harbor Docs", mark: "H", color: "oklch(0.55 0.17 255)", secure: true },23
{ url: "harbor.dev/docs/preview-deploys", title: "Preview deploys · Harbor Docs", mark: "H", color: "oklch(0.55 0.17 255)", secure: true },24
{ url: "harbor.dev/blog/harbor-2-4", title: "Harbor 2.4: preview deploys for every pull request", mark: "H", color: "oklch(0.55 0.17 255)", secure: true },25
{ url: "status.harbor.dev", title: "Harbor Status", mark: "S", color: "oklch(0.6 0.15 150)", secure: true },26
{ url: "fieldnotes.app/northwind/q4-planning", title: "Q4 planning — Fieldnotes", mark: "F", color: "oklch(0.62 0.16 45)", secure: true },27
{ url: "intranet.local/wiki/on-call", title: "On-call rotation · Wiki", mark: "W", color: "oklch(0.5 0.02 260)", secure: false },28
];29
30
/** A known site, a search (titled by its query), or an unknown domain (titled by its address). */31
export function siteOf(url: string): Site {32
const known = SITES.find((s) => s.url === url);33
if (known) return known;34
const search = searchQuery(url);35
const title = search ? `${search.q} — ${search.engine}` : url;36
return { url, title, mark: (search?.engine ?? url).slice(0, 1).toUpperCase(), color: "oklch(0.55 0.02 260)", secure: true };37
}38
39
export const ENGINES = [40
{ value: "duckduckgo", label: "DuckDuckGo", prefix: "duckduckgo.com/?q=" },41
{ value: "startpage", label: "Startpage", prefix: "startpage.com/search?q=" },42
{ value: "kagi", label: "Kagi", prefix: "kagi.com/search?q=" },43
];44
45
/** What the address bar does with typed text: a known page, a domain, or a search. */46
export function resolve(text: string, engine: string): string {47
const t = text.trim().replace(/^https?:\/\//, "");48
if (SITES.some((s) => s.url === t) || /^[^\s]+\.[a-z]{2,}(\/\S*)?$/i.test(t)) return t;49
const prefix = ENGINES.find((e) => e.value === engine)?.prefix ?? ENGINES[0]!.prefix;50
return prefix + encodeURIComponent(t);51
}52
53
/** The query of a search URL, or null. */54
export const searchQuery = (url: string) => {55
const engine = ENGINES.find((e) => url.startsWith(e.prefix));56
return engine ? { engine: engine.label, q: decodeURIComponent(url.slice(engine.prefix.length)) } : null;57
};58
59
export type Bookmark = { url: string; label: string };60
export const BOOKMARKS: Bookmark[] = [61
{ url: "harbor.dev/docs/getting-started", label: "Harbor Docs" },62
{ url: "status.harbor.dev", label: "Status" },63
{ url: "fieldnotes.app/northwind/q4-planning", label: "Q4 planning" },64
];65
/** The "Reading list" folder of the bookmarks bar. */66
export const READING: Bookmark[] = [67
{ url: "harbor.dev/blog/harbor-2-4", label: "Harbor 2.4 release notes" },68
{ url: "harbor.dev/docs/preview-deploys", label: "Preview deploys" },69
{ url: "intranet.local/wiki/on-call", label: "On-call rotation" },70
];71
72
export type Visit = { url: string; time: string; day: "today" | "yesterday" | "week" };73
export const VISITS: Visit[] = [74
{ url: "status.harbor.dev", time: "09:42", day: "today" },75
{ url: "harbor.dev/docs/preview-deploys", time: "09:31", day: "today" },76
{ url: "harbor.dev/docs/getting-started", time: "09:28", day: "today" },77
{ url: "fieldnotes.app/northwind/q4-planning", time: "08:55", day: "today" },78
{ url: "intranet.local/wiki/on-call", time: "17:20", day: "yesterday" },79
{ url: "harbor.dev/blog/harbor-2-4", time: "16:04", day: "yesterday" },80
{ url: "duckduckgo.com/?q=harbor%20preview%20deploys%20github%20actions", time: "15:58", day: "yesterday" },81
{ url: "fieldnotes.app/northwind/q4-planning", time: "Mon 11:12", day: "week" },82
];83
84
export type Download = { id: string; name: string; size: number; received: number; kind: "pdf" | "archive" | "file" };85
/* every seeded download has finished: nothing runs (or spins) until the user starts one */86
export const DOWNLOADS: Download[] = [87
{ id: "invoice", name: "invoice-2026-10.pdf", size: 0.2, received: 0.2, kind: "pdf" },88
{ id: "assets", name: "brand-assets-v3.zip", size: 148, received: 148, kind: "archive" },89
];90
/** What the Download link on the Getting started page fetches. */91
export const CLI_DOWNLOAD = { name: "harbor-cli-2.4.0-linux-x64.tar.gz", size: 20.3, kind: "archive" } as const;1
/* What the browser shows in its page area: a few simple sites, the new tab page, search results,2
* and the browser's own History and Settings pages. Every page is plain layout around the3
* system's components; links are real anchors that navigate inside the window. */4
import { useState, type MouseEvent, type ReactNode } from "react";5
import {6
Alert, Avatar, Button, Card, CardBody, CardDescription, CardHeader, CardTitle, CodeBlock, EmptyState,7
InputGroup, Link as UiLink, PageHeader, SegmentedControl, Select, StatusPill, Switch, Table, TableBody, TableCell, TableHead, TableHeader, TableRow, Tag,8
} from "@fndn/react";9
import { ClockCounterClockwise, DownloadSimple, Gear, MagnifyingGlass, Browsers, Trash } from "@phosphor-icons/react";10
import { BOOKMARKS, ENGINES, HISTORY, HOME, SETTINGS, SITES, searchQuery, siteOf, type Visit } from "./data";11
12
export type Settings = { bookmarksBar: boolean; askWhereToSave: boolean; zoom: string; engine: string };13
type Go = (url: string) => void;14
15
/** The page's icon: the browser's own pages get a glyph, sites a lettered mark (14px in a tab). */16
export function Favicon({ url, size = 16 }: { url: string; size?: 14 | 16 | 24 }) {17
if (url === HISTORY) return <ClockCounterClockwise data-slot="icon" weight="bold" aria-hidden />;18
if (url === SETTINGS) return <Gear data-slot="icon" weight="bold" aria-hidden />;19
if (url === HOME) return <Browsers data-slot="icon" weight="bold" aria-hidden />;20
const site = siteOf(url);21
return <Avatar shape="square" size={size} initials={site.mark} color={site.color} />;22
}23
24
/** A link that navigates inside the window. */25
function Link({ to, go, children }: { to: string; go: Go; children: ReactNode }) {26
const click = (e: MouseEvent) => {27
e.preventDefault();28
go(to);29
};30
return <UiLink href={`https://${to}`} onClick={click}>{children}</UiLink>;31
}32
33
const Prose = ({ children }: { children: ReactNode }) => (34
/* a web page keeps its own direction, whatever the browser's interface uses (an English page stays35
* left to right in a right-to-left browser): the content decides */36
<article dir="auto" className="mx-auto flex max-w-[680px] flex-col gap-4 px-6 py-10 text-md leading-relaxed text-ink-2 max-sm:px-4 max-sm:py-6">{children}</article>37
);38
const H1 = ({ children }: { children: ReactNode }) => <h1 className="text-xl font-semibold text-ink">{children}</h1>;39
40
function NewTab({ go, engine }: { go: Go; engine: string }) {41
const [q, setQ] = useState("");42
const name = ENGINES.find((e) => e.value === engine)?.label;43
return (44
<div className="mx-auto flex max-w-[560px] flex-col items-center gap-6 px-4 pt-[12vh] pb-10">45
<h1 className="text-xl font-semibold text-ink">Good morning</h1>46
<form className="w-full" onSubmit={(e) => { e.preventDefault(); if (q.trim()) go(q); }}>47
<InputGroup size="lg" aria-label={`Search with ${name}`} placeholder={`Search with ${name} or type a URL`} value={q} onChange={(e) => setQ(e.target.value)} start={<MagnifyingGlass data-slot="icon" weight="bold" />} enterKeyHint="go" />48
</form>49
{/* Chrome's shortcut tiles: the site's mark on a round field over its name (which wraps) */}50
<nav aria-label="Shortcuts" className="flex flex-wrap justify-center gap-1">51
{BOOKMARKS.map((b) => (52
<a key={b.url} href={`https://${b.url}`} onClick={(e) => { e.preventDefault(); go(b.url); }}53
className="flex w-24 flex-col items-center gap-2 rounded-card px-1 pt-3 pb-2 text-center text-xs text-ink-2 [overflow-wrap:anywhere] hover:bg-hover hover:text-ink motion-colors-fast motion-transform-press [:root:not([data-fndn-input=keyboard])_&:active]:scale-press">54
<span className="grid size-12 place-items-center rounded-full bg-field"><Favicon url={b.url} size={24} /></span>55
{b.label}56
</a>57
))}58
</nav>59
</div>60
);61
}62
63
function SearchResults({ engine, q, go }: { engine: string; q: string; go: Go }) {64
const words = q.toLowerCase().split(/\s+/).filter(Boolean);65
const hits = SITES.filter((s) => !s.url.startsWith("ui://") && words.some((w) => s.title.toLowerCase().includes(w) || s.url.includes(w)));66
return (67
<Prose>68
<p className="text-sm text-ink-2">{engine} · results for <span className="text-ink">“{q}”</span></p>69
{hits.length === 0 && <EmptyState icon="magnifying-glass" title="No results" hint="Try fewer or different words." />}70
{hits.map((s) => (71
<div key={s.url} className="flex flex-col gap-0.5">72
<span className="flex items-center gap-2 text-sm text-ink-2"><Favicon url={s.url} />{s.url}</span>73
<Link to={s.url} go={go}><span className="text-lg">{s.title}</span></Link>74
</div>75
))}76
</Prose>77
);78
}79
80
function DocsPage({ go, download }: { go: Go; download: () => void }) {81
return (82
<Prose>83
<Tag tone="blue" className="self-start">Docs</Tag>84
<H1>Getting started</H1>85
<p>Harbor deploys every push to a fresh URL. Install the CLI, link a project, and your next commit ships to a preview.</p>86
<CodeBlock variant="command" value="npm install --global @harbor/cli" />87
<p>88
No npm? <UiLink href="https://harbor.dev/download/harbor-cli-2.4.0-linux-x64.tar.gz" onClick={(e: MouseEvent) => { e.preventDefault(); download(); }}>89
<DownloadSimple data-slot="icon" weight="bold" aria-hidden className="me-1 inline align-[-2px]" />Download the CLI for Linux</UiLink> (20.3 MB).90
</p>91
<p>Then run <code className="font-mono text-sm text-ink">harbor link</code> in your repository and follow the prompts.</p>92
<Alert tone="accent" title="Preview deploys are on by default">Turn them off per branch in the project settings.</Alert>93
<p>Next: <Link to="harbor.dev/docs/preview-deploys" go={go}>Preview deploys</Link> · <Link to="status.harbor.dev" go={go}>Service status</Link></p>94
</Prose>95
);96
}97
98
const SERVICES: [string, "green" | "orange"][] = [["Deploys", "green"], ["Builds", "green"], ["Edge network", "green"], ["Logs", "orange"]];99
function StatusPage() {100
return (101
<Prose>102
<H1>Harbor Status</H1>103
<Alert tone="orange" title="Degraded: log search">Log search is slower than usual in eu-west. Deploys are not affected. Updated 09:40 UTC.</Alert>104
<Card>105
{SERVICES.map(([name, tone]) => (106
<CardBody key={name} className="flex items-center justify-between gap-4 border-b border-line-soft last:border-0">107
<span className="text-ink">{name}</span>108
<StatusPill tone={tone}>{tone === "green" ? "Operational" : "Degraded"}</StatusPill>109
</CardBody>110
))}111
</Card>112
</Prose>113
);114
}115
116
function Article({ url, go }: { url: string; go: Go }) {117
const site = siteOf(url);118
return (119
<Prose>120
<p className="text-sm text-ink-2">{url.split("/")[0]}</p>121
<H1>{site.title}</H1>122
<p>Every pull request now gets its own preview URL, posted as a comment on the pull request and torn down when it merges. Reviewers click through the change instead of reading about it.</p>123
<p>Previews share the production build cache, so most of them are live in under a minute. Read <Link to="harbor.dev/docs/preview-deploys" go={go}>the guide</Link> to set protection rules and environment variables per branch.</p>124
</Prose>125
);126
}127
128
function Unreachable({ url, reload }: { url: string; reload: () => void }) {129
return (130
<div className="mx-auto flex max-w-[480px] flex-col items-start gap-4 px-6 pt-[12vh]">131
<EmptyState size="block" icon="file" title="This site can’t be reached" hint={`${url.split("/")[0]} took too long to respond. Check the address, or try again.`} />132
<Button variant="outline" size="sm" onClick={reload}>Try again</Button>133
</div>134
);135
}136
137
const DAYS = [{ value: "all", label: "All time" }, { value: "today", label: "Today" }, { value: "yesterday", label: "Yesterday" }, { value: "week", label: "Earlier this week" }];138
function HistoryPage({ visits, go, clear }: { visits: Visit[]; go: Go; clear: () => void }) {139
const [q, setQ] = useState("");140
const [day, setDay] = useState("all");141
const shown = visits.filter((v) => (day === "all" || v.day === day) && `${siteOf(v.url).title} ${v.url}`.toLowerCase().includes(q.toLowerCase()));142
return (143
<div className="mx-auto flex max-w-[860px] flex-col gap-4 px-6 py-8 max-sm:px-4">144
<PageHeader145
title="History"146
actions={<Button size="sm" variant="secondary" icon={<Trash data-slot="icon" weight="bold" />} onClick={clear} disabled={!visits.length}>Clear browsing data</Button>}147
/>148
<div className="flex flex-wrap gap-2">149
<InputGroup className="min-w-[200px] flex-1" aria-label="Search history" placeholder="Search history" value={q} onChange={(e) => setQ(e.target.value)} start={<MagnifyingGlass data-slot="icon" weight="bold" />} />150
<Select className="w-44" aria-label="When" items={DAYS} value={day} onValueChange={(v) => setDay(v ?? "all")} />151
</div>152
{shown.length === 0 ? (153
<EmptyState size="block" icon="magnifying-glass" title={visits.length ? "No pages match" : "Your history is empty"} hint={visits.length ? "Try another word or time range." : "Pages you visit appear here."} />154
) : (155
<Table aria-label="Visited pages">156
<TableHeader>157
<TableRow><TableHead>Page</TableHead><TableHead numeric>Visited</TableHead></TableRow>158
</TableHeader>159
<TableBody>160
{shown.map((v, i) => (161
<TableRow key={`${v.url}-${i}`}>162
<TableCell>163
<span className="flex min-w-0 items-center gap-2">164
<Favicon url={v.url} />165
<Link to={v.url} go={go}>{siteOf(v.url).title}</Link>166
<span className="truncate text-ink-2 max-sm:hidden" title={v.url}>{v.url.split("/")[0]}</span>167
</span>168
</TableCell>169
<TableCell numeric className="whitespace-nowrap">{v.time}</TableCell>170
</TableRow>171
))}172
</TableBody>173
</Table>174
)}175
</div>176
);177
}178
179
/** One setting: its name and hint at the start, its control at the end (under them when narrow). */180
const Row = ({ title, hint, children }: { title: string; hint: string; children: ReactNode }) => (181
<CardBody className="flex flex-wrap items-center justify-between gap-x-6 gap-y-2 border-b border-line-soft last:border-0">182
<div className="flex min-w-[200px] flex-1 flex-col gap-0.5"><span className="text-ink">{title}</span><span className="text-sm text-ink-2">{hint}</span></div>183
{children}184
</CardBody>185
);186
187
function SettingsPage({ settings, set }: { settings: Settings; set: (patch: Partial<Settings>) => void }) {188
return (189
<div className="mx-auto flex max-w-[720px] flex-col gap-4 px-6 py-8 max-sm:px-4">190
<PageHeader title="Settings" />191
<Card>192
<CardHeader><CardTitle>Appearance</CardTitle><CardDescription>How pages look in this window.</CardDescription></CardHeader>193
<Row title="Show bookmarks bar" hint="Your bookmarks under the address bar.">194
<Switch label="Show bookmarks bar" checked={settings.bookmarksBar} onCheckedChange={(v) => set({ bookmarksBar: v })} />195
</Row>196
<Row title="Page zoom" hint="Text and images on every site.">197
<SegmentedControl size="sm" aria-label="Page zoom" options={["90%", "100%", "125%"]} value={settings.zoom} onValueChange={(v) => set({ zoom: v })} />198
</Row>199
</Card>200
<Card>201
<CardHeader><CardTitle>Search and downloads</CardTitle></CardHeader>202
<Row title="Search engine" hint="Used by the address bar.">203
<Select className="w-44" aria-label="Search engine" items={ENGINES} value={settings.engine} onValueChange={(v) => v && set({ engine: v })} />204
</Row>205
<Row title="Ask where to save each file" hint="Otherwise files go to Downloads.">206
<Switch label="Ask where to save each file" checked={settings.askWhereToSave} onCheckedChange={(v) => set({ askWhereToSave: v })} />207
</Row>208
</Card>209
</div>210
);211
}212
213
/** The page area's content for a URL. */214
export function Page(props: { url: string; go: Go; reload: () => void; download: () => void; settings: Settings; set: (patch: Partial<Settings>) => void; visits: Visit[]; clearHistory: () => void }) {215
const { url, go, settings } = props;216
const search = searchQuery(url);217
if (url === HOME) return <NewTab go={go} engine={settings.engine} />;218
if (url === HISTORY) return <HistoryPage visits={props.visits} go={go} clear={props.clearHistory} />;219
if (url === SETTINGS) return <SettingsPage settings={settings} set={props.set} />;220
if (search) return <SearchResults engine={search.engine} q={search.q} go={go} />;221
if (url === "harbor.dev/docs/getting-started") return <DocsPage go={go} download={props.download} />;222
if (url === "status.harbor.dev") return <StatusPage />;223
if (SITES.some((s) => s.url === url)) return <Article url={url} go={go} />;224
return <Unreachable url={url} reload={props.reload} />;225
}1
/* The browser's chrome under the tab strip: navigation buttons, the address bar (site information,2
* suggestions, bookmark star), downloads, the main menu, and the bookmarks bar. */3
import { useEffect, useState, type KeyboardEvent, type ReactNode } from "react";4
import {5
Button, Combobox, Drawer, Menu, Popover, Progress, ProgressRing, Separator, Toggle, Tooltip, type MenuEntry,6
} from "@fndn/react";7
import {8
ArrowClockwise, ArrowLeft, ArrowRight, BookmarkSimple, Browsers, ClockCounterClockwise, DotsThreeVertical, DownloadSimple,9
File, FilePdf, FolderOpen, Gear, Globe, Lock, MagnifyingGlass, Package, Plus, Star, Warning, X,10
} from "@phosphor-icons/react";11
import { DOWNLOADS, ENGINES, HOME, READING, SITES, resolve, searchQuery, siteOf, type Bookmark, type Download, type Visit } from "./data";12
import { Favicon } from "./pages";13
14
/** A square icon button with its name in a tooltip. */15
export function IconButton({ label, shortcut, icon, ...rest }: { label: string; shortcut?: string; icon: ReactNode; onClick?: () => void; disabled?: boolean; className?: string }) {16
return (17
<Tooltip content={label} shortcut={shortcut}>18
<Button variant="ghost" size="sm" square muted aria-label={label} icon={icon} {...rest} />19
</Tooltip>20
);21
}22
23
/** The site information button at the start of the address bar: a lock, a warning, or the browser's24
* own mark on its pages. Always there, so the address never moves when the page changes. */25
function SiteInfo({ url, secure }: { url: string; secure: boolean }) {26
const internal = url.startsWith("ui://");27
const Glyph = internal ? Browsers : secure ? Lock : Warning;28
const [label, text] = internal29
? ["This is a browser page", "Settings, history and the new tab page belong to the browser, not to a website."]30
: secure31
? ["Connection is secure", "Your information, like passwords or card numbers, is private when it is sent to this site."]32
: ["Not secure", "Don’t enter passwords or card numbers on this site: they could be read by others on the network."];33
return (34
<Popover35
title={internal ? "Browser" : url.split("/")[0]}36
placement="bottom-start"37
trigger={<Button variant="ghost" size="xs" shape="rounded" square muted aria-label="View site information" icon={<Glyph data-slot="icon" weight="bold" />} />}38
>39
<div className="flex w-[260px] max-w-full flex-col gap-2 text-sm text-ink-2">40
<span className="flex items-center gap-2 text-ink"><Glyph data-slot="icon" weight="bold" />{label}</span>41
<p>{text}</p>42
</div>43
</Popover>44
);45
}46
47
/** The suggestions for what was typed, Chrome's order: pages whose address starts with it (Enter48
* goes there), then a search for it, then pages that merely contain it (in the address or the49
* title). With nothing typed, every page. Each row leads with what it is (the site's favicon, a50
* globe for an address not visited yet, a magnifier for the search), and the typed part of the51
* address stays in ink while the rest dims (highlightMatch). */52
function suggestionItems(typed: string, pages: string[], engine: string) {53
const row = (u: string) => {54
const title = siteOf(u).title;55
return { value: u, label: u, icon: <Favicon url={u} size={14} />, meta: title === u ? undefined : title, keywords: [title] };56
};57
const q = typed.trim();58
if (!q) return pages.map(row);59
const lower = q.toLowerCase();60
const prefix = pages.filter((u) => u.toLowerCase().startsWith(lower));61
const typedUrl = resolve(q, engine);62
const domain = !searchQuery(typedUrl) && !pages.includes(typedUrl) ? [{ value: typedUrl, label: typedUrl, icon: <Globe data-slot="icon" weight="bold" />, keywords: [q] }] : [];63
const name = ENGINES.find((e) => e.value === engine)?.label ?? ENGINES[0]!.label;64
const search = { value: `search:${q}`, label: `Search ${name} for “${q}”`, icon: <MagnifyingGlass data-slot="icon" weight="bold" />, keywords: [q] };65
return [...prefix.map(row), ...domain, search, ...pages.filter((u) => !prefix.includes(u)).map(row)];66
}67
68
export function AddressBar({ url, secure, bookmarked, onBookmark, suggestions, go, engine }: {69
url: string; secure: boolean; bookmarked: boolean; onBookmark: (on: boolean) => void; suggestions: string[]; go: (text: string) => void; engine: string;70
}) {71
/* what the user typed (not the label a selection writes into the field) */72
const [typed, setTyped] = useState("");73
const items = suggestionItems(typed, suggestions, engine);74
const choose = (v: string | null) => {75
setTyped("");76
if (!v) return;77
const prefix = ENGINES.find((e) => e.value === engine)?.prefix ?? ENGINES[0]!.prefix;78
go(v.startsWith("search:") ? prefix + encodeURIComponent(v.slice(7)) : v);79
};80
/* Enter with no row highlighted (the list closed): go to the text, or search for it */81
const enter = (e: KeyboardEvent) => {82
const input = e.target as HTMLInputElement;83
if (e.key !== "Enter" || input.tagName !== "INPUT" || !input.value.trim()) return;84
if (!document.querySelector("[data-slot=combobox-content][data-state=open] [data-slot=combobox-item][data-highlighted]")) { setTyped(""); go(input.value); }85
};86
const internal = url.startsWith("ui://");87
return (88
<div className="flex min-w-0 flex-1" onKeyDown={enter} onInput={(e) => setTyped((e.target as HTMLInputElement).value)}>89
<Combobox90
className="min-w-0 flex-1"91
size="sm"92
variant="subtle"93
caret={false}94
highlightMatch95
aria-label="Address and search bar"96
placeholder="Search or type a URL"97
items={items}98
value={url === HOME ? null : url}99
onValueChange={choose}100
onOpenChange={(open) => { if (!open) setTyped(""); }}101
start={url === HOME102
? <span className="grid size-6 place-items-center"><MagnifyingGlass data-slot="icon" weight="bold" aria-hidden /></span>103
: <SiteInfo url={url} secure={secure} />}104
end={!internal && (105
<Toggle variant="ghost" size="xs" shape="rounded" square muted tooltip={bookmarked ? "Remove bookmark" : "Bookmark this tab"}106
pressed={bookmarked} onPressedChange={onBookmark} icon={<Star data-slot="icon" weight={bookmarked ? "fill" : "bold"} />} />107
)}108
/>109
</div>110
);111
}112
113
const ICON = { pdf: FilePdf, archive: Package, file: File };114
const mb = (n: number) => (n < 1 ? `${Math.round(n * 1000)} KB` : `${n.toFixed(1)} MB`);115
116
/** Downloads keep receiving while the window is open: STEP megabytes every half second. */117
const STEP = 0.5;118
export function useDownloads() {119
const [list, setList] = useState<Download[]>(DOWNLOADS);120
const active = list.some((d) => d.received < d.size);121
useEffect(() => {122
if (!active) return;123
const timer = setInterval(() => setList((all) => all.map((d) => (d.received < d.size ? { ...d, received: Math.min(d.size, d.received + STEP) } : d))), 500);124
return () => clearInterval(timer);125
}, [active]);126
return [list, setList] as const;127
}128
129
export function Downloads({ list, onCancel, onClear, open, onOpenChange }: {130
list: Download[]; onCancel: (id: string) => void; onClear: () => void; open: boolean; onOpenChange: (open: boolean) => void;131
}) {132
const running = list.find((d) => d.received < d.size);133
const icon = running134
? <ProgressRing size="sm" tone="accent" progress={running.received / running.size} label={`Downloading ${running.name}`}><DownloadSimple data-slot="icon" weight="bold" /></ProgressRing>135
: <DownloadSimple data-slot="icon" weight="bold" />;136
return (137
<Popover138
open={open}139
onOpenChange={onOpenChange}140
title="Downloads"141
placement="bottom-end"142
trigger={<Tooltip content="Downloads"><Button variant="ghost" size="sm" square muted aria-label="Downloads" icon={icon} /></Tooltip>}143
>144
<div className="flex w-[300px] max-w-full flex-col gap-3">145
{list.length === 0 && <p className="text-sm text-ink-2">Files you download appear here.</p>}146
{list.map((d) => {147
const Glyph = ICON[d.kind];148
const done = d.received >= d.size;149
return (150
<div key={d.id} className="flex items-start gap-3">151
<Glyph className="mt-0.5 size-5 shrink-0 text-ink-3" weight="bold" aria-hidden />152
<div className="flex min-w-0 flex-1 flex-col gap-1">153
<span className="text-sm text-ink [overflow-wrap:anywhere]">{d.name}</span>154
{!done && <Progress size="sm" tone="accent" value={d.received} max={d.size} ariaLabel={`Downloading ${d.name}`} />}155
<span className="text-xs text-ink-2 tabular-nums">156
{done ? `${mb(d.size)} · Done` : `${mb(d.received)} of ${mb(d.size)} · ${Math.ceil(((d.size - d.received) / STEP) * 0.5)} s left`}157
</span>158
</div>159
{done160
? <IconButton label="Show in folder" icon={<FolderOpen data-slot="icon" weight="bold" />} />161
: <IconButton label="Cancel download" icon={<X data-slot="icon" weight="bold" />} onClick={() => onCancel(d.id)} />}162
</div>163
);164
})}165
{list.length > 0 && <Button size="sm" variant="outline" className="self-start" onClick={onClear}>Clear list</Button>}166
</div>167
</Popover>168
);169
}170
171
export function BrowserMenu({ closed, bookmarks, bookmarksBar, zoom, onSelect, onBookmarksBar, onZoom }: {172
closed: { id: string; url: string }[]; bookmarks: Bookmark[]; bookmarksBar: boolean; zoom: string;173
onSelect: (value: string) => void; onBookmarksBar: (on: boolean) => void; onZoom: (zoom: string) => void;174
}) {175
const items: MenuEntry[] = [176
{ value: "new-tab", label: "New tab", meta: "Alt+T", icon: <Plus data-slot="icon" weight="bold" /> },177
{ value: "reopen", label: "Reopen closed tab", meta: "Alt+Shift+T", disabled: closed.length === 0 },178
{ type: "separator" },179
{180
type: "submenu", label: "History", icon: <ClockCounterClockwise data-slot="icon" weight="bold" />, items: [181
{ value: "history", label: "Show full history", meta: "Alt+Y" },182
{ type: "separator" },183
{184
type: "group", label: "Recently closed",185
items: closed.length ? closed.slice(0, 5).map((t) => ({ value: `closed:${t.id}`, label: siteOf(t.url).title })) : [{ value: "none", label: "No closed tabs", disabled: true }],186
},187
],188
},189
{ value: "downloads", label: "Downloads", meta: "Alt+J", icon: <DownloadSimple data-slot="icon" weight="bold" /> },190
{191
type: "submenu", label: "Bookmarks", icon: <BookmarkSimple data-slot="icon" weight="bold" />, items: [192
{ type: "checkbox", value: "bookmarks-bar", label: "Show bookmarks bar", checked: bookmarksBar },193
{ type: "separator" },194
...bookmarks.map((b) => ({ value: `open:${b.url}`, label: b.label })),195
],196
},197
{ type: "separator" },198
{ type: "radio-group", name: "zoom", label: "Zoom", value: zoom, items: ["90%", "100%", "125%"].map((v) => ({ value: v, label: v })) },199
{ type: "separator" },200
{ value: "settings", label: "Settings", icon: <Gear data-slot="icon" weight="bold" /> },201
];202
return (203
<Menu items={items} placement="bottom-end" onSelect={onSelect} onCheckedChange={(_, on) => onBookmarksBar(on)} onRadioChange={(_, v) => onZoom(v)}>204
<Tooltip content="Customize and control">205
<Button variant="ghost" size="sm" square muted aria-label="Main menu" icon={<DotsThreeVertical data-slot="icon" weight="bold" />} />206
</Tooltip>207
</Menu>208
);209
}210
211
/** The bookmarks under the address bar, and the Reading list folder. The row keeps 4px above and212
* 6px below the buttons: it scrolls sideways (and sits in a clipped reveal), so the focus ring213
* (2px at a 2px offset) must fit inside it. The folder's glyph takes a favicon's 16px box, so every214
* bookmark's label starts the same way. */215
export function BookmarksBar({ bookmarks, go }: { bookmarks: Bookmark[]; go: (url: string) => void }) {216
return (217
<nav aria-label="Bookmarks" className="flex min-w-0 items-center gap-0.5 overflow-x-auto overscroll-x-contain px-2 pt-1 pb-1.5 [scrollbar-width:none]">218
{bookmarks.map((b) => (219
<Button key={b.url} variant="ghost" size="xs" icon={<Favicon url={b.url} />} onClick={() => go(b.url)} className="shrink-0">{b.label}</Button>220
))}221
<Separator orientation="vertical" decorative className="mx-1 h-4 self-center" />222
<Menu items={READING.map((b) => ({ value: b.url, label: b.label }))} onSelect={go}>223
<Button variant="ghost" size="xs" className="shrink-0" icon={<span className="grid size-4 place-items-center"><FolderOpen className="size-4" weight="bold" aria-hidden /></span>}>Reading list</Button>224
</Menu>225
</nav>226
);227
}228
229
export function NavButtons({ canBack, canForward, loading, back, forward, reload, stop }: {230
canBack: boolean; canForward: boolean; loading: boolean; back: () => void; forward: () => void; reload: () => void; stop: () => void;231
}) {232
return (233
<>234
<IconButton label="Back" icon={<ArrowLeft data-slot="icon" weight="bold" />} onClick={back} disabled={!canBack} />235
<IconButton label="Forward" icon={<ArrowRight data-slot="icon" weight="bold" />} onClick={forward} disabled={!canForward} className="max-sm:hidden" />236
{loading237
? <IconButton label="Stop loading" icon={<X data-slot="icon" weight="bold" />} onClick={stop} />238
: <IconButton label="Reload" icon={<ArrowClockwise data-slot="icon" weight="bold" />} onClick={reload} />}239
</>240
);241
}242
243
/** Every page the address bar can suggest: the sites, the history, and the current page. */244
export const suggestionsFor = (url: string, visits: Visit[]) =>245
[...new Set([...(url === HOME ? [] : [url]), ...SITES.filter((s) => !s.url.startsWith("ui://")).map((s) => s.url), ...visits.map((v) => v.url)])];246
247
/** On a phone: the tab-count button beside the address bar, and the open tabs as a sheet of cards248
* (Chrome and Safari on a phone show no tab strip). A card selects its tab; its × closes it. */249
export function TabSwitcher({ tabs, active, open, onOpenChange, select, close, newTab }: {250
tabs: { id: string; url: string; loading: boolean }[]; active: string; open: boolean; onOpenChange: (open: boolean) => void;251
select: (id: string) => void; close: (id: string) => void; newTab: () => void;252
}) {253
const count = tabs.length;254
const label = `${count} open ${count === 1 ? "tab" : "tabs"}`;255
return (256
<Drawer257
className="sm:hidden"258
open={open}259
onOpenChange={onOpenChange}260
title={label}261
footer={<Button size="sm" variant="primary" icon={<Plus data-slot="icon" weight="bold" />} onClick={newTab}>New tab</Button>}262
trigger={263
<Button variant="ghost" size="sm" square muted aria-label={`${label}, switch tabs`}264
icon={<span aria-hidden className="grid size-4 place-items-center rounded-[4px] border-[1.5px] border-current text-[10px] font-semibold leading-none tabular-nums">{count > 99 ? ":D" /* as Chrome does */ : count}</span>} />265
}266
>267
<ul className="grid grid-cols-2 gap-3 pb-1" aria-label="Open tabs">268
{tabs.map((t) => {269
const site = siteOf(t.url);270
const current = t.id === active;271
return (272
<li key={t.id} className={`relative flex min-w-0 flex-col overflow-hidden rounded-card bg-surface shadow-card ${current ? "outline-2 outline-accent" : ""}`}>273
<div className="flex min-w-0 items-center gap-1.5 py-1 ps-2 pe-1">274
<span className="grid size-4 shrink-0 place-items-center text-ink-2"><Favicon url={t.url} size={14} /></span>275
<button type="button" onClick={() => select(t.id)} aria-current={current ? "page" : undefined}276
className="min-w-0 flex-1 truncate text-start text-xs text-ink after:absolute after:inset-0 after:content-['']" title={site.title}>277
{site.title}278
</button>279
<Button variant="ghost" size="xs" shape="rounded" square muted aria-label={`Close ${site.title}`} className="relative z-1" icon={<X data-slot="icon" weight="bold" />} onClick={() => close(t.id)} />280
</div>281
<span className="truncate border-t border-line-soft bg-inset px-2 pt-2 pb-6 text-xs text-ink-2" title={t.url}>{t.url.split("/")[0]}</span>282
</li>283
);284
})}285
</ul>286
</Drawer>287
);288
}