Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/renderer/src/features/notes/StickyNoteCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ interface StickyNoteCardProps {
snapTargets: readonly SessionBounds[];
onBoundsChange(id: string, bounds: SessionBounds): void;
onTextChange(id: string, text: string): void;
onClose(id: string): void;
}

interface DragState {
Expand All @@ -43,7 +44,8 @@ export function StickyNoteCard({
snapEnabled,
snapTargets,
onBoundsChange,
onTextChange
onTextChange,
onClose
}: StickyNoteCardProps): React.JSX.Element {
const editor = useRef<HTMLTextAreaElement>(null);
const dragState = useRef<DragState | null>(null);
Expand Down Expand Up @@ -216,6 +218,18 @@ export function StickyNoteCard({
onPointerCancel={endDrag}
>
<span><UiIcon name="sticky-note" size="1.15em" />{t(locale, "stickyNote")}</span>
<button
className="sticky-note-card__close"
type="button"
onClick={() => {
saveText(text);
onClose(note.id);
}}
title={t(locale, "close")}
aria-label={t(locale, "close")}
>
<UiIcon name="close" size="1.23em" />
</button>
</header>
<textarea
ref={editor}
Expand Down
1 change: 1 addition & 0 deletions src/renderer/src/features/workspace/WorkspaceCanvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,7 @@ export function WorkspaceCanvas(props: WorkspaceCanvasProps): React.JSX.Element
]}
onBoundsChange={onStickyNoteBoundsChange}
onTextChange={onStickyNoteTextChange}
onClose={onDeleteStickyNote}
/>
))}
</div>
Expand Down
4 changes: 3 additions & 1 deletion src/renderer/src/styles/app.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions tests/settings-ui.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,20 @@ test("one context dispatcher preserves native menus and routes regions and notes
assert.match(workspace, /onCreateStickyNote/);
});

test("sticky notes expose a top-right close button wired to deletion", async () => {
const [workspace, noteCard, styles] = await Promise.all([
readFile(workspacePath, "utf8"),
readFile(new URL("../src/renderer/src/features/notes/StickyNoteCard.tsx", import.meta.url), "utf8"),
readFile(appStylesPath, "utf8")
]);
assert.match(workspace, /onClose=\{onDeleteStickyNote\}/);
assert.match(noteCard, /className="sticky-note-card__close"/);
assert.match(noteCard, /onClose\(note\.id\)/);
assert.match(noteCard, /aria-label=\{t\(locale, "close"\)\}/);
assert.match(styles, /\.sticky-note-card__header \{[^}]*justify-content: space-between/);
assert.match(styles, /\.sticky-note-card__close \{/);
});

test("canvas windows use click-to-front stacking and Browser occlusion", async () => {
const workspace = await readFile(workspacePath, "utf8");
assert.match(workspace, /closest<HTMLElement>\("\[data-canvas-layer-id\]"\)/);
Expand Down