feat: toggle chain set theme-color

This commit is contained in:
Alisa | Side.one 2023-06-08 17:20:34 +08:00
parent 7fe56465b5
commit d822430d6a
4 changed files with 9 additions and 2 deletions

View File

@ -8,6 +8,7 @@
"min_tx_fee": "5000000000000000",
"addr_prefix": "evmos",
"logo": "/logos/evmos.png",
// "theme_color": "159 94% 51%",
"keplr_features": ["ibc-transfer", "ibc-go", "eth-address-gen", "eth-key-sign"],
"assets": [{
"base": "aevmos",

View File

@ -9,6 +9,7 @@
"min_tx_fee": "800",
"addr_prefix": "osmo",
"logo": "/logos/osmosis.jpg",
// "theme_color": "99 40% 21%",
"assets": [{
"base": "uosmo",
"symbol": "OSMO",

View File

@ -35,7 +35,6 @@ export const useBlockchain = defineStore('blockchain', {
},
getters: {
current(): ChainConfig | undefined {
console.log(this.dashboard.chains[this.chainName], 'jljfkj')
return this.dashboard.chains[this.chainName];
},
logo(): string {
@ -58,16 +57,21 @@ export const useBlockchain = defineStore('blockchain', {
},
computedChainMenu() {
let currNavItem: VerticalNavItems = [];
const router = useRouter();
const routes = router?.getRoutes() || [];
if (this.current && routes) {
if (this.current?.themeColor) {
document.body.style.setProperty('--p', `${this.current?.themeColor}`);
}else {
document.body.style.setProperty('--p', '237.65 100% 70%');
}
currNavItem = [
{
title: this.current?.prettyName || this.chainName || '',
icon: { image: this.current.logo, size: '22' },
i18n: false,
badgeContent: this.isConsumerChain ? 'Consumer' : undefined,
themeColor: this.current?.themeColor,
badgeClass: 'bg-error',
children: routes
.filter((x) => x.meta.i18n) // defined menu name

View File

@ -166,6 +166,7 @@ export function fromLocal(lc: LocalConfig): ChainConfig {
conf.logo = lc.logo;
conf.keplrFeatures = lc.keplr_features;
conf.keplrPriceStep = lc.keplr_price_step;
conf.themeColor = lc.theme_color;
return conf;
}