Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.

Commit

Permalink
Hide app store search bar in stable channel (#38)
Browse files Browse the repository at this point in the history
* Hide app store search bar in stable channel

* Update Citadel SDK

* Implement getting update channel

* Workaround for import

* Better workaround
  • Loading branch information
AaronDewes authored Jun 10, 2022
1 parent 58f8017 commit 07b501d
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"dependencies": {
"@aarondewes/vue-slider-component": "^3.2.16",
"@bitcoin-design/bitcoin-icons-vue": "^0.1.9",
"@runcitadel/sdk": "^0.4.0-beta.3",
"@runcitadel/sdk": "^0.5.0",
"@vue/compat": "^3.2.31",
"bignumber.js": "^9.0.2",
"bootstrap": "^5.1.3",
Expand Down
2 changes: 1 addition & 1 deletion src/store/sdk.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Citadel from '@runcitadel/sdk';
import Citadel from '../../node_modules/@runcitadel/sdk/dist/index.js';
import {defineStore} from 'pinia';

export interface State {
Expand Down
15 changes: 15 additions & 0 deletions src/store/system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ export interface State {
cpuTemperatureUnit: 'celsius' | 'fahrenheit';
uptime: null | number;
isNvme: boolean;
// It can be anything, but these are the most likely
updateChannel: 'stable' | 'beta' | 'c-lightning' | string;
sdkStore: ReturnType<typeof useSdkStore>;
}

Expand Down Expand Up @@ -130,6 +132,7 @@ export default defineStore('system', {
cpuTemperatureUnit: 'celsius',
uptime: null,
isNvme: false,
updateChannel: 'stable',
sdkStore: useSdkStore(),
}),
actions: {
Expand All @@ -140,6 +143,18 @@ export default defineStore('system', {
this.version = version;
}
},
async getUpdateChannel() {
const data = await this.sdkStore.citadel.manager.system.getUpdateChannel(
'',
);
if (data) {
this.updateChannel = data;
}
},
async setUpdateChannel(channel: string) {
await this.sdkStore.citadel.manager.system.setUpdateChannel(channel);
this.updateChannel = channel;
},
getUnit() {
if (window.localStorage.getItem('unit')) {
this.unit = window.localStorage.getItem('unit') as 'sats' | 'btc';
Expand Down
6 changes: 3 additions & 3 deletions src/store/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,14 @@ export default defineStore('user', {
seed: string[];
}) {
if (!this.registered) {
const jwt = await this.sdkStore.citadel.manager.auth.register(
const response = await this.sdkStore.citadel.manager.auth.register(
name,
password,
seed,
);

if (jwt) {
this.setJwt(jwt);
if (response && response.jwt) {
this.setJwt(response.jwt);
this.registered = true;
this.seed = []; // Remove seed from store
}
Expand Down
4 changes: 4 additions & 0 deletions src/views/AppStore.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
</div>
</div>
<b-input
v-if="systemStore.updateChannel !== 'stable'"
v-model="searchQuery"
class="neu-input my-4"
placeholder="Search for apps"
Expand Down Expand Up @@ -97,11 +98,13 @@
<script lang="ts" setup>
import {computed, ref} from 'vue';
import useAppsStore, {app as appType} from '../store/apps';
import useSystemStore from '../store/system';
import Fuse from 'fuse.js';
import CardWidget from '../components/CardWidget.vue';
const appsStore = useAppsStore();
const systemStore = useSystemStore();
const showIncompatible = ref(false);
const searchQuery = ref('');
Expand Down Expand Up @@ -134,6 +137,7 @@ const categorizedAppStore = computed((): Record<string, appType[]> => {
});
appsStore.getAppStore();
systemStore.getUpdateChannel();
</script>

<style lang="scss" scoped>
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ __metadata:
dependencies:
"@aarondewes/vue-slider-component": ^3.2.16
"@bitcoin-design/bitcoin-icons-vue": ^0.1.9
"@runcitadel/sdk": ^0.4.0-beta.3
"@runcitadel/sdk": ^0.5.0
"@types/node": ^17.0.21
"@typescript-eslint/eslint-plugin": ^5.13.0
"@typescript-eslint/parser": ^5.13.0
Expand Down Expand Up @@ -190,13 +190,13 @@ __metadata:
languageName: unknown
linkType: soft

"@runcitadel/sdk@npm:^0.4.0-beta.3":
version: 0.4.0
resolution: "@runcitadel/sdk@npm:0.4.0"
"@runcitadel/sdk@npm:^0.5.0":
version: 0.5.0
resolution: "@runcitadel/sdk@npm:0.5.0"
peerDependencies:
"@types/react": ^18.0.5
react: ^18.0.0
checksum: a5bfb7a4cd7003bcb3117185e0ff008bef7fa8f63a5798afe7a5021bc18522a5ddd4277441838a145731238be42dcc43be102b9c336b806ed63ec4c43da2a341
checksum: 5b51e783c59d5e759acaae89ed9902e8fb3a22e92e96a455a0cffa08d9debe0a81095ba253784f42cfa7178dc3ff2f9a432e8191290915406c39fc1ffedfaed0
languageName: node
linkType: hard

Expand Down

0 comments on commit 07b501d

Please sign in to comment.