flex lb new try

This commit is contained in:
Sendou
2019-05-12 20:05:14 +03:00
parent 38546b4ff8
commit 7a5801d9ef
19 changed files with 130 additions and 20 deletions

View File

@@ -1,13 +1,13 @@
{
"files": {
"main.js": "/static/js/main.6b938c71.chunk.js",
"main.js.map": "/static/js/main.6b938c71.chunk.js.map",
"main.js": "/static/js/main.da08d9e2.chunk.js",
"main.js.map": "/static/js/main.da08d9e2.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.fa52ac4d.chunk.js": "/static/js/2.fa52ac4d.chunk.js",
"static/js/2.fa52ac4d.chunk.js.map": "/static/js/2.fa52ac4d.chunk.js.map",
"static/js/2.1e06adcb.chunk.js": "/static/js/2.1e06adcb.chunk.js",
"static/js/2.1e06adcb.chunk.js.map": "/static/js/2.1e06adcb.chunk.js.map",
"index.html": "/index.html",
"precache-manifest.7846553709668e3c6e40e67f2be99c60.js": "/precache-manifest.7846553709668e3c6e40e67f2be99c60.js",
"precache-manifest.d365e923b865f382dc219adbf25448b8.js": "/precache-manifest.d365e923b865f382dc219adbf25448b8.js",
"service-worker.js": "/service-worker.js",
"static/media/bridge.png": "/static/media/bridge.fba72008.png",
"static/media/depot.png": "/static/media/depot.c5459318.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.fa52ac4d.chunk.js"></script><script src="/static/js/main.6b938c71.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.1e06adcb.chunk.js"></script><script src="/static/js/main.da08d9e2.chunk.js"></script></body></html>

View File

@@ -1,15 +1,15 @@
self.__precacheManifest = (self.__precacheManifest || []).concat([
{
"revision": "fd133cd7fb4a919d5ea324538fb8c668",
"revision": "cfeb39c1831eba0efcf366a06bc6baec",
"url": "/index.html"
},
{
"revision": "4944087cf4cc29bdc0c1",
"url": "/static/js/2.fa52ac4d.chunk.js"
"revision": "950de206b3ef3d8ff151",
"url": "/static/js/2.1e06adcb.chunk.js"
},
{
"revision": "7919089a7bbadcb7182c",
"url": "/static/js/main.6b938c71.chunk.js"
"revision": "d211156ce3a47a22d4d2",
"url": "/static/js/main.da08d9e2.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.7846553709668e3c6e40e67f2be99c60.js"
"/precache-manifest.d365e923b865f382dc219adbf25448b8.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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -37,6 +37,7 @@ const typeDefs = gql`
alias: String
twitter: String
weapons: [String!]!
weaponsCount: Int!
topTotal: [Placement!]!
topTotalScore: Float
topShooter: [Placement]
@@ -104,6 +105,7 @@ const typeDefs = gql`
topDualiesPlayers (amount: Int): [Player!]!
topBrellaPlayers (amount: Int): [Player!]!
topPlayers (weapon: String!): topPlayer!
topFlex: [Player!]!
weaponPlacementStats(weapon: String!): [Int!]!
playerInfo(uid: String!): PlayerWithPlacements!
searchForPlayers(name: String! exact: Boolean): [Placement]!
@@ -310,6 +312,12 @@ const resolvers = {
return {placements: placements.slice(0, 101), modeCount: [m.sz+m.tc+m.rm+m.cb, m.sz, m.tc, m.rm, m.cb]}
},
topFlex: async (root, args) => {
return Player
.find({})
.sort({ "weaponsCount": "desc", "topTotalScore": "desc" })
.limit(50)
},
playerInfo: async (root, args) => {
const player = await Player
.findOne({ unique_id: args.uid })

View File

@@ -6,6 +6,7 @@ const playerSchema = new mongoose.Schema({
alias: String,
twitter: String,
weapons: [String],
weaponsCount: { type: Number, required: true },
topTotal: {
type: [{
type: mongoose.Schema.Types.ObjectId,

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

@@ -22,7 +22,7 @@ const App = () => {
<div>
<ScrollToTop />
<Switch>
<Route exact path="/" render={() => <Redirect to="/xleaderboard"/>} />
<Route exact path="/" render={() => <Redirect to="/xsearch"/>} />
<Route path="/xleaderboard" render={() => <WeaponLeaderboardSelector setMenuSelection={setMenuSelection} />} />
<Route exact path="/xsearch" render={() => <XSearch setMenuSelection={setMenuSelection} />} />
<Route exact path="/xsearch/w/:wpn" render={({ match }) =>

View File

@@ -1,5 +1,5 @@
import React, { useEffect, useState, useRef } from 'react'
import { TextArea, Loader, Checkbox, Form, Header, List, Image, Divider, Icon, Grid, Input, Button, Label } from 'semantic-ui-react'
import { Loader, Checkbox, Form, Header, List, Image, Divider, Icon, Grid, Input, Button, Label } from 'semantic-ui-react'
import { useQuery } from 'react-apollo-hooks'
import { maplists } from '../../graphql/queries/maplists'
import szIcon from '../img/modeIcons/sz.png'

View File

@@ -0,0 +1,61 @@
import React from 'react'
import { Table, Icon, Popup } from 'semantic-ui-react'
import { useQuery } from 'react-apollo-hooks'
import { Loader } from 'semantic-ui-react'
import { Link } from 'react-router-dom'
import { topFlex } from '../../graphql/queries/topFlex'
const FlexLeaderboard = ({ setActiveItem }) => {
const result = useQuery(topFlex)
setActiveItem('topFlex')
if (result.loading) {
return <div style={{"paddingTop": "25px", "paddingBottom": "20000px"}} ><Loader active inline='centered' /></div>
}
if (result.error) {
return <div style={{"color": "red"}}>{result.error.message}</div>
}
document.title = 'Flex Leaderboard - sendou.ink'
const leaderboard = result.data['topFlex']
return (
<Table style={{"paddingTop": "5px", "paddingBottom": "5px"}} basic='very'>
<Table.Header>
<Table.Row>
<Table.HeaderCell></Table.HeaderCell>
<Table.HeaderCell>Name</Table.HeaderCell>
<Table.HeaderCell>
Flex Power
<Popup
trigger={<Icon name='question circle'/>}
content="Flex Power is the amount of unique weapons the player has reached top 500 with. Different kits count as unique weapons but reskins (e.g. Tentatek & Octoshot) don't."
position='bottom center'
/>
</Table.HeaderCell>
<Table.HeaderCell>Total Power</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
{leaderboard.map((player, index) =>
<Table.Row key={player.id}>
<Table.Cell>{index + 1}</Table.Cell>
<Table.Cell><Link to={`/xsearch/p/${player.unique_id}`} style={{"color": "black"}}><u>{player.alias ? player.alias : player.name}</u></Link>
{player.twitter ?
<a href={`https://twitter.com/${player.twitter}`}><Icon style={{"paddingLeft": "5px"}} name="twitter"/></a>
: null}
</Table.Cell>
<Table.Cell>{player.weaponsCount}</Table.Cell>
<Table.Cell>
{player.topTotalScore}
</Table.Cell>
</Table.Row>
)}
</Table.Body>
</Table>
)
}
export default FlexLeaderboard

View File

@@ -2,6 +2,7 @@ import React, { useState } from 'react'
import { Menu, Responsive } from 'semantic-ui-react'
import { Route, withRouter } from 'react-router-dom'
import WeaponLeaderboard from './WeaponLeaderboard'
import FlexLeaderboard from './FlexLeaderboard'
import { topTotalPlayers } from '../../graphql/queries/topPlayers'
import { topShooterPlayers } from '../../graphql/queries/topShooters'
import { topBlasterPlayers } from '../../graphql/queries/topBlasters'
@@ -20,6 +21,7 @@ import rollerIcon from '../img/wpnIcons/rollers.png'
import shooterIcon from '../img/wpnIcons/shooters.png'
import slosherIcon from '../img/wpnIcons/sloshers.png'
import splatlingIcon from '../img/wpnIcons/splatlings.png'
import flexIcon from '../img/wpnIcons/flex.png'
const WeaponLeaderboardSelector = withRouter(({ history, setMenuSelection }) => {
const [activeItem, setActiveItem] = useState('')
@@ -44,6 +46,15 @@ const WeaponLeaderboardSelector = withRouter(({ history, setMenuSelection }) =>
All
</Menu.Item>
<Menu.Item
name='flex'
active={activeItem === 'topFlex'}
onClick={() => { history.push('/xleaderboard/flex')}}
>
<img style={wpnIcon} src={flexIcon} alt="Flex Icon"/>
Flex
</Menu.Item>
<Menu.Item
name='shooters'
active={activeItem === 'topShooter'}
@@ -127,6 +138,14 @@ const WeaponLeaderboardSelector = withRouter(({ history, setMenuSelection }) =>
<img style={wpnIcon} src={allIcon} alt="All Icon"/>
All
</Menu.Item>
<Menu.Item
name='flex'
active={activeItem === 'topFlex'}
onClick={() => { history.push('/xleaderboard/flex')}}
>
<img style={wpnIcon} src={flexIcon} alt="Flex Icon"/>
Flex
</Menu.Item>
</Menu>
<Menu compact icon='labeled'>
<Menu.Item
@@ -217,6 +236,12 @@ const WeaponLeaderboardSelector = withRouter(({ history, setMenuSelection }) =>
/>
}
/>
<Route exact path="/xleaderboard/flex" render={() =>
<FlexLeaderboard
setActiveItem={setActiveItem}
/>
}
/>
<Route exact path="/xleaderboard/shooters" render={() =>
<WeaponLeaderboard
query={topShooterPlayers}

15
react-ui/src/graphql/queries/topFlex.js vendored Normal file
View File

@@ -0,0 +1,15 @@
import { gql } from 'apollo-boost'
export const topFlex = gql`
{
topFlex {
id
unique_id
name
alias
twitter
weaponsCount
topTotalScore
}
}
`