@oanda/labs-sentiment-widget 1.0.23 → 1.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +264 -0
- package/dist/main/SentimentWidget/SentimentWidget.js +10 -3
- package/dist/main/SentimentWidget/SentimentWidget.js.map +1 -1
- package/dist/main/SentimentWidget/Tool.js +4 -4
- package/dist/main/SentimentWidget/Tool.js.map +1 -1
- package/dist/main/SentimentWidget/render.js +4 -2
- package/dist/main/SentimentWidget/render.js.map +1 -1
- package/dist/main/SentimentWidget/types.js.map +1 -1
- package/dist/main/gql/types/gql.js +2 -2
- package/dist/main/gql/types/gql.js.map +1 -1
- package/dist/main/translations/index.js +19 -0
- package/dist/main/translations/index.js.map +1 -0
- package/dist/main/translations/sources/en.json +4 -0
- package/dist/main/translations/sources/zh_TW.json +4 -0
- package/dist/main/translations/translations.js +11 -0
- package/dist/main/translations/translations.js.map +1 -0
- package/dist/module/SentimentWidget/SentimentWidget.js +10 -3
- package/dist/module/SentimentWidget/SentimentWidget.js.map +1 -1
- package/dist/module/SentimentWidget/Tool.js +2 -2
- package/dist/module/SentimentWidget/Tool.js.map +1 -1
- package/dist/module/SentimentWidget/render.js +4 -2
- package/dist/module/SentimentWidget/render.js.map +1 -1
- package/dist/module/SentimentWidget/types.js.map +1 -1
- package/dist/module/translations/index.js +12 -0
- package/dist/module/translations/index.js.map +1 -0
- package/dist/module/translations/sources/en.json +4 -0
- package/dist/module/translations/sources/zh_TW.json +4 -0
- package/dist/module/translations/translations.js +5 -0
- package/dist/module/translations/translations.js.map +1 -0
- package/dist/types/SentimentWidget/SentimentWidget.d.ts +1 -1
- package/dist/types/SentimentWidget/types.d.ts +2 -0
- package/dist/types/translations/index.d.ts +4 -0
- package/dist/types/translations/translations.d.ts +4 -0
- package/lokalise.config.json +18 -0
- package/package.json +4 -3
- package/src/SentimentWidget/SentimentWidget.tsx +15 -8
- package/src/SentimentWidget/Tool.tsx +2 -2
- package/src/SentimentWidget/render.tsx +2 -0
- package/src/SentimentWidget/types.ts +2 -0
- package/src/translations/index.ts +13 -0
- package/src/translations/sources/en.json +4 -0
- package/src/translations/sources/zh_TW.json +4 -0
- package/src/translations/translations.ts +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,270 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 1.0.26 (2023-10-18)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## 1.0.25 (2023-10-17)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## 1.0.24 (2023-10-13)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## 1.0.23 (2023-10-13)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## 1.0.22 (2023-10-11)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## 1.0.21 (2023-10-10)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## 1.0.20 (2023-10-06)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## 1.0.19 (2023-10-06)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## 1.0.18 (2023-10-05)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## 1.0.17 (2023-10-04)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## 1.0.16 (2023-10-04)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## 1.0.15 (2023-10-04)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## 1.0.14 (2023-10-03)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
## 1.0.13 (2023-10-03)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
## 1.0.12 (2023-10-03)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
## 1.0.11 (2023-10-02)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
## 1.0.10 (2023-09-29)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
## 1.0.9 (2023-09-28)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
## 1.0.8 (2023-09-27)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
## 1.0.7 (2023-09-26)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
## 1.0.6 (2023-09-21)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
## 1.0.5 (2023-09-13)
|
|
91
|
+
|
|
92
|
+
**Note:** Version bump only for package @oanda/labs-sentiment-widget
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
## 1.0.25 (2023-10-17)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
## 1.0.24 (2023-10-13)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
## 1.0.23 (2023-10-13)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
## 1.0.22 (2023-10-11)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
## 1.0.21 (2023-10-10)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
## 1.0.20 (2023-10-06)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
## 1.0.19 (2023-10-06)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
## 1.0.18 (2023-10-05)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
## 1.0.17 (2023-10-04)
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
## 1.0.16 (2023-10-04)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
## 1.0.15 (2023-10-04)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
## 1.0.14 (2023-10-03)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
## 1.0.13 (2023-10-03)
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
## 1.0.12 (2023-10-03)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
## 1.0.11 (2023-10-02)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
## 1.0.10 (2023-09-29)
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
## 1.0.9 (2023-09-28)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
## 1.0.8 (2023-09-27)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
## 1.0.7 (2023-09-26)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
## 1.0.6 (2023-09-21)
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
## 1.0.5 (2023-09-13)
|
|
179
|
+
|
|
180
|
+
**Note:** Version bump only for package @oanda/labs-sentiment-widget
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
## 1.0.24 (2023-10-13)
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
## 1.0.23 (2023-10-13)
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
## 1.0.22 (2023-10-11)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
## 1.0.21 (2023-10-10)
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
## 1.0.20 (2023-10-06)
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
## 1.0.19 (2023-10-06)
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
## 1.0.18 (2023-10-05)
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
## 1.0.17 (2023-10-04)
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
## 1.0.16 (2023-10-04)
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
## 1.0.15 (2023-10-04)
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
## 1.0.14 (2023-10-03)
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
## 1.0.13 (2023-10-03)
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
## 1.0.12 (2023-10-03)
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
## 1.0.11 (2023-10-02)
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
## 1.0.10 (2023-09-29)
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
## 1.0.9 (2023-09-28)
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
## 1.0.8 (2023-09-27)
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
## 1.0.7 (2023-09-26)
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
## 1.0.6 (2023-09-21)
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
## 1.0.5 (2023-09-13)
|
|
263
|
+
|
|
264
|
+
**Note:** Version bump only for package @oanda/labs-sentiment-widget
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
|
|
6
270
|
## 1.0.23 (2023-10-13)
|
|
7
271
|
|
|
8
272
|
|
|
@@ -6,27 +6,34 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.SentimentWidget = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _client = require("@apollo/client");
|
|
9
|
+
var _monoI18n = require("@oanda/mono-i18n");
|
|
10
|
+
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
9
11
|
var _Widget = require("./Widget");
|
|
10
12
|
var _Tool = require("./Tool");
|
|
13
|
+
var _translations = require("../translations");
|
|
11
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
15
|
const SentimentWidget = _ref => {
|
|
13
16
|
let {
|
|
14
17
|
graphqlUrl,
|
|
15
18
|
division,
|
|
16
|
-
instrument
|
|
19
|
+
instrument,
|
|
20
|
+
locale
|
|
17
21
|
} = _ref;
|
|
18
22
|
const client = new _client.ApolloClient({
|
|
19
23
|
uri: graphqlUrl,
|
|
20
24
|
cache: new _client.InMemoryCache()
|
|
21
25
|
});
|
|
22
|
-
return _react.default.createElement(
|
|
26
|
+
return _react.default.createElement(_monoI18n.LocaleProvider, {
|
|
27
|
+
locale: (0, _labsWidgetCommon.getLocale)(locale),
|
|
28
|
+
translations: _translations.translations
|
|
29
|
+
}, _react.default.createElement(_client.ApolloProvider, {
|
|
23
30
|
client: client
|
|
24
31
|
}, instrument ? _react.default.createElement(_Widget.Widget, {
|
|
25
32
|
division: division,
|
|
26
33
|
instrument: instrument
|
|
27
34
|
}) : _react.default.createElement(_Tool.Tool, {
|
|
28
35
|
division: division
|
|
29
|
-
}));
|
|
36
|
+
})));
|
|
30
37
|
};
|
|
31
38
|
exports.SentimentWidget = SentimentWidget;
|
|
32
39
|
//# sourceMappingURL=SentimentWidget.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SentimentWidget.js","names":["_react","_interopRequireDefault","require","_client","_Widget","_Tool","obj","__esModule","default","SentimentWidget","_ref","graphqlUrl","division","instrument","client","ApolloClient","uri","cache","InMemoryCache","createElement","ApolloProvider","Widget","Tool","exports"],"sources":["../../../src/SentimentWidget/SentimentWidget.tsx"],"sourcesContent":["import React from 'react';\nimport { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';\nimport { Widget } from './Widget';\nimport { Tool } from './Tool';\nimport { SentimentConfig } from './types';\n\nconst SentimentWidget = ({
|
|
1
|
+
{"version":3,"file":"SentimentWidget.js","names":["_react","_interopRequireDefault","require","_client","_monoI18n","_labsWidgetCommon","_Widget","_Tool","_translations","obj","__esModule","default","SentimentWidget","_ref","graphqlUrl","division","instrument","locale","client","ApolloClient","uri","cache","InMemoryCache","createElement","LocaleProvider","getLocale","translations","ApolloProvider","Widget","Tool","exports"],"sources":["../../../src/SentimentWidget/SentimentWidget.tsx"],"sourcesContent":["import React from 'react';\nimport { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';\nimport { LocaleProvider } from '@oanda/mono-i18n';\nimport { getLocale } from '@oanda/labs-widget-common';\nimport { Widget } from './Widget';\nimport { Tool } from './Tool';\nimport { SentimentConfig } from './types';\nimport { translations } from '../translations';\n\nconst SentimentWidget = ({\n graphqlUrl, division, instrument, locale,\n}: SentimentConfig) => {\n const client = new ApolloClient({\n uri: graphqlUrl,\n cache: new InMemoryCache(),\n });\n\n return (\n <LocaleProvider locale={getLocale(locale)} translations={translations}>\n <ApolloProvider client={client}>\n {instrument ? (\n <Widget division={division} instrument={instrument} />\n ) : (\n <Tool division={division} />\n )}\n </ApolloProvider>\n </LocaleProvider>\n );\n};\n\nexport { SentimentWidget };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAEA,IAAAM,aAAA,GAAAN,OAAA;AAA+C,SAAAD,uBAAAQ,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAE/C,MAAMG,eAAe,GAAGC,IAAA,IAED;EAAA,IAFE;IACvBC,UAAU;IAAEC,QAAQ;IAAEC,UAAU;IAAEC;EACnB,CAAC,GAAAJ,IAAA;EAChB,MAAMK,MAAM,GAAG,IAAIC,oBAAY,CAAC;IAC9BC,GAAG,EAAEN,UAAU;IACfO,KAAK,EAAE,IAAIC,qBAAa,CAAC;EAC3B,CAAC,CAAC;EAEF,OACEtB,MAAA,CAAAW,OAAA,CAAAY,aAAA,CAACnB,SAAA,CAAAoB,cAAc;IAACP,MAAM,EAAE,IAAAQ,2BAAS,EAACR,MAAM,CAAE;IAACS,YAAY,EAAEA;EAAa,GACpE1B,MAAA,CAAAW,OAAA,CAAAY,aAAA,CAACpB,OAAA,CAAAwB,cAAc;IAACT,MAAM,EAAEA;EAAO,GAC5BF,UAAU,GACThB,MAAA,CAAAW,OAAA,CAAAY,aAAA,CAACjB,OAAA,CAAAsB,MAAM;IAACb,QAAQ,EAAEA,QAAS;IAACC,UAAU,EAAEA;EAAW,CAAE,CAAC,GAEtDhB,MAAA,CAAAW,OAAA,CAAAY,aAAA,CAAChB,KAAA,CAAAsB,IAAI;IAACd,QAAQ,EAAEA;EAAS,CAAE,CAEf,CACF,CAAC;AAErB,CAAC;AAACe,OAAA,CAAAlB,eAAA,GAAAA,eAAA"}
|
|
@@ -11,8 +11,8 @@ var _getSentimentList = require("../gql/getSentimentList");
|
|
|
11
11
|
var _utils = require("./utils");
|
|
12
12
|
var _SortSwitch = require("./components/SortSwitch");
|
|
13
13
|
var _graphql = require("../gql/types/graphql");
|
|
14
|
-
function _getRequireWildcardCache(
|
|
15
|
-
function _interopRequireWildcard(
|
|
14
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
16
|
const Tool = _ref => {
|
|
17
17
|
let {
|
|
18
18
|
division
|
|
@@ -36,7 +36,7 @@ const Tool = _ref => {
|
|
|
36
36
|
return _react.default.createElement("div", {
|
|
37
37
|
"data-testid": "sentiment-tool",
|
|
38
38
|
className: "lw-text-sm lw-text-black"
|
|
39
|
-
}, error ? _react.default.createElement("div", {
|
|
39
|
+
}, error || sortedData.length === 0 ? _react.default.createElement("div", {
|
|
40
40
|
className: "lw-flex lw-h-[200px] lw-items-center lw-justify-center lw-border lw-border-solid lw-border-grey lw-p-2"
|
|
41
41
|
}, _react.default.createElement(_labsWidgetCommon.ChartError, null)) : _react.default.createElement(_react.default.Fragment, null, _react.default.createElement("div", {
|
|
42
42
|
className: "lw-flex lw-justify-end lw-pb-5"
|
|
@@ -55,7 +55,7 @@ const Tool = _ref => {
|
|
|
55
55
|
}, loading ? _react.default.createElement(_labsWidgetCommon.Loader, {
|
|
56
56
|
size: _labsWidgetCommon.LoaderSize.md
|
|
57
57
|
}) : _react.default.createElement("p", {
|
|
58
|
-
className: "lw-truncate lw-font-sans lw-font-bold"
|
|
58
|
+
className: "lw-truncate lw-font-sans lw-text-sm lw-font-bold"
|
|
59
59
|
}, item.name || '\u2014')), _react.default.createElement(_labsWidgetCommon.Sentiment, {
|
|
60
60
|
isLoading: loading,
|
|
61
61
|
height: _labsWidgetCommon.SentimentHeight.md,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tool.js","names":["_react","_interopRequireWildcard","require","_labsWidgetCommon","_client","_getSentimentList","_utils","_SortSwitch","_graphql","_getRequireWildcardCache","
|
|
1
|
+
{"version":3,"file":"Tool.js","names":["_react","_interopRequireWildcard","require","_labsWidgetCommon","_client","_getSentimentList","_utils","_SortSwitch","_graphql","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","Tool","_ref","division","sort","setSort","useState","Sort","Bullish","sortedData","setSortedData","Array","fill","loading","data","error","useQuery","getSentimentList","variables","useEffect","sortData","createElement","className","length","ChartError","Fragment","SortSwitch","disabled","selected","SelectedArrow","UP","DOWN","onClickButtonDown","Bearish","onClickButtonUp","map","item","index","key","name","Loader","size","LoaderSize","md","Sentiment","isLoading","height","SentimentHeight","sentiment","exports"],"sources":["../../../src/SentimentWidget/Tool.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport {\n Sentiment, SentimentHeight, Loader, LoaderSize, ChartError,\n} from '@oanda/labs-widget-common';\nimport { useQuery } from '@apollo/client';\nimport { getSentimentList } from '../gql/getSentimentList';\nimport { SentimentToolConfig } from './types';\nimport { sortData } from './utils';\nimport { SelectedArrow, SortSwitch } from './components/SortSwitch';\nimport {\n GetSentimentListQuery, GetSentimentListQueryVariables, SentimentInstrument, Sort,\n} from '../gql/types/graphql';\n\nconst Tool = ({ division }: SentimentToolConfig) => {\n const [sort, setSort] = useState(Sort.Bullish);\n const [sortedData, setSortedData] = useState<Omit<SentimentInstrument, 'id'>[]>(new Array(20).fill({}));\n const { loading, data, error } = useQuery<\n GetSentimentListQuery,\n GetSentimentListQueryVariables\n >(getSentimentList, {\n variables: {\n division,\n },\n });\n\n useEffect(() => {\n if (data) {\n setSortedData(sortData(data, sort));\n }\n }, [data, sort]);\n\n return (\n <div data-testid=\"sentiment-tool\" className=\"lw-text-sm lw-text-black\">\n {error || sortedData.length === 0 ? (\n <div className=\"lw-flex lw-h-[200px] lw-items-center lw-justify-center lw-border lw-border-solid lw-border-grey lw-p-2\">\n <ChartError />\n </div>\n ) : (\n <>\n <div className=\"lw-flex lw-justify-end lw-pb-5\">\n <SortSwitch\n disabled={loading}\n selected={sort === Sort.Bullish ? SelectedArrow.UP : SelectedArrow.DOWN}\n onClickButtonDown={() => setSort(Sort.Bearish)}\n onClickButtonUp={() => setSort(Sort.Bullish)}\n />\n </div>\n <div className=\"lw-flex lw-flex-col lw-border lw-border-solid lw-border-grey lw-p-2\">\n {sortedData.map((item, index) => (\n <div className=\"lw-flex lw-h-8 lw-w-full lw-items-center\" key={item.name || index}>\n <div className=\"lw-w-[120px] lw-shrink-0\">\n {loading ? (\n <Loader size={LoaderSize.md} />\n ) : (\n <p className=\"lw-truncate lw-font-sans lw-text-sm lw-font-bold\">{item.name || '\\u2014'}</p>\n )}\n </div>\n <Sentiment\n isLoading={loading}\n height={SentimentHeight.md}\n sentiment={item.sentiment}\n />\n </div>\n ))}\n </div>\n </>\n )}\n </div>\n );\n};\n\nexport { Tool };\n"],"mappings":"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"}
|
|
@@ -8,11 +8,13 @@ const {
|
|
|
8
8
|
graphqlUrl,
|
|
9
9
|
division,
|
|
10
10
|
instrument,
|
|
11
|
-
renderElementId
|
|
11
|
+
renderElementId,
|
|
12
|
+
locale
|
|
12
13
|
} = window.sentimentWidgetConfig;
|
|
13
14
|
(0, _reactDom.render)(_react.default.createElement(_SentimentWidget.SentimentWidget, {
|
|
14
15
|
graphqlUrl: graphqlUrl,
|
|
15
16
|
division: division,
|
|
16
|
-
instrument: instrument
|
|
17
|
+
instrument: instrument,
|
|
18
|
+
locale: locale
|
|
17
19
|
}), document.getElementById(renderElementId));
|
|
18
20
|
//# sourceMappingURL=render.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","names":["_react","_interopRequireDefault","require","_reactDom","_SentimentWidget","obj","__esModule","default","graphqlUrl","division","instrument","renderElementId","window","sentimentWidgetConfig","render","createElement","SentimentWidget","document","getElementById"],"sources":["../../../src/SentimentWidget/render.tsx"],"sourcesContent":["import React from 'react';\nimport { render } from 'react-dom';\nimport { SentimentWidget } from './SentimentWidget';\nimport { SentimentWrapperConfig } from './types';\n\ndeclare global {\n interface Window {\n sentimentWidgetConfig: SentimentWrapperConfig;\n }\n}\n\nconst {\n graphqlUrl,\n division,\n instrument,\n renderElementId,\n} = window.sentimentWidgetConfig;\n\nrender(\n <SentimentWidget\n graphqlUrl={graphqlUrl}\n division={division}\n instrument={instrument}\n />,\n document.getElementById(renderElementId),\n);\n"],"mappings":";;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AAAoD,SAAAD,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AASpD,MAAM;EACJG,UAAU;EACVC,QAAQ;EACRC,UAAU;EACVC;AACF,CAAC,GAAGC,MAAM,CAACC,qBAAqB;AAEhC,IAAAC,gBAAM,
|
|
1
|
+
{"version":3,"file":"render.js","names":["_react","_interopRequireDefault","require","_reactDom","_SentimentWidget","obj","__esModule","default","graphqlUrl","division","instrument","renderElementId","locale","window","sentimentWidgetConfig","render","createElement","SentimentWidget","document","getElementById"],"sources":["../../../src/SentimentWidget/render.tsx"],"sourcesContent":["import React from 'react';\nimport { render } from 'react-dom';\nimport { SentimentWidget } from './SentimentWidget';\nimport { SentimentWrapperConfig } from './types';\n\ndeclare global {\n interface Window {\n sentimentWidgetConfig: SentimentWrapperConfig;\n }\n}\n\nconst {\n graphqlUrl,\n division,\n instrument,\n renderElementId,\n locale,\n} = window.sentimentWidgetConfig;\n\nrender(\n <SentimentWidget\n graphqlUrl={graphqlUrl}\n division={division}\n instrument={instrument}\n locale={locale}\n />,\n document.getElementById(renderElementId),\n);\n"],"mappings":";;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AAAoD,SAAAD,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AASpD,MAAM;EACJG,UAAU;EACVC,QAAQ;EACRC,UAAU;EACVC,eAAe;EACfC;AACF,CAAC,GAAGC,MAAM,CAACC,qBAAqB;AAEhC,IAAAC,gBAAM,EACJf,MAAA,CAAAO,OAAA,CAAAS,aAAA,CAACZ,gBAAA,CAAAa,eAAe;EACdT,UAAU,EAAEA,UAAW;EACvBC,QAAQ,EAAEA,QAAS;EACnBC,UAAU,EAAEA,UAAW;EACvBE,MAAM,EAAEA;AAAO,CAChB,CAAC,EACFM,QAAQ,CAACC,cAAc,CAACR,eAAe,CACzC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../src/SentimentWidget/types.ts"],"sourcesContent":["import { Division } from '../gql/types/graphql';\n\nexport interface SentimentConfig {\n graphqlUrl: string;\n division: Division;\n instrument?: string;\n}\nexport interface SentimentWrapperConfig extends SentimentConfig {\n renderElementId: string;\n}\nexport interface SentimentWidgetConfig {\n division: Division;\n instrument: string;\n}\n\nexport interface SentimentToolConfig {\n division: Division;\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../src/SentimentWidget/types.ts"],"sourcesContent":["import { Locale } from '@oanda/mono-i18n';\nimport { Division } from '../gql/types/graphql';\n\nexport interface SentimentConfig {\n graphqlUrl: string;\n division: Division;\n instrument?: string;\n locale: Locale;\n}\nexport interface SentimentWrapperConfig extends SentimentConfig {\n renderElementId: string;\n}\nexport interface SentimentWidgetConfig {\n division: Division;\n instrument: string;\n}\n\nexport interface SentimentToolConfig {\n division: Division;\n}\n"],"mappings":""}
|
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.graphql = graphql;
|
|
7
7
|
var types = _interopRequireWildcard(require("./graphql"));
|
|
8
|
-
function _getRequireWildcardCache(
|
|
9
|
-
function _interopRequireWildcard(
|
|
8
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
9
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
10
10
|
const documents = {
|
|
11
11
|
"\n query GetInstrumentSentiment(\n $name: String!\n $division: Division\n ) {\n sentiment(\n name: $name\n division: $division\n ) {\n name\n sentiment {\n shortPercent\n longPercent\n }\n }\n }\n": types.GetInstrumentSentimentDocument,
|
|
12
12
|
"\n query GetSentimentList (\n $division: Division\n ) {\n sentimentList (\n division: $division\n ) {\n name\n sentiment {\n shortPercent\n longPercent\n }\n }\n }\n": types.GetSentimentListDocument
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gql.js","names":["types","_interopRequireWildcard","require","_getRequireWildcardCache","
|
|
1
|
+
{"version":3,"file":"gql.js","names":["types","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","documents","GetInstrumentSentimentDocument","GetSentimentListDocument","graphql","source"],"sources":["../../../../src/gql/types/gql.ts"],"sourcesContent":["/* eslint-disable */\nimport * as types from './graphql';\nimport { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';\n\n/**\n * Map of all GraphQL operations in the project.\n *\n * This map has several performance disadvantages:\n * 1. It is not tree-shakeable, so it will include all operations in the project.\n * 2. It is not minifiable, so the string of a GraphQL query will be multiple times inside the bundle.\n * 3. It does not support dead code elimination, so it will add unused operations.\n *\n * Therefore it is highly recommended to use the babel or swc plugin for production.\n */\nconst documents = {\n \"\\n query GetInstrumentSentiment(\\n $name: String!\\n $division: Division\\n ) {\\n sentiment(\\n name: $name\\n division: $division\\n ) {\\n name\\n sentiment {\\n shortPercent\\n longPercent\\n }\\n }\\n }\\n\": types.GetInstrumentSentimentDocument,\n \"\\n query GetSentimentList (\\n $division: Division\\n ) {\\n sentimentList (\\n division: $division\\n ) {\\n name\\n sentiment {\\n shortPercent\\n longPercent\\n }\\n }\\n }\\n\": types.GetSentimentListDocument,\n};\n\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n *\n *\n * @example\n * ```ts\n * const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);\n * ```\n *\n * The query argument is unknown!\n * Please regenerate the types.\n */\nexport function graphql(source: string): unknown;\n\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport function graphql(source: \"\\n query GetInstrumentSentiment(\\n $name: String!\\n $division: Division\\n ) {\\n sentiment(\\n name: $name\\n division: $division\\n ) {\\n name\\n sentiment {\\n shortPercent\\n longPercent\\n }\\n }\\n }\\n\"): (typeof documents)[\"\\n query GetInstrumentSentiment(\\n $name: String!\\n $division: Division\\n ) {\\n sentiment(\\n name: $name\\n division: $division\\n ) {\\n name\\n sentiment {\\n shortPercent\\n longPercent\\n }\\n }\\n }\\n\"];\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport function graphql(source: \"\\n query GetSentimentList (\\n $division: Division\\n ) {\\n sentimentList (\\n division: $division\\n ) {\\n name\\n sentiment {\\n shortPercent\\n longPercent\\n }\\n }\\n }\\n\"): (typeof documents)[\"\\n query GetSentimentList (\\n $division: Division\\n ) {\\n sentimentList (\\n division: $division\\n ) {\\n name\\n sentiment {\\n shortPercent\\n longPercent\\n }\\n }\\n }\\n\"];\n\nexport function graphql(source: string) {\n return (documents as any)[source] ?? {};\n}\n\nexport type DocumentType<TDocumentNode extends DocumentNode<any, any>> = TDocumentNode extends DocumentNode< infer TType, any> ? TType : never;"],"mappings":";;;;;;AACA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAmC,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAc,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAI,CAAA,KAAAA,CAAA,CAAAX,GAAA,IAAAW,CAAA,CAAAC,GAAA,IAAAR,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAI,CAAA,IAAAV,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAgB,GAAA,CAAAnB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAanC,MAAMY,SAAS,GAAG;EACd,+PAA+P,EAAExB,KAAK,CAACyB,8BAA8B;EACrS,wNAAwN,EAAEzB,KAAK,CAAC0B;AACpO,CAAC;AAyBM,SAASC,OAAOA,CAACC,MAAc,EAAE;EACtC,OAAQJ,SAAS,CAASI,MAAM,CAAC,IAAI,CAAC,CAAC;AACzC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.translations = void 0;
|
|
7
|
+
var _monoI18n = require("@oanda/mono-i18n");
|
|
8
|
+
var _en = _interopRequireDefault(require("./sources/en.json"));
|
|
9
|
+
var _zh_TW = _interopRequireDefault(require("./sources/zh_TW.json"));
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
const translations = exports.translations = {
|
|
12
|
+
[_monoI18n.Locale.en]: {
|
|
13
|
+
translation: _en.default
|
|
14
|
+
},
|
|
15
|
+
[_monoI18n.Locale.zhTW]: {
|
|
16
|
+
translation: _zh_TW.default
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_monoI18n","require","_en","_interopRequireDefault","_zh_TW","obj","__esModule","default","translations","exports","Locale","en","translation","zhTW"],"sources":["../../../src/translations/index.ts"],"sourcesContent":["import { Locale, Translations } from '@oanda/mono-i18n';\n\nimport en from './sources/en.json';\nimport zhTW from './sources/zh_TW.json';\n\nimport { defaultTranslations } from './translations';\n\nexport type TranslationKey = keyof typeof defaultTranslations;\n\nexport const translations: Translations = {\n [Locale.en]: { translation: en },\n [Locale.zhTW]: { translation: zhTW },\n};\n"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAEA,IAAAC,GAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAD,sBAAA,CAAAF,OAAA;AAAwC,SAAAE,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAMjC,MAAMG,YAA0B,GAAAC,OAAA,CAAAD,YAAA,GAAG;EACxC,CAACE,gBAAM,CAACC,EAAE,GAAG;IAAEC,WAAW,EAAED;EAAG,CAAC;EAChC,CAACD,gBAAM,CAACG,IAAI,GAAG;IAAED,WAAW,EAAEC;EAAK;AACrC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.defaultTranslations = void 0;
|
|
7
|
+
const defaultTranslations = exports.defaultTranslations = {
|
|
8
|
+
data_unavailable: 'Data unavailable',
|
|
9
|
+
pagination_entries_range: '{{firstItemOnPage}}-{{lastItemOnPage}} of {{itemCount}} entries'
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=translations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translations.js","names":["defaultTranslations","exports","data_unavailable","pagination_entries_range"],"sources":["../../../src/translations/translations.ts"],"sourcesContent":["export const defaultTranslations = {\n data_unavailable: 'Data unavailable',\n pagination_entries_range: '{{firstItemOnPage}}-{{lastItemOnPage}} of {{itemCount}} entries',\n};\n"],"mappings":";;;;;;AAAO,MAAMA,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAG;EACjCE,gBAAgB,EAAE,kBAAkB;EACpCC,wBAAwB,EAAE;AAC5B,CAAC"}
|
|
@@ -1,25 +1,32 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';
|
|
3
|
+
import { LocaleProvider } from '@oanda/mono-i18n';
|
|
4
|
+
import { getLocale } from '@oanda/labs-widget-common';
|
|
3
5
|
import { Widget } from './Widget';
|
|
4
6
|
import { Tool } from './Tool';
|
|
7
|
+
import { translations } from '../translations';
|
|
5
8
|
const SentimentWidget = _ref => {
|
|
6
9
|
let {
|
|
7
10
|
graphqlUrl,
|
|
8
11
|
division,
|
|
9
|
-
instrument
|
|
12
|
+
instrument,
|
|
13
|
+
locale
|
|
10
14
|
} = _ref;
|
|
11
15
|
const client = new ApolloClient({
|
|
12
16
|
uri: graphqlUrl,
|
|
13
17
|
cache: new InMemoryCache()
|
|
14
18
|
});
|
|
15
|
-
return React.createElement(
|
|
19
|
+
return React.createElement(LocaleProvider, {
|
|
20
|
+
locale: getLocale(locale),
|
|
21
|
+
translations: translations
|
|
22
|
+
}, React.createElement(ApolloProvider, {
|
|
16
23
|
client: client
|
|
17
24
|
}, instrument ? React.createElement(Widget, {
|
|
18
25
|
division: division,
|
|
19
26
|
instrument: instrument
|
|
20
27
|
}) : React.createElement(Tool, {
|
|
21
28
|
division: division
|
|
22
|
-
}));
|
|
29
|
+
})));
|
|
23
30
|
};
|
|
24
31
|
export { SentimentWidget };
|
|
25
32
|
//# sourceMappingURL=SentimentWidget.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SentimentWidget.js","names":["React","ApolloClient","InMemoryCache","ApolloProvider","Widget","Tool","SentimentWidget","_ref","graphqlUrl","division","instrument","client","uri","cache","createElement"],"sources":["../../../src/SentimentWidget/SentimentWidget.tsx"],"sourcesContent":["import React from 'react';\nimport { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';\nimport { Widget } from './Widget';\nimport { Tool } from './Tool';\nimport { SentimentConfig } from './types';\n\nconst SentimentWidget = ({
|
|
1
|
+
{"version":3,"file":"SentimentWidget.js","names":["React","ApolloClient","InMemoryCache","ApolloProvider","LocaleProvider","getLocale","Widget","Tool","translations","SentimentWidget","_ref","graphqlUrl","division","instrument","locale","client","uri","cache","createElement"],"sources":["../../../src/SentimentWidget/SentimentWidget.tsx"],"sourcesContent":["import React from 'react';\nimport { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';\nimport { LocaleProvider } from '@oanda/mono-i18n';\nimport { getLocale } from '@oanda/labs-widget-common';\nimport { Widget } from './Widget';\nimport { Tool } from './Tool';\nimport { SentimentConfig } from './types';\nimport { translations } from '../translations';\n\nconst SentimentWidget = ({\n graphqlUrl, division, instrument, locale,\n}: SentimentConfig) => {\n const client = new ApolloClient({\n uri: graphqlUrl,\n cache: new InMemoryCache(),\n });\n\n return (\n <LocaleProvider locale={getLocale(locale)} translations={translations}>\n <ApolloProvider client={client}>\n {instrument ? (\n <Widget division={division} instrument={instrument} />\n ) : (\n <Tool division={division} />\n )}\n </ApolloProvider>\n </LocaleProvider>\n );\n};\n\nexport { SentimentWidget };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,YAAY,EAAEC,aAAa,EAAEC,cAAc,QAAQ,gBAAgB;AAC5E,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SAASC,SAAS,QAAQ,2BAA2B;AACrD,SAASC,MAAM,QAAQ,UAAU;AACjC,SAASC,IAAI,QAAQ,QAAQ;AAE7B,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAMC,eAAe,GAAGC,IAAA,IAED;EAAA,IAFE;IACvBC,UAAU;IAAEC,QAAQ;IAAEC,UAAU;IAAEC;EACnB,CAAC,GAAAJ,IAAA;EAChB,MAAMK,MAAM,GAAG,IAAId,YAAY,CAAC;IAC9Be,GAAG,EAAEL,UAAU;IACfM,KAAK,EAAE,IAAIf,aAAa,CAAC;EAC3B,CAAC,CAAC;EAEF,OACEF,KAAA,CAAAkB,aAAA,CAACd,cAAc;IAACU,MAAM,EAAET,SAAS,CAACS,MAAM,CAAE;IAACN,YAAY,EAAEA;EAAa,GACpER,KAAA,CAAAkB,aAAA,CAACf,cAAc;IAACY,MAAM,EAAEA;EAAO,GAC5BF,UAAU,GACTb,KAAA,CAAAkB,aAAA,CAACZ,MAAM;IAACM,QAAQ,EAAEA,QAAS;IAACC,UAAU,EAAEA;EAAW,CAAE,CAAC,GAEtDb,KAAA,CAAAkB,aAAA,CAACX,IAAI;IAACK,QAAQ,EAAEA;EAAS,CAAE,CAEf,CACF,CAAC;AAErB,CAAC;AAED,SAASH,eAAe"}
|
|
@@ -28,7 +28,7 @@ const Tool = _ref => {
|
|
|
28
28
|
return React.createElement("div", {
|
|
29
29
|
"data-testid": "sentiment-tool",
|
|
30
30
|
className: "lw-text-sm lw-text-black"
|
|
31
|
-
}, error ? React.createElement("div", {
|
|
31
|
+
}, error || sortedData.length === 0 ? React.createElement("div", {
|
|
32
32
|
className: "lw-flex lw-h-[200px] lw-items-center lw-justify-center lw-border lw-border-solid lw-border-grey lw-p-2"
|
|
33
33
|
}, React.createElement(ChartError, null)) : React.createElement(React.Fragment, null, React.createElement("div", {
|
|
34
34
|
className: "lw-flex lw-justify-end lw-pb-5"
|
|
@@ -47,7 +47,7 @@ const Tool = _ref => {
|
|
|
47
47
|
}, loading ? React.createElement(Loader, {
|
|
48
48
|
size: LoaderSize.md
|
|
49
49
|
}) : React.createElement("p", {
|
|
50
|
-
className: "lw-truncate lw-font-sans lw-font-bold"
|
|
50
|
+
className: "lw-truncate lw-font-sans lw-text-sm lw-font-bold"
|
|
51
51
|
}, item.name || '\u2014')), React.createElement(Sentiment, {
|
|
52
52
|
isLoading: loading,
|
|
53
53
|
height: SentimentHeight.md,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tool.js","names":["React","useEffect","useState","Sentiment","SentimentHeight","Loader","LoaderSize","ChartError","useQuery","getSentimentList","sortData","SelectedArrow","SortSwitch","Sort","Tool","_ref","division","sort","setSort","Bullish","sortedData","setSortedData","Array","fill","loading","data","error","variables","createElement","className","Fragment","disabled","selected","UP","DOWN","onClickButtonDown","Bearish","onClickButtonUp","map","item","index","key","name","size","md","isLoading","height","sentiment"],"sources":["../../../src/SentimentWidget/Tool.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport {\n Sentiment, SentimentHeight, Loader, LoaderSize, ChartError,\n} from '@oanda/labs-widget-common';\nimport { useQuery } from '@apollo/client';\nimport { getSentimentList } from '../gql/getSentimentList';\nimport { SentimentToolConfig } from './types';\nimport { sortData } from './utils';\nimport { SelectedArrow, SortSwitch } from './components/SortSwitch';\nimport {\n GetSentimentListQuery, GetSentimentListQueryVariables, SentimentInstrument, Sort,\n} from '../gql/types/graphql';\n\nconst Tool = ({ division }: SentimentToolConfig) => {\n const [sort, setSort] = useState(Sort.Bullish);\n const [sortedData, setSortedData] = useState<Omit<SentimentInstrument, 'id'>[]>(new Array(20).fill({}));\n const { loading, data, error } = useQuery<\n GetSentimentListQuery,\n GetSentimentListQueryVariables\n >(getSentimentList, {\n variables: {\n division,\n },\n });\n\n useEffect(() => {\n if (data) {\n setSortedData(sortData(data, sort));\n }\n }, [data, sort]);\n\n return (\n <div data-testid=\"sentiment-tool\" className=\"lw-text-sm lw-text-black\">\n {error ? (\n <div className=\"lw-flex lw-h-[200px] lw-items-center lw-justify-center lw-border lw-border-solid lw-border-grey lw-p-2\">\n <ChartError />\n </div>\n ) : (\n <>\n <div className=\"lw-flex lw-justify-end lw-pb-5\">\n <SortSwitch\n disabled={loading}\n selected={sort === Sort.Bullish ? SelectedArrow.UP : SelectedArrow.DOWN}\n onClickButtonDown={() => setSort(Sort.Bearish)}\n onClickButtonUp={() => setSort(Sort.Bullish)}\n />\n </div>\n <div className=\"lw-flex lw-flex-col lw-border lw-border-solid lw-border-grey lw-p-2\">\n {sortedData.map((item, index) => (\n <div className=\"lw-flex lw-h-8 lw-w-full lw-items-center\" key={item.name || index}>\n <div className=\"lw-w-[120px] lw-shrink-0\">\n {loading ? (\n <Loader size={LoaderSize.md} />\n ) : (\n <p className=\"lw-truncate lw-font-sans lw-font-bold\">{item.name || '\\u2014'}</p>\n )}\n </div>\n <Sentiment\n isLoading={loading}\n height={SentimentHeight.md}\n sentiment={item.sentiment}\n />\n </div>\n ))}\n </div>\n </>\n )}\n </div>\n );\n};\n\nexport { Tool };\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAClD,SACEC,SAAS,EAAEC,eAAe,EAAEC,MAAM,EAAEC,UAAU,EAAEC,UAAU,QACrD,2BAA2B;AAClC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,gBAAgB,QAAQ,yBAAyB;AAE1D,SAASC,QAAQ,QAAQ,SAAS;AAClC,SAASC,aAAa,EAAEC,UAAU,QAAQ,yBAAyB;AACnE,SAC8EC,IAAI,QAC3E,sBAAsB;AAE7B,MAAMC,IAAI,GAAGC,IAAA,IAAuC;EAAA,IAAtC;IAAEC;EAA8B,CAAC,GAAAD,IAAA;EAC7C,MAAM,CAACE,IAAI,EAAEC,OAAO,CAAC,GAAGhB,QAAQ,CAACW,IAAI,CAACM,OAAO,CAAC;EAC9C,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAGnB,QAAQ,CAAoC,IAAIoB,KAAK,CAAC,EAAE,CAAC,CAACC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;EACvG,MAAM;IAAEC,OAAO;IAAEC,IAAI;IAAEC;EAAM,CAAC,GAAGlB,QAAQ,CAGvCC,gBAAgB,EAAE;IAClBkB,SAAS,EAAE;MACTX;IACF;EACF,CAAC,CAAC;EAEFf,SAAS,CAAC,MAAM;IACd,IAAIwB,IAAI,EAAE;MACRJ,aAAa,CAACX,QAAQ,CAACe,IAAI,EAAER,IAAI,CAAC,CAAC;IACrC;EACF,CAAC,EAAE,CAACQ,IAAI,EAAER,IAAI,CAAC,CAAC;EAEhB,OACEjB,KAAA,CAAA4B,aAAA;IAAK,eAAY,gBAAgB;IAACC,SAAS,EAAC;EAA0B,GACnEH,KAAK,
|
|
1
|
+
{"version":3,"file":"Tool.js","names":["React","useEffect","useState","Sentiment","SentimentHeight","Loader","LoaderSize","ChartError","useQuery","getSentimentList","sortData","SelectedArrow","SortSwitch","Sort","Tool","_ref","division","sort","setSort","Bullish","sortedData","setSortedData","Array","fill","loading","data","error","variables","createElement","className","length","Fragment","disabled","selected","UP","DOWN","onClickButtonDown","Bearish","onClickButtonUp","map","item","index","key","name","size","md","isLoading","height","sentiment"],"sources":["../../../src/SentimentWidget/Tool.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport {\n Sentiment, SentimentHeight, Loader, LoaderSize, ChartError,\n} from '@oanda/labs-widget-common';\nimport { useQuery } from '@apollo/client';\nimport { getSentimentList } from '../gql/getSentimentList';\nimport { SentimentToolConfig } from './types';\nimport { sortData } from './utils';\nimport { SelectedArrow, SortSwitch } from './components/SortSwitch';\nimport {\n GetSentimentListQuery, GetSentimentListQueryVariables, SentimentInstrument, Sort,\n} from '../gql/types/graphql';\n\nconst Tool = ({ division }: SentimentToolConfig) => {\n const [sort, setSort] = useState(Sort.Bullish);\n const [sortedData, setSortedData] = useState<Omit<SentimentInstrument, 'id'>[]>(new Array(20).fill({}));\n const { loading, data, error } = useQuery<\n GetSentimentListQuery,\n GetSentimentListQueryVariables\n >(getSentimentList, {\n variables: {\n division,\n },\n });\n\n useEffect(() => {\n if (data) {\n setSortedData(sortData(data, sort));\n }\n }, [data, sort]);\n\n return (\n <div data-testid=\"sentiment-tool\" className=\"lw-text-sm lw-text-black\">\n {error || sortedData.length === 0 ? (\n <div className=\"lw-flex lw-h-[200px] lw-items-center lw-justify-center lw-border lw-border-solid lw-border-grey lw-p-2\">\n <ChartError />\n </div>\n ) : (\n <>\n <div className=\"lw-flex lw-justify-end lw-pb-5\">\n <SortSwitch\n disabled={loading}\n selected={sort === Sort.Bullish ? SelectedArrow.UP : SelectedArrow.DOWN}\n onClickButtonDown={() => setSort(Sort.Bearish)}\n onClickButtonUp={() => setSort(Sort.Bullish)}\n />\n </div>\n <div className=\"lw-flex lw-flex-col lw-border lw-border-solid lw-border-grey lw-p-2\">\n {sortedData.map((item, index) => (\n <div className=\"lw-flex lw-h-8 lw-w-full lw-items-center\" key={item.name || index}>\n <div className=\"lw-w-[120px] lw-shrink-0\">\n {loading ? (\n <Loader size={LoaderSize.md} />\n ) : (\n <p className=\"lw-truncate lw-font-sans lw-text-sm lw-font-bold\">{item.name || '\\u2014'}</p>\n )}\n </div>\n <Sentiment\n isLoading={loading}\n height={SentimentHeight.md}\n sentiment={item.sentiment}\n />\n </div>\n ))}\n </div>\n </>\n )}\n </div>\n );\n};\n\nexport { Tool };\n"],"mappings":"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"}
|
|
@@ -5,11 +5,13 @@ const {
|
|
|
5
5
|
graphqlUrl,
|
|
6
6
|
division,
|
|
7
7
|
instrument,
|
|
8
|
-
renderElementId
|
|
8
|
+
renderElementId,
|
|
9
|
+
locale
|
|
9
10
|
} = window.sentimentWidgetConfig;
|
|
10
11
|
render(React.createElement(SentimentWidget, {
|
|
11
12
|
graphqlUrl: graphqlUrl,
|
|
12
13
|
division: division,
|
|
13
|
-
instrument: instrument
|
|
14
|
+
instrument: instrument,
|
|
15
|
+
locale: locale
|
|
14
16
|
}), document.getElementById(renderElementId));
|
|
15
17
|
//# sourceMappingURL=render.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","names":["React","render","SentimentWidget","graphqlUrl","division","instrument","renderElementId","window","sentimentWidgetConfig","createElement","document","getElementById"],"sources":["../../../src/SentimentWidget/render.tsx"],"sourcesContent":["import React from 'react';\nimport { render } from 'react-dom';\nimport { SentimentWidget } from './SentimentWidget';\nimport { SentimentWrapperConfig } from './types';\n\ndeclare global {\n interface Window {\n sentimentWidgetConfig: SentimentWrapperConfig;\n }\n}\n\nconst {\n graphqlUrl,\n division,\n instrument,\n renderElementId,\n} = window.sentimentWidgetConfig;\n\nrender(\n <SentimentWidget\n graphqlUrl={graphqlUrl}\n division={division}\n instrument={instrument}\n />,\n document.getElementById(renderElementId),\n);\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,MAAM,QAAQ,WAAW;AAClC,SAASC,eAAe,QAAQ,mBAAmB;AASnD,MAAM;EACJC,UAAU;EACVC,QAAQ;EACRC,UAAU;EACVC;AACF,CAAC,GAAGC,MAAM,CAACC,qBAAqB;
|
|
1
|
+
{"version":3,"file":"render.js","names":["React","render","SentimentWidget","graphqlUrl","division","instrument","renderElementId","locale","window","sentimentWidgetConfig","createElement","document","getElementById"],"sources":["../../../src/SentimentWidget/render.tsx"],"sourcesContent":["import React from 'react';\nimport { render } from 'react-dom';\nimport { SentimentWidget } from './SentimentWidget';\nimport { SentimentWrapperConfig } from './types';\n\ndeclare global {\n interface Window {\n sentimentWidgetConfig: SentimentWrapperConfig;\n }\n}\n\nconst {\n graphqlUrl,\n division,\n instrument,\n renderElementId,\n locale,\n} = window.sentimentWidgetConfig;\n\nrender(\n <SentimentWidget\n graphqlUrl={graphqlUrl}\n division={division}\n instrument={instrument}\n locale={locale}\n />,\n document.getElementById(renderElementId),\n);\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,MAAM,QAAQ,WAAW;AAClC,SAASC,eAAe,QAAQ,mBAAmB;AASnD,MAAM;EACJC,UAAU;EACVC,QAAQ;EACRC,UAAU;EACVC,eAAe;EACfC;AACF,CAAC,GAAGC,MAAM,CAACC,qBAAqB;AAEhCR,MAAM,CACJD,KAAA,CAAAU,aAAA,CAACR,eAAe;EACdC,UAAU,EAAEA,UAAW;EACvBC,QAAQ,EAAEA,QAAS;EACnBC,UAAU,EAAEA,UAAW;EACvBE,MAAM,EAAEA;AAAO,CAChB,CAAC,EACFI,QAAQ,CAACC,cAAc,CAACN,eAAe,CACzC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../src/SentimentWidget/types.ts"],"sourcesContent":["import { Division } from '../gql/types/graphql';\n\nexport interface SentimentConfig {\n graphqlUrl: string;\n division: Division;\n instrument?: string;\n}\nexport interface SentimentWrapperConfig extends SentimentConfig {\n renderElementId: string;\n}\nexport interface SentimentWidgetConfig {\n division: Division;\n instrument: string;\n}\n\nexport interface SentimentToolConfig {\n division: Division;\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../src/SentimentWidget/types.ts"],"sourcesContent":["import { Locale } from '@oanda/mono-i18n';\nimport { Division } from '../gql/types/graphql';\n\nexport interface SentimentConfig {\n graphqlUrl: string;\n division: Division;\n instrument?: string;\n locale: Locale;\n}\nexport interface SentimentWrapperConfig extends SentimentConfig {\n renderElementId: string;\n}\nexport interface SentimentWidgetConfig {\n division: Division;\n instrument: string;\n}\n\nexport interface SentimentToolConfig {\n division: Division;\n}\n"],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Locale } from '@oanda/mono-i18n';
|
|
2
|
+
import en from './sources/en.json';
|
|
3
|
+
import zhTW from './sources/zh_TW.json';
|
|
4
|
+
export const translations = {
|
|
5
|
+
[Locale.en]: {
|
|
6
|
+
translation: en
|
|
7
|
+
},
|
|
8
|
+
[Locale.zhTW]: {
|
|
9
|
+
translation: zhTW
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["Locale","en","zhTW","translations","translation"],"sources":["../../../src/translations/index.ts"],"sourcesContent":["import { Locale, Translations } from '@oanda/mono-i18n';\n\nimport en from './sources/en.json';\nimport zhTW from './sources/zh_TW.json';\n\nimport { defaultTranslations } from './translations';\n\nexport type TranslationKey = keyof typeof defaultTranslations;\n\nexport const translations: Translations = {\n [Locale.en]: { translation: en },\n [Locale.zhTW]: { translation: zhTW },\n};\n"],"mappings":"AAAA,SAASA,MAAM,QAAsB,kBAAkB;AAEvD,OAAOC,EAAE,MAAM,mBAAmB;AAClC,OAAOC,IAAI,MAAM,sBAAsB;AAMvC,OAAO,MAAMC,YAA0B,GAAG;EACxC,CAACH,MAAM,CAACC,EAAE,GAAG;IAAEG,WAAW,EAAEH;EAAG,CAAC;EAChC,CAACD,MAAM,CAACE,IAAI,GAAG;IAAEE,WAAW,EAAEF;EAAK;AACrC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translations.js","names":["defaultTranslations","data_unavailable","pagination_entries_range"],"sources":["../../../src/translations/translations.ts"],"sourcesContent":["export const defaultTranslations = {\n data_unavailable: 'Data unavailable',\n pagination_entries_range: '{{firstItemOnPage}}-{{lastItemOnPage}} of {{itemCount}} entries',\n};\n"],"mappings":"AAAA,OAAO,MAAMA,mBAAmB,GAAG;EACjCC,gBAAgB,EAAE,kBAAkB;EACpCC,wBAAwB,EAAE;AAC5B,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { SentimentConfig } from './types';
|
|
3
|
-
declare const SentimentWidget: ({ graphqlUrl, division, instrument }: SentimentConfig) => JSX.Element;
|
|
3
|
+
declare const SentimentWidget: ({ graphqlUrl, division, instrument, locale, }: SentimentConfig) => JSX.Element;
|
|
4
4
|
export { SentimentWidget };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { Locale } from '@oanda/mono-i18n';
|
|
1
2
|
import { Division } from '../gql/types/graphql';
|
|
2
3
|
export interface SentimentConfig {
|
|
3
4
|
graphqlUrl: string;
|
|
4
5
|
division: Division;
|
|
5
6
|
instrument?: string;
|
|
7
|
+
locale: Locale;
|
|
6
8
|
}
|
|
7
9
|
export interface SentimentWrapperConfig extends SentimentConfig {
|
|
8
10
|
renderElementId: string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"projectId": "19607517615e88022ba782.45168463",
|
|
3
|
+
"outputDir": "src/translations/sources",
|
|
4
|
+
"esModuleTranslations": "src/translations/translations.ts",
|
|
5
|
+
"messagesFormat": "esModule",
|
|
6
|
+
"esModuleConstName": "defaultTranslations",
|
|
7
|
+
"includeEmptyTranslations": true,
|
|
8
|
+
"downloadOptions": {
|
|
9
|
+
"format": "json",
|
|
10
|
+
"add_newline_eof": true,
|
|
11
|
+
"placeholder_format": "i18n",
|
|
12
|
+
"indentation": "2sp",
|
|
13
|
+
"plural_format": "i18next",
|
|
14
|
+
"export_empty_as": "skip",
|
|
15
|
+
"include_tags": ["common_widgets"],
|
|
16
|
+
"filter_langs": ["en", "zh_TW"]
|
|
17
|
+
}
|
|
18
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oanda/labs-sentiment-widget",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.26",
|
|
4
4
|
"description": "Labs Sentiment Widget",
|
|
5
5
|
"main": "dist/main/index.js",
|
|
6
6
|
"module": "dist/module/index.js",
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"license": "UNLICENSED",
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@apollo/client": "3.7.17",
|
|
16
|
-
"@oanda/labs-widget-common": "^1.0.
|
|
16
|
+
"@oanda/labs-widget-common": "^1.0.26",
|
|
17
|
+
"@oanda/mono-i18n": "9.0.0",
|
|
17
18
|
"classnames": "2.3.2",
|
|
18
19
|
"graphql": "16.7.1"
|
|
19
20
|
},
|
|
@@ -21,5 +22,5 @@
|
|
|
21
22
|
"@graphql-codegen/cli": "5.0.0",
|
|
22
23
|
"@graphql-codegen/client-preset": "4.1.0"
|
|
23
24
|
},
|
|
24
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "1c59d814fdb1e15659d977474c873233848a944e"
|
|
25
26
|
}
|
|
@@ -1,23 +1,30 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';
|
|
3
|
+
import { LocaleProvider } from '@oanda/mono-i18n';
|
|
4
|
+
import { getLocale } from '@oanda/labs-widget-common';
|
|
3
5
|
import { Widget } from './Widget';
|
|
4
6
|
import { Tool } from './Tool';
|
|
5
7
|
import { SentimentConfig } from './types';
|
|
8
|
+
import { translations } from '../translations';
|
|
6
9
|
|
|
7
|
-
const SentimentWidget = ({
|
|
10
|
+
const SentimentWidget = ({
|
|
11
|
+
graphqlUrl, division, instrument, locale,
|
|
12
|
+
}: SentimentConfig) => {
|
|
8
13
|
const client = new ApolloClient({
|
|
9
14
|
uri: graphqlUrl,
|
|
10
15
|
cache: new InMemoryCache(),
|
|
11
16
|
});
|
|
12
17
|
|
|
13
18
|
return (
|
|
14
|
-
<
|
|
15
|
-
{
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
<LocaleProvider locale={getLocale(locale)} translations={translations}>
|
|
20
|
+
<ApolloProvider client={client}>
|
|
21
|
+
{instrument ? (
|
|
22
|
+
<Widget division={division} instrument={instrument} />
|
|
23
|
+
) : (
|
|
24
|
+
<Tool division={division} />
|
|
25
|
+
)}
|
|
26
|
+
</ApolloProvider>
|
|
27
|
+
</LocaleProvider>
|
|
21
28
|
);
|
|
22
29
|
};
|
|
23
30
|
|
|
@@ -31,7 +31,7 @@ const Tool = ({ division }: SentimentToolConfig) => {
|
|
|
31
31
|
|
|
32
32
|
return (
|
|
33
33
|
<div data-testid="sentiment-tool" className="lw-text-sm lw-text-black">
|
|
34
|
-
{error ? (
|
|
34
|
+
{error || sortedData.length === 0 ? (
|
|
35
35
|
<div className="lw-flex lw-h-[200px] lw-items-center lw-justify-center lw-border lw-border-solid lw-border-grey lw-p-2">
|
|
36
36
|
<ChartError />
|
|
37
37
|
</div>
|
|
@@ -52,7 +52,7 @@ const Tool = ({ division }: SentimentToolConfig) => {
|
|
|
52
52
|
{loading ? (
|
|
53
53
|
<Loader size={LoaderSize.md} />
|
|
54
54
|
) : (
|
|
55
|
-
<p className="lw-truncate lw-font-sans lw-font-bold">{item.name || '\u2014'}</p>
|
|
55
|
+
<p className="lw-truncate lw-font-sans lw-text-sm lw-font-bold">{item.name || '\u2014'}</p>
|
|
56
56
|
)}
|
|
57
57
|
</div>
|
|
58
58
|
<Sentiment
|
|
@@ -14,6 +14,7 @@ const {
|
|
|
14
14
|
division,
|
|
15
15
|
instrument,
|
|
16
16
|
renderElementId,
|
|
17
|
+
locale,
|
|
17
18
|
} = window.sentimentWidgetConfig;
|
|
18
19
|
|
|
19
20
|
render(
|
|
@@ -21,6 +22,7 @@ render(
|
|
|
21
22
|
graphqlUrl={graphqlUrl}
|
|
22
23
|
division={division}
|
|
23
24
|
instrument={instrument}
|
|
25
|
+
locale={locale}
|
|
24
26
|
/>,
|
|
25
27
|
document.getElementById(renderElementId),
|
|
26
28
|
);
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { Locale } from '@oanda/mono-i18n';
|
|
1
2
|
import { Division } from '../gql/types/graphql';
|
|
2
3
|
|
|
3
4
|
export interface SentimentConfig {
|
|
4
5
|
graphqlUrl: string;
|
|
5
6
|
division: Division;
|
|
6
7
|
instrument?: string;
|
|
8
|
+
locale: Locale;
|
|
7
9
|
}
|
|
8
10
|
export interface SentimentWrapperConfig extends SentimentConfig {
|
|
9
11
|
renderElementId: string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Locale, Translations } from '@oanda/mono-i18n';
|
|
2
|
+
|
|
3
|
+
import en from './sources/en.json';
|
|
4
|
+
import zhTW from './sources/zh_TW.json';
|
|
5
|
+
|
|
6
|
+
import { defaultTranslations } from './translations';
|
|
7
|
+
|
|
8
|
+
export type TranslationKey = keyof typeof defaultTranslations;
|
|
9
|
+
|
|
10
|
+
export const translations: Translations = {
|
|
11
|
+
[Locale.en]: { translation: en },
|
|
12
|
+
[Locale.zhTW]: { translation: zhTW },
|
|
13
|
+
};
|