diff --git a/frontend-react/src/components/builds/BuildsBrowser.js b/frontend-react/src/components/builds/BuildsBrowser.js index b3d555f26..06605e335 100644 --- a/frontend-react/src/components/builds/BuildsBrowser.js +++ b/frontend-react/src/components/builds/BuildsBrowser.js @@ -35,7 +35,7 @@ const BuildsBrowser = () => { if (error) return return ( <> -
+
{weapon ? ( <> {weapon} Builds diff --git a/frontend-react/src/components/links/Links.js b/frontend-react/src/components/links/Links.js index 091a734d1..a9b4ddcc6 100644 --- a/frontend-react/src/components/links/Links.js +++ b/frontend-react/src/components/links/Links.js @@ -15,8 +15,8 @@ const Links = () => { return ( <> -
-
+
+
Discord diff --git a/frontend-react/src/components/plus/PlusFAQ.js b/frontend-react/src/components/plus/PlusFAQ.js new file mode 100644 index 000000000..6ad50f5f9 --- /dev/null +++ b/frontend-react/src/components/plus/PlusFAQ.js @@ -0,0 +1,115 @@ +import React, { useState } from "react" +import { Accordion, Icon } from "semantic-ui-react" + +const PlusFAQ = () => { + const [active, setActive] = useState(-1) + + const handleClick = (e, titleProps) => { + const { index } = titleProps + const newIndex = active === index ? -1 : index + + setActive(newIndex) + } + + return ( + <> + + + +

+ What are +1 and +2? +

+
+ +
+ They are private Splatoon 2 Discord servers made for LFG purposes. + Typically people use them to find pick-ups to play with, a team to + play against in a scrim or just general chatting. All +1 members + have access to +2 but not the other way around. +
+
+ + +

+ How can I join? +

+
+ +
+ There are two ways to join: +
    +
  • + Get suggested by someone already in the server and pass the + monthly voting +
  • +
  • Get vouched by someone who is eligible to do so
  • +
+
+
+ + +

+ What is the voting? +

+
+ +
+ Every month (first weekend starting on Friday) a voting is held on + each server to decide the roster. The members vote on each other as + well as any new suggestions. You need to get 50% or better to get + access or stay in the server. +
+
+ + +

+ How is the percentage calculated in the voting? +

+
+ +
+ Best score you can get is everyone of your own region giving you +2 + and of the opposite region giving you +1. This would translate to + 100%. Similarly 0% would mean everyone gave you the worst possible + score. Example of 50% could be a situation where you got -0.5 from + your own region but +0.5 from the opposite. +
+
+ + +

+ Why can I only give +1 or -1 to members of the opposite region? +

+
+ +
+ This is because due to time zones you typically play the most with + people living close to your own time zones so you have a better idea + about those players. The idea is that you have more of a say about + people who you regularly play with. Of course there are exceptions + and people might play at odd hours (and indeed not everyone lives in + Europe or the Americas) but through testing we noticed this system + gives better results. +
+
+ + +

+ How does the vouching work? +

+
+ +
+ If you got a high score in the latest voting you can vouch someone + to join a server. For +1 members this ratio is 90% and for +2 85%. + +1 members can choose to vouch someone to either +1 or +2. If the + person you vouched gets kicked in their first voting you can't vouch + anyone for 6 months. +
+
+
+ + ) +} + +export default PlusFAQ diff --git a/frontend-react/src/components/root/App.js b/frontend-react/src/components/root/App.js index 70b985c33..9c4d7e200 100644 --- a/frontend-react/src/components/root/App.js +++ b/frontend-react/src/components/root/App.js @@ -9,16 +9,7 @@ const App = () => {
-
- -
+
diff --git a/frontend-react/src/components/root/MainMenu.js b/frontend-react/src/components/root/MainMenu.js index 824435503..07d691240 100644 --- a/frontend-react/src/components/root/MainMenu.js +++ b/frontend-react/src/components/root/MainMenu.js @@ -135,9 +135,22 @@ const MainMenu = () => { {data?.user?.plus?.membership_status && ( - - {data.user.plus.membership_status === "ONE" ? "+1" : "+2"} - + + + + Home + + + FAQ + + {/* + Voting History + */} + + )} {logInOrAva()} diff --git a/frontend-react/src/components/root/Page.js b/frontend-react/src/components/root/Page.js new file mode 100644 index 000000000..340119c6d --- /dev/null +++ b/frontend-react/src/components/root/Page.js @@ -0,0 +1,31 @@ +import React from "react" +import { Header, Icon } from "semantic-ui-react" + +const Page = ({ title, subtitle, icon, children }) => { + return ( +
+
+ {title && !subtitle &&
{title}
} + {title && subtitle && ( +
+ {icon && } + + {title} + {subtitle} + +
+ )} +
+
{children}
+
+ ) +} + +export default Page diff --git a/frontend-react/src/components/root/Routes.js b/frontend-react/src/components/root/Routes.js index 40a7141f7..f46e33b1a 100644 --- a/frontend-react/src/components/root/Routes.js +++ b/frontend-react/src/components/root/Routes.js @@ -2,6 +2,7 @@ import React, { Suspense, lazy } from "react" import { Route, Switch } from "react-router-dom" import Loading from "../common/Loading" import NotFound from "../common/NotFound" +import Page from "./Page" const HomePage = lazy(() => import("../root/HomePage")) const MapListGenerator = lazy(() => import("../maps/MapListGenerator")) @@ -22,6 +23,7 @@ const TournamentSearchPage = lazy(() => const BuildsBrowser = lazy(() => import("../builds/BuildsBrowser")) const FreeAgentBrowser = lazy(() => import("../freeagents/FreeAgentBrowser")) const PlusPage = lazy(() => import("../plus/PlusPage")) +const PlusFAQ = lazy(() => import("../plus/PlusFAQ")) const UserPage = lazy(() => import("../user/UserPage")) const InfoPage = lazy(() => import("./InfoPage")) const AdminPanel = lazy(() => import("../admin/AdminPanel")) @@ -32,64 +34,177 @@ const Routes = () => { }> - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - - + + + + + + + + + - + + + - + + + - + + + - } /> - } /> + ( + + + + )} + /> + ( + + + + )} + /> ) diff --git a/graphql-schemas/plus.js b/graphql-schemas/plus.js index d60c92a8f..104107474 100644 --- a/graphql-schemas/plus.js +++ b/graphql-schemas/plus.js @@ -202,7 +202,7 @@ const resolvers = { votedIds.add(vote.voter_discord_id) }) - const users = await User.find({ + const eligible_voters = await User.countDocuments({ "plus.membership_status": ctx.user.plus.membership_status, }) @@ -212,7 +212,7 @@ const resolvers = { plus_two_invite_link: process.env.PLUS_TWO_LINK, voting_ends: state.voting_ends, voter_count: votedIds.size, - eligible_voters: users.length, + eligible_voters, } }, usersForVoting: async (root, args, ctx) => { @@ -440,6 +440,14 @@ const resolvers = { if (!ctx.user) throw new AuthenticationError("Not logged in.") if (ctx.user.discord_id !== process.env.ADMIN_ID) throw new AuthenticationError("Not admin.") + + const date = new Date() + const year = date.getFullYear() + const month = date.getMonth() + 1 + const votes = await VotedPerson.find({ + month, + year, + }) }, }, }