Command Center Bridge (command-center/opener-bridge.ts)

appwrite · apps/console/src/lib/command-center/opener-bridge.ts · typescript · BSD-3-Clause
ui, cli, tag:center, tag:bridge

Enables communication between sibling components to open command center.

// Source: https://github.com/appwrite/appwrite | License: BSD-3-Clause | Copyright 2019 Appwrite (https://appwrite.io) and individual contributors
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * Bridge so the agent right-pane (sibling of route layouts) can open the
 * page-owned Command Center. React context cannot cross that sibling boundary.
 */

export type CommandCenterPage =
  | 'shortcuts'
  | 'feedback'
  | 'support'
  | 'docs'
  | 'blog'

type CommandCenterOpener = (page: CommandCenterPage | null) => void

let opener: CommandCenterOpener | null = null

/** Register the active page's Command Center opener. Returns unregister. */
export function registerCommandCenterOpener(
  next: CommandCenterOpener,
): () => void {
  opener = next
  return () => {
    if (

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key