diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index daab196..1ed6173 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -27,6 +27,7 @@ packages/ core/ - @chatcops/core (AI providers, tools, knowledge base) widget/ - @chatcops/widget (embeddable chat UI) server/ - @chatcops/server (server handler + adapters) +website/ - Marketing site + Starlight docs (Astro) ``` ## Development Workflow @@ -71,6 +72,26 @@ ANTHROPIC_API_KEY=sk-... npx tsx src/examples/express-server.ts 3. Register in `packages/core/src/i18n/index.ts` 4. Add to the test in `tests/i18n/locales.test.ts` +## Website Development + +```bash +cd website +pnpm dev +``` + +The website requires a `.env.local` file with: + +```bash +# Required — powers the live chat demo on the landing page +OPENAI_API_KEY=sk-... + +# Optional — visitor counter (Upstash Redis) +UPSTASH_REDIS_REST_URL=https://your-endpoint.upstash.io +UPSTASH_REDIS_REST_TOKEN=your-token-here +``` + +The visitor counter gracefully degrades without Upstash credentials (displays `-`). Google Analytics (`G-GLYL9J6QYX`) is hardcoded in the layout and Starlight config. + ## Commit Convention Use conventional commits: `feat:`, `fix:`, `chore:`, `docs:`, `test:`, `refactor:` diff --git a/packages/widget/src/dom/panel.ts b/packages/widget/src/dom/panel.ts index 749a2e6..fbd83fe 100644 --- a/packages/widget/src/dom/panel.ts +++ b/packages/widget/src/dom/panel.ts @@ -20,10 +20,12 @@ export interface PanelOptions { export class Panel { private el: HTMLDivElement; + private inline: boolean; messages: Messages; input: Input; constructor(root: ShadowRoot, options: PanelOptions) { + this.inline = options.inline ?? false; this.el = document.createElement('div'); this.el.className = 'cc-panel'; if (options.inline) { @@ -86,7 +88,9 @@ export class Panel { show(): void { this.el.classList.add('cc-visible'); - this.input.focus(); + if (!this.inline) { + this.input.focus(); + } } hide(): void { diff --git a/website/astro.config.mjs b/website/astro.config.mjs index b73eb01..2b82d17 100644 --- a/website/astro.config.mjs +++ b/website/astro.config.mjs @@ -7,7 +7,7 @@ import vercel from '@astrojs/vercel'; export default defineConfig({ output: 'static', adapter: vercel(), - site: 'https://chatcops.codercops.com', + site: 'https://chat.codercops.com', vite: { plugins: [tailwindcss()], }, @@ -23,6 +23,17 @@ export default defineConfig({ { icon: 'github', label: 'GitHub', href: 'https://github.com/codercops/chatcops' }, ], head: [ + { + tag: 'script', + attrs: { + src: 'https://www.googletagmanager.com/gtag/js?id=G-GLYL9J6QYX', + async: true, + }, + }, + { + tag: 'script', + content: `window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());gtag('config', 'G-GLYL9J6QYX');`, + }, { tag: 'script', attrs: { diff --git a/website/src/components/landing/Footer.astro b/website/src/components/landing/Footer.astro index 0f05792..edb65f7 100644 --- a/website/src/components/landing/Footer.astro +++ b/website/src/components/landing/Footer.astro @@ -60,7 +60,51 @@ const year = new Date().getFullYear(); Built by CODERCOPS +