mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-30 03:23:48 +01:00
added logic to display server on save dialog
*added logic to display external servers as red
This commit is contained in:
parent
ca28582265
commit
26002e0429
@ -648,7 +648,7 @@ export function Root(props: IProps): React.ReactElement {
|
|||||||
const serverScriptIndex = server.scripts.findIndex((script) => script.filename === closingScript.fileName);
|
const serverScriptIndex = server.scripts.findIndex((script) => script.filename === closingScript.fileName);
|
||||||
if (serverScriptIndex === -1 || savedScriptCode !== server.scripts[serverScriptIndex as number].code) {
|
if (serverScriptIndex === -1 || savedScriptCode !== server.scripts[serverScriptIndex as number].code) {
|
||||||
PromptEvent.emit({
|
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) => {
|
resolve: (result: boolean) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
// Save changes
|
// Save changes
|
||||||
@ -779,20 +779,23 @@ export function Root(props: IProps): React.ReactElement {
|
|||||||
{openScripts.map(({ fileName, hostname }, index) => {
|
{openScripts.map(({ fileName, hostname }, index) => {
|
||||||
const editingCurrentScript = currentScript?.fileName === openScripts[index].fileName &&
|
const editingCurrentScript = currentScript?.fileName === openScripts[index].fileName &&
|
||||||
currentScript?.hostname === openScripts[index].hostname
|
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 = {
|
const iconButtonStyle = {
|
||||||
maxWidth: "25px",
|
maxWidth: "25px",
|
||||||
minWidth: "25px",
|
minWidth: "25px",
|
||||||
minHeight: '38.5px',
|
minHeight: '38.5px',
|
||||||
maxHeight: '38.5px',
|
maxHeight: '38.5px',
|
||||||
...(editingCurrentScript ? {
|
...colorProps
|
||||||
background: Settings.theme.button,
|
|
||||||
borderColor: Settings.theme.button,
|
|
||||||
color: Settings.theme.primary
|
|
||||||
} : {
|
|
||||||
background: Settings.theme.backgroundsecondary,
|
|
||||||
borderColor: Settings.theme.backgroundsecondary,
|
|
||||||
color: Settings.theme.secondary
|
|
||||||
})
|
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<Draggable
|
<Draggable
|
||||||
@ -820,15 +823,7 @@ export function Root(props: IProps): React.ReactElement {
|
|||||||
if (e.button === 1) onTabClose(index);
|
if (e.button === 1) onTabClose(index);
|
||||||
}}
|
}}
|
||||||
style={{
|
style={{
|
||||||
...(editingCurrentScript ? {
|
...colorProps
|
||||||
background: Settings.theme.button,
|
|
||||||
borderColor: Settings.theme.button,
|
|
||||||
color: Settings.theme.primary
|
|
||||||
} : {
|
|
||||||
background: Settings.theme.backgroundsecondary,
|
|
||||||
borderColor: Settings.theme.backgroundsecondary,
|
|
||||||
color: Settings.theme.secondary
|
|
||||||
})
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{hostname}:~/{fileName} {dirty(index)}
|
{hostname}:~/{fileName} {dirty(index)}
|
||||||
|
Loading…
Reference in New Issue
Block a user