mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-28 14:20:46 -05:00
admin panel
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"files": {
|
||||
"main.js": "/static/js/main.ba99c69a.chunk.js",
|
||||
"main.js.map": "/static/js/main.ba99c69a.chunk.js.map",
|
||||
"main.js": "/static/js/main.218830e9.chunk.js",
|
||||
"main.js.map": "/static/js/main.218830e9.chunk.js.map",
|
||||
"runtime~main.js": "/static/js/runtime~main.a8a9905a.js",
|
||||
"runtime~main.js.map": "/static/js/runtime~main.a8a9905a.js.map",
|
||||
"static/js/2.18546bdc.chunk.js": "/static/js/2.18546bdc.chunk.js",
|
||||
"static/js/2.18546bdc.chunk.js.map": "/static/js/2.18546bdc.chunk.js.map",
|
||||
"static/js/2.293c6b6c.chunk.js": "/static/js/2.293c6b6c.chunk.js",
|
||||
"static/js/2.293c6b6c.chunk.js.map": "/static/js/2.293c6b6c.chunk.js.map",
|
||||
"index.html": "/index.html",
|
||||
"precache-manifest.bed1d8e4606fb4bd4bb8b0aa9d016cd4.js": "/precache-manifest.bed1d8e4606fb4bd4bb8b0aa9d016cd4.js",
|
||||
"precache-manifest.883e08704944232663937174720b1687.js": "/precache-manifest.883e08704944232663937174720b1687.js",
|
||||
"service-worker.js": "/service-worker.js",
|
||||
"static/media/ancho-v_games.png": "/static/media/ancho-v_games.07d5d0f6.png",
|
||||
"static/media/arowana_mall.png": "/static/media/arowana_mall.26cf0823.png",
|
||||
|
||||
@@ -1 +1 @@
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="shortcut icon" href="/favicon.ico"/><link rel="stylesheet" href="//cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><link rel="manifest" href="/manifest.json"/><title>sendou.ink</title></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(l){function e(e){for(var r,t,n=e[0],o=e[1],u=e[2],f=0,i=[];f<n.length;f++)t=n[f],p[t]&&i.push(p[t][0]),p[t]=0;for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(l[r]=o[r]);for(s&&s(e);i.length;)i.shift()();return c.push.apply(c,u||[]),a()}function a(){for(var e,r=0;r<c.length;r++){for(var t=c[r],n=!0,o=1;o<t.length;o++){var u=t[o];0!==p[u]&&(n=!1)}n&&(c.splice(r--,1),e=f(f.s=t[0]))}return e}var t={},p={1:0},c=[];function f(e){if(t[e])return t[e].exports;var r=t[e]={i:e,l:!1,exports:{}};return l[e].call(r.exports,r,r.exports,f),r.l=!0,r.exports}f.m=l,f.c=t,f.d=function(e,r,t){f.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.t=function(r,e){if(1&e&&(r=f(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var t=Object.create(null);if(f.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var n in r)f.d(t,n,function(e){return r[e]}.bind(null,n));return t},f.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(r,"a",r),r},f.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},f.p="/";var r=window.webpackJsonp=window.webpackJsonp||[],n=r.push.bind(r);r.push=e,r=r.slice();for(var o=0;o<r.length;o++)e(r[o]);var s=n;a()}([])</script><script src="/static/js/2.18546bdc.chunk.js"></script><script src="/static/js/main.ba99c69a.chunk.js"></script></body></html>
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="shortcut icon" href="/favicon.ico"/><link rel="stylesheet" href="//cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><link rel="manifest" href="/manifest.json"/><title>sendou.ink</title></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(l){function e(e){for(var r,t,n=e[0],o=e[1],u=e[2],f=0,i=[];f<n.length;f++)t=n[f],p[t]&&i.push(p[t][0]),p[t]=0;for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(l[r]=o[r]);for(s&&s(e);i.length;)i.shift()();return c.push.apply(c,u||[]),a()}function a(){for(var e,r=0;r<c.length;r++){for(var t=c[r],n=!0,o=1;o<t.length;o++){var u=t[o];0!==p[u]&&(n=!1)}n&&(c.splice(r--,1),e=f(f.s=t[0]))}return e}var t={},p={1:0},c=[];function f(e){if(t[e])return t[e].exports;var r=t[e]={i:e,l:!1,exports:{}};return l[e].call(r.exports,r,r.exports,f),r.l=!0,r.exports}f.m=l,f.c=t,f.d=function(e,r,t){f.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.t=function(r,e){if(1&e&&(r=f(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var t=Object.create(null);if(f.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var n in r)f.d(t,n,function(e){return r[e]}.bind(null,n));return t},f.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(r,"a",r),r},f.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},f.p="/";var r=window.webpackJsonp=window.webpackJsonp||[],n=r.push.bind(r);r.push=e,r=r.slice();for(var o=0;o<r.length;o++)e(r[o]);var s=n;a()}([])</script><script src="/static/js/2.293c6b6c.chunk.js"></script><script src="/static/js/main.218830e9.chunk.js"></script></body></html>
|
||||
@@ -1,15 +1,15 @@
|
||||
self.__precacheManifest = (self.__precacheManifest || []).concat([
|
||||
{
|
||||
"revision": "014577c816883db02635839c8a9e172a",
|
||||
"revision": "2fa6d74123b337f738f804395e530f40",
|
||||
"url": "/index.html"
|
||||
},
|
||||
{
|
||||
"revision": "b867ef14ecdd9a6e5652",
|
||||
"url": "/static/js/2.18546bdc.chunk.js"
|
||||
"revision": "861b9e9fa93bce3f4a7e",
|
||||
"url": "/static/js/2.293c6b6c.chunk.js"
|
||||
},
|
||||
{
|
||||
"revision": "56bdde670711d2085094",
|
||||
"url": "/static/js/main.ba99c69a.chunk.js"
|
||||
"revision": "05c266b204e8116bfdbd",
|
||||
"url": "/static/js/main.218830e9.chunk.js"
|
||||
},
|
||||
{
|
||||
"revision": "42ac5946195a7306e2a5",
|
||||
@@ -14,7 +14,7 @@
|
||||
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.0/workbox-sw.js");
|
||||
|
||||
importScripts(
|
||||
"/precache-manifest.bed1d8e4606fb4bd4bb8b0aa9d016cd4.js"
|
||||
"/precache-manifest.883e08704944232663937174720b1687.js"
|
||||
);
|
||||
|
||||
self.addEventListener('message', (event) => {
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
build/static/js/2.293c6b6c.chunk.js.map
Normal file
1
build/static/js/2.293c6b6c.chunk.js.map
Normal file
File diff suppressed because one or more lines are too long
2
build/static/js/main.218830e9.chunk.js
Normal file
2
build/static/js/main.218830e9.chunk.js
Normal file
File diff suppressed because one or more lines are too long
1
build/static/js/main.218830e9.chunk.js.map
Normal file
1
build/static/js/main.218830e9.chunk.js.map
Normal file
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
14
index.js
14
index.js
@@ -218,7 +218,6 @@ const typeDefs = gql`
|
||||
searchForUser(discord_id: String twitter: String): User
|
||||
searchForBuilds(discord_id: String!): [Build]!
|
||||
searchForBuildsByWeapon(weapon: String! page: Int): BuildCollection!
|
||||
deleteBuild(id: ID!): Boolean
|
||||
}
|
||||
type Mutation {
|
||||
createUser(
|
||||
@@ -603,12 +602,17 @@ const resolvers = {
|
||||
},
|
||||
Mutation: {
|
||||
updateTwitter: async (root, args, ctx) => {
|
||||
if (!ctx.user.discord_id !== PROCESS.ENV.ADMIN_ID) throw new AuthenticationError('not admin')
|
||||
if (ctx.user.discord_id !== process.env.ADMIN_ID) throw new AuthenticationError('not admin')
|
||||
|
||||
const player = await Player.findOne({ unique_id: args.unique_id }).catch(e => {
|
||||
throw new UserInputError(e.message, {
|
||||
invalidArgs: args,
|
||||
})
|
||||
})
|
||||
|
||||
const player = await Player.findOne({ unique_id: args.unique_id })
|
||||
if (!player) throw new UserInputError
|
||||
|
||||
player.twitter_name = args.twitter.toLowerCase()
|
||||
player.twitter = args.twitter.toLowerCase()
|
||||
|
||||
try {
|
||||
await player.save()
|
||||
@@ -617,7 +621,7 @@ const resolvers = {
|
||||
invalidArgs: args,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
return true
|
||||
},
|
||||
addBuild: async (root, args, ctx) => {
|
||||
|
||||
23
react-ui/src/components/Misc/Admin.js
vendored
23
react-ui/src/components/Misc/Admin.js
vendored
@@ -1,12 +1,28 @@
|
||||
import React from 'react'
|
||||
import { Icon, Header, Loader } from 'semantic-ui-react'
|
||||
import React, { useState } from 'react'
|
||||
import { Input, Header, Loader, Button } from 'semantic-ui-react'
|
||||
import { useQuery, useMutation } from 'react-apollo-hooks'
|
||||
import { Redirect } from 'react-router-dom'
|
||||
|
||||
import { userLean } from '../../graphql/queries/userLean'
|
||||
import { updateTwitter } from '../../graphql/mutations/updateTwitter'
|
||||
|
||||
const Admin = () => {
|
||||
const { data, error, loading } = useQuery(userLean)
|
||||
const [uid, setUid] = useState('')
|
||||
const [twitter, setTwitter] = useState('')
|
||||
|
||||
const updateTwitterMutation = useMutation(updateTwitter)
|
||||
|
||||
const handleUidTwitter = async (e) => {
|
||||
e.preventDefault()
|
||||
|
||||
await updateTwitterMutation({
|
||||
variables: { unique_id: uid, twitter }
|
||||
})
|
||||
|
||||
setUid('')
|
||||
setTwitter('')
|
||||
}
|
||||
|
||||
if (loading) {
|
||||
return <div style={{"paddingTop": "25px", "paddingBottom": "20000px"}} ><Loader active inline='centered' /></div>
|
||||
@@ -24,6 +40,9 @@ const Admin = () => {
|
||||
return (
|
||||
<div>
|
||||
<Header>Add Twitter for a player</Header>
|
||||
Enter unique id: <Input value={uid} onChange={(event) => setUid(event.target.value)}/>
|
||||
Enter Twitter <Input value={twitter} onChange={(event) => setTwitter(event.target.value)}/>
|
||||
<Button onClick={handleUidTwitter}>Submit</Button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState } from 'react'
|
||||
import React, { useState, useEffect } from 'react'
|
||||
import { useQuery } from 'react-apollo-hooks'
|
||||
import { Table, Loader, Image, Pagination, Header, Popup, Icon } from 'semantic-ui-react'
|
||||
import { Link, Redirect } from 'react-router-dom'
|
||||
@@ -61,8 +61,7 @@ const abilities = {
|
||||
"OS": {image: OS, fullName: "Object Shredder", mainOnly: true}
|
||||
}
|
||||
|
||||
const BuildCollection = ({ weapon }) => {
|
||||
const [page, setPage] = useState(1)
|
||||
const BuildCollection = ({ weapon, page, setPage }) => {
|
||||
const { data, error, loading } = useQuery(searchForBuildsByWeapon, { variables: { weapon, page }})
|
||||
|
||||
if (loading) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import BuildCollection from './BuildCollection'
|
||||
|
||||
const BuildSearch = ({ setMenuSelection, weaponFromUrl }) => {
|
||||
const [weapon, setWeapon] = useState(weaponFromUrl ? weaponFromUrl : '')
|
||||
const [page, setPage] = useState(1)
|
||||
|
||||
useEffect(() => {
|
||||
setMenuSelection('builds')
|
||||
@@ -13,10 +14,10 @@ const BuildSearch = ({ setMenuSelection, weaponFromUrl }) => {
|
||||
return (
|
||||
<div>
|
||||
<div>
|
||||
<WeaponForm weaponForm={weapon} setWeaponForm={setWeapon} push />
|
||||
<WeaponForm weaponForm={weapon} setWeaponForm={setWeapon} push setPage={setPage} />
|
||||
</div>
|
||||
<div>
|
||||
{weapon === '' ? null : <BuildCollection weapon={weapon}/>}
|
||||
{weapon === '' ? null : <BuildCollection weapon={weapon} page={page} setPage={setPage} />}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -4,7 +4,7 @@ import { withRouter } from 'react-router-dom'
|
||||
import { weapons } from '../../utils/lists'
|
||||
import weaponDict from '../../utils/english_internal.json'
|
||||
|
||||
const WeaponForm = withRouter(({ history, weaponForm, setWeaponForm, showImages=true, push=false }) => {
|
||||
const WeaponForm = withRouter(({ history, weaponForm, setWeaponForm, showImages=true, push=false, setPage }) => {
|
||||
return (
|
||||
<div>
|
||||
<Dropdown
|
||||
@@ -25,6 +25,7 @@ const WeaponForm = withRouter(({ history, weaponForm, setWeaponForm, showImages=
|
||||
onChange={(event, { value }) => {
|
||||
setWeaponForm(value)
|
||||
if (push) history.push(`/builds/${value.replace(/ /g, '_')}`)
|
||||
if (setPage) setPage(1)
|
||||
}}
|
||||
value={weaponForm}
|
||||
/>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { gql } from './node_modules/apollo-boost'
|
||||
import { gql } from 'apollo-boost'
|
||||
|
||||
export const addBuild = gql`
|
||||
export const updateTwitter = gql`
|
||||
mutation updateTwitter ($unique_id: String!, $twitter: String!) {
|
||||
updateTwitter(
|
||||
unique_id: $unique_id,
|
||||
|
||||
Reference in New Issue
Block a user