aboutsummaryrefslogtreecommitdiff
path: root/src-vue/src/plugins/store.ts
diff options
context:
space:
mode:
authorRémy Raes <contact@remyraes.com>2022-11-30 18:48:45 +0100
committerGitHub <noreply@github.com>2022-11-30 18:48:45 +0100
commitd61f3fe1b0c9f4461d33f289b3100465d77999ad (patch)
tree80d03616cc2475a242ce315f7007d4152cfd3bfe /src-vue/src/plugins/store.ts
parente301086cbb26fcb1d9e520c016b00233aba0f315 (diff)
downloadFlightCore-d61f3fe1b0c9f4461d33f289b3100465d77999ad.tar.gz
FlightCore-d61f3fe1b0c9f4461d33f289b3100465d77999ad.zip
feat: Release channel selector (#86)
* refactor: Move release channel button to settings * chore: Revert single newline removal * feat: add basic selector * feat: add basic selector style (to match button style) * fix: remove box-shadow on selector * feat: selector displays release canal from UI store * refactor: export toggleReleaseCandidate to store, for it to be used by release canal selector * feat: selector effectively changes release canal * fix: selector members typing issue * refactor: adjust selector labels * refactor: remove channel switching button Since the channel selector on the play view allows users to switch channels, this button is now useless. * feat: add a switch to toggle releases switching * feat: switch only appears if corresponding flag is enabled * feat: adjust button corners regarding releases switching state * feat: switch value is saved in persistent store * refactor: update release candidate label * fix: set release canal to RELEASE when switch is toggled off
Diffstat (limited to 'src-vue/src/plugins/store.ts')
-rw-r--r--src-vue/src/plugins/store.ts28
1 files changed, 28 insertions, 0 deletions
diff --git a/src-vue/src/plugins/store.ts b/src-vue/src/plugins/store.ts
index 8e793ced..e2246c44 100644
--- a/src-vue/src/plugins/store.ts
+++ b/src-vue/src/plugins/store.ts
@@ -28,6 +28,7 @@ export interface FlightCoreStore {
installed_northstar_version: string,
northstar_state: NorthstarState,
northstar_release_canal: ReleaseCanal,
+ enableReleasesSwitch: boolean,
releaseNotes: ReleaseInfo[],
thunderstoreMods: ThunderstoreMod[],
@@ -51,6 +52,7 @@ export const store = createStore<FlightCoreStore>({
installed_northstar_version: "",
northstar_state: NorthstarState.GAME_NOT_FOUND,
northstar_release_canal: ReleaseCanal.RELEASE,
+ enableReleasesSwitch: false,
releaseNotes: [],
thunderstoreMods: [],
@@ -248,6 +250,26 @@ export const store = createStore<FlightCoreStore>({
position: 'bottom-right'
});
});
+ },
+ async toggleReleaseCandidate(state: FlightCoreStore) {
+ // Flip between RELEASE and RELEASE_CANDIDATE
+ state.northstar_release_canal = state.northstar_release_canal === ReleaseCanal.RELEASE
+ ? ReleaseCanal.RELEASE_CANDIDATE
+ : ReleaseCanal.RELEASE;
+
+ // Save change in persistent store
+ await persistentStore.set('northstar-release-canal', { value: state.northstar_release_canal });
+
+ // Update current state so that update check etc can be performed
+ store.commit("checkNorthstarUpdates");
+
+ // Display notification to highlight change
+ ElNotification({
+ title: `${state.northstar_release_canal}`,
+ message: `Switched release channel to: "${state.northstar_release_canal}"`,
+ type: 'success',
+ position: 'bottom-right'
+ });
}
}
});
@@ -278,6 +300,12 @@ async function _initializeApp(state: any) {
console.log("Value not found in store");
}
+ // Grab "Enable releases switching" setting from store if possible
+ const valueFromStore: {value: boolean} | null = await persistentStore.get('northstar-releases-switching');
+ if (valueFromStore) {
+ state.enableReleasesSwitch = valueFromStore.value;
+ }
+
// Get FlightCore version number
state.flightcore_version = await invoke("get_flightcore_version_number");