Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4b810f3828 | ||
|
|
b23e97cf78 | ||
|
|
2fc95b9682 | ||
|
|
771b1558b7 | ||
|
|
bcf8fc8acf | ||
|
|
6a929b51be |
12
README.md
12
README.md
@@ -1,8 +1,6 @@
|
||||
# Random user
|
||||
Online preview: http://theenoro.the-co.de/random-user/
|
||||
|
||||
|
||||
|
||||
## Download
|
||||
### Build yourself
|
||||
NodeJS: https://nodejs.org/en/
|
||||
@@ -19,14 +17,15 @@ lessc src_less/main.less build/main.css
|
||||
mv public build
|
||||
```
|
||||
### Latest Artifact
|
||||
witout building - just download and put into webfolder.
|
||||
https://gitlab.thee.moe/theenoro/random-user/-/jobs/artifacts/master/download?job=pages
|
||||
|
||||
## Usage
|
||||
### Get it running
|
||||
Just use a simple webserver, if you want to use the rescan.php then you need php-cli or something like apache/nginx with the php module.
|
||||
### Create new Classes / Usergroups w/o rescan.php
|
||||
1. create in `build/data/class` a new folder for a new group of users
|
||||
2. modify the `classes.json` in `build/data/class` and add in the array your ne folder name
|
||||
1. create in `public/data/class` a new folder for a new group of users
|
||||
2. modify the `classes.json` in `public/data/class` and add in the array your ne folder name
|
||||
3. create in your new folder a file with the name 'user.json' and a structure like
|
||||
```json
|
||||
{"user":[
|
||||
@@ -37,6 +36,7 @@ Just use a simple webserver, if you want to use the rescan.php then you need php
|
||||
|
||||
```
|
||||
### Create new Classes / Usergroups w/ rescan.php
|
||||
1. create in `build/data/class` a new folder for a new group of users
|
||||
2. run in the build folder `php ./rescan.php`, it will generate the `classes.json` and all `user.json` files for you
|
||||
1. (for the web rescan)go to public/ and run `chown -R www-data:www-data class` that the user www-data owns the folder and can write files.
|
||||
2. create in `public/data/class` a new folder for a new group of users
|
||||
3. run in the public folder `php ./rescan.php`, it will generate the `classes.json` and all `user.json` files for you. Or get on your website https://yourdoma.in/rescan.php
|
||||
|
||||
|
||||
13
package-lock.json
generated
13
package-lock.json
generated
@@ -6630,7 +6630,8 @@
|
||||
},
|
||||
"ansi-regex": {
|
||||
"version": "2.1.1",
|
||||
"bundled": true
|
||||
"bundled": true,
|
||||
"optional": true
|
||||
},
|
||||
"aproba": {
|
||||
"version": "1.2.0",
|
||||
@@ -6995,7 +6996,8 @@
|
||||
},
|
||||
"safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"bundled": true
|
||||
"bundled": true,
|
||||
"optional": true
|
||||
},
|
||||
"safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
@@ -7043,6 +7045,7 @@
|
||||
"strip-ansi": {
|
||||
"version": "3.0.1",
|
||||
"bundled": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"ansi-regex": "^2.0.0"
|
||||
}
|
||||
@@ -7081,11 +7084,13 @@
|
||||
},
|
||||
"wrappy": {
|
||||
"version": "1.0.2",
|
||||
"bundled": true
|
||||
"bundled": true,
|
||||
"optional": true
|
||||
},
|
||||
"yallist": {
|
||||
"version": "3.0.3",
|
||||
"bundled": true
|
||||
"bundled": true,
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,21 +39,21 @@ export class Main extends React.Component{
|
||||
|
||||
}
|
||||
selCh(e){
|
||||
console.log(e.target.value);
|
||||
//console.log(e.target.value);
|
||||
var v = e.target.value;
|
||||
var me = this;
|
||||
if(v!=='-'){
|
||||
Students_loader.loadStudents(e.target.value,(data)=>{
|
||||
console.log(data)
|
||||
//console.log(data)
|
||||
User.user_arr = [];
|
||||
me.setState({students:[],stud_html:[]});
|
||||
|
||||
var ht = [];
|
||||
console.log(v)
|
||||
//console.log(v)
|
||||
data.user.map((cl,i)=>
|
||||
ht.push(<Student username={cl} cl={v} i={i}></Student>)
|
||||
)
|
||||
console.log(ht[0])
|
||||
//console.log(ht[0])
|
||||
me.setState({students:data.user,selected:v,stud_html:ht})
|
||||
})
|
||||
}else{
|
||||
@@ -85,7 +85,7 @@ export class Main extends React.Component{
|
||||
var x = Math.floor(Math.random()*users);
|
||||
if(already_picked.indexOf(x)===-1){
|
||||
already_picked.push(x);
|
||||
console.log(x);
|
||||
//console.log(x);
|
||||
User.user_arr[x].disappear();
|
||||
pushed = true;
|
||||
}
|
||||
@@ -102,7 +102,7 @@ export class Main extends React.Component{
|
||||
|
||||
openGrpGui(){
|
||||
if(this.state.grp_gui==='invi'){
|
||||
this.setState({grp_gui:'vi',"css":".group{opacity:1}"});
|
||||
this.setState({grp_gui:'vi',"css":".group{opacity:1} .user.disappear{opacity: 1 !important; }"});
|
||||
|
||||
}else{
|
||||
this.setState({grp_gui:'invi',"css":".group{opacity:0}"});
|
||||
@@ -123,7 +123,7 @@ export class Main extends React.Component{
|
||||
for(var i = 0; i<this.state.students.length;i++){
|
||||
var grp = Math.floor(Math.random()*mk_groups);
|
||||
if(this.state.students.length-1-fill>=i || tmp_map['grp_'+grp].length<mk_groups){
|
||||
console.log("TEST")
|
||||
//console.log("TEST")
|
||||
var g = false;
|
||||
var y = 0;
|
||||
while(g===false){
|
||||
@@ -132,13 +132,13 @@ export class Main extends React.Component{
|
||||
g=true;
|
||||
}
|
||||
if(y>100){
|
||||
console.log("ESC");
|
||||
//console.log("ESC");
|
||||
break;
|
||||
}
|
||||
y++;
|
||||
}
|
||||
}else{
|
||||
console.log("FILL")
|
||||
//console.log("FILL")
|
||||
}
|
||||
User.user_arr[i].setGroup(grp)
|
||||
tmp_map["grp_"+grp].push( User.user_arr[i]);
|
||||
@@ -146,11 +146,11 @@ export class Main extends React.Component{
|
||||
}
|
||||
|
||||
|
||||
console.log("INFO");
|
||||
console.log(tmp_map)
|
||||
console.log("REST " +fill);
|
||||
console.log(Math.floor(this.state.students.length/this.state.grp_member));
|
||||
console.log("INFO END")
|
||||
//console.log("INFO");
|
||||
//console.log(tmp_map)
|
||||
//console.log("REST " +fill);
|
||||
//console.log(Math.floor(this.state.students.length/this.state.grp_member));
|
||||
//console.log("INFO END")
|
||||
}
|
||||
|
||||
render(){
|
||||
@@ -161,7 +161,7 @@ export class Main extends React.Component{
|
||||
<select className="select-wrapper" onChange={this.selCh} value={this.state.selected} title="Gruppe auswählen">
|
||||
<option value="-">-</option>
|
||||
{this.state.classes.map((cl,i)=>
|
||||
<option value={cl.toLowerCase()}>{cl.toUpperCase()}</option>
|
||||
<option value={cl}>{cl.toUpperCase()}</option>
|
||||
)}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@@ -45,7 +45,7 @@ export class Student extends React.Component{
|
||||
var c = "user chosen_"+this.state.num+' '+this.state.dis;
|
||||
return (
|
||||
<div className={c}>
|
||||
<div className="group">{this.state.group}</div>
|
||||
<div className="group">{this.state.group+1}</div>
|
||||
<div className="user_img"><img src={this.state.img_url} onError={this.onErr} alt=""></img></div>
|
||||
<div className="username">{this.state.username}</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user