feat: auto-clear logs on connect

This commit is contained in:
backuppc
2026-01-16 14:57:07 +09:00
parent 71f119414f
commit e5695bed22

11
App.tsx
View File

@@ -140,6 +140,7 @@ const App: React.FC = () => {
const handleConnectA = async () => {
try {
console.log("Connect A Clicked");
setLogsA([]);
await serialA.current.connect(baudRateA);
setIsConnectedA(true);
serialA.current.startReading((data) => {
@@ -166,6 +167,7 @@ const App: React.FC = () => {
const handleConnectB = async () => {
try {
console.log("Connect B Clicked");
setLogsB([]);
await serialB.current.connect(baudRateB);
setIsConnectedB(true);
serialB.current.startReading((data) => {
@@ -246,16 +248,14 @@ const App: React.FC = () => {
<div className="flex bg-gray-800 rounded border border-gray-700 ml-2">
<button
onClick={() => setViewMode(ViewMode.ASCII)}
className={`px-2 py-0.5 text-[10px] font-bold rounded-l transition-all ${
viewMode === ViewMode.ASCII ? 'bg-gray-600 text-white' : 'text-gray-400 hover:text-white'
className={`px-2 py-0.5 text-[10px] font-bold rounded-l transition-all ${viewMode === ViewMode.ASCII ? 'bg-gray-600 text-white' : 'text-gray-400 hover:text-white'
}`}
>
ASCII
</button>
<button
onClick={() => setViewMode(ViewMode.HEX)}
className={`px-2 py-0.5 text-[10px] font-bold rounded-r transition-all ${
viewMode === ViewMode.HEX ? 'bg-gray-600 text-white' : 'text-gray-400 hover:text-white'
className={`px-2 py-0.5 text-[10px] font-bold rounded-r transition-all ${viewMode === ViewMode.HEX ? 'bg-gray-600 text-white' : 'text-gray-400 hover:text-white'
}`}
>
HEX
@@ -288,8 +288,7 @@ const App: React.FC = () => {
<div className={`flex-1 flex overflow-hidden p-2 md:p-4 gap-2 md:gap-4 ${isDualMode ? 'flex-col md:flex-row' : 'flex-col'}`}>
{/* Port A Terminal */}
<div className={`flex flex-col transition-all duration-300 ease-in-out ${
isDualMode
<div className={`flex flex-col transition-all duration-300 ease-in-out ${isDualMode
? 'w-full h-1/2 md:w-1/2 md:h-full'
: 'w-full h-full'
}`}>