fix: update goals such that the app compiles again

This commit is contained in:
zkldi
2022-04-24 10:56:03 +01:00
parent 71a93a8f58
commit c1479ca43a
3 changed files with 21 additions and 16 deletions
@@ -8,7 +8,7 @@ import { BarChartTooltip } from "components/charts/ChartTooltip";
import ClassBadge from "components/game/ClassBadge";
import useSetSubheader from "components/layout/header/useSetSubheader";
import Card from "components/layout/page/Card";
import UserGoalTable from "components/tables/goals/UserGoalTable";
import GoalSubTable from "components/tables/goals/GoalSubTable";
import ScoreTable from "components/tables/scores/ScoreTable";
import ApiError from "components/util/ApiError";
import AsyncLoader from "components/util/AsyncLoader";
@@ -33,7 +33,7 @@ import {
PublicUserDocument,
ScoreDocument,
SongDocument,
UserGoalDocument,
GoalSubscriptionDocument,
} from "tachi-common";
import { RecentClassesReturn } from "types/api-returns";
import { GamePT } from "types/react";
@@ -77,7 +77,7 @@ function RecentAchievedGoalsComponent({ game, playtype }: GamePT) {
const { data, isLoading, error } = useApiQuery<{
users: PublicUserDocument[];
goals: GoalDocument[];
userGoals: UserGoalDocument[];
goalSubs: GoalSubscriptionDocument[];
}>(`/games/${game}/${playtype}/goals/recently-achieved`);
if (error) {
@@ -93,7 +93,7 @@ function RecentAchievedGoalsComponent({ game, playtype }: GamePT) {
const userMap = CreateUserMap(data.users);
const goalMap = CreateGoalMap(data.goals);
for (const userGoal of data.userGoals) {
for (const userGoal of data.goalSubs) {
const user = userMap.get(userGoal.userID);
const goal = goalMap.get(userGoal.goalID);
@@ -122,7 +122,7 @@ function RecentAchievedGoalsComponent({ game, playtype }: GamePT) {
<Divider />
</Col>
<Col xs={12}>
<UserGoalTable dataset={dataset} game={game} playtype={playtype} />
<GoalSubTable dataset={dataset} game={game} playtype={playtype} />
</Col>
</Row>
);
@@ -2,27 +2,32 @@ import { ChangeOpacity } from "util/color-opacity";
import { NumericSOV, StrSOV } from "util/sorts";
import GentleLink from "components/util/GentleLink";
import React from "react";
import { COLOUR_SET, GoalDocument, PublicUserDocument, UserGoalDocument } from "tachi-common";
import {
COLOUR_SET,
GoalDocument,
PublicUserDocument,
GoalSubscriptionDocument,
} from "tachi-common";
import { GamePT } from "types/react";
import TimestampCell from "../cells/TimestampCell";
import UserCell from "../cells/UserCell";
import TachiTable, { Header } from "../components/TachiTable";
export type UserGoalDataset = (UserGoalDocument & {
export type GoalSubDataset = (GoalSubscriptionDocument & {
__related: {
user: PublicUserDocument;
goal: GoalDocument;
};
})[];
export default function UserGoalTable({
export default function GoalSubTable({
game,
playtype,
dataset,
}: GamePT & { dataset: UserGoalDataset }) {
const headers: Header<UserGoalDataset[0]>[] = [
}: GamePT & { dataset: GoalSubDataset }) {
const headers: Header<GoalSubDataset[0]>[] = [
["User", "User", StrSOV(x => x.__related.user.username)],
["Goal", "Goal", StrSOV(x => x.__related.goal.title)],
["Goal", "Goal", StrSOV(x => x.__related.goal.name)],
[
"Progress",
"Progress",
@@ -38,7 +43,7 @@ export default function UserGoalTable({
entryName="Goals"
searchFunctions={{
user: k => k.__related.user.username,
goal: k => k.__related.goal.title,
goal: k => k.__related.goal.name,
timestamp: k => k.timeAchieved,
}}
rowFunction={d => (
@@ -48,7 +53,7 @@ export default function UserGoalTable({
<GentleLink
to={`/dashboard/games/${game}/${playtype}/targets/goals/${d.goalID}`}
>
{d.__related.goal.title}
{d.__related.goal.name}
</GentleLink>
</td>
<td
+3 -3
View File
@@ -21,7 +21,7 @@ import {
UGSRatingsLookup,
UserGameStats,
UserGameStatsSnapshot,
UserGoalDocument,
GoalSubscriptionDocument,
} from "tachi-common";
export interface UGPTStatsReturn<I extends IDStrings = IDStrings> {
@@ -166,8 +166,8 @@ export interface UserRecentSummary {
recentFolders: FolderDocument[];
recentFolderStats: FolderStatsInfo[];
recentGoals: GoalDocument[];
recentImprovedGoals: UserGoalDocument[];
recentAchievedGoals: UserGoalDocument[];
recentImprovedGoals: GoalSubscriptionDocument[];
recentAchievedGoals: GoalSubscriptionDocument[];
}
export interface ServerStatus {