From a9f02d0166665d11691ae9c719236d69fa6d4161 Mon Sep 17 00:00:00 2001 From: Eduardo Jaeger Date: Tue, 15 Aug 2023 14:01:31 -0300 Subject: [PATCH 1/7] Turning off maps for other networks --- src/config/chains/eos/index.ts | 2 +- src/config/chains/jungle/index.ts | 2 +- src/config/chains/ux/index.ts | 2 +- src/config/chains/wax/index.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/config/chains/eos/index.ts b/src/config/chains/eos/index.ts index dc8e0393..025feaf6 100644 --- a/src/config/chains/eos/index.ts +++ b/src/config/chains/eos/index.ts @@ -31,7 +31,7 @@ const FUEL_RPC_ENDPOINT = { }; const API_ENDPOINT = 'https://example.com'; const S3_PRODUCER_BUCKET = 'https://telos-producer-validation.s3.amazonaws.com'; -const DISPLAY_MAP = true; +const DISPLAY_MAP = false; const THEME = { primary: '#28417c', secondary: '#000000', //disso diff --git a/src/config/chains/jungle/index.ts b/src/config/chains/jungle/index.ts index 1f55311e..bf2522ee 100644 --- a/src/config/chains/jungle/index.ts +++ b/src/config/chains/jungle/index.ts @@ -41,7 +41,7 @@ const RPC_ENDPOINT = { port: 443, }; const API_ENDPOINT = 'https://example.com'; -const DISPLAY_MAP = true; +const DISPLAY_MAP = false; const THEME = { primary: '#28417c', secondary: '#000000', //disso diff --git a/src/config/chains/ux/index.ts b/src/config/chains/ux/index.ts index 1e6dfb99..b4f6d819 100644 --- a/src/config/chains/ux/index.ts +++ b/src/config/chains/ux/index.ts @@ -23,7 +23,7 @@ const RPC_ENDPOINT = { }; const API_ENDPOINT = 'https://example.com'; const S3_PRODUCER_BUCKET = 'https://telos-producer-validation.s3.amazonaws.com'; -const DISPLAY_MAP = true; +const DISPLAY_MAP = false; const THEME = {}; export default class UX extends BaseChain { diff --git a/src/config/chains/wax/index.ts b/src/config/chains/wax/index.ts index 9cfbc6ed..077af1db 100644 --- a/src/config/chains/wax/index.ts +++ b/src/config/chains/wax/index.ts @@ -26,7 +26,7 @@ const RPC_ENDPOINT = { }; const API_ENDPOINT = 'https://example.com'; const S3_PRODUCER_BUCKET = 'https://telos-producer-validation.s3.amazonaws.com'; -const DISPLAY_MAP = true; +const DISPLAY_MAP = false; const THEME = {}; export default class EOS extends BaseChain { From e668f53bd5345be57892ae3fd66600620929c5a0 Mon Sep 17 00:00:00 2001 From: Eduardo Jaeger Date: Tue, 15 Aug 2023 17:23:10 -0300 Subject: [PATCH 2/7] Returning price chart --- src/pages/Network.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/Network.vue b/src/pages/Network.vue index 8a270cf1..da2f4018 100644 --- a/src/pages/Network.vue +++ b/src/pages/Network.vue @@ -131,7 +131,7 @@ export default defineComponent({
- + From b7cb2c57856b3e91c44c1df0baee5764fad175b5 Mon Sep 17 00:00:00 2001 From: donnyquixotic Date: Mon, 21 Aug 2023 13:00:23 -0500 Subject: [PATCH 3/7] refactor: update useRouteDataNetwork type --- src/router/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/router/index.ts b/src/router/index.ts index 2a6cd883..f8386b4b 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -3,7 +3,7 @@ import { createRouter, createWebHistory } from 'vue-router'; import { StateInterface } from 'src/store'; import routes from 'src/router/routes'; import ConfigManager from 'src/config/ConfigManager'; -import { computed, reactive } from 'vue'; +import { ComputedRef, computed, reactive } from 'vue'; const configMgr = ConfigManager.get(); @@ -67,6 +67,6 @@ export default route(function (/* { store, ssrContext } */) { return Router; }); -export function useRouteDataNetwork() { +export function useRouteDataNetwork(): ComputedRef { return computed(() => routeData.network); } From 615a1644cfe2d20b251aa8f0c84d3f1f90f36882 Mon Sep 17 00:00:00 2001 From: donnyquixotic Date: Mon, 21 Aug 2023 13:03:43 -0500 Subject: [PATCH 4/7] fix: missing key in default theme --- src/config/BaseChain.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/config/BaseChain.ts b/src/config/BaseChain.ts index eebfeaf3..4f4c9d5e 100644 --- a/src/config/BaseChain.ts +++ b/src/config/BaseChain.ts @@ -30,6 +30,7 @@ export const DEFAULT_THEME = { 'color-header-border': '#777777', 'color-header-support-background': 'linear-gradient(180deg, #4C4C4C 0%, #3B3B3B 147.34%)', 'color-graph-shadow': '#3f65c228', + 'color-footer-background': '#000000', }; export default abstract class BaseChain implements Chain { From d6de49c2cf8aa1cba21c3993059651f7a8e8f49c Mon Sep 17 00:00:00 2001 From: Viterbo Date: Mon, 21 Aug 2023 21:21:28 -0300 Subject: [PATCH 5/7] reparing broken unit tests --- package.json | 3 ++- src/store/account/actions.ts | 1 - .../__tests__/store/account/actions.spec.ts | 24 ++++++++++++------- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 75dae71a..118fd5a9 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,8 @@ "build": "quasar clean && quasar build", "lint": "eslint --ext .js,.ts,.vue ./", "test": "jest --coverage", - "test:coverage": "quasar serve test/jest/coverage/lcov-report/ --port 8788" + "test:coverage": "quasar serve test/jest/coverage/lcov-report/ --port 8788", + "test:actions": "jest test/jest/__tests__/store/account/actions.spec.ts" }, "dependencies": { "@greymass/eosio": "^0.6.8", diff --git a/src/store/account/actions.ts b/src/store/account/actions.ts index c83fd11d..3da93bcd 100644 --- a/src/store/account/actions.ts +++ b/src/store/account/actions.ts @@ -37,7 +37,6 @@ export const actions: ActionTree = { commit('setAccountName', accountName); commit('setChainId', (authenticator as Authenticator).chains[0].chainId); - console.log(authenticator); localStorage.setItem(`account_${(authenticator as Authenticator).chains[0].chainId}`, accountName); localStorage.setItem( `autoLogin_${(authenticator as Authenticator).chains[0].chainId}`, diff --git a/test/jest/__tests__/store/account/actions.spec.ts b/test/jest/__tests__/store/account/actions.spec.ts index 5a96e63f..e7512228 100644 --- a/test/jest/__tests__/store/account/actions.spec.ts +++ b/test/jest/__tests__/store/account/actions.spec.ts @@ -46,12 +46,12 @@ global.fetch = jest.fn((input: RequestInfo | URL) => } as unknown as Response), ); -const sessionStorageMock = { +const localStorageMock = { getItem: jest.fn(), setItem: jest.fn(), removeItem:jest.fn(), }; -Object.defineProperty(window, 'sessionStorage', { value: sessionStorageMock }); +Object.defineProperty(window, 'localStorage', { value: localStorageMock }); const transactionHeaders = { @@ -88,16 +88,23 @@ jest.mock('@greymass/eosio', () => ({ import { actions } from 'src/store/account/actions'; import { User } from 'universal-authenticator-library'; +const chainIdMock = 'chainIdMock'; + describe('Store - Account Actions', () => { let commit: jest.Mock; let state: AccountStateInterface; let users: User[] = []; + + // commit('setChainId', (authenticator as Authenticator).chains[0].chainId); const newAuthenticatorMock = (requestName = false) => ({ init: jest.fn(), shouldRequestAccountName: jest.fn().mockResolvedValue(new Promise(resolve => resolve(requestName))), login: jest.fn().mockResolvedValue(new Promise(resolve => resolve(users))), getName: jest.fn().mockReturnValue('autoLogin'), + chains: [{ + chainId: chainIdMock, + }], }); let authenticator = newAuthenticatorMock(); @@ -116,6 +123,7 @@ describe('Store - Account Actions', () => { user: null, accountName: '', accountPermission: '', + chainId: chainIdMock, } as AccountStateInterface; }); @@ -162,8 +170,8 @@ describe('Store - Account Actions', () => { expect(commit).toHaveBeenCalledWith('setUser', expect.any(FuelUserWrapper)); expect(commit).toHaveBeenCalledWith('setIsAuthenticated', true); expect(commit).toHaveBeenCalledWith('setAccountName', 'john.doe'); - expect(sessionStorageMock.setItem).toHaveBeenCalledWith('account', 'john.doe'); - expect(sessionStorageMock.setItem).toHaveBeenCalledWith('autoLogin', 'autoLogin'); + expect(localStorageMock.setItem).toHaveBeenCalledWith('account_' + chainIdMock, 'john.doe'); + expect(localStorageMock.setItem).toHaveBeenCalledWith('autoLogin_' + chainIdMock, 'autoLogin'); }); @@ -183,8 +191,8 @@ describe('Store - Account Actions', () => { expect(commit).toHaveBeenCalledWith('setUser', expect.any(FuelUserWrapper)); expect(commit).toHaveBeenCalledWith('setIsAuthenticated', true); expect(commit).toHaveBeenCalledWith('setAccountName', 'john.doe'); - expect(sessionStorageMock.setItem).toHaveBeenCalledWith('account', 'john.doe'); - expect(sessionStorageMock.setItem).toHaveBeenCalledWith('autoLogin', 'autoLogin'); + expect(localStorageMock.setItem).toHaveBeenCalledWith('account_' + chainIdMock, 'john.doe'); + expect(localStorageMock.setItem).toHaveBeenCalledWith('autoLogin_' + chainIdMock, 'autoLogin'); }); }); @@ -199,8 +207,8 @@ describe('Store - Account Actions', () => { expect(commit).toHaveBeenCalledWith('setAccountName', ''); expect(commit).toHaveBeenCalledWith('setUser', null); - expect(sessionStorageMock.removeItem).toHaveBeenCalledWith('account'); - expect(sessionStorageMock.removeItem).toHaveBeenCalledWith('autoLogin'); + expect(localStorageMock.removeItem).toHaveBeenCalledWith('account_' + chainIdMock); + expect(localStorageMock.removeItem).toHaveBeenCalledWith('autoLogin_' + chainIdMock); }); }); }); From e66ff339724d683f465066e05db9da811e336c9e Mon Sep 17 00:00:00 2001 From: donnyquixotic Date: Mon, 28 Aug 2023 16:14:54 -0500 Subject: [PATCH 6/7] refactor: update test scripts --- package.json | 5 ++--- src/components/LoginHandler.vue | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 118fd5a9..996838a0 100644 --- a/package.json +++ b/package.json @@ -9,9 +9,8 @@ "dev": "quasar dev", "build": "quasar clean && quasar build", "lint": "eslint --ext .js,.ts,.vue ./", - "test": "jest --coverage", - "test:coverage": "quasar serve test/jest/coverage/lcov-report/ --port 8788", - "test:actions": "jest test/jest/__tests__/store/account/actions.spec.ts" + "test": "jest", + "test:coverage": "jest --coverage" }, "dependencies": { "@greymass/eosio": "^0.6.8", diff --git a/src/components/LoginHandler.vue b/src/components/LoginHandler.vue index cbae2ca7..7eb2d404 100644 --- a/src/components/LoginHandler.vue +++ b/src/components/LoginHandler.vue @@ -19,7 +19,6 @@ export default defineComponent({ const account = computed(() => store.state.account.accountName); onMounted(() => { - console.log(getChain().getChainId()); const storedAccount = localStorage.getItem('account_' + getChain().getChainId()); if (storedAccount) { void store.commit('account/setAccountName', storedAccount); From 91bff6174a69a93eebcaecf3953eb126bbf88954 Mon Sep 17 00:00:00 2001 From: Eduardo Jaeger Date: Mon, 4 Sep 2023 17:08:30 -0300 Subject: [PATCH 7/7] Fixing Map style --- src/components/WorldMap.vue | 136 ++++++++++++++++++------------------ 1 file changed, 68 insertions(+), 68 deletions(-) diff --git a/src/components/WorldMap.vue b/src/components/WorldMap.vue index 6a3d6cab..68537674 100644 --- a/src/components/WorldMap.vue +++ b/src/components/WorldMap.vue @@ -22,74 +22,6 @@ import { useStore } from 'src/store'; import VectorImageLayer from 'ol/layer/VectorImage'; import { getCssVar } from 'quasar'; -// Map core style -const style = new Style({ - image: new CircleStyle({ - fill: new Fill({ - color: '#FFFFFF' - }), - radius: 5 - }), - fill: new Fill({ - color: getCssVar('color-map') - }), - stroke: new Stroke({ - color: getCssVar('color-map'), - width: 1 - }), - zIndex: 50 -}); - -// BP location feature style with zIndex biggetr that map -const producerStyle = new Style({ - image: new CircleStyle({ - fill: new Fill({ - color: '#8276d2' - }), - stroke: new Stroke({ - color: '#63C9EF', - width: 3 - }), - radius: 5 - }), - zIndex: 51 -}); - -const top21Style = new Style({ - image: new CircleStyle({ - fill: new Fill({ - color: '#8276d2' - }), - stroke: new Stroke({ - color: '#FFFFFF', - width: 3 - }), - radius: 5 - }), - zIndex: 51 -}); - -// Map source uses vectorLayer with vector source -const source = new VectorSource({ - wrapX: false, - url: 'https://openlayers.org/data/vector/ecoregions.json', - format: new GeoJSON() -}); - -const vectorLayer = new VectorImageLayer({ - imageRatio: 1, - source: source, - style: style -}); - -const vectorSource = new VectorSource({ - wrapX: false -}); - -const vector = new VectorLayer({ - source: vectorSource -}); - export default defineComponent({ name: 'WorldMap', components: { @@ -142,6 +74,74 @@ export default defineComponent({ async mounted() { await this.updateBpList(); + // ---- Map Styles ---- + const style = new Style({ + image: new CircleStyle({ + fill: new Fill({ + color: '#FFFFFF' + }), + radius: 5 + }), + fill: new Fill({ + color: getCssVar('color-map') + }), + stroke: new Stroke({ + color: getCssVar('color-map'), + width: 1 + }), + zIndex: 50 + }); + + // BP location feature style with zIndex biggetr that map + const producerStyle = new Style({ + image: new CircleStyle({ + fill: new Fill({ + color: '#8276d2' + }), + stroke: new Stroke({ + color: '#63C9EF', + width: 3 + }), + radius: 5 + }), + zIndex: 51 + }); + + const top21Style = new Style({ + image: new CircleStyle({ + fill: new Fill({ + color: '#8276d2' + }), + stroke: new Stroke({ + color: '#FFFFFF', + width: 3 + }), + radius: 5 + }), + zIndex: 51 + }); + + // Map source uses vectorLayer with vector source + const source = new VectorSource({ + wrapX: false, + url: 'https://openlayers.org/data/vector/ecoregions.json', + format: new GeoJSON() + }); + + const vectorLayer = new VectorImageLayer({ + imageRatio: 1, + source: source, + style: style + }); + + const vectorSource = new VectorSource({ + wrapX: false + }); + + const vector = new VectorLayer({ + source: vectorSource + }); + // ---- Overlay ---- const container = this.$refs['popup'] as any; const content = this.$refs['popup-content'] as any;