Labs improvements
This commit is contained in:
parent
727e6daaae
commit
5831a68e11
2 changed files with 15 additions and 13 deletions
|
@ -114,12 +114,10 @@ module.exports = {
|
||||||
},
|
},
|
||||||
|
|
||||||
isFeatureEnabled: function(feature: string): boolean {
|
isFeatureEnabled: function(feature: string): boolean {
|
||||||
feature = feature.match(/\w+/g).join('_').toLowerCase();
|
|
||||||
return localStorage.getItem(`mx_labs_feature_${feature}`) === 'true';
|
return localStorage.getItem(`mx_labs_feature_${feature}`) === 'true';
|
||||||
},
|
},
|
||||||
|
|
||||||
setFeatureEnabled: function(feature: string, enabled: boolean) {
|
setFeatureEnabled: function(feature: string, enabled: boolean) {
|
||||||
feature = feature.match(/\w+/g).join('_').toLowerCase();
|
|
||||||
localStorage.setItem(`mx_labs_feature_${feature}`, enabled);
|
localStorage.setItem(`mx_labs_feature_${feature}`, enabled);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -27,8 +27,14 @@ var Email = require('../../email');
|
||||||
var AddThreepid = require('../../AddThreepid');
|
var AddThreepid = require('../../AddThreepid');
|
||||||
|
|
||||||
const LABS_FEATURES = [
|
const LABS_FEATURES = [
|
||||||
'Rich Text Editor',
|
{
|
||||||
'End-to-End Encryption'
|
name: 'Rich Text Editor',
|
||||||
|
id: 'rich_text_editor'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'End-to-End Encryption',
|
||||||
|
id: 'e2e_encryption'
|
||||||
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
module.exports = React.createClass({
|
module.exports = React.createClass({
|
||||||
|
@ -364,14 +370,14 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
this._renderLabs = function () {
|
this._renderLabs = function () {
|
||||||
let features = LABS_FEATURES.map(feature => (
|
let features = LABS_FEATURES.map(feature => (
|
||||||
<div key={feature}>
|
<div key={feature.id}>
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
id={feature}
|
id={feature.id}
|
||||||
name={feature}
|
name={feature.id}
|
||||||
defaultChecked={UserSettingsStore.isFeatureEnabled(feature)}
|
defaultChecked={UserSettingsStore.isFeatureEnabled(feature.id)}
|
||||||
onChange={e => UserSettingsStore.setFeatureEnabled(feature, e.target.checked)} />
|
onChange={e => UserSettingsStore.setFeatureEnabled(feature.id, e.target.checked)} />
|
||||||
<label htmlFor={feature}>{feature}</label>
|
<label htmlFor={feature.id}>{feature.name}</label>
|
||||||
</div>
|
</div>
|
||||||
));
|
));
|
||||||
return (
|
return (
|
||||||
|
@ -379,10 +385,8 @@ module.exports = React.createClass({
|
||||||
<h3>Labs</h3>
|
<h3>Labs</h3>
|
||||||
|
|
||||||
<div className="mx_UserSettings_section">
|
<div className="mx_UserSettings_section">
|
||||||
<p>These experimental features may change, break or disappear at any time. We make absolutely no guarantees about what may happen if you turn one of these experiments on, and your client may even spontaneously combust. Jokes aside, your client may delete all your data or your security and privacy could be compromised in unexpected ways. Please proceed with caution.</p>
|
<p>These are experimental features that may break in unexpected ways. Use with caution.</p>
|
||||||
{features}
|
{features}
|
||||||
<br />
|
|
||||||
<div className="mx_UserSettings_button" onClick={() => window.location.reload()}>Restart Vector</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue