Skip to content

Commit

Permalink
fix #1076 #1416 (#1449)
Browse files Browse the repository at this point in the history
* fix #1076 #1416

* Update src/language/en-US.json

Co-authored-by: Xavi Artigas <xavierartigas@yahoo.es>

* update settings modal to select networkTab when opened from node selector

Co-authored-by: Xavi Artigas <xavierartigas@yahoo.es>
  • Loading branch information
bassemmagdy and segfaultxavi authored Jun 14, 2021
1 parent b1f8180 commit 11ec754
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/components/PeerSelector/PeerSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
:key="`sep${index}`"
class="list-item pointer"
:class="[{ active: currentPeerInfo.url == url }]"
@click="currentPeerInfo.url !== url ? switchPeer(url) : ''"
>
<div class="overflow_ellipsis" :title="friendlyName">
<div class="node-list-entry">{{ friendlyName }}</div>
Expand Down
1 change: 1 addition & 0 deletions src/components/PeerSelector/PeerSelectorTs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export class PeerSelectorTs extends Vue {
goSettings() {
this.poptipVisible = false;
this.$store.commit('profile/toggleSettings');
this.$store.commit('profile/toggleNetworkSettings', true);
}
onCloseNetworkModal() {
this.$store.dispatch('network/SET_NETWORK_IS_NOT_MATCHING_PROFILE', false);
Expand Down
7 changes: 6 additions & 1 deletion src/components/Settings/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
<img :src="settingsIcon" class="setting-menu-icon" />
<span>{{ $t('settings') }}</span>
</a>
<ModalSettings v-if="isSettingsVisible" :visible="isSettingsVisible" @close="toggleSettings" />
<ModalSettings
v-if="isSettingsVisible"
:network-settings-selected="isNetworkSettingsSelected"
:visible="isSettingsVisible"
@close="toggleSettings"
/>
</div>
</template>
<script lang="ts">
Expand Down
3 changes: 3 additions & 0 deletions src/components/Settings/SettingsTs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@ import { mapGetters } from 'vuex';
computed: {
...mapGetters({
isSettingsVisible: 'profile/isSettingsVisible',
isNetworkSettingsSelected: 'profile/isNetworkSettingsSelected',
}),
},
})
export class SettingsTs extends Vue {
public isSettingsVisible: boolean;
public isNetworkSettingsSelected: boolean;

public toggleSettings() {
this.$store.commit('profile/toggleSettings');
this.$store.commit('profile/toggleNetworkSettings', false);
}

public get settingsIcon() {
Expand Down
6 changes: 6 additions & 0 deletions src/store/Profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@ interface ProfileState {
currentProfile: ProfileModel;
isAuthenticated: boolean;
isSettingsVisible: boolean;
isNetworkSettingsSelected: boolean;
}

const profileState: ProfileState = {
initialized: false,
currentProfile: null,
isAuthenticated: false,
isSettingsVisible: false,
isNetworkSettingsSelected: false,
};
export default {
namespaced: true,
Expand All @@ -52,6 +54,7 @@ export default {
isPrivateKeyProfile: (state: ProfileState): boolean => {
return state.currentProfile ? !state.currentProfile.seed : false;
},
isNetworkSettingsSelected: (state: ProfileState) => state.isNetworkSettingsSelected,
},
mutations: {
setInitialized: (state: ProfileState, initialized: boolean) => {
Expand All @@ -62,6 +65,9 @@ export default {
toggleSettings: (state: ProfileState) => {
state.isSettingsVisible = !state.isSettingsVisible;
},
toggleNetworkSettings: (state: ProfileState, networkTabSelector: boolean) => {
state.isNetworkSettingsSelected = networkTabSelector;
},
},
actions: {
async initialize({ commit, getters }) {
Expand Down
4 changes: 4 additions & 0 deletions src/views/modals/ModalSettings/ModalSettingsTs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ enum SettingsTabs {
export class ModalSettingsTs extends Vue {
/// region component properties
@Prop({ default: false }) visible: boolean;
@Prop({ default: false }) networkSettingsSelected: boolean;
/// end-region component properties

/**
Expand Down Expand Up @@ -68,6 +69,9 @@ export class ModalSettingsTs extends Vue {
created() {
// when on /profiles route, only the NETWORK tab should be displayed
this.availableTabs = this.availableTabs.filter((key) => !!this.currentAccount || key === 'NETWORK');
if (this.networkSettingsSelected) {
this.currentTabIndex = 2;
}
}

/**
Expand Down

0 comments on commit 11ec754

Please sign in to comment.