-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSettings.jsx
79 lines (75 loc) · 2.88 KB
/
Settings.jsx
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
const { React } = require('powercord/webpack');
const { SwitchItem, Category } = require('powercord/components/settings');
const providers = require('./providers.json');
module.exports = class Settings extends React.Component {
constructor(props) {
super(props);
this.state = { categoryOpened: true };
}
get toggledProviders() {
return providers;
}
toSnake(str) {
return str.split(' ').join('-').toLowerCase();
}
render() {
return (
<div>
<Category
name='Providers'
description='Toggle the various reverse image search providers'
opened={this.state.categoryOpened}
onChange={() =>
this.setState({
categoryOpened: !this.state.categoryOpened,
})
}
>
{providers.map(i => (
<SwitchItem
value={this.props.getSetting(
`RIS-provider-${this.toSnake(i.name)}`,
i.default
)}
onChange={() =>
this.props.toggleSetting(
`RIS-provider-${this.toSnake(i.name)}`,
i.default
)
}
>
{i.name}
</SwitchItem>
))}
</Category>
<SwitchItem
value={this.props.getSetting('RIS-openAll', false)}
onChange={() =>
this.props.toggleSetting(`RIS-openAll`, false)
}
note='Adds an option to search for the image in ALL enabled providers.'
>
Open All
</SwitchItem>
<SwitchItem
value={this.props.getSetting('RIS-enlargeImages', false)}
onChange={() =>
this.props.toggleSetting(`RIS-enlargeImages`, false)
}
note='Change the size of server icons / avatars from 32 to 512 or highest when searching.'
>
Enlarge icons
</SwitchItem>
<SwitchItem
value={this.props.getSetting('RIS-convertPNG', false)}
onChange={() =>
this.props.toggleSetting(`RIS-convertPNG`, false)
}
note='Automatically changes the extension from .webp to .png when searching.'
>
.webp to .png
</SwitchItem>
</div>
);
}
};