mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-10-01 15:48:23 -05:00
rotations removed preference selector
This commit is contained in:
@@ -6,14 +6,7 @@ import rankedIcon from "../../assets/ranked.png"
|
||||
import leagueIcon from "../../assets/league.png"
|
||||
import regularIcon from "../../assets/regular.png"
|
||||
|
||||
const modeShort = {
|
||||
"Splat Zones": "sz",
|
||||
"Tower Control": "tc",
|
||||
Rainmaker: "rm",
|
||||
"Clam Blitz": "cb"
|
||||
}
|
||||
|
||||
const RotationSegments = ({ rotation, preferences }) => {
|
||||
const RotationSegments = ({ rotation }) => {
|
||||
const [currentTime, setCurrentTime] = useState(
|
||||
new Date(Math.floor(Date.now() / 1000))
|
||||
)
|
||||
@@ -46,13 +39,7 @@ const RotationSegments = ({ rotation, preferences }) => {
|
||||
<Divider horizontal>
|
||||
<Header as="h4">{header}</Header>
|
||||
</Divider>
|
||||
<Segment
|
||||
disabled={
|
||||
preferences[modeShort[r.rule.name]][r.stage_a.name] &&
|
||||
preferences[modeShort[r.rule.name]][r.stage_b.name]
|
||||
}
|
||||
raised
|
||||
>
|
||||
<Segment raised>
|
||||
<Grid columns={3} stackable>
|
||||
<Grid.Row>
|
||||
<Grid.Column>
|
||||
@@ -128,28 +115,12 @@ const RotationSegments = ({ rotation, preferences }) => {
|
||||
}}
|
||||
>
|
||||
<Popup
|
||||
trigger={
|
||||
<Image
|
||||
src={mapIcons[r.stage_a.name]}
|
||||
rounded
|
||||
disabled={
|
||||
preferences[modeShort[r.rule.name]][r.stage_a.name]
|
||||
}
|
||||
/>
|
||||
}
|
||||
trigger={<Image src={mapIcons[r.stage_a.name]} rounded />}
|
||||
content={r.stage_a.name}
|
||||
basic
|
||||
/>
|
||||
<Popup
|
||||
trigger={
|
||||
<Image
|
||||
src={mapIcons[r.stage_b.name]}
|
||||
rounded
|
||||
disabled={
|
||||
preferences[modeShort[r.rule.name]][r.stage_b.name]
|
||||
}
|
||||
/>
|
||||
}
|
||||
trigger={<Image src={mapIcons[r.stage_b.name]} rounded />}
|
||||
content={r.stage_b.name}
|
||||
basic
|
||||
/>
|
||||
|
||||
41
react-ui/src/components/rotation/Rotations.js
vendored
41
react-ui/src/components/rotation/Rotations.js
vendored
@@ -1,60 +1,31 @@
|
||||
import React, { useEffect, useState } from "react"
|
||||
import { useQuery } from "@apollo/react-hooks"
|
||||
import { rotationData } from "../../graphql/queries/rotationData"
|
||||
import { maplists } from "../../graphql/queries/maplists"
|
||||
import { Button } from "semantic-ui-react"
|
||||
|
||||
import Loading from "../common/Loading"
|
||||
import Error from "../common/Error"
|
||||
import MapPreferenceSelector from "./MapPreferenceSelector"
|
||||
import RotationSegments from "./RotationSegments"
|
||||
|
||||
const Rotations = ({ setMenuSelection }) => {
|
||||
const Rotations = () => {
|
||||
const { data, error, loading } = useQuery(rotationData)
|
||||
const monthly = useQuery(maplists)
|
||||
const [rotation, setRotation] = useState([])
|
||||
const [preferences, setPreferences] = useState({
|
||||
sz: {},
|
||||
tc: {},
|
||||
rm: {},
|
||||
cb: {}
|
||||
})
|
||||
|
||||
const [show, setShow] = useState(false)
|
||||
|
||||
useEffect(() => {
|
||||
if (loading || monthly.loading) {
|
||||
if (loading) {
|
||||
return
|
||||
}
|
||||
|
||||
document.title = "Rotations - sendou.ink"
|
||||
const rotationPreferencesFromDb = window.localStorage.getItem(
|
||||
"rotationPreferences"
|
||||
)
|
||||
if (rotationPreferencesFromDb) {
|
||||
setPreferences(JSON.parse(rotationPreferencesFromDb))
|
||||
}
|
||||
|
||||
setRotation(JSON.parse(data.rotationData))
|
||||
}, [data, loading, monthly.loading])
|
||||
}, [data, loading])
|
||||
|
||||
if (loading || monthly.loading || rotation.length === 0) return <Loading />
|
||||
if (error || monthly.error) return <Error errorMessage={error.message} />
|
||||
|
||||
const monthlyMaps = monthly.data.maplists[0]
|
||||
if (loading || rotation.length === 0) return <Loading />
|
||||
if (error) return <Error errorMessage={error.message} />
|
||||
|
||||
return (
|
||||
<>
|
||||
<Button icon="cog" onClick={() => setShow(!show)} />
|
||||
{show ? (
|
||||
<div style={{ margin: "1em auto 1em" }}>
|
||||
Uncheck a map in the ranked rotation to mark it as a disliked map.
|
||||
<MapPreferenceSelector maps={monthlyMaps} preferences={preferences} />
|
||||
</div>
|
||||
) : null}
|
||||
<div>
|
||||
<RotationSegments rotation={rotation} preferences={preferences} />
|
||||
</div>
|
||||
<RotationSegments rotation={rotation} />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -147,7 +147,6 @@ const resolvers = {
|
||||
})
|
||||
},
|
||||
searchForPlacements: async (root, args) => {
|
||||
console.log("args", args)
|
||||
const perPage = 25
|
||||
const currentPage = args.page ? args.page - 1 : 0
|
||||
const searchCriteria = {}
|
||||
|
||||
Reference in New Issue
Block a user