Add saves manager button to NaN detected screen

This commit is contained in:
thepaperpilot 2021-07-02 08:48:34 -05:00
parent 3671a072a1
commit 43790603d4
3 changed files with 36 additions and 56 deletions

View file

@ -53,18 +53,19 @@ export default {
.container > * {
margin: 0 4px;
}
</style>
<style>
.danger {
position: relative;
border: solid 2px var(--danger);
padding-right: 0;
border-right-width: 16px;
}
.danger::after {
position: absolute;
content: "!";
color: white;
background: var(--danger);
padding: 2px;
margin-left: 6px;
height: 100%;
right: -13px;
}
</style>

View file

@ -98,18 +98,4 @@ export default {
margin: 0;
margin-right: 4px;
}
.danger {
border: solid 2px var(--danger);
padding-right: 0;
}
.danger::after {
content: "!";
color: white;
background: var(--danger);
padding: 2px;
margin-left: 6px;
height: 100%;
}
</style>

View file

@ -1,27 +1,31 @@
<template>
<Modal :show="show">
<div slot="header" class="nan-modal-header">
<h2>NaN value detected!</h2>
</div>
<div slot="body">
<div>Attempted to assign NaN value to "{{ property }}" (previously {{ format(previous) }}). Auto-saving has been {{ autosave ? 'enabled' : 'disabled' }}. Check the console for more details, and consider sharing it with the developers on discord.</div>
<br>
<div>
<a :href="discordLink" class="nan-modal-discord-link">
<img src="images/discord.png" class="nan-modal-discord" />
{{ discordName }}
</a>
<div v-frag>
<Modal :show="show">
<div slot="header" class="nan-modal-header">
<h2>NaN value detected!</h2>
</div>
<br>
<Toggle title="Autosave" :value="autosave" @change="setAutosave" />
</div>
<div slot="footer" class="nan-footer">
<button @click="setZero" class="button">Set to 0</button>
<button @click="setOne" class="button">Set to 1</button>
<button @click="setPrev" class="button" v-if="previous && previous.neq(0) && previous.neq(1)">Set to previous</button>
<button @click="ignore" class="button danger">Ignore</button>
</div>
</Modal>
<div slot="body">
<div>Attempted to assign NaN value to "{{ property }}" (previously {{ format(previous) }}). Auto-saving has been {{ autosave ? 'enabled' : 'disabled' }}. Check the console for more details, and consider sharing it with the developers on discord.</div>
<br>
<div>
<a :href="discordLink" class="nan-modal-discord-link">
<img src="images/discord.png" class="nan-modal-discord" />
{{ discordName }}
</a>
</div>
<br>
<Toggle title="Autosave" :value="autosave" @change="setAutosave" />
</div>
<div slot="footer" class="nan-footer">
<button @click="toggleSavesManager" class="button">Open Saves Manager</button>
<button @click="setZero" class="button">Set to 0</button>
<button @click="setOne" class="button">Set to 1</button>
<button @click="setPrev" class="button" v-if="previous && previous.neq(0) && previous.neq(1)">Set to previous</button>
<button @click="ignore" class="button danger">Ignore</button>
</div>
</Modal>
<SavesManager :show="showSaves" @closeDialog="toggleSavesManager" />
</div>
</template>
<script>
@ -33,7 +37,7 @@ export default {
name: 'NaNScreen',
data() {
const { discordName, discordLink } = modInfo;
return { discordName, discordLink, format };
return { discordName, discordLink, format, showSaves: false };
},
computed: {
show() {
@ -67,6 +71,9 @@ export default {
},
setAutosave(autosave) {
player.autosave = autosave;
},
toggleSavesManager() {
this.showSaves = !this.showSaves;
}
}
};
@ -97,18 +104,4 @@ export default {
margin: 0;
margin-right: 4px;
}
.danger {
border: solid 2px var(--danger);
padding-right: 0;
}
.danger::after {
content: "!";
color: white;
background: var(--danger);
padding: 2px;
margin-left: 6px;
height: 100%;
}
</style>