mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-05 19:20:12 +08:00
feat: show modal on quest completing
TODO: use setTimeout for now need to change to capture user's activity in container in the future
This commit is contained in:
1 parent
4ad1b865d6
commit
5e1457c007
2 files changed
+13
-2
No files matched your search
@@ -1,5 +1,5 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted } from 'vue'
|
import { onMounted, ref } from 'vue'
|
||||||
import socket from '../utils/socket'
|
import socket from '../utils/socket'
|
||||||
import sessionManager from '../utils/session'
|
import sessionManager from '../utils/session'
|
||||||
import CommandlistPart from '../components/CommandlistPart.vue'
|
import CommandlistPart from '../components/CommandlistPart.vue'
|
||||||
@@ -10,6 +10,8 @@ import VisualizationPart from '../components/VisualizationPart.vue'
|
|||||||
import ControlPalette from '../components/ControlPalette.vue'
|
import ControlPalette from '../components/ControlPalette.vue'
|
||||||
import CompleteModal from '../components/CompleteModal.vue'
|
import CompleteModal from '../components/CompleteModal.vue'
|
||||||
|
|
||||||
|
const completed = ref(false)
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await sessionManager.lastOrCreate()
|
await sessionManager.lastOrCreate()
|
||||||
socket.connect(sessionManager.getSession())
|
socket.connect(sessionManager.getSession())
|
||||||
@@ -29,6 +31,14 @@ onMounted(async () => {
|
|||||||
sessionManager.setTasks(tasks)
|
sessionManager.setTasks(tasks)
|
||||||
})
|
})
|
||||||
socket.on('message', console.log)
|
socket.on('message', console.log)
|
||||||
|
socket.on('status', (event) => {
|
||||||
|
console.log('status', event)
|
||||||
|
if (event === 'finished') {
|
||||||
|
setTimeout(() => {
|
||||||
|
completed.value = true
|
||||||
|
}, 5000)
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -65,7 +75,7 @@ onMounted(async () => {
|
|||||||
</div>
|
</div>
|
||||||
<ControlPalette />
|
<ControlPalette />
|
||||||
</div>
|
</div>
|
||||||
<CompleteModal />
|
<CompleteModal v-if="completed" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script></script>
|
<script></script>
|
||||||
@@ -50,6 +50,7 @@ export default class SessionHandler {
|
|||||||
if (stage.id === 'END') {
|
if (stage.id === 'END') {
|
||||||
this.session.status = 'finished'
|
this.session.status = 'finished'
|
||||||
this.session.finishedAt = new Date()
|
this.session.finishedAt = new Date()
|
||||||
|
pushToSession(this.session.id, 'status', 'finished')
|
||||||
}
|
}
|
||||||
|
|
||||||
this.addNewTasks()
|
this.addNewTasks()
|
||||||
|
|||||||
Reference in new issue
Block a user