mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-07-18 09:48:09 +00:00
## Summary Two changes to the comfy.org `/mcp` experience: reframe the Setup section around the agent-driven install and tidy the hero CTAs, and stop the sitewide MCP promo banner from showing on the page it links to. ## Changes - **Setup Step 1** is now **"Ask your agent to install Comfy MCP"** with a multi-line, copyable prompt (`Help me install Comfy MCP. / Follow the setup guide at https://docs.comfy.org/agent-tools/cloud`). `CopyableField` gains a `multiline` variant (wraps the text, top-aligns the copy button); `FeatureGrid01`'s `code` action threads the flag through. - **Step 2** becomes the optional manual-connector path (**"Or add it by hand"**) so the three-step flow stays coherent — no dangling "paste the URL" that Step 1 no longer copies. - **Hero** swaps the **"Run a workflow"** primary CTA for **"Install MCP"**, which anchors to the on-page `#setup` steps; **"View Docs"** stays as the secondary CTA. - **Announcement banner** no longer advertises the page you're already on. `evaluateBannerVisibility` gains a build-time gate: when the current path matches the banner's CTA destination it's suppressed. Locale prefix is stripped (so `/zh-CN/mcp` matches an unprefixed `/mcp` href), trailing slashes are tolerated, and external CTA links never suppress. Result: the MCP banner shows everywhere except `/mcp` and `/zh-CN/mcp`. - New i18n keys (`mcp.setup.step1.command`, `mcp.hero.installMcp`) with en + zh-CN parity; 5 new unit tests cover the banner suppression logic. - **Breaking**: none. ## Review Focus - @deepme987 @bertfy — copy + flow check. The Step 1 prompt is a paraphrase of the `agent-tools/cloud` install guide. The raw `cloud.comfy.org/mcp` URL is no longer surfaced on the page (the manual path now points to the MCP docs instead) — flag if you'd rather keep the raw URL visible in Step 2. - Banner suppression keys off the CTA's `link.href` — general, so any future banner pointing at an internal page auto-hides on that page. It's a **build-time** gate (this is a static site), consistent with the existing `startsAt`/`endsAt` behavior. - Only the **hero** CTA changed. The "How it works" section deliberately keeps its "Run a workflow" CTA. - zh-CN strings are machine-drafted; a native check would be welcome. ## Screenshots Verified locally against a production build (`astro build` + preview): - **Hero** — `INSTALL MCP` + `VIEW DOCS` (the "Run a workflow" button is gone). "Install MCP" scrolls to `#setup`. - **Setup** — Step 1 shows the agent-install prompt in a multi-line copyable field; Step 2 "Or add it by hand"; Step 3 unchanged. - **Banner** — present on `/`, `/download`, `/cloud`; absent on `/mcp` and `/zh-CN/mcp`. A Vercel preview deploy attaches automatically for a live view. --------- Co-authored-by: imick-io <153135517+imick-io@users.noreply.github.com>
32 lines
829 B
TypeScript
32 lines
829 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
|
|
import { isHrefActive } from './useCurrentPath'
|
|
|
|
describe('isHrefActive', () => {
|
|
it('matches the current page', () => {
|
|
expect(isHrefActive('/mcp', '/mcp')).toBe(true)
|
|
})
|
|
|
|
it('does not match other pages', () => {
|
|
expect(isHrefActive('/mcp', '/pricing')).toBe(false)
|
|
})
|
|
|
|
it('matches regardless of a trailing slash', () => {
|
|
expect(isHrefActive('/mcp', '/mcp/')).toBe(true)
|
|
})
|
|
|
|
it('ignores query and hash on the href', () => {
|
|
expect(isHrefActive('/mcp?ref=banner#setup', '/mcp')).toBe(true)
|
|
})
|
|
|
|
it('never matches an external href', () => {
|
|
expect(
|
|
isHrefActive('https://docs.comfy.org/agent-tools/cloud', '/mcp')
|
|
).toBe(false)
|
|
})
|
|
|
|
it('never matches an empty href', () => {
|
|
expect(isHrefActive('', '/mcp')).toBe(false)
|
|
})
|
|
})
|