Skip to content

Commit 7066c26

Browse files
authored
Improve Help Center UX & AI responses (#4)
* step 2 * replace browser confirm modal with custom one * improve help center UX * Update ai message interpretation
1 parent 5cab41d commit 7066c26

37 files changed

Lines changed: 4346 additions & 855 deletions

File tree

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import * as path from "node:path";
2+
import { test, expect } from "./fixtures";
3+
import {
4+
ensureAuthenticatedInPage,
5+
gotoWithAuthRecovery,
6+
refreshAuthState,
7+
} from "./helpers/auth-refresh";
8+
9+
test.describe("Help Center Markdown Import", () => {
10+
test.describe.configure({ timeout: 120000 });
11+
12+
test.beforeEach(async ({ page }) => {
13+
await refreshAuthState();
14+
const ok = await ensureAuthenticatedInPage(page);
15+
if (!ok) {
16+
test.skip(true, "[help-center-import.spec] Could not authenticate test page");
17+
}
18+
});
19+
20+
test("imports docs folder and shows articles in help center", async ({ page }) => {
21+
await gotoWithAuthRecovery(page, "/articles");
22+
await expect(page.getByRole("heading", { name: /^articles$/i })).toBeVisible({
23+
timeout: 10000,
24+
});
25+
26+
const docsFolderPath = path.resolve(process.cwd(), "docs");
27+
await page.getByTestId("markdown-import-folder-input").setInputFiles(docsFolderPath);
28+
await expect(page.getByTestId("markdown-import-selection-count")).toBeVisible({
29+
timeout: 10000,
30+
});
31+
32+
await page.getByTestId("markdown-import-preview-button").click();
33+
await expect(page.getByText(/Preview ready\./i)).toBeVisible({ timeout: 45000 });
34+
35+
await page.getByTestId("markdown-import-sync-button").click();
36+
await expect(page.getByText(/Synced \d+ markdown files\./i)).toBeVisible({ timeout: 45000 });
37+
38+
const downloadPromise = page.waitForEvent("download");
39+
await page.getByTestId("markdown-export-button").click();
40+
const download = await downloadPromise;
41+
expect(download.suggestedFilename()).toMatch(/help-center-markdown.*\.zip/i);
42+
43+
await gotoWithAuthRecovery(page, "/help");
44+
await expect(page.getByRole("heading", { name: /help center/i })).toBeVisible({
45+
timeout: 10000,
46+
});
47+
48+
const importedArticleLink = page.getByRole("link", { name: /Architecture Overview/i }).first();
49+
await expect(importedArticleLink).toBeVisible({ timeout: 20000 });
50+
const articleHref = await importedArticleLink.getAttribute("href");
51+
expect(articleHref).toBeTruthy();
52+
await gotoWithAuthRecovery(page, articleHref!);
53+
await expect(page.getByRole("heading", { name: /Architecture Overview/i })).toBeVisible({
54+
timeout: 10000,
55+
});
56+
await expect(page.getByText(/high-level architecture/i)).toBeVisible({ timeout: 10000 });
57+
});
58+
});

apps/web/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"@opencom/ui": "workspace:*",
2020
"convex": "^1.31.7",
2121
"dompurify": "^3.3.1",
22+
"fflate": "^0.8.2",
2223
"lucide-react": "^0.469.0",
2324
"next": "^15.5.10",
2425
"react": "^19.2.3",

apps/web/src/app/articles/collections/page.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { useState } from "react";
44
import { useQuery, useMutation } from "convex/react";
55
import { api } from "@opencom/convex";
6+
import { appConfirm } from "@/lib/appConfirm";
67
import { useAuth } from "@/contexts/AuthContext";
78
import { Button, Input } from "@opencom/ui";
89
import { ArrowLeft, Plus, Pencil, Trash2, FolderOpen } from "lucide-react";
@@ -82,7 +83,7 @@ export default function CollectionsPage() {
8283
};
8384

8485
const handleDelete = async (id: Id<"collections">) => {
85-
if (confirm("Are you sure you want to delete this collection?")) {
86+
if (await appConfirm("Are you sure you want to delete this collection?")) {
8687
try {
8788
await deleteCollection({ id });
8889
} catch (error) {

0 commit comments

Comments
 (0)