Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

Keep the Help popover footer inside the popover (PRD-9100) (#5926)

Andrew Mikofalvy8c0db52a2134
diff --git a/.changeset/help-popover-footer-fits.md b/.changeset/help-popover-footer-fits.md
new file mode 100644
index 000000000..6db3fdf45
--- /dev/null
+++ b/.changeset/help-popover-footer-fits.md
@@ -0,0 +1,5 @@
+---
+"@inkeep/open-knowledge": patch
+---
+
+The Help menu footer no longer cuts off "About & updates" or scrolls sideways when the version number is long.
diff --git a/knip.config.ts b/knip.config.ts
index d3638888e..65f0e8807 100644
--- a/knip.config.ts
+++ b/knip.config.ts
@@ -147,15 +147,11 @@ export default {
'packages/server': {
entry: ['src/**/*.test.ts', 'src/parse-worker.ts'],
project: 'src/**',
- ignoreDependencies: [
- '@types/shell-quote',
- ],
+ ignoreDependencies: ['@types/shell-quote'],
},
'packages/cli': {
entry: ['src/**/*.test.ts', 'scripts/*.ts', 'tests/**/*.ts', 'src/parse-worker.ts'],
- ignoreDependencies: [
- 'yjs',
- ],
+ ignoreDependencies: ['yjs'],
},
'packages/desktop': {
entry: [
diff --git a/packages/app/src/components/HelpPopover.browser.test.tsx b/packages/app/src/components/HelpPopover.browser.test.tsx
new file mode 100644
index 000000000..265f0d50a
--- /dev/null
+++ b/packages/app/src/components/HelpPopover.browser.test.tsx
@@ -0,0 +1,94 @@
+import { FALLBACK_LOCALE } from '@inkeep/open-knowledge-core/i18n/resolve-locale';
+import type { Messages } from '@lingui/core';
+import { act, screen } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+import { afterEach, describe, expect, test, vi } from 'vitest';
+import { TooltipProvider } from '@/components/ui/tooltip';
+import { i18n } from '@/lib/i18n';
+import spanishCatalog from '@/locales/es/messages.json';
+import { renderWithI18n } from '../../tests/foundation/render-with-i18n.test-helper';
+import { HelpPopover } from './HelpPopover';
+
+vi.mock('@inkeep/open-knowledge-core/utils/github-stars', () => ({
+ getGitHubStars: async () => 1234,
+}));
+
+const CLOUD_VERSION = '0.84.1-cloud.1596';
+
+function installDesktopBridge(appVersion: string) {
+ (window as unknown as { okDesktop?: unknown }).okDesktop = {
+ appVersion,
+ update: { checkNow: async () => {} },
+ state: {
+ query: async () => ({ channel: 'latest' as const, schemaIncompatibility: null }),
+ },
+ };
+}
+
+async function openHelpPopover(triggerName = 'Resources'): Promise<HTMLElement> {
+ renderWithI18n(
+ <TooltipProvider>
+ <HelpPopover />
+ </TooltipProvider>,
+ );
+ await userEvent.click(screen.getByRole('button', { name: triggerName }));
+ return screen.findByTestId('help-popover-version');
+}
+
+function popoverContent(row: HTMLElement): HTMLElement {
+ const content = row.closest<HTMLElement>('[data-slot="popover-content"]');
+ if (content === null) throw new Error('the version row is not inside the popover content');
+ return content;
+}
+
+function clipping(element: HTMLElement, container: HTMLElement) {
+ const box = element.getBoundingClientRect();
+ const bounds = container.getBoundingClientRect();
+ return {
+ text: element.textContent,
+ clippedInline: element.scrollWidth > element.clientWidth,
+ outsideContainer: box.left < bounds.left || box.right > bounds.right,
+ };
+}
+
+afterEach(() => {
+ (window as unknown as { okDesktop?: unknown }).okDesktop = undefined;
+ act(() => i18n.activate(FALLBACK_LOCALE));
+});
+
+describe('HelpPopover version footer layout', () => {
+ test('a Cloud build version leaves the whole footer inside the popover with no horizontal scroll', async () => {
+ installDesktopBridge(CLOUD_VERSION);
+ const row = await openHelpPopover();
+ const content = popoverContent(row);
+ const [version, label] = Array.from(row.children) as HTMLElement[];
+
+ expect(content.scrollWidth).toBeLessThanOrEqual(content.clientWidth);
+ expect(clipping(version, content)).toEqual({
+ text: `v${CLOUD_VERSION}`,
+ clippedInline: false,
+ outsideContainer: false,
+ });
+ expect(clipping(label, content)).toEqual({
+ text: 'About & updates',
+ clippedInline: false,
+ outsideContainer: false,
+ });
+ });
+
+ test('a longer translated label stays inside the popover with a Cloud build version', async () => {
+ i18n.load('es', spanishCatalog.messages as unknown as Messages);
+ act(() => i18n.activate('es'));
+ installDesktopBridge(CLOUD_VERSION);
+ const row = await openHelpPopover('Recursos');
+ const content = popoverContent(row);
+ const label = row.children[1] as HTMLElement;
+
+ expect(content.scrollWidth).toBeLessThanOrEqual(content.clientWidth);
+ expect(clipping(label, content)).toEqual({
+ text: 'Información y actualizaciones',
+ clippedInline: false,
+ outsideContainer: false,
+ });
+ });
+});
diff --git a/packages/app/src/components/HelpPopover.tsx b/packages/app/src/components/HelpPopover.tsx
index c643cc4db..d654184a8 100644
--- a/packages/app/src/components/HelpPopover.tsx
+++ b/packages/app/src/components/HelpPopover.tsx
@@ -306,7 +306,7 @@ export const HelpPopover: FC = () => {
variant="ghost"
className={cn(
rowClassName,
- 'h-auto w-full justify-start font-mono text-xs font-normal',
+ 'h-auto w-full flex-wrap justify-between gap-y-0.5 text-start font-mono text-xs font-normal whitespace-normal',
)}
onClick={() => {
setPopoverOpen(false);
@@ -314,8 +314,8 @@ export const HelpPopover: FC = () => {
}}
data-testid="help-popover-version"
>
- <span>v{appVersion}</span>{' '}
- <span className="ml-auto font-sans text-muted-foreground">
+ <span className="min-w-0 max-w-full truncate">v{appVersion}</span>{' '}
+ <span className="font-sans text-muted-foreground">
<Trans>About & updates</Trans>
</span>
</Button>
diff --git a/packages/app/tests/integration/bug3-source-mode-writeback.test.ts b/packages/app/tests/integration/bug3-source-mode-writeback.test.ts
index 4549c74b3..a50b00123 100644
--- a/packages/app/tests/integration/bug3-source-mode-writeback.test.ts
+++ b/packages/app/tests/integration/bug3-source-mode-writeback.test.ts
@@ -1,4 +1,3 @@
-
import { readFileSync } from 'node:fs';
import { join } from 'node:path';
import { setTimeout as wait } from 'node:timers/promises';
diff --git a/packages/app/tests/integration/indented-jsx-byte-sacred.test.ts b/packages/app/tests/integration/indented-jsx-byte-sacred.test.ts
index 4fc2c11f9..6fcdc23f2 100644
--- a/packages/app/tests/integration/indented-jsx-byte-sacred.test.ts
+++ b/packages/app/tests/integration/indented-jsx-byte-sacred.test.ts
@@ -1,4 +1,3 @@
-
import { setTimeout as wait } from 'node:timers/promises';
import { normalizeBridge } from '@inkeep/open-knowledge-core';
import { updateYFragment } from '@tiptap/y-tiptap';
diff --git a/packages/app/tests/integration/interior-edit-freshness.test.ts b/packages/app/tests/integration/interior-edit-freshness.test.ts
index 9f2f6feb6..40b5cdfd6 100644
--- a/packages/app/tests/integration/interior-edit-freshness.test.ts
+++ b/packages/app/tests/integration/interior-edit-freshness.test.ts
@@ -1,4 +1,3 @@
-
import { setTimeout as wait } from 'node:timers/promises';
import { updateYFragment, yXmlFragmentToProseMirrorRootNode } from '@tiptap/y-tiptap';
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
diff --git a/packages/app/tests/integration/keystroke-cadence-danger-space.test.ts b/packages/app/tests/integration/keystroke-cadence-danger-space.test.ts
index 2a085742b..93666af70 100644
--- a/packages/app/tests/integration/keystroke-cadence-danger-space.test.ts
+++ b/packages/app/tests/integration/keystroke-cadence-danger-space.test.ts
@@ -1,4 +1,3 @@
-
import { setTimeout as wait } from 'node:timers/promises';
import { updateYFragment, yXmlFragmentToProseMirrorRootNode } from '@tiptap/y-tiptap';
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
diff --git a/packages/app/tests/integration/producer-guard-wiring.test.ts b/packages/app/tests/integration/producer-guard-wiring.test.ts
index 878d5196b..867598d34 100644
--- a/packages/app/tests/integration/producer-guard-wiring.test.ts
+++ b/packages/app/tests/integration/producer-guard-wiring.test.ts
@@ -1,4 +1,3 @@
-
import { setTimeout as wait } from 'node:timers/promises';
import { updateYFragment, yXmlFragmentToProseMirrorRootNode } from '@tiptap/y-tiptap';
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
diff --git a/packages/app/tests/integration/qa-039-reconciliation-counters-http.test.ts b/packages/app/tests/integration/qa-039-reconciliation-counters-http.test.ts
index 4ada3cf26..0970ac12f 100644
--- a/packages/app/tests/integration/qa-039-reconciliation-counters-http.test.ts
+++ b/packages/app/tests/integration/qa-039-reconciliation-counters-http.test.ts
@@ -1,4 +1,3 @@
-
import { randomUUID } from 'node:crypto';
import { afterEach, describe, expect, test } from 'vitest';
import { agentWriteMd, createTestServer, type TestServer } from './test-harness';
diff --git a/packages/app/tests/integration/qa-045-restore-after-gc.test.ts b/packages/app/tests/integration/qa-045-restore-after-gc.test.ts
index cbe2b705f..b632185e1 100644
--- a/packages/app/tests/integration/qa-045-restore-after-gc.test.ts
+++ b/packages/app/tests/integration/qa-045-restore-after-gc.test.ts
@@ -1,4 +1,3 @@
-
import { execFileSync } from 'node:child_process';
import { randomUUID } from 'node:crypto';
import { join } from 'node:path';
diff --git a/packages/app/tests/integration/qa-050-rollback-undo-shipped-path.test.ts b/packages/app/tests/integration/qa-050-rollback-undo-shipped-path.test.ts
index 89bc9b4d9..c530ce4ba 100644
--- a/packages/app/tests/integration/qa-050-rollback-undo-shipped-path.test.ts
+++ b/packages/app/tests/integration/qa-050-rollback-undo-shipped-path.test.ts
@@ -1,4 +1,3 @@
-
import { randomUUID } from 'node:crypto';
import { afterAll, afterEach, beforeAll, describe, expect, test } from 'vitest';
import type * as Y from 'yjs';
diff --git a/packages/app/tests/integration/undo-after-rollback.test.ts b/packages/app/tests/integration/undo-after-rollback.test.ts
index a78aeb0e4..d3767adc9 100644
--- a/packages/app/tests/integration/undo-after-rollback.test.ts
+++ b/packages/app/tests/integration/undo-after-rollback.test.ts
@@ -1,4 +1,3 @@
-
import { ROLLBACK_ORIGIN } from '@inkeep/open-knowledge-server';
import { afterAll, beforeAll, describe, expect, test } from 'vitest';
import * as Y from 'yjs';
diff --git a/packages/app/tests/integration/undo-recycle-reset.test.ts b/packages/app/tests/integration/undo-recycle-reset.test.ts
index e7cc69c3f..b076f955c 100644
--- a/packages/app/tests/integration/undo-recycle-reset.test.ts
+++ b/packages/app/tests/integration/undo-recycle-reset.test.ts
@@ -1,4 +1,3 @@
-
import { writeFileSync } from 'node:fs';
import { join } from 'node:path';
import { setTimeout as wait } from 'node:timers/promises';
diff --git a/packages/app/tests/integration/undo-rederive-survival.test.ts b/packages/app/tests/integration/undo-rederive-survival.test.ts
index 9ddcd0730..7935e35f8 100644
--- a/packages/app/tests/integration/undo-rederive-survival.test.ts
+++ b/packages/app/tests/integration/undo-rederive-survival.test.ts
@@ -1,4 +1,3 @@
-
import { prependFrontmatter } from '@inkeep/open-knowledge-core';
import { Plugin, PluginKey } from '@tiptap/pm/state';
import { updateYFragment, yXmlFragmentToProseMirrorRootNode } from '@tiptap/y-tiptap';
diff --git a/packages/core/src/bridge/compose.ts b/packages/core/src/bridge/compose.ts
index 2a597ec3d..f4cc8a286 100644
--- a/packages/core/src/bridge/compose.ts
+++ b/packages/core/src/bridge/compose.ts
@@ -1,4 +1,3 @@
-
import { prependFrontmatter, stripFrontmatter } from '../extensions/frontmatter.ts';
export type ComposeAdjustment = 'none' | 'body' | 'frontmatter' | 'unresolved';
diff --git a/packages/core/src/bridge/doc-boundary-space.ts b/packages/core/src/bridge/doc-boundary-space.ts
index 01ef76a9f..8fb428b90 100644
--- a/packages/core/src/bridge/doc-boundary-space.ts
+++ b/packages/core/src/bridge/doc-boundary-space.ts
@@ -1,4 +1,3 @@
-
import { FRONTMATTER_RE, stripFrontmatter } from '../extensions/frontmatter.ts';
import { carriedEdgeEmpties, type DocEdgeEmpties } from '../markdown/doc-edge-blank-runs.ts';
diff --git a/packages/core/src/markdown/comment-promoter.ts b/packages/core/src/markdown/comment-promoter.ts
index fb0ba5a7c..fc267cbea 100644
--- a/packages/core/src/markdown/comment-promoter.ts
+++ b/packages/core/src/markdown/comment-promoter.ts
@@ -1,4 +1,3 @@
-
import type { Nodes, Paragraph, PhrasingContent, Root, RootContent, Text } from 'mdast';
import { SKIP, visit } from 'unist-util-visit';
import type { VFile } from 'vfile';
diff --git a/packages/core/src/markdown/merged-walker.ts b/packages/core/src/markdown/merged-walker.ts
index fa3cfcd86..bfd7e3109 100644
--- a/packages/core/src/markdown/merged-walker.ts
+++ b/packages/core/src/markdown/merged-walker.ts
@@ -1,4 +1,3 @@
-
import type { Nodes, Parent, Root } from 'mdast';
import { SKIP, visit } from 'unist-util-visit';
import type { VFile } from 'vfile';
diff --git a/packages/core/src/markdown/safe-url.ts b/packages/core/src/markdown/safe-url.ts
index 8be632ba4..4d3250d3a 100644
--- a/packages/core/src/markdown/safe-url.ts
+++ b/packages/core/src/markdown/safe-url.ts
@@ -1,4 +1,3 @@
-
export const SAFE_URL_SCHEMES = ['https', 'http', 'mailto', 'tel', 'ftp', 'sms'] as const;
const SCHEME_ALT = SAFE_URL_SCHEMES.map((s) => `${s}:`).join('|');