Working tests

This commit is contained in:
2020-12-31 12:37:45 -05:00
parent 8143f518f5
commit aa9eaf11f7
11 changed files with 51 additions and 36 deletions

View File

@ -1,124 +0,0 @@
import React, { useState, useEffect } from "react";
import './App.css';
class Card extends React.Component{
state = {
data: {}
}
constructor(props) {
super(props);
this.state.data = props;
}
render() {
return (
<div className="card">
<h4><b>{this.state.data.Username}</b></h4>
<div className="container">
<p>{this.state.data.Closed}</p>
<p>{this.state.data.UserID}</p>
<p><a href={this.state.data.Photo}>Verification Photo</a></p>
</div>
</div>
);
}
}
function CardImg(data) {
return (
<div className="card-img">
<h4><b>Pend: {data.Username}</b></h4>
<img src={data.Photo !== undefined ? data.Photo : "https://thiscatdoesnotexist.com/"} alt="Avatar" style={{ width: "100%" }} />
<div className="container">
<p>{data.UserID}</p>
</div>
</div>
)
}
/*
function UserDetail(userID, verification) {
const [data, setData] = useState([]);
useEffect(() => {
fetch(
`https://thanos.nightmare.haus/api/user?userID=${userID}`
)
.then(res => res.json())
.then(response => {
setData(response);
})
.catch(error => console.log(error));
});
return (
<div className="card">
<h4><b>{data.Nick}</b></h4>
<img src={verification !== undefined ? verification : "https://thiscatdoesnotexist.com/"} alt="Avatar" style={{ width: "100%" }} />
<div className="container">
<img src={data.user.avatar !== undefined ? `https://cdn.discordapp.com/avatars/${userID}/${data.user.avatar}.png` : "https://thiscatdoesnotexist.com/"} alt="Avatar" style={{ width: "100%" }} />
<p>{data.joined_at}</p>
<p>{data.user.id}</p>
</div>
</div>
)
}
*/
class Pending extends React.Component {
state = {
pending: []
}
componentDidMount() {
const apiUrl = 'https://thanos.nightmare.haus/api/pending';
fetch(apiUrl)
.then((response) => response.json())
.then((data) => this.setState({pending: Object.values(data)}));
}
render() {
return (
<div className="App">
<ul>
{this.state.pending.map((data, i) => (
<li key={i}> <CardImg {...data} /></li>
))}
</ul>
<br></br>
</div>
);
}
}
class Verification extends React.Component {
state = {
verifications: []
}
componentDidMount() {
const apiUrl = 'https://thanos.nightmare.haus/api/verifications';
fetch(apiUrl)
.then((response) => response.json())
.then((data) => this.setState({verifications: data}));
}
render() {
return (
<div className="App">
<Pending />
<ul>
{this.state.verifications.map((data, i) => (
<li key={i}> <Card {...data} /></li>
))}
</ul>
</div>
);
}
}
export {
Pending,
Verification,
}
export default Verification;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,2 @@
(this.webpackJsonpthanos=this.webpackJsonpthanos||[]).push([[0],{15:function(t,e,n){},16:function(t,e,n){},17:function(t,e,n){"use strict";n.r(e);var a=n(0),s=n(1),c=n.n(s),i=n(9),r=n.n(i),o=(n(15),n(8)),h=n(3),j=n(4),d=n(2),l=n(6),u=n(5),b=(n(16),function(t){Object(l.a)(n,t);var e=Object(u.a)(n);function n(t){var a;return Object(h.a)(this,n),(a=e.call(this,t)).state={data:{},details:{},expand:!1},a.state.data=t,a.state.details={},a.state.expand=!1,a.onClick=a.onClick.bind(Object(d.a)(a)),a}return Object(j.a)(n,[{key:"onClick",value:function(t){var e=this;fetch("https://thanos.nightmare.haus/api/user?userID=".concat(this.state.data.UserID)).then((function(t){return t.json()})).then((function(t){e.setState({data:e.state.data,expand:!e.state.expand,details:t})})).catch((function(t){return console.log(t)}))}},{key:"render",value:function(){return this.state.expand&&null!=this.state.details?Object(a.jsx)("div",{onClick:this.onClick,children:Object(a.jsx)(p,{data:this.state.details,verification:this.state.data.Photo})}):Object(a.jsxs)("div",{className:"card",onClick:this.onClick,children:[Object(a.jsx)("h4",{children:Object(a.jsxs)("b",{children:[this.state.data.Username,null==this.state.details?" (Invalid)":""]})}),Object(a.jsxs)("div",{className:"container",children:[Object(a.jsx)("p",{children:this.state.data.Closed}),Object(a.jsx)("p",{children:this.state.data.UserID}),Object(a.jsx)("p",{children:Object(a.jsx)("a",{href:this.state.data.Photo,children:"Verification Photo"})})]})]})}}]),n}(c.a.Component));function O(t){return Object(a.jsxs)("div",{className:"card-img",children:[Object(a.jsx)("h4",{children:Object(a.jsxs)("b",{children:["Pend: ",t.Username]})}),Object(a.jsx)("img",{src:void 0!==t.Photo?t.Photo:"https://thiscatdoesnotexist.com/",alt:"Avatar",style:{width:"100%"}}),Object(a.jsx)("div",{className:"container",children:Object(a.jsx)("p",{children:t.UserID})})]})}function p(t,e){return e=(t=t.data).verification,Object(a.jsxs)("div",{className:"card-img",children:[Object(a.jsx)("h4",{children:Object(a.jsx)("b",{children:null!==t.Nick?t.Nick:t.user.Username})}),Object(a.jsx)("img",{src:void 0!==t.user.avatar?"https://cdn.discordapp.com/avatars/".concat(t.user.id,"/").concat(t.user.avatar,".png?size=64"):"https://thiscatdoesnotexist.com/",alt:"Avatar"}),Object(a.jsxs)("div",{className:"container",children:[Object(a.jsx)("img",{src:void 0!==e?e:"https://thiscatdoesnotexist.com/",alt:"Avatar",style:{width:"100%"}}),Object(a.jsx)("p",{children:t.joined_at}),Object(a.jsx)("p",{children:t.user.id})]})]})}var v=function(t){Object(l.a)(n,t);var e=Object(u.a)(n);function n(){var t;Object(h.a)(this,n);for(var a=arguments.length,s=new Array(a),c=0;c<a;c++)s[c]=arguments[c];return(t=e.call.apply(e,[this].concat(s))).state={pending:[]},t}return Object(j.a)(n,[{key:"componentDidMount",value:function(){var t=this;fetch("https://thanos.nightmare.haus/api/pending").then((function(t){return t.json()})).then((function(e){return t.setState({pending:Object.values(e)})}))}},{key:"render",value:function(){return Object(a.jsxs)("div",{className:"App",children:[Object(a.jsx)("ul",{children:this.state.pending.map((function(t,e){return Object(a.jsxs)("li",{children:[" ",Object(a.jsx)(O,Object(o.a)({},t))]},e)}))}),Object(a.jsx)("br",{})]})}}]),n}(c.a.Component),x=function(t){Object(l.a)(n,t);var e=Object(u.a)(n);function n(){var t;Object(h.a)(this,n);for(var a=arguments.length,s=new Array(a),c=0;c<a;c++)s[c]=arguments[c];return(t=e.call.apply(e,[this].concat(s))).state={verifications:[]},t}return Object(j.a)(n,[{key:"componentDidMount",value:function(){var t=this;fetch("https://thanos.nightmare.haus/api/verifications").then((function(t){return t.json()})).then((function(e){return t.setState({verifications:e})}))}},{key:"render",value:function(){return Object(a.jsxs)("div",{className:"App",children:[Object(a.jsx)(v,{}),Object(a.jsx)("ul",{children:this.state.verifications.map((function(t,e){return Object(a.jsxs)("li",{children:[" ",Object(a.jsx)(b,Object(o.a)({},t))]},e)}))})]})}}]),n}(c.a.Component);r.a.render(Object(a.jsxs)(c.a.StrictMode,{children:[Object(a.jsx)(x,{}),Object(a.jsx)(x,{})]}),document.getElementById("react_app"))}},[[17,1,2]]]);
//# sourceMappingURL=main.67033e8f.chunk.js.map

File diff suppressed because one or more lines are too long

View File

@ -1,2 +0,0 @@
(this.webpackJsonpthanos=this.webpackJsonpthanos||[]).push([[0],{14:function(t,e,n){},15:function(t,e,n){},16:function(t,e,n){"use strict";n.r(e);var c=n(0),a=n(1),s=n.n(a),r=n(8),i=n.n(r),j=(n(14),n(7)),o=n(2),h=n(3),d=n(5),u=n(4),l=(n(15),function(t){Object(d.a)(n,t);var e=Object(u.a)(n);function n(t){var c;return Object(o.a)(this,n),(c=e.call(this,t)).state={data:{}},c.state.data=t,c}return Object(h.a)(n,[{key:"render",value:function(){return Object(c.jsxs)("div",{className:"card",children:[Object(c.jsx)("h4",{children:Object(c.jsx)("b",{children:this.state.data.Username})}),Object(c.jsxs)("div",{className:"container",children:[Object(c.jsx)("p",{children:this.state.data.Closed}),Object(c.jsx)("p",{children:this.state.data.UserID}),Object(c.jsx)("p",{children:Object(c.jsx)("a",{href:this.state.data.Photo,children:"Verification Photo"})})]})]})}}]),n}(s.a.Component));function b(t){return Object(c.jsxs)("div",{className:"card-img",children:[Object(c.jsx)("h4",{children:Object(c.jsxs)("b",{children:["Pend: ",t.Username]})}),Object(c.jsx)("img",{src:void 0!==t.Photo?t.Photo:"https://thiscatdoesnotexist.com/",alt:"Avatar",style:{width:"100%"}}),Object(c.jsx)("div",{className:"container",children:Object(c.jsx)("p",{children:t.UserID})})]})}var O=function(t){Object(d.a)(n,t);var e=Object(u.a)(n);function n(){var t;Object(o.a)(this,n);for(var c=arguments.length,a=new Array(c),s=0;s<c;s++)a[s]=arguments[s];return(t=e.call.apply(e,[this].concat(a))).state={pending:[]},t}return Object(h.a)(n,[{key:"componentDidMount",value:function(){var t=this;fetch("https://thanos.nightmare.haus/api/pending").then((function(t){return t.json()})).then((function(e){return t.setState({pending:Object.values(e)})}))}},{key:"render",value:function(){return Object(c.jsxs)("div",{className:"App",children:[Object(c.jsx)("ul",{children:this.state.pending.map((function(t,e){return Object(c.jsxs)("li",{children:[" ",Object(c.jsx)(b,Object(j.a)({},t))]},e)}))}),Object(c.jsx)("br",{})]})}}]),n}(s.a.Component),p=function(t){Object(d.a)(n,t);var e=Object(u.a)(n);function n(){var t;Object(o.a)(this,n);for(var c=arguments.length,a=new Array(c),s=0;s<c;s++)a[s]=arguments[s];return(t=e.call.apply(e,[this].concat(a))).state={verifications:[]},t}return Object(h.a)(n,[{key:"componentDidMount",value:function(){var t=this;fetch("https://thanos.nightmare.haus/api/verifications").then((function(t){return t.json()})).then((function(e){return t.setState({verifications:e})}))}},{key:"render",value:function(){return Object(c.jsxs)("div",{className:"App",children:[Object(c.jsx)(O,{}),Object(c.jsx)("ul",{children:this.state.verifications.map((function(t,e){return Object(c.jsxs)("li",{children:[" ",Object(c.jsx)(l,Object(j.a)({},t))]},e)}))})]})}}]),n}(s.a.Component);i.a.render(Object(c.jsxs)(s.a.StrictMode,{children:[Object(c.jsx)(p,{}),Object(c.jsx)(p,{})]}),document.getElementById("react_app"))}},[[16,1,2]]]);
//# sourceMappingURL=main.bf43163b.chunk.js.map

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,8 @@
<br><br>
<div id="react_app"></div>
<script>!function (e) { function t(t) { for (var n, l, a = t[0], f = t[1], i = t[2], c = 0, s = []; c < a.length; c++)l = a[c], Object.prototype.hasOwnProperty.call(o, l) && o[l] && s.push(o[l][0]), o[l] = 0; for (n in f) Object.prototype.hasOwnProperty.call(f, n) && (e[n] = f[n]); for (p && p(t); s.length;)s.shift()(); return u.push.apply(u, i || []), r() } function r() { for (var e, t = 0; t < u.length; t++) { for (var r = u[t], n = !0, a = 1; a < r.length; a++) { var f = r[a]; 0 !== o[f] && (n = !1) } n && (u.splice(t--, 1), e = l(l.s = r[0])) } return e } var n = {}, o = { 1: 0 }, u = []; function l(t) { if (n[t]) return n[t].exports; var r = n[t] = { i: t, l: !1, exports: {} }; return e[t].call(r.exports, r, r.exports, l), r.l = !0, r.exports } l.m = e, l.c = n, l.d = function (e, t, r) { l.o(e, t) || Object.defineProperty(e, t, { enumerable: !0, get: r }) }, l.r = function (e) { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e, "__esModule", { value: !0 }) }, l.t = function (e, t) { if (1 & t && (e = l(e)), 8 & t) return e; if (4 & t && "object" == typeof e && e && e.__esModule) return e; var r = Object.create(null); if (l.r(r), Object.defineProperty(r, "default", { enumerable: !0, value: e }), 2 & t && "string" != typeof e) for (var n in e) l.d(r, n, function (t) { return e[t] }.bind(null, n)); return r }, l.n = function (e) { var t = e && e.__esModule ? function () { return e.default } : function () { return e }; return l.d(t, "a", t), t }, l.o = function (e, t) { return Object.prototype.hasOwnProperty.call(e, t) }, l.p = "/"; var a = this.webpackJsonpthanos = this.webpackJsonpthanos || [], f = a.push.bind(a); a.push = t, a = a.slice(); for (var i = 0; i < a.length; i++)t(a[i]); var p = f; r() }([])</script>
<script src="/static/js/2.23e2242b.chunk.js"></script>
<script src="/static/js/main.bf43163b.chunk.js"></script>
<div id="react_app"></div>
<div class="container h-100 d-flex justify-content-center align-items-center">
<script>!function (e) { function t(t) { for (var n, l, a = t[0], f = t[1], i = t[2], c = 0, s = []; c < a.length; c++)l = a[c], Object.prototype.hasOwnProperty.call(o, l) && o[l] && s.push(o[l][0]), o[l] = 0; for (n in f) Object.prototype.hasOwnProperty.call(f, n) && (e[n] = f[n]); for (p && p(t); s.length;)s.shift()(); return u.push.apply(u, i || []), r() } function r() { for (var e, t = 0; t < u.length; t++) { for (var r = u[t], n = !0, a = 1; a < r.length; a++) { var f = r[a]; 0 !== o[f] && (n = !1) } n && (u.splice(t--, 1), e = l(l.s = r[0])) } return e } var n = {}, o = { 1: 0 }, u = []; function l(t) { if (n[t]) return n[t].exports; var r = n[t] = { i: t, l: !1, exports: {} }; return e[t].call(r.exports, r, r.exports, l), r.l = !0, r.exports } l.m = e, l.c = n, l.d = function (e, t, r) { l.o(e, t) || Object.defineProperty(e, t, { enumerable: !0, get: r }) }, l.r = function (e) { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e, "__esModule", { value: !0 }) }, l.t = function (e, t) { if (1 & t && (e = l(e)), 8 & t) return e; if (4 & t && "object" == typeof e && e && e.__esModule) return e; var r = Object.create(null); if (l.r(r), Object.defineProperty(r, "default", { enumerable: !0, value: e }), 2 & t && "string" != typeof e) for (var n in e) l.d(r, n, function (t) { return e[t] }.bind(null, n)); return r }, l.n = function (e) { var t = e && e.__esModule ? function () { return e.default } : function () { return e }; return l.d(t, "a", t), t }, l.o = function (e, t) { return Object.prototype.hasOwnProperty.call(e, t) }, l.p = "/"; var a = this.webpackJsonpthanos = this.webpackJsonpthanos || [], f = a.push.bind(a); a.push = t, a = a.slice(); for (var i = 0; i < a.length; i++)t(a[i]); var p = f; r() }([])</script>
<script src="/static/js/2.55237e37.chunk.js"></script>
<script src="/static/js/main.67033e8f.chunk.js"></script>
</div>
</body>