Skip to content

Commit f284508

Browse files
committed
added mod pack component to frontend
1 parent 59db7f9 commit f284508

File tree

3 files changed

+48
-2
lines changed

3 files changed

+48
-2
lines changed

ui/App/components/ConfigContent.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class ConfigContent extends React.Component {
4747
<section className="content">
4848
<div className="box">
4949
<div className="box-header">
50-
<h3 className="box-title">Manage Server Configuration</h3>
50+
<h3 className="box-title">Game Configuration</h3>
5151
</div>
5252

5353
<div className="box-body">
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import React from 'react';
2+
3+
class ModPacks extends React.Component {
4+
constructor(props) {
5+
super(props)
6+
}
7+
8+
render() {
9+
return(
10+
<div className="box">
11+
<div className="box-header">
12+
<h3 className="box-title">Mod Packs</h3>
13+
</div>
14+
15+
<div className="box-body">
16+
<p>itest</p>
17+
</div>
18+
</div>
19+
)
20+
}
21+
22+
}
23+
24+
export default ModPacks

ui/App/components/ModsContent.jsx

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,26 @@ import React from 'react';
22
import {IndexLink} from 'react-router';
33
import ModList from './Mods/ListMods.jsx';
44
import InstalledMods from './Mods/InstalledMods.jsx';
5+
import ModPacks from './Mods/ModPacks.jsx'
56

67
class ModsContent extends React.Component {
78
constructor(props) {
89
super(props);
910
this.componentDidMount = this.componentDidMount.bind(this);
1011
this.toggleMod = this.toggleMod.bind(this);
1112
this.loadInstalledModList = this.loadInstalledModList.bind(this);
13+
this.loadModPackList = this.loadModPackList.bind(this);
1214
this.state = {
1315
installedMods: [],
14-
listMods: []
16+
listMods: [],
17+
modPacks: [],
1518
};
1619
}
1720

1821
componentDidMount() {
1922
this.loadModList();
2023
this.loadInstalledModList();
24+
this.loadModPackList();
2125
}
2226

2327
loadModList() {
@@ -51,6 +55,21 @@ class ModsContent extends React.Component {
5155
});
5256
}
5357

58+
loadModPackList() {
59+
$.ajax({
60+
url: "/api/mods/packs/list",
61+
dataType: "json",
62+
success: (resp) => {
63+
if (resp.success === true) {
64+
this.setState({modPacks: resp.data})
65+
console.log(this.state)
66+
} else {
67+
this.setState({modPacks: []})
68+
}
69+
}
70+
})
71+
}
72+
5473
toggleMod(modName) {
5574
$.ajax({
5675
url: "/api/mods/toggle/" + modName,
@@ -88,6 +107,9 @@ class ModsContent extends React.Component {
88107
{...this.state}
89108
toggleMod={this.toggleMod}
90109
/>
110+
<ModPacks
111+
112+
/>
91113

92114
</section>
93115
</div>

0 commit comments

Comments
 (0)