@finos/legend-application-pure-ide
Version:
Legend Pure IDE application core
48 lines • 3.48 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
/**
* Copyright (c) 2020-present, Goldman Sachs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { observer } from 'mobx-react-lite';
import { flowResult } from 'mobx';
import { useApplicationStore } from '@finos/legend-application';
import { clsx, HammerIcon, TerminalIcon } from '@finos/legend-art';
import { usePureIDEStore } from './PureIDEStoreProvider.js';
import { FileEditorState } from '../stores/FileEditorState.js';
const FileEditorStatusBar = observer((props) => {
const { fileEditorState } = props;
const currentCursorInfo = fileEditorState.textEditorState.cursorObserver;
const selectionLength = currentCursorInfo?.selection
? fileEditorState.textEditorState.model.getValueInRange(currentCursorInfo.selection).length
: 0;
// actions
const goToLine = () => fileEditorState.setShowGoToLinePrompt(true);
return (_jsx("div", { className: "file-editor__status-bar", children: currentCursorInfo?.position && (_jsx("button", { className: "editor__status-bar__action file-editor__status-bar__cursor-info", onClick: goToLine, tabIndex: -1, title: "Go to Line/Column", children: `Ln ${currentCursorInfo.position.lineNumber}, Col ${currentCursorInfo.position.column} ${selectionLength ? ` (${selectionLength} selected)` : ''}` })) }));
});
export const StatusBar = observer(() => {
const ideStore = usePureIDEStore();
const applicationStore = useApplicationStore();
// actions
const togglePanelGroup = () => ideStore.panelGroupDisplayState.toggle();
const executeGo = () => {
flowResult(ideStore.executeGo()).catch(applicationStore.alertUnhandledError);
};
return (_jsxs("div", { className: "editor__status-bar", children: [_jsx("div", { className: "editor__status-bar__left", children: _jsx("div", { className: "editor__status-bar__workspace" }) }), _jsxs("div", { className: "editor__status-bar__right", children: [ideStore.tabManagerState.currentTab instanceof FileEditorState && (_jsx(FileEditorStatusBar, { fileEditorState: ideStore.tabManagerState.currentTab })), _jsx("button", { className: clsx('editor__status-bar__action editor__status-bar__compile-btn', {
'editor__status-bar__compile-btn--wiggling': ideStore.executionState.isInProgress,
}), disabled: ideStore.initState.isInInitialState ||
ideStore.executionState.isInProgress, onClick: executeGo, tabIndex: -1, title: "Execute (F9)", children: _jsx(HammerIcon, {}) }), _jsx("button", { className: clsx('editor__status-bar__action editor__status-bar__action__toggler', {
'editor__status-bar__action__toggler--active': Boolean(ideStore.panelGroupDisplayState.isOpen),
}), onClick: togglePanelGroup, tabIndex: -1, title: "Toggle panel", children: _jsx(TerminalIcon, {}) })] })] }));
});
//# sourceMappingURL=StatusBar.js.map