diff options
author | GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> | 2022-10-04 22:05:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-04 22:05:26 +0200 |
commit | dd2f37620b8a4d925bdb55badfb598c30d9c5ba8 (patch) | |
tree | e1f79d454123f51d2a5c0adbc9d4eeee07186df5 /src-vue/src/components/PlayButton.vue | |
parent | 7f0ee9be80988f13f1d234136725a03db0335ec5 (diff) | |
parent | 5912e98a02e799b7ad6c910567fe18988ab84798 (diff) | |
download | FlightCore-dd2f37620b8a4d925bdb55badfb598c30d9c5ba8.tar.gz FlightCore-dd2f37620b8a4d925bdb55badfb598c30d9c5ba8.zip |
Merge pull request #2 from Alystrasz/feat/new-ui
Full UI rework
Diffstat (limited to 'src-vue/src/components/PlayButton.vue')
-rw-r--r-- | src-vue/src/components/PlayButton.vue | 69 |
1 files changed, 69 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..8e0b4149 --- /dev/null +++ b/src-vue/src/components/PlayButton.vue @@ -0,0 +1,69 @@ +<script lang="ts"> +import { defineComponent } from 'vue'; +import { NorthstarState } from '../utils/NorthstarState'; +import { ReleaseCanal } from '../utils/ReleaseCanal'; + +export default defineComponent({ + name: 'PlayButton', + computed: { + playButtonLabel(): string { + if (this.$store.state.northstar_is_running) { + return "Game is running"; + } + + switch(this.$store.state.northstar_state) { + case NorthstarState.GAME_NOT_FOUND: + return "Titanfall2 not found"; + 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 ""; + } + }, + northstarIsRunning(): boolean { + return this.$store.state.northstar_is_running; + }, + options(): {key: string, value: string}[] { + return Object.keys(ReleaseCanal).map(function (v) { + return { + key: v, + value: Object.keys(ReleaseCanal)[Object.values(ReleaseCanal).indexOf(v)] + } + }); + } + }, + 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> +button { + text-transform: uppercase; + border-radius: 2px; + padding: 30px; + font-size: 15px; +} +.fc_launch__button:focus { + background-color: var(--el-color-primary); + border-color: var(--el-color-primary); +} +</style> |