@elice/material-exercise 1.250613.0 → 1.250616.0-teamleaderboard.0

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.
@@ -8,6 +8,7 @@ var React = require('react');
8
8
  var blocks = require('@elice/blocks');
9
9
  var icons = require('@elice/icons');
10
10
  var intl = require('@elice/intl');
11
+ var FileSaver = require('file-saver');
11
12
  var recoil = require('recoil');
12
13
  var recoil$1 = require('../context/recoil.js');
13
14
  require('../context/context.js');
@@ -18,48 +19,32 @@ require('../context/ExerciseProvider.js');
18
19
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
19
20
 
20
21
  var React__default = /*#__PURE__*/_interopDefaultCompat(React);
22
+ var FileSaver__default = /*#__PURE__*/_interopDefaultCompat(FileSaver);
21
23
 
22
- //
23
- //
24
- //
25
24
  var ELICE_MATERIAL_EXERCISE_ARDUINO_AGENT_MODAL_KEY = 'elice-material-exercise-arduino-agent-modal-closed';
26
25
  var ELICE_MATERIAL_EXERCISE_ARDUINO_AGENT_MODAL_VALUE = 'true';
26
+ var ARDUINO_AGENT_MAC_DOWNLOAD_URL = 'https://eli.so/arduino-agent-mac';
27
+ var ARDUINO_AGENT_WIN_DOWNLOAD_URL = 'https://eli.so/arduino-agent-win';
27
28
  var ARDUINO_AGENT_MANUAL_URL = 'https://eli.so/arduino-faq';
28
- var ARDUINO_AGENT_MAC_DOWNLOAD_META = Object.freeze({
29
- mac: {
30
- filename: 'EliceArdunioAgent-mac.pkg',
31
- url: 'https://eli.so/arduino-agent-mac'
32
- },
33
- win: {
34
- filename: 'EliceArdunioAgent-win.exe',
35
- url: 'https://eli.so/arduino-agent-win'
36
- }
37
- });
38
- //
39
- //
40
- //
41
29
  var ExerciseRunnerControllerArduinoAgentModal = function ExerciseRunnerControllerArduinoAgentModal() {
42
30
  var intl$1 = intl.useRawEliceIntl();
43
31
  var _useRecoilState = recoil.useRecoilState(recoil$1.exerciseArduinoAgentModalState),
44
32
  _useRecoilState2 = _rollupPluginBabelHelpers.slicedToArray(_useRecoilState, 2),
45
33
  open = _useRecoilState2[0],
46
34
  setOpen = _useRecoilState2[1];
47
- var downloadAgent = function downloadAgent(os) {
48
- var a = document.createElement('a');
49
- a.href = ARDUINO_AGENT_MAC_DOWNLOAD_META[os].url;
50
- a.download = ARDUINO_AGENT_MAC_DOWNLOAD_META[os].filename;
51
- a.click();
52
- };
53
- var handleClose = function handleClose() {
54
- setOpen(false);
55
- localStorage.setItem(ELICE_MATERIAL_EXERCISE_ARDUINO_AGENT_MODAL_KEY, ELICE_MATERIAL_EXERCISE_ARDUINO_AGENT_MODAL_VALUE);
56
- };
57
35
  React__default.default.useEffect(function () {
58
36
  var isConfirmed = localStorage.getItem(ELICE_MATERIAL_EXERCISE_ARDUINO_AGENT_MODAL_KEY) === ELICE_MATERIAL_EXERCISE_ARDUINO_AGENT_MODAL_VALUE;
59
37
  if (!isConfirmed) {
60
38
  setOpen(true);
61
39
  }
62
40
  }, [setOpen]);
41
+ var handleClose = function handleClose() {
42
+ setOpen(false);
43
+ localStorage.setItem(ELICE_MATERIAL_EXERCISE_ARDUINO_AGENT_MODAL_KEY, ELICE_MATERIAL_EXERCISE_ARDUINO_AGENT_MODAL_VALUE);
44
+ };
45
+ var handleDownload = function handleDownload(fileUrl) {
46
+ FileSaver__default.default.saveAs(fileUrl);
47
+ };
63
48
  var renderAgentInstallInstruction = function renderAgentInstallInstruction() {
64
49
  return jsxRuntime.jsxs(jsxRuntime.Fragment, {
65
50
  children: [jsxRuntime.jsx(blocks.Text, {
@@ -88,7 +73,7 @@ var ExerciseRunnerControllerArduinoAgentModal = function ExerciseRunnerControlle
88
73
  }),
89
74
  iconAlign: "left",
90
75
  onClick: function onClick() {
91
- return downloadAgent('win');
76
+ return handleDownload(ARDUINO_AGENT_WIN_DOWNLOAD_URL);
92
77
  },
93
78
  children: intl$1.formatMessage({
94
79
  id: 'exerciseRunner.controller.arduino.agent.instruction.install.window'
@@ -103,7 +88,7 @@ var ExerciseRunnerControllerArduinoAgentModal = function ExerciseRunnerControlle
103
88
  }),
104
89
  iconAlign: "left",
105
90
  onClick: function onClick() {
106
- return downloadAgent('mac');
91
+ return handleDownload(ARDUINO_AGENT_MAC_DOWNLOAD_URL);
107
92
  },
108
93
  children: intl$1.formatMessage({
109
94
  id: 'exerciseRunner.controller.arduino.agent.instruction.install.mac'
@@ -114,12 +99,14 @@ var ExerciseRunnerControllerArduinoAgentModal = function ExerciseRunnerControlle
114
99
  };
115
100
  var renderAgentConnectionInstruction = function renderAgentConnectionInstruction() {
116
101
  return jsxRuntime.jsxs(jsxRuntime.Fragment, {
117
- children: [jsxRuntime.jsx(blocks.Text, {
102
+ children: [jsxRuntime.jsxs(blocks.Text, {
118
103
  role: "gray0",
119
104
  bold: true,
120
- children: intl$1.formatMessage({
105
+ children: [intl$1.formatMessage({
121
106
  id: 'exerciseRunner.controller.arduino.agent.instruction.connect'
122
- })
107
+ }), intl$1.formatMessage({
108
+ id: 'exerciseRunner.controller.arduino.agent.instruction.connect'
109
+ })]
123
110
  }), jsxRuntime.jsx(blocks.Vspace, {
124
111
  height: 0.25
125
112
  }), jsxRuntime.jsx(blocks.Text, {
@@ -4,6 +4,7 @@ import React from 'react';
4
4
  import { Modal, Vspace, Text, Flex, Button, Icon, Hspace } from '@elice/blocks';
5
5
  import { eisWindows, eisMac, eilArrowRightwardsBasic } from '@elice/icons';
6
6
  import { useRawEliceIntl } from '@elice/intl';
7
+ import FileSaver from 'file-saver';
7
8
  import { useRecoilState } from 'recoil';
8
9
  import { exerciseArduinoAgentModalState } from '../context/recoil.js';
9
10
  import '../context/context.js';
@@ -11,47 +12,30 @@ import '../context/recoilTypes.js';
11
12
  import '../context/subjects.js';
12
13
  import '../context/ExerciseProvider.js';
13
14
 
14
- //
15
- //
16
- //
17
15
  var ELICE_MATERIAL_EXERCISE_ARDUINO_AGENT_MODAL_KEY = 'elice-material-exercise-arduino-agent-modal-closed';
18
16
  var ELICE_MATERIAL_EXERCISE_ARDUINO_AGENT_MODAL_VALUE = 'true';
17
+ var ARDUINO_AGENT_MAC_DOWNLOAD_URL = 'https://eli.so/arduino-agent-mac';
18
+ var ARDUINO_AGENT_WIN_DOWNLOAD_URL = 'https://eli.so/arduino-agent-win';
19
19
  var ARDUINO_AGENT_MANUAL_URL = 'https://eli.so/arduino-faq';
20
- var ARDUINO_AGENT_MAC_DOWNLOAD_META = Object.freeze({
21
- mac: {
22
- filename: 'EliceArdunioAgent-mac.pkg',
23
- url: 'https://eli.so/arduino-agent-mac'
24
- },
25
- win: {
26
- filename: 'EliceArdunioAgent-win.exe',
27
- url: 'https://eli.so/arduino-agent-win'
28
- }
29
- });
30
- //
31
- //
32
- //
33
20
  var ExerciseRunnerControllerArduinoAgentModal = function ExerciseRunnerControllerArduinoAgentModal() {
34
21
  var intl = useRawEliceIntl();
35
22
  var _useRecoilState = useRecoilState(exerciseArduinoAgentModalState),
36
23
  _useRecoilState2 = _slicedToArray(_useRecoilState, 2),
37
24
  open = _useRecoilState2[0],
38
25
  setOpen = _useRecoilState2[1];
39
- var downloadAgent = function downloadAgent(os) {
40
- var a = document.createElement('a');
41
- a.href = ARDUINO_AGENT_MAC_DOWNLOAD_META[os].url;
42
- a.download = ARDUINO_AGENT_MAC_DOWNLOAD_META[os].filename;
43
- a.click();
44
- };
45
- var handleClose = function handleClose() {
46
- setOpen(false);
47
- localStorage.setItem(ELICE_MATERIAL_EXERCISE_ARDUINO_AGENT_MODAL_KEY, ELICE_MATERIAL_EXERCISE_ARDUINO_AGENT_MODAL_VALUE);
48
- };
49
26
  React.useEffect(function () {
50
27
  var isConfirmed = localStorage.getItem(ELICE_MATERIAL_EXERCISE_ARDUINO_AGENT_MODAL_KEY) === ELICE_MATERIAL_EXERCISE_ARDUINO_AGENT_MODAL_VALUE;
51
28
  if (!isConfirmed) {
52
29
  setOpen(true);
53
30
  }
54
31
  }, [setOpen]);
32
+ var handleClose = function handleClose() {
33
+ setOpen(false);
34
+ localStorage.setItem(ELICE_MATERIAL_EXERCISE_ARDUINO_AGENT_MODAL_KEY, ELICE_MATERIAL_EXERCISE_ARDUINO_AGENT_MODAL_VALUE);
35
+ };
36
+ var handleDownload = function handleDownload(fileUrl) {
37
+ FileSaver.saveAs(fileUrl);
38
+ };
55
39
  var renderAgentInstallInstruction = function renderAgentInstallInstruction() {
56
40
  return jsxs(Fragment, {
57
41
  children: [jsx(Text, {
@@ -80,7 +64,7 @@ var ExerciseRunnerControllerArduinoAgentModal = function ExerciseRunnerControlle
80
64
  }),
81
65
  iconAlign: "left",
82
66
  onClick: function onClick() {
83
- return downloadAgent('win');
67
+ return handleDownload(ARDUINO_AGENT_WIN_DOWNLOAD_URL);
84
68
  },
85
69
  children: intl.formatMessage({
86
70
  id: 'exerciseRunner.controller.arduino.agent.instruction.install.window'
@@ -95,7 +79,7 @@ var ExerciseRunnerControllerArduinoAgentModal = function ExerciseRunnerControlle
95
79
  }),
96
80
  iconAlign: "left",
97
81
  onClick: function onClick() {
98
- return downloadAgent('mac');
82
+ return handleDownload(ARDUINO_AGENT_MAC_DOWNLOAD_URL);
99
83
  },
100
84
  children: intl.formatMessage({
101
85
  id: 'exerciseRunner.controller.arduino.agent.instruction.install.mac'
@@ -106,12 +90,14 @@ var ExerciseRunnerControllerArduinoAgentModal = function ExerciseRunnerControlle
106
90
  };
107
91
  var renderAgentConnectionInstruction = function renderAgentConnectionInstruction() {
108
92
  return jsxs(Fragment, {
109
- children: [jsx(Text, {
93
+ children: [jsxs(Text, {
110
94
  role: "gray0",
111
95
  bold: true,
112
- children: intl.formatMessage({
96
+ children: [intl.formatMessage({
113
97
  id: 'exerciseRunner.controller.arduino.agent.instruction.connect'
114
- })
98
+ }), intl.formatMessage({
99
+ id: 'exerciseRunner.controller.arduino.agent.instruction.connect'
100
+ })]
115
101
  }), jsx(Vspace, {
116
102
  height: 0.25
117
103
  }), jsx(Text, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elice/material-exercise",
3
- "version": "1.250613.0",
3
+ "version": "1.250616.0-teamleaderboard.0",
4
4
  "description": "User view and editing components of Elice material exercise",
5
5
  "repository": "https://git.elicer.io/elice/frontend/library/elice-material",
6
6
  "license": "UNLICENSED",
@@ -83,11 +83,11 @@
83
83
  "@elice/icons": "^1.230814.0",
84
84
  "@elice/intl": "0.241127.0",
85
85
  "@elice/markdown": "1.241015.0",
86
- "@elice/material-shared-types": "1.250613.0",
87
- "@elice/material-shared-utils": "1.250613.0",
86
+ "@elice/material-shared-types": "1.250604.0",
87
+ "@elice/material-shared-utils": "1.250604.0",
88
88
  "@elice/mui-elements": "^5.250108.0-controllabel.0",
89
89
  "@elice/mui-system": "^5.250108.0-controllabel.0",
90
- "@elice/types": "1.241220.0",
90
+ "@elice/types": "^1.250612.0-teamleaderboard.1",
91
91
  "@elice/websocket": "^1.220815.0",
92
92
  "@emotion/react": "^11.10.5",
93
93
  "@emotion/styled": "^11.10.5",