feat: tear out challenges, they don't work

This commit is contained in:
zkldi
2022-07-03 01:44:30 +01:00
parent 9f7f151ac2
commit cd1262044a
5 changed files with 15 additions and 87 deletions
@@ -1,35 +0,0 @@
import ApiError from "components/util/ApiError";
import DebugContent from "components/util/DebugContent";
import Loading from "components/util/Loading";
import useApiQuery from "components/util/query/useApiQuery";
import React from "react";
import { Game, Playtype, PublicUserDocument } from "tachi-common";
import { ChallengeSubsReturn } from "types/api-returns";
export default function ReceivedChallengesPage({
reqUser,
game,
playtype,
}: {
reqUser: PublicUserDocument;
game: Game;
playtype: Playtype;
}) {
const { data, isLoading, error } = useApiQuery<ChallengeSubsReturn>(
`/users/${reqUser.id}/games/${game}/${playtype}/challenges/subs`
);
if (error) {
<ApiError error={error} />;
}
if (isLoading || !data) {
return <Loading />;
}
return (
<div>
<DebugContent data={data} />
</div>
);
}
@@ -7,7 +7,6 @@ import React from "react";
import { Row, Col } from "react-bootstrap";
import { Switch, Route } from "react-router-dom";
import { FormatGame, Game, GetGameConfig, Playtype, PublicUserDocument } from "tachi-common";
import ReceivedChallengesPage from "./ReceivedChallengesPage";
import RivalsOverviewPage from "./RivalsOverviewPage";
export default function RivalsMainPage({
@@ -34,16 +33,16 @@ export default function RivalsMainPage({
<Col xs={12} className="text-center">
<div className="btn-group">
<SelectLinkButton to={`${base}/rivals/challenge-board`}>
<Icon type="satellite-dish" />
Sent Challenges
<Icon type="list" />
Rival Score Feed
</SelectLinkButton>
<SelectLinkButton to={`${base}/rivals`}>
<Icon type="users" />
Rivals
Manage Rivals
</SelectLinkButton>
<SelectLinkButton to={`${base}/rivals/challenges`}>
<Icon type="bullseye" />
Received Challenges
<SelectLinkButton to={`${base}/rivals/pinned-charts`}>
<Icon type="thumbtack" />
Pinned Charts
</SelectLinkButton>
</div>
<Divider />
@@ -55,14 +54,12 @@ export default function RivalsMainPage({
</Route>
<Route
exact
path="/dashboard/users/:userID/games/:game/:playtype/rivals/challenge-board"
path="/dashboard/users/:userID/games/:game/:playtype/rivals/feed"
></Route>
<Route
exact
path="/dashboard/users/:userID/games/:game/:playtype/rivals/challenges"
>
<ReceivedChallengesPage reqUser={reqUser} game={game} playtype={playtype} />
</Route>
path="/dashboard/users/:userID/games/:game/:playtype/rivals/pinned-charts"
></Route>
</Switch>
</Col>
</Row>
@@ -1,22 +1,18 @@
import { APIFetchV1 } from "util/api";
import { SendErrorToast } from "util/toaster";
import ProfilePicture from "components/user/ProfilePicture";
import Card from "components/layout/page/Card";
import ApiError from "components/util/ApiError";
import Divider from "components/util/Divider";
import Icon from "components/util/Icon";
import Loading from "components/util/Loading";
import UserSelectModal from "components/util/modal/UserSelectModal";
import Muted from "components/util/Muted";
import useApiQuery from "components/util/query/useApiQuery";
import UserIcon from "components/util/UserIcon";
import { UserContext } from "context/UserContext";
import React, { useContext, useEffect, useState } from "react";
import { Alert, Button, Col, Row } from "react-bootstrap";
import { Link } from "react-router-dom";
import { Button, Col } from "react-bootstrap";
import { Game, Playtype, PublicUserDocument } from "tachi-common";
import { GamePT, JustChildren } from "types/react";
import UserSelectModal from "components/util/modal/UserSelectModal";
import UserIcon from "components/util/UserIcon";
import Card from "components/layout/page/Card";
import { TachiConfig } from "lib/config";
export default function RivalsOverviewWrapper({
reqUser,
@@ -105,35 +101,6 @@ function RivalsOverviewPage({
return (
<>
{isRequestingUser && (
<>
<Card header="About Rivals &amp; Challenges">
By setting Rivals on this page, {TachiConfig.name} will restructure parts of
the UI to tell you how your Rivals are doing.
{game === "bms" && (
<>
<br />
If you're using the beatoraja IR, your rivals will{" "}
<b>automatically</b> work in game!
</>
)}
<Divider />
By rivalling a user, you also subscribe to their <b>challenges</b>. This is
another {TachiConfig.name} feature that goes hand-in-hand with rivals!
<br />
You'll automatically be notified when they send out a new challenge, and you
can track your challenges using the above buttons.
<br />
You can also send out challenges. All your Reverse Rivals (and anyone who
rivals you in the future) will receive it.
<br />
Just click any PB of yours that you're proud of, and click{" "}
<b>Set Challenge</b>!
</Card>
<Divider />
</>
)}
<Card header={`${isRequestingUser ? "Your" : `${reqUser.username}'s`} Rivals`}>
<Col xs={12} className="d-flex justify-content-center flex-wrap">
{rivals.map(e => (
+2 -2
View File
@@ -103,10 +103,10 @@ export function UGPTBottomNav({
Leaderboard
</NavItem>,
<NavItem key="rivals" to={`${baseUrl}/rivals`}>
Rivals &amp; Challenges
Rivals
</NavItem>,
<NavItem key="targets" to={`${baseUrl}/targets`}>
Goals &amp; Milestones
Targets
</NavItem>,
];
@@ -3,7 +3,6 @@ import ClassBadge from "components/game/ClassBadge";
import QuickTooltip from "components/layout/misc/QuickTooltip";
import MiniTable from "components/tables/components/MiniTable";
import Divider from "components/util/Divider";
import Icon from "components/util/Icon";
import React from "react";
import {
GetGamePTConfig,