diff --git a/static/App.js b/src/App.js similarity index 64% rename from static/App.js rename to src/App.js index f90261d..e66cc1b 100644 --- a/static/App.js +++ b/src/App.js @@ -1,21 +1,43 @@ -import React, { useState, useEffect } from "react"; +import React from "react"; import './App.css'; class Card extends React.Component{ state = { - data: {} + data: {}, + details: {}, + expand: false } constructor(props) { super(props); this.state.data = props; + this.state.details = {}; + this.state.expand = false; + this.onClick = this.onClick.bind(this); + } + onClick(e) { + fetch( + `https://thanos.nightmare.haus/api/user?userID=${this.state.data.UserID}` + ) + .then(res => res.json()) + .then(response => { + this.setState({data: this.state.data, expand: !this.state.expand, details: response}); + }) + .catch(error => console.log(error)); } - render() { + if (this.state.expand && this.state.details != null) { + return ( +
+ +
+ + ) + } return ( -
-

{this.state.data.Username}

+
+

{this.state.data.Username}{this.state.details == null ? " (Invalid)" : ""}

{this.state.data.Closed}

{this.state.data.UserID}

@@ -37,34 +59,25 @@ class Card extends React.Component{
) } -/* -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)); - }); +function UserDetail(data, verification) { + data = data.data + verification = data.verification return ( -
-

{data.Nick}

- Avatar -
- Avatar +
+

{data.Nick !== null ? data.Nick : data.user.Username}

+ Avatar +
+ + Avatar

{data.joined_at}

{data.user.id}

) } -*/ + class Pending extends React.Component { state = { pending: [] diff --git a/static/js/2.23e2242b.chunk.js b/static/js/2.23e2242b.chunk.js deleted file mode 100644 index d76b33d..0000000 --- a/static/js/2.23e2242b.chunk.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! For license information please see 2.23e2242b.chunk.js.LICENSE.txt */ -(this.webpackJsonpthanos=this.webpackJsonpthanos||[]).push([[2],[function(e,t,n){"use strict";e.exports=n(9)},function(e,t,n){"use strict";e.exports=n(10)},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}n.d(t,"a",(function(){return r}))},function(e,t,n){"use strict";function r(e,t){for(var n=0;n
\n );\n}\n}\n\n function CardImg(data) {\n return (\n
\n

Pend: {data.Username}

\n \"Avatar\"\n
\n

{data.UserID}

\n
\n
\n )\n }\n/*\nfunction UserDetail(userID, verification) {\n const [data, setData] = useState([]);\n useEffect(() => {\n fetch(\n `https://thanos.nightmare.haus/api/user?userID=${userID}`\n )\n .then(res => res.json())\n .then(response => {\n setData(response);\n })\n .catch(error => console.log(error));\n });\n\n return (\n
\n

{data.Nick}

\n \"Avatar\"\n
\n \"Avatar\"\n \n

{data.joined_at}

\n

{data.user.id}

\n
\n
\n )\n}\n*/\nclass Pending extends React.Component {\n state = {\n pending: []\n }\n componentDidMount() {\n const apiUrl = 'https://thanos.nightmare.haus/api/pending';\n fetch(apiUrl)\n .then((response) => response.json())\n .then((data) => this.setState({pending: Object.values(data)}));\n }\n render() {\n return (\n
\n
    \n {this.state.pending.map((data, i) => (\n
  • \n ))}\n
\n

\n
\n );\n }\n}\n\n\n\nclass Verification extends React.Component {\n state = {\n verifications: []\n }\n componentDidMount() {\n const apiUrl = 'https://thanos.nightmare.haus/api/verifications';\n fetch(apiUrl)\n .then((response) => response.json())\n .then((data) => this.setState({verifications: data}));\n }\n\n render() {\n return (\n
\n \n
    \n {this.state.verifications.map((data, i) => (\n
  • \n ))}\n
\n
\n );\n }\n}\n\nexport {\n Pending,\n Verification,\n}\n\nexport default Verification;","import React from 'react';\nimport ReactDOM from 'react-dom';\nimport './index.css';\nimport Verification from './App';\nimport Pending from './App';\n\nReactDOM.render(\n \n \n \n ,\n document.getElementById('react_app')\n);\n"],"sourceRoot":""} \ No newline at end of file diff --git a/static/loggedIn.tpl b/static/loggedIn.tpl index fb6e42d..aeca58a 100644 --- a/static/loggedIn.tpl +++ b/static/loggedIn.tpl @@ -1,6 +1,8 @@ -

-
- - - +
+
+ + + +
+ \ No newline at end of file