@@ -160,9 +191,19 @@ function ActivityInner({
);
}
-function ScoresActivity({ data, user }: { data: ClumpedActivityScores; user: UserDocument }) {
+function ScoresActivity({
+ data,
+ user,
+ shouldShowGame,
+}: {
+ data: ClumpedActivityScores;
+ user: UserDocument;
+ shouldShowGame: boolean;
+}) {
const { game, playtype } = data.scores[0];
+ const prettyGame = shouldShowGame ? `${FormatGame(game, playtype)} ` : "";
+
const [show, setShow] = useState(false);
let subMessage;
@@ -171,7 +212,7 @@ function ScoresActivity({ data, user }: { data: ClumpedActivityScores; user: Use
if (data.scores.length === 1) {
const score0 = data.scores[0];
- subMessage = `a score on ${FormatChart(
+ subMessage = `a ${prettyGame}score on ${FormatChart(
score0.game,
score0.__related.song,
score0.__related.chart
@@ -181,11 +222,11 @@ function ScoresActivity({ data, user }: { data: ClumpedActivityScores; user: Use
mutedText = `"${score0.comment}"`;
}
} else {
- subMessage = `${data.scores.length} scores`;
+ subMessage = `${data.scores.length} ${prettyGame}scores`;
mutedText = TruncateString(
data.scores
- .map((e) => FormatChart(e.game, e.__related.song, e.__related.chart))
+ .map((e) => FormatChart(e.game, e.__related.song, e.__related.chart, true))
.join(", "),
100
);
@@ -223,7 +264,8 @@ function ScoresActivity({ data, user }: { data: ClumpedActivityScores; user: Use
}}
/>
- {user.username} highlighted {subMessage}!
+ highlighted{" "}
+ {subMessage}!
{mutedText && (
<>
@@ -258,8 +300,19 @@ function ScoresActivity({ data, user }: { data: ClumpedActivityScores; user: Use
);
}
-function SessionActivity({ data, user }: { data: ClumpedActivitySession; user: UserDocument }) {
+function SessionActivity({
+ data,
+ user,
+ shouldShowGame,
+}: {
+ data: ClumpedActivitySession;
+ user: UserDocument;
+ shouldShowGame: boolean;
+}) {
const [show, setShow] = useState(false);
+ const { user: loggedInUser } = useContext(UserContext);
+
+ const prettyGame = shouldShowGame ? `${FormatGame(data.game, data.playtype)} ` : "";
const isProbablyActive = Date.now() - data.timeEnded < ONE_HOUR;
@@ -292,9 +345,21 @@ function SessionActivity({ data, user }: { data: ClumpedActivitySession; user: U
fontSize: isProbablyActive ? "1.2rem" : undefined,
}}
>
- {user.username} {isProbablyActive ? "is having" : "had"} a session '
- {data.name}' with {data.scoreInfo.length}{" "}
- {data.scoreInfo.length === 1 ? "score" : "scores"}.
+ {/* worst string formatting ever */}
+
{" "}
+ {isProbablyActive
+ ? user.id === loggedInUser?.id
+ ? "are having"
+ : "is having"
+ : "had"}{" "}
+ a {prettyGame}
+ session '{data.name}' with {data.scoreInfo.length}{" "}
+ {data.scoreInfo.length === 1 ? "score" : "scores"}
+ {data.highlight ? "!" : "."}
{data.desc && data.desc !== "This session has no description." && (
@@ -328,7 +393,7 @@ function SessionShower({ sessionID }: { sessionID: string }) {
}
return (
-
+
@@ -348,9 +413,11 @@ function SessionShower({ sessionID }: { sessionID: string }) {
function ClassAchievementActivity({
data,
user,
+ shouldShowGame,
}: {
data: ClumpedActivityClassAchievement;
user: UserDocument;
+ shouldShowGame: boolean;
}) {
return (
@@ -365,12 +432,7 @@ function ClassAchievementActivity({
>
-
- {user.username}
- {" "}
+ {" "}
achieved{" "}
+ {shouldShowGame && ` in ${FormatGame(data.game, data.playtype)}`}!
{data.classOldValue !== null && (
<>
{" "}
@@ -405,3 +468,20 @@ function ClassAchievementActivity({
);
}
+
+function UGPTLink({ reqUser, game, playtype }: UGPT) {
+ // currently
+ const { user } = useContext(UserContext);
+
+ return (
+
+ {user?.id === reqUser.id ? "You" : reqUser.username}
+
+ );
+}
diff --git a/client/src/components/dashboard/DashboardActivity.tsx b/client/src/components/dashboard/DashboardActivity.tsx
new file mode 100644
index 000000000..41d309f09
--- /dev/null
+++ b/client/src/components/dashboard/DashboardActivity.tsx
@@ -0,0 +1,12 @@
+import Activity from "components/activity/Activity";
+import React from "react";
+import { UserDocument } from "tachi-common";
+
+export default function DashboardActivity({ user }: { user: UserDocument }) {
+ return (
+ <>
+
Here's what you and your rivals have been up to!
+
+ >
+ );
+}
diff --git a/client/src/components/dashboard/DashboardHeader.tsx b/client/src/components/dashboard/DashboardHeader.tsx
new file mode 100644
index 000000000..00822365e
--- /dev/null
+++ b/client/src/components/dashboard/DashboardHeader.tsx
@@ -0,0 +1,20 @@
+import Navbar from "components/nav/Navbar";
+import NavItem from "components/nav/NavItem";
+import React from "react";
+
+export function DashboardHeader() {
+ const navItems = [
+
+ Activity
+ ,
+
+ Your Profiles
+ ,
+ ];
+
+ return (
+
+ {navItems}
+
+ );
+}
diff --git a/client/src/components/sessions/SessionRaiseBreakdown.tsx b/client/src/components/sessions/SessionRaiseBreakdown.tsx
index 45750fd08..ffeedd131 100644
--- a/client/src/components/sessions/SessionRaiseBreakdown.tsx
+++ b/client/src/components/sessions/SessionRaiseBreakdown.tsx
@@ -47,48 +47,6 @@ export default function SessionRaiseBreakdown({
const { user } = useContext(UserContext);
- // todo infer default table
- // const gptConfig = GetGamePTConfig(game, playtype);
-
- const [chartIDs, setChartIDs] = useState
([]);
- const [tableID, setTableID] = useState(null);
- const [tableFolders, setTableFolders] = useState([]);
- const [folder, setFolder] = useState(null);
- const [filter, setFilter] = useState<"folder" | "all" | "highlighted">("all");
-
- useEffect(() => {
- if (!tableID) {
- return;
- }
-
- APIFetchV1(`/games/${game}/${playtype}/tables/${tableID}`).then((r) => {
- if (!r.success) {
- throw new Error(r.description);
- }
-
- // @ts-expect-error todo
- setTableFolders(r.body.folders);
- // @ts-expect-error todo
- setFolder(r.body.folders[r.body.folders.length - 1]);
- });
- }, [tableID]);
-
- useEffect(() => {
- if (filter !== "folder" || !folder) {
- setChartIDs(null);
- return;
- }
-
- APIFetchV1(`/games/${game}/${playtype}/folders/${folder.folderID}`).then((r) => {
- if (!r.success) {
- throw new Error(r.description);
- }
-
- // @ts-expect-error todo
- setChartIDs(r.body.charts.map((e) => e.chartID));
- });
- }, [folder, tableID, filter]);
-
const { data, error } = useQuery(`/games/${game}/${playtype}/tables`, async () => {
const res = await APIFetchV1(`/games/${game}/${playtype}/tables`);
@@ -100,12 +58,6 @@ export default function SessionRaiseBreakdown({
});
const [view, setView] = useState<"lamps" | "both" | "grades">("both");
- useEffect(() => {
- if (tableID === null && (data?.length ?? 0) > 0) {
- setTableID(data![0].tableID);
- }
- }, [data]);
-
if (error) {
return <>{(error as Error).message}>;
}
@@ -138,54 +90,6 @@ export default function SessionRaiseBreakdown({
-
-