mirror of
https://github.com/zkldi/Tachi.git
synced 2026-09-29 18:37:58 +03:00
fix: don't show personal activity if no scores
allow other stuff tho
This commit is contained in:
@@ -1,20 +1,22 @@
|
||||
import { APIFetchV1 } from "util/api";
|
||||
import { ChangeOpacity } from "util/color-opacity";
|
||||
import { CreateGoalMap } from "util/data";
|
||||
import { RFA } from "util/misc";
|
||||
import { NumericSOV } from "util/sorts";
|
||||
import { heySplashes } from "util/splashes";
|
||||
import { ChangeOpacity } from "util/color-opacity";
|
||||
import { CreateGoalMap } from "util/data";
|
||||
import Activity from "components/activity/Activity";
|
||||
import DashboardActivity from "components/dashboard/DashboardActivity";
|
||||
import { DashboardHeader } from "components/dashboard/DashboardHeader";
|
||||
import useSetSubheader from "components/layout/header/useSetSubheader";
|
||||
import SessionCard from "components/sessions/SessionCard";
|
||||
import ApiError from "components/util/ApiError";
|
||||
import AsyncLoader from "components/util/AsyncLoader";
|
||||
import Divider from "components/util/Divider";
|
||||
import GentleLink from "components/util/GentleLink";
|
||||
import GoalLink from "components/util/GoalLink";
|
||||
import LinkButton from "components/util/LinkButton";
|
||||
import Loading from "components/util/Loading";
|
||||
import useApiQuery from "components/util/query/useApiQuery";
|
||||
import { UserContext } from "context/UserContext";
|
||||
import { AllLUGPTStatsContext } from "context/AllLUGPTStatsContext";
|
||||
import { UserSettingsContext } from "context/UserSettingsContext";
|
||||
import { ColourConfig, TachiConfig } from "lib/config";
|
||||
import React, { useContext, useMemo } from "react";
|
||||
@@ -22,29 +24,19 @@ import { Alert } from "react-bootstrap";
|
||||
import { Link, Route, Switch } from "react-router-dom";
|
||||
import { COLOUR_SET, GetGameConfig, UserDocument } from "tachi-common";
|
||||
import { UGSWithRankingData, UserRecentSummary } from "types/api-returns";
|
||||
import { DashboardHeader } from "components/dashboard/DashboardHeader";
|
||||
import DashboardActivity from "components/dashboard/DashboardActivity";
|
||||
import GoalLink from "components/util/GoalLink";
|
||||
import Activity from "components/activity/Activity";
|
||||
import { FolderInfoComponent } from "./users/games/_game/_playtype/folders/FolderSelectPage";
|
||||
import { GameStatContainer } from "./users/UserGamesPage";
|
||||
|
||||
export function DashboardPage() {
|
||||
const { settings } = useContext(UserSettingsContext);
|
||||
|
||||
useSetSubheader("Dashboard", [settings]);
|
||||
useSetSubheader("Home", [settings]);
|
||||
|
||||
const { user } = useContext(UserContext);
|
||||
const { ugs } = useContext(AllLUGPTStatsContext);
|
||||
|
||||
if (!user) {
|
||||
return <DashboardNotLoggedIn />;
|
||||
}
|
||||
|
||||
if (ugs?.length === 0) {
|
||||
return <DashboardLoggedInNoScores user={user} />;
|
||||
}
|
||||
|
||||
return <DashboardLoggedIn user={user} />;
|
||||
}
|
||||
|
||||
@@ -277,23 +269,3 @@ function FeatureContainer({ tagline, description }: { tagline: string; descripti
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function DashboardLoggedInNoScores({ user }: { user: UserDocument }) {
|
||||
return (
|
||||
<div>
|
||||
<span className="display-4">
|
||||
Welcome to {TachiConfig.name}, {user.username}!
|
||||
</span>
|
||||
<h4 className="mt-4">It looks like you have no scores. Let's get you set up!</h4>
|
||||
<Divider />
|
||||
<h4 style={{ lineHeight: 2 }}>
|
||||
Once you've got some scores imported, we'll analyse your scores.
|
||||
<br />
|
||||
You'll get a profile for that game, and a position on the leaderboards!
|
||||
</h4>
|
||||
<LinkButton className="btn-outline-primary" to="/import">
|
||||
Import some scores!
|
||||
</LinkButton>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,16 @@
|
||||
import Activity from "components/activity/Activity";
|
||||
import React from "react";
|
||||
import { AllLUGPTStatsContext } from "context/AllLUGPTStatsContext";
|
||||
import React, { useContext } from "react";
|
||||
import { UserDocument } from "tachi-common";
|
||||
import { DashboardLoggedInNoScores } from "./DashboardLoggedInNoScores";
|
||||
|
||||
export default function DashboardActivity({ user }: { user: UserDocument }) {
|
||||
const { ugs } = useContext(AllLUGPTStatsContext);
|
||||
|
||||
if (ugs?.length === 0) {
|
||||
return <DashboardLoggedInNoScores user={user} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="display-4 mb-4">Here's what's been happening.</div>
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import Divider from "components/util/Divider";
|
||||
import LinkButton from "components/util/LinkButton";
|
||||
import { TachiConfig } from "lib/config";
|
||||
import React from "react";
|
||||
import { UserDocument } from "tachi-common";
|
||||
|
||||
export function DashboardLoggedInNoScores({ user }: { user: UserDocument }) {
|
||||
return (
|
||||
<div>
|
||||
<span className="display-4">
|
||||
Welcome to {TachiConfig.name}, {user.username}!
|
||||
</span>
|
||||
<h4 className="mt-4">It looks like you have no scores. Let's get you set up!</h4>
|
||||
<Divider />
|
||||
<h4 style={{ lineHeight: 2 }}>
|
||||
Once you've got some scores imported, we'll analyse your scores.
|
||||
<br />
|
||||
You'll get a profile for that game, and a position on the leaderboards!
|
||||
</h4>
|
||||
<LinkButton className="btn-outline-primary" to="/import">
|
||||
Import some scores!
|
||||
</LinkButton>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user