diff --git a/app/features/friends/components/FriendMenu.tsx b/app/features/friends/components/FriendMenu.tsx
index 0fd23d38d..0e08fd4f7 100644
--- a/app/features/friends/components/FriendMenu.tsx
+++ b/app/features/friends/components/FriendMenu.tsx
@@ -12,7 +12,7 @@ import {
import { ListButton } from "~/components/SideNav";
import { SENDOUQ_ACTIVITY_LABEL } from "~/features/friends/friends-constants";
import { useDateTimeFormat } from "~/hooks/intl/useDateTimeFormat";
-import { SENDOUQ_LOOKING_PAGE, tournamentSubsPage } from "~/utils/urls";
+import { SENDOUQ_PAGE, tournamentSubsPage } from "~/utils/urls";
export function FriendMenu({
discordId,
@@ -54,7 +54,7 @@ export function FriendMenu({
})
: null;
- const activityHref = resolveActivityHref({ subtitle, tournamentId });
+ const activity = resolveActivity({ subtitle, tournamentId });
return (
<>
@@ -73,15 +73,27 @@ export function FriendMenu({
} onAction={onNavigate}>
{t("friends:friendsList.viewUserPage")}
- {activityHref ? (
+ {activity?.type === "sendouq" ? (
}
+ onAction={() => {
+ fetcher.submit(
+ { _action: "JOIN_QUEUE", direct: "true" },
+ { method: "post", action: SENDOUQ_PAGE },
+ );
+ onNavigate?.();
+ }}
+ >
+ {t("friends:friendsList.joinSendouQ")}
+
+ ) : null}
+ {activity?.type === "tournament" ? (
+ }
onAction={onNavigate}
>
- {activityHref.isSendouQ
- ? t("friends:friendsList.joinSendouQ")
- : t("friends:friendsList.viewTournament")}
+ {t("friends:friendsList.viewTournament")}
) : null}
{friendshipId !== undefined ? (
@@ -130,18 +142,21 @@ export function FriendMenu({
);
}
-function resolveActivityHref(friend: {
+function resolveActivity(friend: {
subtitle: string | null;
tournamentId: number | null;
}) {
if (!friend.subtitle) return null;
if (friend.subtitle === SENDOUQ_ACTIVITY_LABEL) {
- return { url: SENDOUQ_LOOKING_PAGE, isSendouQ: true };
+ return { type: "sendouq" } as const;
}
if (friend.tournamentId) {
- return { url: tournamentSubsPage(friend.tournamentId), isSendouQ: false };
+ return {
+ type: "tournament",
+ url: tournamentSubsPage(friend.tournamentId),
+ } as const;
}
return null;
diff --git a/app/features/sendouq-match/components/RejoinSections.tsx b/app/features/sendouq-match/components/RejoinSections.tsx
index bbc2f05da..8e8a0761e 100644
--- a/app/features/sendouq-match/components/RejoinSections.tsx
+++ b/app/features/sendouq-match/components/RejoinSections.tsx
@@ -1,5 +1,5 @@
import { useTranslation } from "react-i18next";
-import { Link, useFetcher } from "react-router";
+import { useFetcher } from "react-router";
import { SendouButton } from "~/components/elements/Button";
import { SENDOUQ_PAGE } from "~/utils/urls";
import * as RejoinVote from "../core/RejoinVote";
@@ -95,14 +95,25 @@ export function TrustedRejoinSection({
function DeclinedSection() {
const { t } = useTranslation(["q"]);
+ const rejoinFetcher = useFetcher();
return (
{t("q:match.rematch.declined")}
-
+
{
+ rejoinFetcher.submit(
+ { _action: "JOIN_QUEUE", direct: "true" },
+ { method: "post", action: SENDOUQ_PAGE },
+ );
+ }}
+ >
{t("q:match.rematch.rejoinQueue")}
-
+
);
}
diff --git a/app/features/sendouq/actions/q.server.ts b/app/features/sendouq/actions/q.server.ts
index c7eed27da..91281757b 100644
--- a/app/features/sendouq/actions/q.server.ts
+++ b/app/features/sendouq/actions/q.server.ts
@@ -18,7 +18,11 @@ import { refreshSendouQInstance, SendouQ } from "../core/SendouQ.server";
import { JOIN_CODE_SEARCH_PARAM_KEY } from "../q-constants";
import { frontPageSchema } from "../q-schemas.server";
import { userCanJoinQueueAt } from "../q-utils";
-import { SendouQError, setGroupChatMetadata } from "../q-utils.server";
+import {
+ SendouQError,
+ setGroupChatMetadata,
+ sqRedirectIfNeeded,
+} from "../q-utils.server";
export const action: ActionFunction = async ({ request, url }) => {
const user = requireUser();
@@ -30,6 +34,11 @@ export const action: ActionFunction = async ({ request, url }) => {
try {
switch (data._action) {
case "JOIN_QUEUE": {
+ sqRedirectIfNeeded({
+ ownGroup: SendouQ.findOwnGroup(user.id),
+ currentLocation: "default",
+ });
+
await validateCanJoinQ(user);
const { chatCodeToRevalidate } = await SQGroupRepository.createGroup({