diff --git a/.tmp/proof/issue-137-github-templates.png b/.tmp/proof/issue-137-github-templates.png new file mode 100644 index 0000000..cc894a7 Binary files /dev/null and b/.tmp/proof/issue-137-github-templates.png differ diff --git a/.tmp/proof/issue-137-template-previews.png b/.tmp/proof/issue-137-template-previews.png new file mode 100644 index 0000000..1980a03 Binary files /dev/null and b/.tmp/proof/issue-137-template-previews.png differ diff --git a/packages/app/src/components/showcase/ShowcaseCard.test.tsx b/packages/app/src/components/showcase/ShowcaseCard.test.tsx index ea85477..556d213 100644 --- a/packages/app/src/components/showcase/ShowcaseCard.test.tsx +++ b/packages/app/src/components/showcase/ShowcaseCard.test.tsx @@ -10,7 +10,7 @@ const baseItem: ShowcaseItem = { 'Scaffold a Model Context Protocol server that AI assistants connect to for domain-specific tools and context.', category: 'templates', link: templateShowcaseLink('mcp-server'), - linkLabel: 'Use template', + linkLabel: 'Preview template', tags: ['recommended', 'ai', 'mcp', 'github'], isRecommended: true, }; @@ -50,7 +50,7 @@ describe('ShowcaseCard', () => { it('links the action button to the item link with its label', async () => { await renderInTestApp(); - const link = screen.getByRole('link', { name: 'Use template' }); + const link = screen.getByRole('link', { name: 'Preview template' }); expect(link).toHaveAttribute( 'href', '/self-service/templates/default/mcp-server', diff --git a/packages/app/src/components/showcase/ShowcasePage.test.tsx b/packages/app/src/components/showcase/ShowcasePage.test.tsx index ad149f6..7765f0a 100644 --- a/packages/app/src/components/showcase/ShowcasePage.test.tsx +++ b/packages/app/src/components/showcase/ShowcasePage.test.tsx @@ -4,6 +4,30 @@ import { ShowcasePage } from './ShowcasePage'; import { showcaseItems, countByCategory } from './showcaseConfig'; describe('ShowcasePage', () => { + it('explains guest preview access before linking to templates', async () => { + await renderInTestApp(); + + expect(screen.getByText(/Guest access is read-only/)).toHaveTextContent( + 'You can preview template forms and steps. Running a template to create a repository or pull request requires developer permissions.', + ); + const templateLinks = screen.getAllByRole('link', { + name: 'Preview template', + }); + expect(templateLinks).toHaveLength(8); + templateLinks.forEach(link => { + expect(link).toHaveAttribute( + 'href', + expect.stringMatching(/^\/self-service\/templates\/default\//), + ); + }); + expect( + screen.getByRole('link', { name: 'Browse templates' }), + ).toHaveAttribute('href', '/self-service'); + expect( + screen.queryByRole('link', { name: /Use template|Create component/ }), + ).not.toBeInTheDocument(); + }); + it('labels search and exposes the active category and result count', async () => { await renderInTestApp(); @@ -69,9 +93,9 @@ describe('ShowcasePage', () => { fireEvent.click(screen.getByText(/^Answer Engine \(/)); - expect(screen.getByRole('alert')).toHaveTextContent( - 'The demo does not generate answers.', - ); + expect( + screen.getByText(/The demo does not generate answers/), + ).toHaveTextContent('The demo does not generate answers.'); const search = within( screen.getByTestId('showcase-card-answer-engine-search'), ); @@ -89,7 +113,7 @@ describe('ShowcasePage', () => { extension.getByText(/your own document index and AI Hub/), ).toBeInTheDocument(); expect( - extension.getByRole('link', { name: 'Use template' }), + extension.getByRole('link', { name: 'Preview template' }), ).toHaveAttribute( 'href', '/self-service/templates/default/answer-engine-worker', diff --git a/packages/app/src/components/showcase/ShowcasePage.tsx b/packages/app/src/components/showcase/ShowcasePage.tsx index 6451a65..7fd1c45 100644 --- a/packages/app/src/components/showcase/ShowcasePage.tsx +++ b/packages/app/src/components/showcase/ShowcasePage.tsx @@ -50,12 +50,18 @@ export const ShowcasePage = () => { What this portal can do - Start a new service from a proven template, publish it to GitHub, - and make it findable through the catalog and docs search. Pick a - card to explore a portal feature or preview a software template. + Explore how templates, GitHub integration and catalog search fit + together. Pick a card to try a portal feature or preview a software + template. + + Guest access is read-only. You can preview template forms and steps. + Running a template to create a repository or pull request requires + developer permissions. + + Catalog and TechDocs keyword search runs in this portal. Generated answers are an extension you can build with the Answer Engine Worker diff --git a/packages/app/src/components/showcase/showcaseConfig.ts b/packages/app/src/components/showcase/showcaseConfig.ts index 0722c70..dfb6108 100644 --- a/packages/app/src/components/showcase/showcaseConfig.ts +++ b/packages/app/src/components/showcase/showcaseConfig.ts @@ -42,7 +42,7 @@ export const showcaseItems: ShowcaseItem[] = [ 'Scaffold a provider-agnostic gateway in front of your organisation LLM providers, with auth, rate limiting, cost tracking and audit logging.', category: 'templates', link: templateShowcaseLink('ai-hub-service'), - linkLabel: 'Use template', + linkLabel: 'Preview template', tags: ['recommended', 'ai', 'llm', 'github'], isRecommended: true, }, @@ -53,7 +53,7 @@ export const showcaseItems: ShowcaseItem[] = [ 'Scaffold a queue consumer that retrieves context from a document index and produces cited answers, with an indexer and query API.', category: 'templates', link: templateShowcaseLink('answer-engine-worker'), - linkLabel: 'Use template', + linkLabel: 'Preview template', tags: ['recommended', 'ai', 'rag', 'github'], isRecommended: true, }, @@ -64,7 +64,7 @@ export const showcaseItems: ShowcaseItem[] = [ 'Scaffold a Model Context Protocol server that AI assistants connect to for domain-specific tools and context.', category: 'templates', link: templateShowcaseLink('mcp-server'), - linkLabel: 'Use template', + linkLabel: 'Preview template', tags: ['recommended', 'ai', 'mcp', 'github'], isRecommended: true, }, @@ -75,7 +75,7 @@ export const showcaseItems: ShowcaseItem[] = [ 'Create a new blank repository in GitHub from a local skeleton and register it in the catalog.', category: 'templates', link: templateShowcaseLink('github-blank-repo'), - linkLabel: 'Use template', + linkLabel: 'Preview template', tags: ['recommended', 'github', 'repo'], isRecommended: true, }, @@ -86,7 +86,7 @@ export const showcaseItems: ShowcaseItem[] = [ 'Create a documentation site in a GitHub repository and open it as a pull request for review.', category: 'templates', link: templateShowcaseLink('github-pull-request-docs'), - linkLabel: 'Use template', + linkLabel: 'Preview template', tags: ['recommended', 'github', 'techdocs'], isRecommended: true, }, @@ -97,7 +97,7 @@ export const showcaseItems: ShowcaseItem[] = [ 'Create a new blank repository in GitLab from a local skeleton and register it in the catalog.', category: 'templates', link: templateShowcaseLink('docs-blank-repo'), - linkLabel: 'Use template', + linkLabel: 'Preview template', tags: ['recommended', 'gitlab', 'repo'], isRecommended: true, }, @@ -108,7 +108,7 @@ export const showcaseItems: ShowcaseItem[] = [ 'Create a documentation site in a GitLab repository and open it as a merge request for review.', category: 'templates', link: templateShowcaseLink('docs-template-gitlab-merge-request'), - linkLabel: 'Use template', + linkLabel: 'Preview template', tags: ['recommended', 'gitlab', 'techdocs'], isRecommended: true, }, @@ -129,7 +129,7 @@ export const showcaseItems: ShowcaseItem[] = [ 'Publish new repositories and pull requests from templates with the GitHub scaffolder actions.', category: 'github', link: '/self-service', - linkLabel: 'Create component', + linkLabel: 'Browse templates', tags: ['github', 'scaffolder', 'automation'], }, { @@ -161,7 +161,7 @@ export const showcaseItems: ShowcaseItem[] = [ 'Scaffold an answer engine worker to connect to your own document index and AI Hub for cited answers.', category: 'answer-engine', link: templateShowcaseLink('answer-engine-worker'), - linkLabel: 'Use template', + linkLabel: 'Preview template', tags: ['ai', 'rag', 'template'], isRecommended: true, availability: 'Extension template',