From 26002e0429f8a54c9b911bae32188da79da3a7dc Mon Sep 17 00:00:00 2001 From: phyzical Date: Wed, 16 Feb 2022 20:11:37 +0800 Subject: [PATCH] added logic to display server on save dialog *added logic to display external servers as red --- src/ScriptEditor/ui/ScriptEditorRoot.tsx | 33 ++++++++++-------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/src/ScriptEditor/ui/ScriptEditorRoot.tsx b/src/ScriptEditor/ui/ScriptEditorRoot.tsx index 79c5fe6b8..4fb836c83 100644 --- a/src/ScriptEditor/ui/ScriptEditorRoot.tsx +++ b/src/ScriptEditor/ui/ScriptEditorRoot.tsx @@ -648,7 +648,7 @@ export function Root(props: IProps): React.ReactElement { const serverScriptIndex = server.scripts.findIndex((script) => script.filename === closingScript.fileName); if (serverScriptIndex === -1 || savedScriptCode !== server.scripts[serverScriptIndex as number].code) { PromptEvent.emit({ - txt: "Do you want to save changes to " + closingScript.fileName + "?", + txt: `Do you want to save changes to ${closingScript.fileName} on ${closingScript.hostname}?`, resolve: (result: boolean) => { if (result) { // Save changes @@ -779,20 +779,23 @@ export function Root(props: IProps): React.ReactElement { {openScripts.map(({ fileName, hostname }, index) => { const editingCurrentScript = currentScript?.fileName === openScripts[index].fileName && currentScript?.hostname === openScripts[index].hostname + const externalScript = currentScript?.hostname !== 'home' + const scriptFilenameTextColor = externalScript + const colorProps = editingCurrentScript ? { + background: Settings.theme.button, + borderColor: Settings.theme.button, + color: Settings.theme.primary + } : { + background: Settings.theme.backgroundsecondary, + borderColor: Settings.theme.backgroundsecondary, + color: Settings.theme.secondary + } const iconButtonStyle = { maxWidth: "25px", minWidth: "25px", minHeight: '38.5px', maxHeight: '38.5px', - ...(editingCurrentScript ? { - background: Settings.theme.button, - borderColor: Settings.theme.button, - color: Settings.theme.primary - } : { - background: Settings.theme.backgroundsecondary, - borderColor: Settings.theme.backgroundsecondary, - color: Settings.theme.secondary - }) + ...colorProps }; return ( {hostname}:~/{fileName} {dirty(index)}