Skip to content

Persistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More

1.3 KB
Raw Blame
import React from 'react';
import { useI18n } from '../../i18n';
import { MEMORY_TABS, tabHash, type MemoryTab } from '../utils/memory-route';
import { isPlainClick } from '../utils/links';

/** Each tab's words, for every tab in MEMORY_TABS (a new tab fails the typecheck here until it has words). */
const TAB_WORDS: Record<MemoryTab, (t: (english: string) => string) => string> = {
  timeline: t => t('Timeline'),
  sessions: t => t('Sessions'),
};

/**
 * Timeline and Sessions under the page's heading (Codex's .tabs): real links to each tab's address, the page shown
 * marked in green with its underline. On a session's own page no tab is drawn; its breadcrumb leads back. A plain
 * click on the tab already shown stays put: its address can differ from the page's (`#/` under `#/?find=x`), and
 * following it would add a history entry that Back returns to with nothing changed.
 */
export function ViewTabs({ active }: { active: MemoryTab }) {
  const { t } = useI18n();
  return (
    <nav className="mem-tabs" aria-label={t('Memory views')}>
      {MEMORY_TABS.map(tab => (
        <a key={tab} className="mem-tab" href={tabHash(tab)} aria-current={tab === active ? 'page' : undefined}
          onClick={event => { if (tab === active && isPlainClick(event)) event.preventDefault(); }}>
          {TAB_WORDS[tab](t)}
        </a>
      ))}
    </nav>
  );
}