From 0f9ae2a5cbbb0938ec5ec46dc4f38f4eb30f5306 Mon Sep 17 00:00:00 2001 From: Sendou Date: Thu, 22 Aug 2019 23:45:22 +0300 Subject: [PATCH] Started working on X Browser --- react-ui/src/App.js | 4 +- react-ui/src/components/Misc/MainMenu.js | 2 +- react-ui/src/components/XRank/PageXBrowser.js | 76 +++++++++++++++++-- .../components/XSearch/PlayerSearchForm.js | 35 --------- react-ui/src/components/XSearch/XSearch.js | 23 ------ .../graphql/queries/searchForPlacements.js | 1 + react-ui/src/img/imports.js | 7 ++ 7 files changed, 82 insertions(+), 66 deletions(-) delete mode 100644 react-ui/src/components/XSearch/PlayerSearchForm.js delete mode 100644 react-ui/src/components/XSearch/XSearch.js diff --git a/react-ui/src/App.js b/react-ui/src/App.js index 746236e06..cf804185a 100644 --- a/react-ui/src/App.js +++ b/react-ui/src/App.js @@ -6,7 +6,7 @@ import NotFound from './components/Misc/NotFound' import { BrowserRouter as Router, Route, Switch } from 'react-router-dom' import PageXLeaderboard from './components/XLeaderboard/PageXLeaderboard' -import XSearch from './components/XSearch/XSearch' +import PageXBrowser from './components/XRank/PageXBrowser' import InfoPlayer from './components/XSearch/InfoPlayer' import ScrollToTop from './utils/ScrollToTop' import PageMapListGenerator from './components/Tools/PageMapListGenerator' @@ -31,7 +31,7 @@ const App = () => { } /> } /> - } /> + } /> } /> diff --git a/react-ui/src/components/Misc/MainMenu.js b/react-ui/src/components/Misc/MainMenu.js index a611c074b..7375e0331 100644 --- a/react-ui/src/components/Misc/MainMenu.js +++ b/react-ui/src/components/Misc/MainMenu.js @@ -141,7 +141,7 @@ const MainMenu = withRouter(({ history, menuSelection, setMenuSelection }) => { }} /> { history.push("/xsearch") diff --git a/react-ui/src/components/XRank/PageXBrowser.js b/react-ui/src/components/XRank/PageXBrowser.js index 8121791c9..cb96f3b6d 100644 --- a/react-ui/src/components/XRank/PageXBrowser.js +++ b/react-ui/src/components/XRank/PageXBrowser.js @@ -1,12 +1,78 @@ -import React from 'react' -import { Segment } from 'semantic-ui-react' +import React, { useEffect } from "react" +import { Segment } from "semantic-ui-react" +import { Spin, Table } from "antd" +import { useQuery } from "@apollo/react-hooks" +import { useSelector } from "react-redux" +import { Link } from "react-router-dom" -const PageXBrowser = () => { +import { searchForPlacements } from "../../graphql/queries/searchForPlacements" +import language_dict from '../../utils/english_internal.json' +import { modesArr } from '../../img/imports' + +const PageXBrowser = ({ setMenuSelection }) => { + const localization = useSelector(state => state.localization) + const { data, error, loading } = useQuery(searchForPlacements, { + variables: {} + }) + + useEffect(() => { + document.title = `${localization["Top 500 Browser"]} - sendou.ink` + setMenuSelection("search") + }, [localization, setMenuSelection]) + + if (error) return
{error.message}
+ if (loading) return + + const columns = [ + { + title: localization['Name'], + dataIndex: 'name', + render: name => {name}, + }, + { + title: localization['X Power'], + dataIndex: 'x_power', + }, + { + title: localization['Mode'], + dataIndex: 'mode', + render: mode => {mode}, + }, + { + title: localization['Placement'], + dataIndex: 'rank', + }, + { + title: localization['Weapon'], + dataIndex: 'weapon', + render: weapon => {weapon} + }, + { + title: localization['Month'], + dataIndex: 'month', + } + { + title: localization['Year'], + dataIndex: 'year', + } + { + title: localization['ID'], + dataIndex: 'unique_id', + } + ] + + console.log("data", data) return ( - moro + "Header"} + footer={() => "Footer"} + /> ) } -export default PageXBrowser \ No newline at end of file +export default PageXBrowser diff --git a/react-ui/src/components/XSearch/PlayerSearchForm.js b/react-ui/src/components/XSearch/PlayerSearchForm.js deleted file mode 100644 index b37cd3861..000000000 --- a/react-ui/src/components/XSearch/PlayerSearchForm.js +++ /dev/null @@ -1,35 +0,0 @@ -import React, { useState } from 'react' -import { Button, Form, Checkbox } from 'semantic-ui-react' -import XSearchResults from './XSearchResults' - -const PlayerSearchForm = (props) => { - const [playerForm, setPlayerForm] = useState('') - const [exact, setExact] = useState(false) - const [renderSearch, setRenderSearch] = useState(false) - return ( -
-
- { - setRenderSearch(false) - setPlayerForm(event.target.value)} - } - /> - - -
- setExact(!exact)} checked={exact} /> -
- {renderSearch ? : null} -
- ) -} - -export default PlayerSearchForm \ No newline at end of file diff --git a/react-ui/src/components/XSearch/XSearch.js b/react-ui/src/components/XSearch/XSearch.js deleted file mode 100644 index 0f3b644fb..000000000 --- a/react-ui/src/components/XSearch/XSearch.js +++ /dev/null @@ -1,23 +0,0 @@ -import React, { useEffect } from 'react' -import { WeaponFormWithButton } from './WeaponForm' -import PlayerSearchForm from './PlayerSearchForm' - -const XSearch = ({ setMenuSelection }) => { - useEffect(() => { - setMenuSelection('search') - document.title = "X Rank Top 500 Search - sendou.ink" - }, [setMenuSelection]) - return ( -
-
-
- -
-
or
- -
-
- ) -} - -export default XSearch \ No newline at end of file diff --git a/react-ui/src/graphql/queries/searchForPlacements.js b/react-ui/src/graphql/queries/searchForPlacements.js index 3ffe5c6af..47a0e44df 100644 --- a/react-ui/src/graphql/queries/searchForPlacements.js +++ b/react-ui/src/graphql/queries/searchForPlacements.js @@ -28,6 +28,7 @@ query searchForPlacements( unique_id month year + mode player { twitter } diff --git a/react-ui/src/img/imports.js b/react-ui/src/img/imports.js index 970db23df..4f41436d0 100644 --- a/react-ui/src/img/imports.js +++ b/react-ui/src/img/imports.js @@ -25,6 +25,11 @@ import T from './abilityIcons/T.png' import TI from './abilityIcons/TI.png' import OS from './abilityIcons/OS.png' +import SplatZ from './modeIcons/sz.png' +import TowerC from './modeIcons/tc.png' +import RainM from './modeIcons/rm.png' +import ClamB from './modeIcons/cb.png' + export const abilities = { "BDU": {image: BDU, fullName: "Bomb Defense Up DX"}, "BRU": {image: BRU, fullName: "Sub Power Up"}, @@ -53,4 +58,6 @@ export const abilities = { "OS": {image: OS, fullName: "Object Shredder", mainOnly: true} } +export const modesArr = [null, SplatZ, TowerC, RainM, ClamB] + export const top500crown = top500 \ No newline at end of file