links page

This commit is contained in:
Sendou
2019-05-20 22:47:50 +03:00
parent 2a227b8e1a
commit fd36d54b9b
18 changed files with 164 additions and 21 deletions

View File

@@ -1,13 +1,13 @@
{
"files": {
"main.js": "/static/js/main.63753ec6.chunk.js",
"main.js.map": "/static/js/main.63753ec6.chunk.js.map",
"main.js": "/static/js/main.4c1af679.chunk.js",
"main.js.map": "/static/js/main.4c1af679.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.6770ed2d.chunk.js": "/static/js/2.6770ed2d.chunk.js",
"static/js/2.6770ed2d.chunk.js.map": "/static/js/2.6770ed2d.chunk.js.map",
"static/js/2.55ce7a59.chunk.js": "/static/js/2.55ce7a59.chunk.js",
"static/js/2.55ce7a59.chunk.js.map": "/static/js/2.55ce7a59.chunk.js.map",
"index.html": "/index.html",
"precache-manifest.c82c5bc095303fa8636ad0a92df98310.js": "/precache-manifest.c82c5bc095303fa8636ad0a92df98310.js",
"precache-manifest.98616b2e0db57de939893fc6d6fa403d.js": "/precache-manifest.98616b2e0db57de939893fc6d6fa403d.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",

View File

@@ -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.6770ed2d.chunk.js"></script><script src="/static/js/main.63753ec6.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.55ce7a59.chunk.js"></script><script src="/static/js/main.4c1af679.chunk.js"></script></body></html>

View File

@@ -1,15 +1,15 @@
self.__precacheManifest = (self.__precacheManifest || []).concat([
{
"revision": "2ddfe4d44e57391b3ce76152cd014595",
"revision": "263c0c76db10fbf668b70280425ae71c",
"url": "/index.html"
},
{
"revision": "c4832d7b84459c1103b9",
"url": "/static/js/2.6770ed2d.chunk.js"
"revision": "ba394d26abe9b15f2753",
"url": "/static/js/2.55ce7a59.chunk.js"
},
{
"revision": "6ad3612afd565a4d6322",
"url": "/static/js/main.63753ec6.chunk.js"
"revision": "5813558134488f70b3eb",
"url": "/static/js/main.4c1af679.chunk.js"
},
{
"revision": "42ac5946195a7306e2a5",

View File

@@ -14,7 +14,7 @@
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.0/workbox-sw.js");
importScripts(
"/precache-manifest.c82c5bc095303fa8636ad0a92df98310.js"
"/precache-manifest.98616b2e0db57de939893fc6d6fa403d.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

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

@@ -7,6 +7,7 @@ const cors = require('cors')
const Placement = require('./models/placement')
const Player = require('./models/player')
const Maplist = require('./models/maplist')
const Link = require('./models/link')
//const User = require('./models/user')
const jwt = require('jsonwebtoken')
const path = require('path')
@@ -89,7 +90,19 @@ const typeDefs = gql`
tc: [String!]!
rm: [String!]!
cb: [String!]!
}
enum LinkType {
DISCORD
GUIDE
MISC
}
type Link {
title: String!
url: String!
description: String!
type: LinkType!
}
type Token {
@@ -114,6 +127,7 @@ const typeDefs = gql`
searchForPlayers(name: String! exact: Boolean): [Placement]!
maplists: [Maplist!]!
rotationData: String
links: [Link!]!
}
type Mutation {
@@ -406,6 +420,15 @@ const resolvers = {
} else {
return JSON.stringify(rotationData)
}
},
links: (root, args) => {
return Link
.find({})
.catch(e => {
throw new UserInputError(e.message, {
invalidArgs: args,
})
})
}
}
}

10
models/link.js Normal file
View File

@@ -0,0 +1,10 @@
const mongoose = require('mongoose')
const linkSchema = new mongoose.Schema({
title: {type: String, required: true},
url: {type: String, required: true},
description: {type: String, required: true},
type: {type: String, required: true}
})
module.exports = mongoose.model('Link', linkSchema)

4
react-ui/src/App.js vendored
View File

@@ -12,6 +12,7 @@ import InfoWeapon from './components/XSearch/InfoWeapon'
import ScrollToTop from './utils/ScrollToTop'
import MapListGenerator from './components/Tools/MapListGenerator'
import Rotations from './components/Tools/Rotations'
import Links from './components/Misc/Links'
const App = () => {
const [menuSelection, setMenuSelection] = useState('home')
@@ -38,6 +39,9 @@ const App = () => {
<Route exact path="/rotation" render={() =>
<Rotations setMenuSelection={setMenuSelection} />
} />
<Route exact path="/links" render={() =>
<Links setMenuSelection={setMenuSelection} />
} />
<Route path="/404" render={() => <NotFound />} />
<Route path="*" render={() => <NotFound />} />
</Switch>

View File

@@ -5,7 +5,8 @@ const Footer = () => {
return (
<div style={{"fontSize": "small", "paddingTop": "25px"}} >
<hr />
Website by <a href="https://twitter.com/sendouc">Sendou</a>. Data for X Rank Leaderboards provided by <a href="https://twitter.com/LeanYoshi">Lean</a>.<br />
Website by <a href="https://twitter.com/sendouc">Sendou</a>. Data for the X Rank Leaderboards provided by <a href="https://twitter.com/LeanYoshi">Lean</a>.
Data for the rotations provided by <a href="https://splatoon2.ink/">splatoon2.ink</a>.<br />
<Icon name='github' /> Source code for this site is available on <a href="https://github.com/Sendouc/sendou-ink">GitHub</a>
</div>
)

89
react-ui/src/components/Misc/Links.js vendored Normal file
View File

@@ -0,0 +1,89 @@
import React from 'react'
import { Icon, Header, Loader, List } from 'semantic-ui-react'
import { useQuery } from 'react-apollo-hooks'
import { links } from '../../graphql/queries/links'
const Links = ({ setMenuSelection }) => {
const { data, error, loading } = useQuery(links)
setMenuSelection('links')
document.title = 'Links - sendou.ink'
if (loading) {
return <div style={{"paddingTop": "25px", "paddingBottom": "20000px"}} ><Loader active inline='centered' /></div>
}
if (error) {
return <div style={{"color": "red"}}>{error.message}</div>
}
const linksData = data.links
return (
<div>
<div style={{'paddingTop': '10px'}}>
<Header as='h1'>
<Icon name='discord' />
<Header.Content>Discord</Header.Content>
</Header>
<List divided verticalAlign='middle'>
{linksData.map(l => {
if (l.type !== 'DISCORD') {
return null
}
return (
<List.Item key={l.title}>
<List.Header size='small' as='a' href={l.url}>{l.title}</List.Header>
<List.Description>
{l.description}
</List.Description>
</List.Item>
)
})}
</List>
</div>
<div style={{'paddingTop': '25px'}}>
<Header as='h1'>
<Icon name='book' />
<Header.Content>Guides</Header.Content>
</Header>
<List divided verticalAlign='middle'>
{linksData.map(l => {
if (l.type !== 'GUIDE') {
return null
}
return (
<List.Item key={l.title}>
<List.Header size='small' as='a' href={l.url}>{l.title}</List.Header>
<List.Description>
{l.description}
</List.Description>
</List.Item>
)
})}
</List>
</div>
<div style={{'paddingTop': '25px'}}>
<Header as='h1'>
<Icon name='folder open' />
<Header.Content>Misc</Header.Content>
</Header>
<List divided verticalAlign='middle'>
{linksData.map(l => {
if (l.type !== 'MISC') {
return null
}
return (
<List.Item key={l.title}>
<List.Header size='small' as='a' href={l.url}>{l.title}</List.Header>
<List.Description>
{l.description}
</List.Description>
</List.Item>
)
})}
</List>
</div>
</div>
)
}
export default Links

View File

@@ -37,6 +37,11 @@ const MainMenu = withRouter(({ history, menuSelection, setMenuSelection }) => {
active={menuSelection === 'search'}
onClick={() => { history.push('/xsearch') }}
/>
<Menu.Item
name='links'
active={menuSelection === 'links'}
onClick={() => { history.push('links') }}
/>
</Menu>
</Segment>
)

View File

@@ -107,7 +107,7 @@ const Rotations = ({ setMenuSelection }) => {
useEffect(() => {
setMenuSelection('rotations')
document.title = 'Maplist Generator - sendou.ink'
document.title = 'Rotations - sendou.ink'
}, [setMenuSelection])
if (loading || monthly.loading || rotation.length === 0) {
@@ -118,7 +118,6 @@ const Rotations = ({ setMenuSelection }) => {
}
const monthlyMaps = monthly.data.maplists[0]
console.log('prefs', preferences)
return (
<div>

12
react-ui/src/graphql/queries/links.js vendored Normal file
View File

@@ -0,0 +1,12 @@
import { gql } from 'apollo-boost'
export const links = gql`
{
links {
title
url
description
type
}
}
`