mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-10 00:38:07 +00:00
更新用户界面组件,使用 Ink 的 stdin 检测替代原有的 TTY 检测,确保在不同环境下的输入支持。同时,修改启动脚本以确保 Bun 启动时正确处理 TTY 输入,提升用户交互体验。
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import React, { useEffect, useRef, useState } from "react";
|
||||
import { Box, Text, useInput } from "ink";
|
||||
import { Box, Text, useInput, useStdin } from "ink";
|
||||
import { makerConfig } from "../config";
|
||||
import { AsterExchangeAdapter } from "../exchanges/aster-adapter";
|
||||
import { OffsetMakerEngine, type OffsetMakerEngineSnapshot } from "../core/offset-maker-engine";
|
||||
@@ -10,9 +10,13 @@ interface OffsetMakerAppProps {
|
||||
onExit: () => void;
|
||||
}
|
||||
|
||||
const inputSupported = Boolean(process.stdin && (process.stdin as any).isTTY);
|
||||
function useInputSupported() {
|
||||
const { isRawModeSupported } = useStdin();
|
||||
return Boolean(isRawModeSupported);
|
||||
}
|
||||
|
||||
export function OffsetMakerApp({ onExit }: OffsetMakerAppProps) {
|
||||
const inputSupported = useInputSupported();
|
||||
const [snapshot, setSnapshot] = useState<OffsetMakerEngineSnapshot | null>(null);
|
||||
const [error, setError] = useState<Error | null>(null);
|
||||
const engineRef = useRef<OffsetMakerEngine | null>(null);
|
||||
|
||||
Reference in New Issue
Block a user