aboutsummaryrefslogtreecommitdiff
path: root/src-vue/src/components
diff options
context:
space:
mode:
authorAlystrasz <contact@remyraes.com>2022-09-27 23:46:40 +0200
committerAlystrasz <contact@remyraes.com>2022-09-27 23:46:40 +0200
commit5c389c65d00accfb75277e4c91b40899e6f3c79f (patch)
treec4aa953ded5a7e6259eb890e66bc5d6f5e8272fb /src-vue/src/components
parent3fbff7947f206561d3dde7ad01b8712ee7c59311 (diff)
downloadFlightCore-5c389c65d00accfb75277e4c91b40899e6f3c79f.tar.gz
FlightCore-5c389c65d00accfb75277e4c91b40899e6f3c79f.zip
refactor: export PlayButton component to dedicated file
Diffstat (limited to 'src-vue/src/components')
-rw-r--r--src-vue/src/components/PlayButton.vue49
1 files changed, 49 insertions, 0 deletions
diff --git a/src-vue/src/components/PlayButton.vue b/src-vue/src/components/PlayButton.vue
new file mode 100644
index 00000000..0cb75c94
--- /dev/null
+++ b/src-vue/src/components/PlayButton.vue
@@ -0,0 +1,49 @@
+<script lang="ts">
+import { NorthstarState } from '../utils/NorthstarState';
+
+export default {
+ name: 'PlayButton',
+ data() {},
+ computed: {
+ playButtonLabel(): string {
+ if (this.$store.state.northstar_is_running) {
+ return "Game is running";
+ }
+
+ switch(this.$store.state.northstar_state) {
+ case NorthstarState.INSTALL:
+ return "Install";
+ case NorthstarState.INSTALLING:
+ return "Installing..."
+ case NorthstarState.MUST_UPDATE:
+ return "Update";
+ case NorthstarState.UPDATING:
+ return "Updating...";
+ case NorthstarState.READY_TO_PLAY:
+ return "Launch game";
+
+ default:
+ return "";
+ }
+ }
+ },
+ methods: {
+ launchGame() {
+ this.$store.commit('launchGame');
+ }
+ }
+};
+</script>
+
+<template>
+ <el-button :disabled="northstarIsRunning" type="primary" size="large" @click="launchGame" class="fc_launch__button">
+ {{ playButtonLabel }}
+ </el-button>
+</template>
+
+<style scoped>
+.fc_launch__button:focus {
+ background-color: var(--el-color-primary);
+ border-color: var(--el-color-primary);
+}
+</style>