Skip to content

Commit

Permalink
🌐 Add locale to route
Browse files Browse the repository at this point in the history
  • Loading branch information
williamchong authored and nwingt committed Feb 17, 2023
1 parent 97b2cb5 commit 4d8a142
Show file tree
Hide file tree
Showing 16 changed files with 86 additions and 58 deletions.
22 changes: 13 additions & 9 deletions src/components/EventModal/Collect/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -326,18 +326,22 @@ export default {
}
},
goToNFTDetails() {
this.$router.push({
name: 'nft-class-classId-nftId',
params: { classId: this.classId, nftId: this.justCollectedNFTId },
});
this.$router.push(
this.localeLocation({
name: 'nft-class-classId-nftId',
params: { classId: this.classId, nftId: this.justCollectedNFTId },
})
);
this.uiCloseTxModal();
},
goToPortfolio() {
this.$router.push({
name: 'id',
params: { id: this.getAddress },
query: { tab: 'collected' },
});
this.$router.push(
this.localeLocation({
name: 'id',
params: { id: this.getAddress },
query: { tab: 'collected' },
})
);
this.uiCloseTxModal();
},
onClickModelViewer() {
Expand Down
4 changes: 3 additions & 1 deletion src/components/NFTAboutPage/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,9 @@ export default {
);
},
handleCollect(classId) {
this.$router.push({ name: 'writing-nft', hash: `#${classId}` });
this.$router.push(
this.localeLocation({ name: 'writing-nft', hash: `#${classId}` })
);
},
handleCollectFromWidgetSection(classId) {
logTrackerEvent(this, 'NFTAboutPage', 'GoToCampaign(Widget)', classId, 1);
Expand Down
16 changes: 9 additions & 7 deletions src/components/NFTPage/CollectorList/Item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,15 @@ export default {
},
methods: {
handleRowClick() {
this.$router.push({
name: 'nft-class-classId-nftId',
params: {
classId: this.classId,
nftId: this.owner.collectedFirstNFTId,
},
});
this.$router.push(
this.localeLocation({
name: 'nft-class-classId-nftId',
params: {
classId: this.classId,
nftId: this.owner.collectedFirstNFTId,
},
})
);
},
},
};
Expand Down
10 changes: 6 additions & 4 deletions src/components/NFTPage/EventList/Table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,12 @@ export default {
methods: {
getChainExplorerTx,
handleRowClick(event) {
this.$router.push({
name: event.nftId ? 'nft-class-classId-nftId' : 'nft-class-classId',
params: { classId: event.classId, nftId: event.nftId },
});
this.$router.push(
this.localeLocation({
name: event.nftId ? 'nft-class-classId-nftId' : 'nft-class-classId',
params: { classId: event.classId, nftId: event.nftId },
})
);
},
},
};
Expand Down
4 changes: 3 additions & 1 deletion src/components/SettingsPageHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ export default {
.split('-')
.slice(0, -1)
.join('-');
if (backRouteName) this.$router.push({ name: backRouteName });
if (backRouteName) {
this.$router.push(this.localeLocation({ name: backRouteName }));
}
},
},
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/SiteHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
>
<NuxtLink
class="w-[90px] hover:scale-105 active:scale-100 transition-transform"
:disabled="getHomeRoute.name === $route.name"
:disabled="localeLocation(getHomeRoute).name === $route.name"
:to="localeLocation(getHomeRoute)"
>
<Logo class="fill-current" />
Expand Down
2 changes: 1 addition & 1 deletion src/mixins/navigation-listener.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default {
event.data.type === 'navigate' &&
event.data.route
) {
this.$router.push(event.data.route);
this.$router.push(this.localeLocation(event.data.route));
}
},
},
Expand Down
10 changes: 6 additions & 4 deletions src/mixins/nft.js
Original file line number Diff line number Diff line change
Expand Up @@ -880,10 +880,12 @@ export default {
}
},
goNFTDetails() {
this.$router.push({
name: 'nft-class-classId',
params: { classId: this.classId },
});
this.$router.push(
this.localeLocation({
name: 'nft-class-classId',
params: { classId: this.classId },
})
);
},
normalizeNFTMessage(m) {
if (m.memo === 'like.co NFT API') return '';
Expand Down
8 changes: 5 additions & 3 deletions src/mixins/wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,11 @@ export default {
this.navigateToMyDashboard();
}
} else {
this.$router.push({
name: 'dashboard',
});
this.$router.push(
this.localeLocation({
name: 'dashboard',
})
);
}
},
navigateToSettings() {
Expand Down
10 changes: 6 additions & 4 deletions src/pages/_id/index/subscribe/_subscriptionId.vue
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,12 @@ export default {
methods: {
...mapActions(['lazyGetUserInfoByAddress']),
handleClickClose() {
this.$router.replace({
name: 'id',
params: { id: this.wallet },
});
this.$router.replace(
this.localeLocation({
name: 'id',
params: { id: this.wallet },
})
);
},
handleClickConfirm() {
return this.isSubscribePage
Expand Down
10 changes: 6 additions & 4 deletions src/pages/dashboard/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,12 @@ export default {
},
goMyPortfolio() {
logTrackerEvent(this, 'MyDashboard', 'GoToMyPortfolio', this.wallet, 1);
this.$router.push({
name: 'id',
params: { id: this.wallet },
});
this.$router.push(
this.localeLocation({
name: 'id',
params: { id: this.wallet },
})
);
},
},
};
Expand Down
2 changes: 1 addition & 1 deletion src/pages/logout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default {
async mounted() {
window.open(LIKECOIN_LOGOUT_POPUP_URL);
await this.userLogout();
this.$router.replace(this.getHomeRoute);
this.$router.replace(this.localeLocation(this.getHomeRoute));
},
methods: {
...mapActions(['userLogout']),
Expand Down
20 changes: 12 additions & 8 deletions src/pages/nft/class/_classId/_nftId.vue
Original file line number Diff line number Diff line change
Expand Up @@ -550,10 +550,12 @@ export default {
onSelectNFT(e) {
const { value: nftId } = e.target;
logTrackerEvent(this, 'NFT', 'nft_details_select_nft', nftId, 1);
this.$router.push({
name: 'nft-class-classId-nftId',
params: { classId: this.classId, nftId },
});
this.$router.push(
this.localeLocation({
name: 'nft-class-classId-nftId',
params: { classId: this.classId, nftId },
})
);
},
onToggleTransfer() {
this.isOpenTransferModal = true;
Expand Down Expand Up @@ -644,10 +646,12 @@ export default {
this.nftId,
1
);
this.$router.push({
name: 'nft-class-classId-nftId',
params: { classId: this.classId, nftId: this.nftIdCollectNext },
});
this.$router.push(
this.localeLocation({
name: 'nft-class-classId-nftId',
params: { classId: this.classId, nftId: this.nftIdCollectNext },
})
);
},
handleClickUserCollectedCount() {
logTrackerEvent(
Expand Down
10 changes: 6 additions & 4 deletions src/pages/nft/class/_classId/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -379,10 +379,12 @@ export default {
this.nftId,
1
);
this.$router.push({
name: 'nft-class-classId-nftId',
params: { classId: this.classId, nftId: this.nftIdCollectNext },
});
this.$router.push(
this.localeLocation({
name: 'nft-class-classId-nftId',
params: { classId: this.classId, nftId: this.nftIdCollectNext },
})
);
},
handleClickSellFromPriceSection() {
logTrackerEvent(
Expand Down
12 changes: 7 additions & 5 deletions src/pages/nft/fiat/stripe.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ export default {
uiIsOpenCollectModal(isOpen) {
if (!isOpen) {
if (this.classId) {
this.$router.replace({
name: 'nft-class-classId',
params: { classId: this.classId },
});
this.$router.replace(
this.localeLocation({
name: 'nft-class-classId',
params: { classId: this.classId },
})
);
} else {
this.$router.replace('/');
this.$router.replace(this.localeLocation({ name: 'index' }));
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/pages/oauth/redirect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default {
if (postAuthRoute) {
this.$router.replace(postAuthRoute);
} else {
this.$router.replace(this.getHomeRoute);
this.$router.replace(this.localeLocation(this.getHomeRoute));
}
} catch (err) {
const errData = err.response || err;
Expand Down

0 comments on commit 4d8a142

Please sign in to comment.