diff --git a/app/features/sendouq/components/GroupCard.tsx b/app/features/sendouq/components/GroupCard.tsx index 7a94b432a..0f9f44d13 100644 --- a/app/features/sendouq/components/GroupCard.tsx +++ b/app/features/sendouq/components/GroupCard.tsx @@ -32,6 +32,7 @@ export function GroupCard({ hideVc = false, hideWeapons = false, hideNote: _hidenote = false, + enableKicking, }: { group: Omit; action?: "LIKE" | "UNLIKE" | "GROUP_UP" | "MATCH_UP"; @@ -42,6 +43,7 @@ export function GroupCard({ hideVc?: boolean; hideWeapons?: boolean; hideNote?: boolean; + enableKicking?: boolean; }) { const fetcher = useFetcher(); @@ -70,6 +72,7 @@ export function GroupCard({ hideVc={hideVc} hideWeapons={hideWeapons} hideNote={hideNote} + enableKicking={enableKicking} /> ); })} @@ -141,6 +144,7 @@ function GroupMember({ hideVc, hideWeapons, hideNote, + enableKicking, }: { member: NonNullable[number]; showActions: boolean; @@ -148,6 +152,7 @@ function GroupMember({ hideVc?: boolean; hideWeapons?: boolean; hideNote?: boolean; + enableKicking?: boolean; }) { const user = useUser(); @@ -173,7 +178,11 @@ function GroupMember({
{showActions || displayOnly ? ( - + ) : null} {member.skill ? : null}
@@ -379,10 +388,13 @@ function MemberSkillDifference({ function MemberRoleManager({ member, displayOnly, + enableKicking, }: { member: NonNullable[number]; displayOnly?: boolean; + enableKicking?: boolean; }) { + const loggedInUser = useUser(); const fetcher = useFetcher(); const { t } = useTranslation(["q"]); const Icon = member.role === "OWNER" ? StarFilledIcon : StarIcon; @@ -399,14 +411,18 @@ function MemberRoleManager({ /> } > -
+
{t(`q:roles.${member.role}`)}
{member.role !== "OWNER" && !displayOnly ? ( - + {member.role === "REGULAR" ? ( ) : null} + {enableKicking && member.id !== loggedInUser?.id ? ( + + Kick + + ) : null} ) : null}
diff --git a/app/features/sendouq/q-schemas.server.ts b/app/features/sendouq/q-schemas.server.ts index 4833b7ebe..9adf16d3b 100644 --- a/app/features/sendouq/q-schemas.server.ts +++ b/app/features/sendouq/q-schemas.server.ts @@ -87,6 +87,10 @@ export const lookingSchema = z.union([ z.object({ _action: _action("LEAVE_GROUP"), }), + z.object({ + _action: _action("KICK_FROM_GROUP"), + userId: id, + }), z.object({ _action: _action("REFRESH_GROUP"), }), diff --git a/app/features/sendouq/routes/q.looking.tsx b/app/features/sendouq/routes/q.looking.tsx index 258cea752..0c0598910 100644 --- a/app/features/sendouq/routes/q.looking.tsx +++ b/app/features/sendouq/routes/q.looking.tsx @@ -270,6 +270,19 @@ export const action: ActionFunction = async ({ request }) => { throw redirect(SENDOUQ_PAGE); } + case "KICK_FROM_GROUP": { + validateIsGroupOwner(); + validate(data.userId !== user.id, "Can't kick yourself"); + + leaveGroup({ + groupId: currentGroup.id, + userId: data.userId, + newOwnerId: null, + wasOwner: false, + }); + + break; + } case "REFRESH_GROUP": { refreshGroup(currentGroup.id); diff --git a/app/features/sendouq/routes/q.preparing.tsx b/app/features/sendouq/routes/q.preparing.tsx index 81964db8a..31dfede2c 100644 --- a/app/features/sendouq/routes/q.preparing.tsx +++ b/app/features/sendouq/routes/q.preparing.tsx @@ -146,7 +146,13 @@ export default function QPreparingPage() { return (
- +
{data.group.members.length < FULL_GROUP_SIZE && hasGroupManagerPerms(data.role) ? (