Skip to content

Commit 19a5d95

Browse files
display page on dashboard if staking is supported
1 parent f67873f commit 19a5d95

File tree

6 files changed

+18
-12
lines changed

6 files changed

+18
-12
lines changed

src/components/page.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ export const symbol = (name: string) => {
2727
target.symbol = name;
2828
}
2929
}
30-
30+
export const enableStaking = () => {
31+
return (target: any) => {
32+
target.enableStaking = true;
33+
}
34+
}
3135

3236
/**
3337
* Abstract Page

src/pages/csc.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@ CSC Network
33
44
55
*/
6-
import { xml, useState, reactive, useRef, } from "@odoo/owl";
7-
import { useContract, useWallet, switchChain } from "@web/core/wallet"
8-
import { OPage } from "@web/components/page";
6+
import { useState } from "@odoo/owl";
7+
import { OPage, enableStaking, logo, route, symbol, themplate, title } from "../components/page";
8+
import { switchChain, useContract, useWallet } from "../core/wallet";
99

10-
import cetABI from "@web/data/csc-validators.json"
11-
12-
import "./csc.xml";
10+
import cetABI from "../data/csc-validators.json";
1311
import "./csc.scss";
14-
import { logo, route, symbol, themplate, title } from "../components/page";
12+
import "./csc.xml";
1513

1614
const genzAdderss = "0xEAfF084e6da9aFE8EcAB4d85de940e7d3153296F";
1715
const testAddress = "0x42eAcf5b37540920914589a6B1b5e45d82D0C1ca";
@@ -26,6 +24,7 @@ const mainnetChainId = "0x34";
2624
@logo('./img/csc.svg')
2725
@themplate('pages.csc')
2826
@symbol('CET')
27+
@enableStaking()
2928
export class CscStakingPage extends OPage {
3029

3130
wallet = useWallet();

src/pages/dashboard.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<!-- Content Row -->
1212
<div class="row">
1313
<t t-foreach="state.pages" t-key="route" t-as="page">
14-
<div class="col-xl-3 col-md-6 mb-4">
14+
<div t-if="page.enableStaking" class="col-xl-3 col-md-6 mb-4">
1515
<div class="card border-left-success shadow h-100 py-2 ">
1616
<div class="card-body">
1717
<div class="row no-gutters align-items-center">

src/pages/fantom.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import { useContract, useWallet, switchChain } from "@web/core/wallet";
2828
import FantomABI from "@web/data/fantom.json"
2929
import "./fantom.xml";
3030
import "./fantom.scss";
31-
import { route, OPage, title, logo, themplate, symbol } from "../components/page";
31+
import { route, OPage, title, logo, themplate, symbol, enableStaking } from "../components/page";
3232

3333

3434
const genzAdderss = "0x5a1b57f87b59e093d332c945c66b602843099f97";
@@ -44,6 +44,7 @@ const mainnetChainId = "0xfa";
4444
@logo('./img/fantom.svg')
4545
@themplate('pages.fantom')
4646
@symbol('FAT')
47+
@enableStaking()
4748
export class FantomStaking extends OPage {
4849

4950
wallet = useWallet();

src/pages/polygon.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useState } from "@odoo/owl";
22
import { switchChain, useContract, useWallet } from "../core/wallet";
3-
import { OPage, logo, route, symbol, themplate, title } from "../components/page";
3+
import { OPage, enableStaking, logo, route, symbol, themplate, title } from "../components/page";
44

55

66
import MaticABI from "../data/polygon-matic.json";
@@ -21,6 +21,7 @@ const mainnetChainId = "0x89";
2121
@logo('./img/matic.jpg')
2222
@themplate('pages.polygon')
2323
@symbol('MATIC')
24+
@enableStaking()
2425
export class MaticStaking extends OPage {
2526

2627
wallet = useWallet();

src/pages/sGTON.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Component, xml, useState, reactive, useRef, } from "@odoo/owl";
22
import { useContract, useWallet, switchChain } from "@web/core/wallet";
3-
import { route, OPage, title, logo, themplate } from "../components/page";
3+
import { route, OPage, title, logo, themplate, enableStaking } from "../components/page";
44

55

66
import sGTONABI from "@web/data/sGTON.json"
@@ -20,6 +20,7 @@ const mainnetChainId = "0x1";
2020
@title('sGTON (sGTON)')
2121
@logo('./img/sGTON.jpeg')
2222
@themplate('pages.sGTON')
23+
@enableStaking()
2324
export class sGTONStaking extends OPage {
2425

2526
wallet = useWallet();

0 commit comments

Comments
 (0)