-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
af44bd7
commit 916ac7f
Showing
12 changed files
with
20 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 0 additions & 47 deletions
47
libs/remix-ui/terminal-transactions/src/components/terminal-transactions.tsx
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 8 additions & 35 deletions
43
libs/remix-ui/terminal/src/lib/components/remix-ui-terminal-menu-buttons.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,42 @@ | ||
import { AppContext } from '@remix-ui/app' | ||
import React, { useContext, useEffect } from 'react' // eslint-disable-line | ||
import { TerminalContext } from '../context' | ||
import { RemixUiTerminalProps, SET_OPEN } from '../types/terminalTypes' | ||
import './remix-ui-terminal-menu-buttons.css' | ||
import { desktopConnextionType } from '@remix-api'; | ||
|
||
export const RemixUITerminalMenuButtons = (props: RemixUiTerminalProps) => { | ||
const { xtermState, dispatchXterm, terminalState, dispatch } = useContext(TerminalContext) | ||
const appContext = useContext(AppContext) | ||
|
||
function selectOutput(event: any): void { | ||
props.plugin.call('layout', 'minimize', props.plugin.profile.name, false) | ||
dispatchXterm({ type: 'SET_TERMINAL_TAB', payload: 'output' }) | ||
dispatchXterm({ type: 'SHOW_OUTPUT', payload: true }) | ||
dispatch({ type: SET_OPEN, payload: true }) | ||
} | ||
|
||
const showTerminal = async (event: any): Promise<void> => { | ||
const showTerminal = async(event: any): Promise<void> => { | ||
props.plugin.call('layout', 'minimize', props.plugin.profile.name, false) | ||
if (xtermState.terminals.length === 0) { | ||
if ( xtermState.terminals.length === 0) { | ||
const start_time = Date.now() | ||
const pid = await props.plugin.call('xterm', 'createTerminal', xtermState.workingDir, null) | ||
const end_time = Date.now() | ||
console.log(`createTerminal took ${end_time - start_time} ms`) | ||
dispatchXterm({ type: 'HIDE_ALL_TERMINALS', payload: null }) | ||
dispatchXterm({ type: 'SET_TERMINAL_TAB', payload: 'xterm' }) | ||
dispatchXterm({ type: 'SHOW_OUTPUT', payload: false }) | ||
dispatchXterm({ type: 'ADD_TERMINAL', payload: { pid, queue: '', timeStamp: Date.now(), ref: null, hidden: false } }) | ||
} else { | ||
dispatchXterm({ type: 'SET_TERMINAL_TAB', payload: 'xterm' }) | ||
dispatchXterm({ type: 'SHOW_OUTPUT', payload: false }) | ||
} | ||
dispatch({ type: SET_OPEN, payload: true }) | ||
} | ||
|
||
const showTransactions = async (event: any): Promise<void> => { | ||
dispatchXterm({ type: 'SET_TERMINAL_TAB', payload: 'transactions' }) | ||
} | ||
|
||
if (appContext.appState.connectedToDesktop === desktopConnextionType.connected) { | ||
|
||
return null | ||
return ( | ||
<div className='d-flex flex-row align-items-center'> | ||
|
||
<button data-id="tab" id="tabTransactionsDebugger" className={`xtermButton w-100 btn btn-sm border-secondary btn-secondary'}`} | ||
onClick={async (e) => await showTransactions(e)} | ||
> | ||
pending transactions | ||
</button> | ||
</div> | ||
) | ||
} | ||
|
||
return ( | ||
<div className='d-flex flex-row align-items-center'> | ||
<button id="tabOutput" data-id="tabOutput" className={`xtermButton btn btn-sm border-secondary mr-2 border ${!(xtermState.selectedTerminalTab === 'output') ? '' : 'd-flex btn-secondary'}`} onClick={selectOutput}> | ||
<button id="tabOutput" data-id="tabOutput" className={`xtermButton btn btn-sm border-secondary mr-2 border ${!xtermState.showOutput ? '' : 'd-flex btn-secondary'}`} onClick={selectOutput}> | ||
Output | ||
</button> | ||
<button data-id="tabXTerm" id="tabXTerm" className={`xtermButton mr-2 btn btn-sm border-secondary ${xtermState.terminalsEnabled ? 'd-block' : 'd-none'} ${xtermState.selectedTerminalTab === 'xterm' ? 'd-none' : 'btn-secondary'}`} | ||
onClick={async (e) => await showTerminal(e)}> | ||
<button data-id="tabXTerm" id="tabXTerm" className={`xtermButton btn btn-sm border-secondary ${xtermState.terminalsEnabled ? 'd-block' : 'd-none'} ${xtermState.showOutput ? 'd-none' : 'btn-secondary'}`} | ||
onClick={async(e) => await showTerminal(e)}> | ||
<span className="far fa-terminal border-0 ml-1"></span> | ||
</button> | ||
{/* <button data-id="tab" id="tabTransactionsDebugger" className={`xtermButton w-100 btn btn-sm border-secondary btn-secondary'}`} | ||
onClick={async (e) => await showTransactions(e)} | ||
> | ||
pending transactions | ||
</button> */} | ||
</div> | ||
) | ||
} |
29 changes: 3 additions & 26 deletions
29
libs/remix-ui/terminal/src/lib/remix-ui-terminal-wrapper.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters