forked from UXM-Academy/BlockChain_Platform
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmsgHistory.js
More file actions
201 lines (182 loc) · 6.53 KB
/
msgHistory.js
File metadata and controls
201 lines (182 loc) · 6.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
function IncomingMsg(_ref) {
var msg = _ref.msg,
time_data = _ref.time_data,
img_src = _ref.img_src;
return React.createElement(
"div",
{ className: "incoming_msg" },
React.createElement(
"div",
{ className: "incoming_msg_img" },
React.createElement("img", { src: img_src, alt: "seller" })
),
React.createElement(
"div",
{ className: "received_msg" },
React.createElement(
"div",
{ className: "received_withd_msg" },
React.createElement(
"p",
null,
msg
),
React.createElement(
"span",
{ className: "time_date" },
time_data
)
)
)
);
}
function OutgoingMsg(_ref2) {
var msg = _ref2.msg,
time_data = _ref2.time_data;
return React.createElement(
"div",
{ className: "outgoing_msg" },
React.createElement(
"div",
{ className: "sent_msg" },
React.createElement(
"p",
null,
msg
),
React.createElement(
"span",
{ className: "time_date" },
time_data
)
)
);
}
function RequestMsg(_ref3) {
var time_data = _ref3.time_data,
img_src = _ref3.img_src;
return React.createElement(
"div",
{ className: "incoming_msg" },
React.createElement(
"div",
{ className: "incoming_msg_img" },
React.createElement("img", { src: img_src, alt: "seller" })
),
React.createElement(
"div",
{ className: "received_msg" },
React.createElement(
"div",
{ className: "received_withd_msg" },
React.createElement(
"p",
null,
"\uACE0\uAC1D\uB2D8 \uC0C1\uD488\uC758 \uC81C\uC791 \uC794\uD589\uC744 \uC704\uD574",
React.createElement("br", null),
"\uC791\uC5C5 \uC2B9\uC778\uC744 \uBD80\uD0C1\uB4DC\uB9BD\uB2C8\uB2E4.",
React.createElement("br", null),
React.createElement(
"button",
{ type: "button", className: "btn btn-success trigger" },
"\uC790\uC138\uD788 \uBCF4\uAE30"
),
React.createElement(
"span",
{ className: "time_date" },
time_data
)
)
)
)
);
}
var e = React.createElement;
var MsgHistory = function (_React$Component) {
_inherits(MsgHistory, _React$Component);
function MsgHistory(props) {
_classCallCheck(this, MsgHistory);
var _this = _possibleConstructorReturn(this, (MsgHistory.__proto__ || Object.getPrototypeOf(MsgHistory)).call(this, props));
_this.state = {
imcoming_data: [{
type: "incoming_msg",
msg: "Apollo University, Delhi, India Test",
time_data: "11:01 AM | Today",
img_src: "https://ptetutorials.com/images/user-profile.png"
}, {
msg: "Apollo University, Delhi, India Test",
time_data: "11:01 AM | Today",
img_src: "https://ptetutorials.com/images/user-profile.png"
}],
outgoing_data: [{
type: "outgoing_msg",
msg: "Apollo University, Delhi, India Test",
time_data: "11:01 AM | Today"
}, {
msg: "Apollo University, Delhi, India Test",
time_data: "11:01 AM | Today"
}],
request_data: [{
type: "request_msg",
time_data: "11:01 AM | Today",
img_src: "https://ptetutorials.com/images/user-profile.png"
}]
};
return _this;
}
_createClass(MsgHistory, [{
key: "show",
value: function show() {
// 시간순으로 정렬 그리고 반복
var showData = [];
//임시
for (var _i = 0; _i < 2; _i++) {
showData.push(this.state.imcoming_data[_i]);
}
for (var _i2 = 0; _i2 < 2; _i2++) {
showData.push(this.state.outgoing_data[_i2]);
}
showData.push(this.state.request_data[i]);
return showData;
}
}, {
key: "render",
value: function render() {
var showData = this.show();
console.log(showData);
return React.createElement(
"div",
null,
showData.map(function (data) {
if (data.type == "incoming_msg") {
return React.createElement(IncomingMsg, {
msg: data.msg,
time_data: data.time_data,
img_src: data.img_src
});
} else if (data.type == "outgoing_msg") {
return React.createElement(OutgoingMsg, { msg: data.msg, time_data: data.time_data });
} else {
return React.createElement(RequestMsg, { time_data: data.time_data, img_src: data.img_src });
}
})
);
}
}]);
return MsgHistory;
}(React.Component);
// Find all DOM containers, and render Like buttons into them.
// domContainer = document.querySelector("#acceptApproval");
// console.log("true");
// ReactDOM.render(e(AcceptApproval), domContainer);
// ReactDOM.render(<AcceptApproval></AcceptApproval>);
document.querySelectorAll(".msg_history").forEach(function (domContainer) {
// Read the comment ID from a data-* attribute.
console.log(domContainer);
ReactDOM.render(e(MsgHistory), domContainer);
});