mirror of
https://github.com/mudabbir-ahmad/MAD-Treasure-Hunt.git
synced 2026-10-08 03:00:20 +00:00
Enhance navigation and data handling: update BottomNavbar to pass selected department, refactor GameSettingsScreen and PlayersScreen for improved subgroup management, and adjust API calls to support department-specific data.
This commit is contained in:
1 parent
43c8bb2bff
commit
4a0468d155
7 files changed
+148
-60
No files matched your search
@@ -11,7 +11,8 @@ const TeamScreen = () => {
|
||||
|
||||
const session = getSession();
|
||||
const isAdmin = session.isAcceptedAdmin;
|
||||
const {getLobby, getTeam, createTeam, joinTeamByCode, getTeamMembers, leaveTeam, getUser, updateUser, updateTeam, getAdminWaitlist} = useGameHook();
|
||||
const isBusiness = Boolean(session.isBusiness);
|
||||
const {getLobby, getSubgroup, getTeam, createTeam, joinTeamByCode, getTeamMembers, leaveTeam, getUser, updateUser, updateTeam, getAdminWaitlist} = useGameHook();
|
||||
|
||||
// State ----------------------
|
||||
|
||||
@@ -46,11 +47,19 @@ const TeamScreen = () => {
|
||||
if (!session.currentGid) { setLoading(false); return; }
|
||||
|
||||
const group = await getLobby(session.currentGid);
|
||||
if (group && !group.TeamsEnabled) {
|
||||
let teamsAreEnabled = Boolean(group?.TeamsEnabled);
|
||||
|
||||
if (isBusiness && session.currentSGid) {
|
||||
const subgroup = await getSubgroup(session.currentSGid);
|
||||
if (subgroup) teamsAreEnabled = Boolean(subgroup.TeamsEnabled);
|
||||
}
|
||||
|
||||
if (!teamsAreEnabled) {
|
||||
setTeamsDisabled(true);
|
||||
setLoading(false);
|
||||
return;
|
||||
}
|
||||
setTeamsDisabled(false);
|
||||
|
||||
if (!activeTid) {
|
||||
const waitlist = await getAdminWaitlist(session.currentGid, session.currentUid);
|
||||
@@ -70,7 +79,11 @@ const TeamScreen = () => {
|
||||
if (!teamCode.trim()) return;
|
||||
// Force uppercase just in case a lowercase code is pasted
|
||||
const code = teamCode.trim().toUpperCase();
|
||||
const result = await joinTeamByCode({JoinCode: code, Uid: session.currentUid});
|
||||
const result = await joinTeamByCode({
|
||||
JoinCode: code,
|
||||
Uid: session.currentUid,
|
||||
ExpectedSGid: session.currentSGid,
|
||||
});
|
||||
if (!result) return;
|
||||
|
||||
// If the server indicates this code matched the admin join code
|
||||
|
||||
Reference in new issue
Block a user