-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathmy-message-sidebar.js
62 lines (62 loc) · 4.24 KB
/
my-message-sidebar.js
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
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const mailspring_exports_1 = require("mailspring-exports");
class MyMessageSidebar extends mailspring_exports_1.React.Component {
// This sidebar component listens to the FocusedContactStore,
// which gives us access to the Contact object of the currently
// selected person in the conversation. If you wanted to take
// the contact and fetch your own data, you'd want to create
// your own store, so the flow of data would be:
// FocusedContactStore => Your Store => Your Component
constructor(props) {
super(props);
this._onChange = () => {
this.setState(this._getStateFromStores());
};
this._getStateFromStores = () => {
return {
contact: mailspring_exports_1.FocusedContactsStore.focusedContact()
};
};
this.state = this._getStateFromStores();
}
componentDidMount() {
this.unsubscribe = mailspring_exports_1.FocusedContactsStore.listen(this._onChange);
}
componentWillUnmount() {
this.unsubscribe();
}
_renderContent() {
// Want to include images or other static assets in your components?
// Reference them using the mailspring:// URL scheme:
//
// <RetinaImg
// url="mailspring://<<package.name>>/assets/checkmark_templatethis.2x.png"
// mode={RetinaImg.Mode.ContentIsMask}/>
//
return (mailspring_exports_1.React.createElement("div", { className: "header" },
mailspring_exports_1.React.createElement("h1", null,
this.state.contact.displayName(),
" is the focused contact.")));
}
_renderPlaceholder() {
return mailspring_exports_1.React.createElement("div", null, " No Data Available ");
}
render() {
const content = this.state.contact
? this._renderContent()
: this._renderPlaceholder();
return mailspring_exports_1.React.createElement("div", { className: "my-message-sidebar" }, content);
}
}
exports.default = MyMessageSidebar;
MyMessageSidebar.displayName = "MyMessageSidebar";
// Providing container styles tells the app how to constrain
// the column your component is being rendered in. The min and
// max size of the column are chosen automatically based on
// these values.
MyMessageSidebar.containerStyles = {
order: 1,
flexShrink: 0
};
//# sour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