Skip to content

Commit 909bdc5

Browse files
committed
fix namespaces
1 parent 712c4bf commit 909bdc5

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

frontend/frontend.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
function addCss(fileName) {
1+
const namespace = 'module-tournament-tree'
22

3+
function addCss(fileName) {
34
var head = document.head;
45
var link = document.createElement('link');
56

@@ -13,7 +14,7 @@ function addCss(fileName) {
1314
addCss('/pages/op-rcv-tournament-tree/style/tournament_tree_op.css');
1415
addCss('https://use.typekit.net/anc5qxp.css');
1516

16-
$('#embed-copy').val(`${location.href}/tournament_tree-gfx.html`);
17+
$('#embed-copy').val(`${location.href}/tournament_tree-gfx.html${window.apiKey !== null ? '?apikey' + window.apiKey : ''}`);
1718

1819
const dataDiv = document.querySelectorAll('[data-matchId]');
1920
const roundsSelect = document.querySelectorAll('[data-round]');
@@ -61,7 +62,7 @@ function save () {
6162

6263
window.LPTE.emit({
6364
meta: {
64-
namespace: 'rcv-tournament-tree',
65+
namespace,
6566
type: 'set',
6667
version: 1
6768
},
@@ -73,7 +74,7 @@ function save () {
7374
function unset() {
7475
window.LPTE.emit({
7576
meta: {
76-
namespace: 'rcv-tournament-tree',
77+
namespace,
7778
type: 'unset',
7879
version: 1
7980
}
@@ -83,7 +84,7 @@ function unset() {
8384
async function init () {
8485
const data = await window.LPTE.request({
8586
meta: {
86-
namespace: 'rcv-tournament-tree',
87+
namespace,
8788
type: 'request',
8889
version: 1
8990
}

plugin.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import type { PluginContext } from '@rcv-prod-toolkit/types'
22
import type { GfxState } from './types/GfxState'
33

4-
const namespace = 'rcv-tournament-tree';
5-
64
const initialState : GfxState = {
75
state: "NO_MATCHES",
86
matches: [],
@@ -19,6 +17,8 @@ const gameMatrix : [number, number | null][] = [
1917
]
2018

2119
module.exports = async (ctx: PluginContext) => {
20+
const namespace = ctx.plugin.module.getName();
21+
2222
let gfxState = initialState;
2323

2424
// Register new UI page
@@ -29,9 +29,9 @@ module.exports = async (ctx: PluginContext) => {
2929
version: 1
3030
},
3131
pages: [{
32-
name: 'OP: rcv-tournament-tree',
32+
name: 'Tournament Tree',
3333
frontend: 'frontend',
34-
id : 'op-rcv-tournament-tree'
34+
id : `op-${namespace}`
3535
}]
3636
});
3737

@@ -59,7 +59,7 @@ module.exports = async (ctx: PluginContext) => {
5959
ctx.LPTE.emit({
6060
meta: {
6161
type: 'set',
62-
namespace: 'rcv-teams',
62+
namespace: 'module-teams',
6363
version: 1
6464
},
6565
teams: match.teams,

0 commit comments

Comments
 (0)