2021-06-20 23:29:55 -05:00
|
|
|
<template>
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
<div class="save" :class="{ active }">
|
|
|
|
<div class="handle material-icons">drag_handle</div>
|
|
|
|
<div class="actions" v-if="!editing">
|
|
|
|
<feedback-button
|
|
|
|
@click="$emit('export')"
|
|
|
|
class="button"
|
|
|
|
left
|
|
|
|
v-if="save.error == undefined && !confirming"
|
|
|
|
>
|
|
|
|
<span class="material-icons">content_paste</span>
|
|
|
|
</feedback-button>
|
|
|
|
<button
|
|
|
|
@click="$emit('duplicate')"
|
|
|
|
class="button"
|
|
|
|
v-if="save.error == undefined && !confirming"
|
|
|
|
>
|
|
|
|
<span class="material-icons">content_copy</span>
|
|
|
|
</button>
|
|
|
|
<button
|
|
|
|
@click="toggleEditing"
|
|
|
|
class="button"
|
|
|
|
v-if="save.error == undefined && !confirming"
|
|
|
|
>
|
|
|
|
<span class="material-icons">edit</span>
|
|
|
|
</button>
|
|
|
|
<danger-button
|
|
|
|
:disabled="active"
|
|
|
|
@click="$emit('delete')"
|
|
|
|
@confirmingChanged="confirmingChanged"
|
|
|
|
>
|
|
|
|
<span class="material-icons" style="margin: -2px">delete</span>
|
|
|
|
</danger-button>
|
|
|
|
</div>
|
|
|
|
<div class="actions" v-else>
|
|
|
|
<button @click="changeName" class="button">
|
|
|
|
<span class="material-icons">check</span>
|
|
|
|
</button>
|
|
|
|
<button @click="toggleEditing" class="button">
|
|
|
|
<span class="material-icons">close</span>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
<div class="details" v-if="save.error == undefined && !editing">
|
|
|
|
<button class="button open" @click="$emit('open')">
|
|
|
|
<h3>{{ save.name }}</h3>
|
|
|
|
</button>
|
|
|
|
<span class="save-version">v{{ save.modVersion }}</span
|
|
|
|
><br />
|
|
|
|
<div v-if="time">Last played {{ dateFormat.format(time) }}</div>
|
|
|
|
</div>
|
|
|
|
<div class="details" v-else-if="save.error == undefined && editing">
|
|
|
|
<TextField v-model="newName" class="editname" @submit="changeName" />
|
|
|
|
</div>
|
|
|
|
<div v-else class="details error">Error: Failed to load save with id {{ save.id }}</div>
|
|
|
|
</div>
|
2021-06-20 23:29:55 -05:00
|
|
|
</template>
|
|
|
|
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
<script lang="ts">
|
|
|
|
import player from "@/game/player";
|
|
|
|
import { PlayerData } from "@/typings/player";
|
|
|
|
import { defineComponent, PropType } from "vue";
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
name: "save",
|
|
|
|
props: {
|
|
|
|
save: {
|
|
|
|
type: Object as PropType<Partial<PlayerData>>,
|
|
|
|
required: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
emits: ["export", "open", "duplicate", "delete", "editSave"],
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
dateFormat: new Intl.DateTimeFormat("en-US", {
|
|
|
|
year: "numeric",
|
|
|
|
month: "numeric",
|
|
|
|
day: "numeric",
|
|
|
|
hour: "numeric",
|
|
|
|
minute: "numeric",
|
|
|
|
second: "numeric"
|
|
|
|
}),
|
|
|
|
editing: false,
|
|
|
|
confirming: false,
|
|
|
|
newName: ""
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
active(): boolean {
|
|
|
|
return this.save.id === player.id;
|
|
|
|
},
|
|
|
|
time(): number | undefined {
|
|
|
|
return this.active ? player.time : this.save.time;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
confirmingChanged(confirming: boolean) {
|
|
|
|
this.confirming = confirming;
|
|
|
|
},
|
|
|
|
toggleEditing() {
|
|
|
|
this.newName = this.save.name || "";
|
|
|
|
this.editing = !this.editing;
|
|
|
|
},
|
|
|
|
changeName() {
|
|
|
|
this.$emit("editSave", this.newName);
|
|
|
|
this.editing = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2021-06-20 23:29:55 -05:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.save {
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
position: relative;
|
|
|
|
border: solid 4px var(--separator);
|
|
|
|
padding: 4px;
|
|
|
|
background: var(--secondary-background);
|
|
|
|
margin: var(--feature-margin);
|
|
|
|
display: flex;
|
2021-06-20 23:29:55 -05:00
|
|
|
align-items: center;
|
|
|
|
min-height: 30px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.save.active {
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
border-color: var(--bought);
|
2021-06-20 23:29:55 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
.open {
|
|
|
|
display: inline;
|
|
|
|
margin: 0;
|
|
|
|
padding-left: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.handle {
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
flex-grow: 0;
|
|
|
|
margin-right: 8px;
|
|
|
|
margin-left: 0;
|
|
|
|
cursor: pointer;
|
2021-06-20 23:29:55 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
.details {
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
margin: 0;
|
2021-06-20 23:29:55 -05:00
|
|
|
flex-grow: 1;
|
|
|
|
margin-right: 80px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.error {
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
font-size: 0.8em;
|
2021-06-20 23:29:55 -05:00
|
|
|
color: var(--danger);
|
|
|
|
}
|
|
|
|
|
|
|
|
.save-version {
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
margin-left: 4px;
|
|
|
|
font-size: 0.7em;
|
|
|
|
opacity: 0.7;
|
2021-06-20 23:29:55 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
.actions {
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
bottom: 0;
|
|
|
|
right: 4px;
|
|
|
|
display: flex;
|
|
|
|
padding: 4px;
|
|
|
|
background: inherit;
|
2021-06-20 23:29:55 -05:00
|
|
|
z-index: 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
.editname {
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
margin: 0;
|
2021-06-20 23:29:55 -05:00
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.save button {
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
transition-duration: 0s;
|
2021-06-20 23:29:55 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
.save .actions button {
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
display: flex;
|
|
|
|
font-size: 1.2em;
|
2021-06-20 23:29:55 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
.save .actions button .material-icons {
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
font-size: unset;
|
2021-06-20 23:29:55 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
.save .button.danger {
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
padding: 4px;
|
2021-06-20 23:29:55 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
.save .field {
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
margin: 0;
|
2021-06-20 23:29:55 -05:00
|
|
|
}
|
|
|
|
</style>
|