Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

feat(open-knowledge): custom markdown sidebar icon and share dialog p… (#1612)

sarah94353929bc1c
diff --git a/.changeset/share-dialog-polish-and-md-sidebar-icon.md b/.changeset/share-dialog-polish-and-md-sidebar-icon.md
new file mode 100644
index 000000000..4abe7496f
--- /dev/null
+++ b/.changeset/share-dialog-polish-and-md-sidebar-icon.md
@@ -0,0 +1,12 @@
+---
+"@inkeep/open-knowledge-app": patch
+---
+
+Sidebar + share-dialog polish:
+
+- Custom Markdown sidebar icon (M↓) for `.md` and `.mdx` files, replacing Pierre's default glyph. Colored via the existing `--trees-file-icon-color-markdown` CSS variable so it tracks light/dark and selected-row treatment.
+- ShareBranchSwitchDialog: align Cancel button styling with the other dialog Cancel buttons (outline + font-mono uppercase). Give the secondary "Open in current branch" button the same uppercase font-mono treatment as the primary "Open in <branch>" button.
+- ShareBranchSwitchDialog: move the repository/file/branch metadata block from the dialog header into the body so it groups visually with the explanation paragraph.
+- ShareBranchSwitchDialog: fix a spurious scrollbar caused by inline `<code>` pills whose `py-0.5` extends past the surrounding line-box (`leading-6` on the variant paragraphs absorbs the inline padding).
+- ShareMetadataRows: bump value rows to `text-1sm` and label cells to `text-xs` for tighter hierarchy (affects both share dialogs that use this component).
+- ShareReceiveDialog: tighten the inline-`<code>` corner radius to `rounded-sm`.
diff --git a/packages/app/src/components/FileTree.tsx b/packages/app/src/components/FileTree.tsx
index e9eb71de8..56383794c 100644
--- a/packages/app/src/components/FileTree.tsx
+++ b/packages/app/src/components/FileTree.tsx
@@ -212,6 +212,9 @@ async function copyToClipboard(text: string, kind: 'full' | 'relative'): Promise
const AGENT_FILE_NAMES = new Set(['agents', 'agent', 'claude', 'skill']);
const LINK_DECORATION_ICON_ID = 'ok-file-tree-link-decoration';
const AGENT_DECORATION_ICON_ID = 'ok-file-tree-agent-decoration';
+const MARKDOWN_FILE_ICON_ID = 'ok-file-tree-markdown';
+const MARKDOWN_FILE_ICON_VIEWBOX = '0 0 48 48';
+const MARKDOWN_FILE_ICON_SYMBOL = `<symbol id="${MARKDOWN_FILE_ICON_ID}" viewBox="${MARKDOWN_FILE_ICON_VIEWBOX}" fill="none" stroke="currentColor" stroke-width="4.62651" stroke-linecap="round" stroke-linejoin="round"><path d="M3.18066 33.4398V13.5603L12.4337 22.8133L21.6867 13.5603V33.4398"/><path d="M38 13.5L38 33"/><path d="M44.8195 26.5L37.8797 33.4398L30.9399 26.5"/></symbol>`;
type IconNode = [string, Record<string, string>][];
@@ -234,6 +237,7 @@ function createLucideSpriteSymbol(id: string, iconNode: IconNode): string {
const FILE_TREE_DECORATION_SPRITE_SHEET = `<svg data-icon-sprite aria-hidden="true" width="0" height="0">
${createLucideSpriteSymbol(LINK_DECORATION_ICON_ID, link2Icon)}
${createLucideSpriteSymbol(AGENT_DECORATION_ICON_ID, botIcon)}
+ ${MARKDOWN_FILE_ICON_SYMBOL}
</svg>`;
const FILE_TREE_UNSAFE_CSS = `${FILE_TREE_EXT_BADGE_CSS}\n${FILE_TREE_RENAME_CHIP_CSS}`;
@@ -1130,6 +1134,10 @@ export function FileTree({ ref }: { ref?: Ref<FileTreeHandle | null> }) {
icons: {
set: 'complete',
spriteSheet: FILE_TREE_DECORATION_SPRITE_SHEET,
+ byFileExtension: {
+ md: { name: MARKDOWN_FILE_ICON_ID, viewBox: MARKDOWN_FILE_ICON_VIEWBOX },
+ mdx: { name: MARKDOWN_FILE_ICON_ID, viewBox: MARKDOWN_FILE_ICON_VIEWBOX },
+ },
},
unsafeCSS: FILE_TREE_UNSAFE_CSS,
composition: {
diff --git a/packages/app/src/components/ShareBranchSwitchDialog.tsx b/packages/app/src/components/ShareBranchSwitchDialog.tsx
index 35a8a0dcb..019dc8786 100644
--- a/packages/app/src/components/ShareBranchSwitchDialog.tsx
+++ b/packages/app/src/components/ShareBranchSwitchDialog.tsx
@@ -312,26 +312,28 @@ export function ShareBranchSwitchDialog({
{share.owner}/{share.repo} — {shareTargetPath(share.target)}
</Trans>
</DialogDescription>
- <ShareMetadataRows
- owner={share.owner}
- repo={share.repo}
- path={shareTargetPath(share.target)}
- kind={share.target.kind}
- branch={share.branch}
- testId="share-branch-switch-metadata"
- branchTestId="share-branch-switch-metadata-branch"
- />
</DialogHeader>
<DialogBody>
+ <div className="mb-4">
+ <ShareMetadataRows
+ owner={share.owner}
+ repo={share.repo}
+ path={shareTargetPath(share.target)}
+ kind={share.target.kind}
+ branch={share.branch}
+ testId="share-branch-switch-metadata"
+ branchTestId="share-branch-switch-metadata-branch"
+ />
+ </div>
{branchSwitchState.phase === 'branch-in-other-worktree' ? (
<div
className="text-sm text-muted-foreground"
data-testid="share-branch-switch-in-other-worktree"
>
- <p>
+ <p className="leading-6">
<Trans>
Branch{' '}
- <code className="rounded bg-muted px-1 py-0.5 text-foreground/80">
+ <code className="rounded-sm bg-muted px-1 py-0.5 text-foreground/80">
{shareBranch}
</code>{' '}
is checked out in:
@@ -362,10 +364,10 @@ export function ShareBranchSwitchDialog({
</Trans>
</p>
) : variant?.kind === 'D' ? (
- <p className="text-sm text-muted-foreground">
+ <p className="text-sm leading-6 text-muted-foreground">
<Trans>
This {targetNoun} only exists on branch{' '}
- <code className="rounded bg-muted px-1 py-0.5 text-foreground/80">
+ <code className="rounded-sm bg-muted px-1 py-0.5 text-foreground/80">
{shareBranch}
</code>
. You have uncommitted changes that prevent switching. Commit or stash your changes,
@@ -373,28 +375,28 @@ export function ShareBranchSwitchDialog({
</Trans>
</p>
) : variant?.kind === 'B' ? (
- <p className="text-sm text-muted-foreground">
+ <p className="text-sm leading-6 text-muted-foreground">
<Trans>
This {targetNoun} was shared from branch{' '}
- <code className="rounded bg-muted px-1 py-0.5 text-foreground/80">
+ <code className="rounded-sm bg-muted px-1 py-0.5 text-foreground/80">
{shareBranch}
</code>
. It doesn't exist on your current branch (
- <code className="rounded bg-muted px-1 py-0.5 text-foreground/80">
+ <code className="rounded-sm bg-muted px-1 py-0.5 text-foreground/80">
{currentLabel}
</code>
).
</Trans>
</p>
) : (
- <p className="text-sm text-muted-foreground">
+ <p className="text-sm leading-6 text-muted-foreground">
<Trans>
This {targetNoun} was shared from branch{' '}
- <code className="rounded bg-muted px-1 py-0.5 text-foreground/80">
+ <code className="rounded-sm bg-muted px-1 py-0.5 text-foreground/80">
{shareBranch}
</code>
. You're currently on{' '}
- <code className="rounded bg-muted px-1 py-0.5 text-foreground/80">
+ <code className="rounded-sm bg-muted px-1 py-0.5 text-foreground/80">
{currentLabel}
</code>
.
@@ -403,7 +405,7 @@ export function ShareBranchSwitchDialog({
)}
{variant && !variant.switchEnabled && variant.conflictingFiles.length > 0 ? (
<div
- className="mt-3 rounded-md border border-border bg-muted/30 p-3 text-xs"
+ className="mt-3 rounded-md border border-border bg-muted/30 p-3 text-1sm"
data-testid="share-branch-switch-conflict"
>
<p className="font-medium text-foreground/90">
@@ -434,7 +436,12 @@ export function ShareBranchSwitchDialog({
) : null}
</DialogBody>
<DialogFooter className="sm:justify-between">
- <Button variant="ghost" onClick={handleCancel} data-testid="share-branch-switch-cancel">
+ <Button
+ variant="ghost"
+ className="font-mono uppercase"
+ onClick={handleCancel}
+ data-testid="share-branch-switch-cancel"
+ >
<Trans>Cancel</Trans>
</Button>
{branchSwitchState.phase === 'branch-in-other-worktree' ? (
@@ -445,7 +452,8 @@ export function ShareBranchSwitchDialog({
<div className="flex flex-col-reverse gap-2 sm:flex-row sm:gap-2">
{variant?.openCurrentEnabled ? (
<Button
- variant="secondary"
+ variant="outline"
+ className="font-mono uppercase"
onClick={handleOpenCurrent}
disabled={switching}
data-testid="share-branch-switch-open-current"
diff --git a/packages/app/src/components/ShareReceiveDialog.test.ts b/packages/app/src/components/ShareReceiveDialog.test.ts
index 8568aafb2..17d70b193 100644
--- a/packages/app/src/components/ShareReceiveDialog.test.ts
+++ b/packages/app/src/components/ShareReceiveDialog.test.ts
@@ -175,8 +175,8 @@ describe('ShareReceiveDialog — ShareMetadataRows (shared module)', () => {
expect(METADATA_SRC).toContain('!DEFAULT_BRANCH_NAMES.has(branch)');
});
- test('shared module label classes mirror the SyncStatusBadge popover (w-20 shrink-0 font-mono uppercase tracking-wide text-2xs)', () => {
- expect(METADATA_SRC).toContain('w-20 shrink-0 font-mono uppercase tracking-wide text-2xs');
+ test('shared module labels use w-20 shrink-0 font-mono uppercase tracking-wide text-xs', () => {
+ expect(METADATA_SRC).toContain('w-20 shrink-0 font-mono uppercase tracking-wide text-xs');
});
test('shared module branch row guards a caller-supplied testid for downstream selection', () => {
diff --git a/packages/app/src/components/ShareReceiveDialog.tsx b/packages/app/src/components/ShareReceiveDialog.tsx
index abb03d8d2..1ce2c31ec 100644
--- a/packages/app/src/components/ShareReceiveDialog.tsx
+++ b/packages/app/src/components/ShareReceiveDialog.tsx
@@ -568,7 +568,7 @@ function ShareReceiveDialogInner({
<p className="mt-3 text-1sm text-muted-foreground">
<Trans>
Looking for{' '}
- <code className="rounded bg-muted px-1 py-0.5 text-foreground/80">
+ <code className="rounded-sm bg-muted px-1 py-0.5 text-foreground/80">
{lookingForUrl}
</code>
.
diff --git a/packages/app/src/components/share-metadata-rows.tsx b/packages/app/src/components/share-metadata-rows.tsx
index 1be9d385a..c136f81e9 100644
--- a/packages/app/src/components/share-metadata-rows.tsx
+++ b/packages/app/src/components/share-metadata-rows.tsx
@@ -24,7 +24,7 @@ export function ShareMetadataRows({
}: ShareMetadataRowsProps) {
const showBranch = branch !== '' && !DEFAULT_BRANCH_NAMES.has(branch);
return (
- <dl className="space-y-2 text-xs text-muted-foreground" data-testid={testId}>
+ <dl className="space-y-2 text-1sm text-muted-foreground" data-testid={testId}>
<ShareMetadataRow label={<Trans>Repository</Trans>}>
<span>
{owner}/{repo}
@@ -56,7 +56,7 @@ interface ShareMetadataRowProps {
function ShareMetadataRow({ label, children }: ShareMetadataRowProps) {
return (
<div className="flex items-baseline gap-2">
- <dt className="w-20 shrink-0 font-mono uppercase tracking-wide text-2xs">{label}</dt>
+ <dt className="w-20 shrink-0 font-mono uppercase tracking-wide text-xs">{label}</dt>
<dd className="min-w-0 flex-1 break-all text-foreground">{children}</dd>
</div>
);