mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-19 12:51:51 +03:00
webterm: clean up component state derivation
This commit is contained in:
parent
329ec8ef3f
commit
d138ab254b
@ -6,8 +6,7 @@ import React, {
|
|||||||
import Helmet from 'react-helmet';
|
import Helmet from 'react-helmet';
|
||||||
|
|
||||||
import useTermState from '~/logic/state/term';
|
import useTermState from '~/logic/state/term';
|
||||||
import useSettingsState from '~/logic/state/settings';
|
import { useDark } from '~/logic/state/join';
|
||||||
import useLocalState from '~/logic/state/local';
|
|
||||||
|
|
||||||
import { Terminal, ITerminalOptions, ITheme } from 'xterm';
|
import { Terminal, ITerminalOptions, ITheme } from 'xterm';
|
||||||
import { FitAddon } from 'xterm-addon-fit';
|
import { FitAddon } from 'xterm-addon-fit';
|
||||||
@ -278,15 +277,8 @@ export default function TermApp(props: TermAppProps) {
|
|||||||
const container = useRef<HTMLDivElement>(null);
|
const container = useRef<HTMLDivElement>(null);
|
||||||
// TODO allow switching of selected
|
// TODO allow switching of selected
|
||||||
const { sessions, selected, slogstream, set } = useTermState();
|
const { sessions, selected, slogstream, set } = useTermState();
|
||||||
|
const session = sessions[selected];
|
||||||
const session = useTermState(useCallback(
|
const dark = useDark();
|
||||||
state => state.sessions[state.selected],
|
|
||||||
[selected, sessions]
|
|
||||||
));
|
|
||||||
|
|
||||||
const osDark = useLocalState(state => state.dark);
|
|
||||||
const theme = useSettingsState(s => s.display.theme);
|
|
||||||
const dark = theme === 'dark' || (theme === 'auto' && osDark);
|
|
||||||
|
|
||||||
const setupSlog = useCallback(() => {
|
const setupSlog = useCallback(() => {
|
||||||
console.log('slog: setting up...');
|
console.log('slog: setting up...');
|
||||||
|
Loading…
Reference in New Issue
Block a user