Skip to content

Feat/end-user-guide-and-help#380

Merged
Xoshbin merged 4 commits into
mainfrom
feat/end-user-guide-and-help
May 30, 2026
Merged

Feat/end-user-guide-and-help#380
Xoshbin merged 4 commits into
mainfrom
feat/end-user-guide-and-help

Conversation

@Xoshbin
Copy link
Copy Markdown
Owner

@Xoshbin Xoshbin commented May 30, 2026

No description provided.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a comprehensive built-in Help extension for the Asyar launcher, featuring a keyboard shortcut catalog, reactive state management, and extensive user documentation covering features like AI agents, portals, snippets, and window management. The review feedback focuses on enhancing the Help view's usability by adding mouse interaction support (such as click handlers, pointer cursors, and hover states on topic rows) and improving the extension's lifecycle robustness by implementing cleanup in onUnload and adding an activation guard in viewDeactivated to prevent memory leaks.

Comment on lines +1 to +6
<script lang="ts">
import { helpViewState } from './helpState.svelte';
import { LAUNCHER_SHORTCUTS } from '../../lib/keyboard/shortcutCatalog';
import Icon from '../../components/base/Icon.svelte';
import { getBuiltInIconName, isBuiltInIcon } from '../../lib/iconUtils';
</script>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To support mouse interactions, import openUrl and guideUrl so they can be used in a click handler on the topic rows.

<script lang="ts">
  import { helpViewState } from './helpState.svelte';
  import { LAUNCHER_SHORTCUTS } from '../../lib/keyboard/shortcutCatalog';
  import Icon from '../../components/base/Icon.svelte';
  import { getBuiltInIconName, isBuiltInIcon } from '../../lib/iconUtils';
  import { openUrl } from '@tauri-apps/plugin-opener';
  import { guideUrl } from './topics';
</script>

Comment on lines +27 to +35
<li class="topic-row" class:selected={i === helpViewState.selectedIndex}>
{#if isBuiltInIcon(topic.icon)}
<Icon name={getBuiltInIconName(topic.icon)} />
{/if}
<span class="topic-text">
<span class="topic-title">{topic.title}</span>
<span class="topic-subtitle">{topic.subtitle}</span>
</span>
</li>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Add an onclick handler to allow users to select and open a topic by clicking on it, improving usability for mouse users.

      {#each helpViewState.filtered as topic, i}
        <li
          class="topic-row"
          class:selected={i === helpViewState.selectedIndex}
          onclick={async () => {
            helpViewState.selectedIndex = i;
            await openUrl(guideUrl(topic.slug));
          }}
        >
          {#if isBuiltInIcon(topic.icon)}
            <Icon name={getBuiltInIconName(topic.icon)} />
          {/if}
          <span class="topic-text">
            <span class="topic-title">{topic.title}</span>
            <span class="topic-subtitle">{topic.subtitle}</span>
          </span>
        </li>
      {/each}

Comment on lines +101 to +108
.topic-row {
display: flex;
align-items: center;
gap: var(--space-3, 8px);
padding: var(--space-2, 6px) var(--space-3, 8px);
border-radius: var(--radius-md, 8px);
cursor: default;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Change the cursor to pointer and add a hover state to visually indicate that the topic rows are interactive and clickable.

  .topic-row {
    display: flex;
    align-items: center;
    gap: var(--space-3, 8px);
    padding: var(--space-2, 6px) var(--space-3, 8px);
    border-radius: var(--radius-md, 8px);
    cursor: pointer;
  }

  .topic-row:hover:not(.selected) {
    background: var(--surface-hover, rgba(255, 255, 255, 0.04));
  }

Comment on lines +17 to +22
class HelpExtension implements Extension {
onUnload = () => {};
private logService?: ILogService;
private extensionManager?: IExtensionManager;
private isViewActive = false;
private handleKeydownBound = (e: KeyboardEvent) => this.handleKeydown(e);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Implement cleanup in onUnload to remove the global keydown event listener and unregister the action when the extension is unloaded, preventing memory leaks.

class HelpExtension implements Extension {
  onUnload = () => {
    window.removeEventListener('keydown', this.handleKeydownBound);
    actionService.unregisterAction(OPEN_GUIDE_ACTION_ID);
  };
  private logService?: ILogService;
  private extensionManager?: IExtensionManager;
  private isViewActive = false;
  private handleKeydownBound = (e: KeyboardEvent) => this.handleKeydown(e);

Comment on lines +50 to +55
async viewDeactivated(_viewPath: string): Promise<void> {
window.removeEventListener('keydown', this.handleKeydownBound);
this.extensionManager?.setActiveViewActionLabel(null);
actionService.unregisterAction(OPEN_GUIDE_ACTION_ID);
this.isViewActive = false;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Add a guard to viewDeactivated to ensure cleanup only runs if the view is currently active, preventing redundant calls and potential side effects.

Suggested change
async viewDeactivated(_viewPath: string): Promise<void> {
window.removeEventListener('keydown', this.handleKeydownBound);
this.extensionManager?.setActiveViewActionLabel(null);
actionService.unregisterAction(OPEN_GUIDE_ACTION_ID);
this.isViewActive = false;
}
async viewDeactivated(_viewPath: string): Promise<void> {
if (!this.isViewActive) return;
window.removeEventListener('keydown', this.handleKeydownBound);
this.extensionManager?.setActiveViewActionLabel(null);
actionService.unregisterAction(OPEN_GUIDE_ACTION_ID);
this.isViewActive = false;
}

@Xoshbin Xoshbin merged commit 62d32de into main May 30, 2026
1 check passed
@Xoshbin Xoshbin deleted the feat/end-user-guide-and-help branch May 30, 2026 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant