mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-11-28 21:20:25 +08:00
- mark last command / prompts in xterm.js - split out term model into its own file - try to detect repl/shells/ssh/tmux etc commands that stop wave ai integration - show icons in term headers for whether wave ai integration is available - keep integration status / last command client side (sync with server on reload)
30 lines
1 KiB
TypeScript
30 lines
1 KiB
TypeScript
// Copyright 2025, Command Line Inc.
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
import type { TermViewModel } from "@/app/view/term/term-model";
|
|
import { computeTheme } from "@/app/view/term/termutil";
|
|
import { TermWrap } from "@/app/view/term/termwrap";
|
|
import { atoms } from "@/store/global";
|
|
import { useAtomValue } from "jotai";
|
|
import { useEffect } from "react";
|
|
|
|
interface TermThemeProps {
|
|
blockId: string;
|
|
termRef: React.RefObject<TermWrap>;
|
|
model: TermViewModel;
|
|
}
|
|
|
|
const TermThemeUpdater = ({ blockId, model, termRef }: TermThemeProps) => {
|
|
const fullConfig = useAtomValue(atoms.fullConfigAtom);
|
|
const blockTermTheme = useAtomValue(model.termThemeNameAtom);
|
|
const transparency = useAtomValue(model.termTransparencyAtom);
|
|
const [theme, _] = computeTheme(fullConfig, blockTermTheme, transparency);
|
|
useEffect(() => {
|
|
if (termRef.current?.terminal) {
|
|
termRef.current.terminal.options.theme = theme;
|
|
}
|
|
}, [theme]);
|
|
return null;
|
|
};
|
|
|
|
export { TermThemeUpdater };
|