mirror of
https://git.rezel.net/LudoTech/traque.git
synced 2026-04-11 00:30:19 +02:00
Server heavy refactoring 4 (not functionnal)
This commit is contained in:
@@ -9,13 +9,12 @@ import { useTeam } from '@/contexts/teamContext';
|
||||
// Components
|
||||
import { IconButton } from '@/components/common/IconButton';
|
||||
// Constants
|
||||
import { COLORS } from '@/constants';
|
||||
import { COLORS } from '@/config';
|
||||
|
||||
const GameLayout = () => {
|
||||
const { t, i18n } = useTranslation();
|
||||
const { logout } = useAuth();
|
||||
const { teamInfos } = useTeam();
|
||||
const { name } = teamInfos;
|
||||
const { teamName } = useTeam();
|
||||
|
||||
const toggleLanguage = () => {
|
||||
i18n.changeLanguage(i18n.language === 'fr' ? 'en' : 'fr');
|
||||
@@ -31,13 +30,11 @@ const GameLayout = () => {
|
||||
}
|
||||
};
|
||||
|
||||
formatText("les minions du bds qui gagne");
|
||||
|
||||
return (
|
||||
<View style={styles.globalContainer}>
|
||||
<View style={styles.headerContainer}>
|
||||
<IconButton style={styles.logoutIcon} source={require('@/assets/images/logout.png')} onPress={logout} />
|
||||
<Text style={styles.name} numberOfLines={1} adjustsFontSizeToFit>{formatText(name, 22)}</Text>
|
||||
<Text style={styles.name} numberOfLines={1} adjustsFontSizeToFit>{formatText(teamName, 22)}</Text>
|
||||
<IconButton style={styles.traductionIcon} source={require('@/assets/images/language.png')} onPress={toggleLanguage} />
|
||||
</View>
|
||||
<Slot/>
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
import { Text, StyleSheet, ScrollView } from 'react-native';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
// Components
|
||||
import { TeamStats } from '@/components/game/TeamStats';
|
||||
import { Show } from '@/components/common/Show';
|
||||
// Hook
|
||||
import { useUserState } from '@/hooks/useUserState';
|
||||
// Constants
|
||||
import { USER_STATE } from '@/constants';
|
||||
import { USER_STATE } from '@/config';
|
||||
|
||||
/*
|
||||
const Leaderboard = ({ teams }) => {
|
||||
@@ -91,7 +90,6 @@ const End = () => {
|
||||
<Text style={styles.title}>{t("end.title_win")}</Text>
|
||||
</Show>
|
||||
<Text style={styles.subtitle}>{t("end.paragraph")}</Text>
|
||||
<TeamStats/>
|
||||
</ScrollView>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -17,14 +17,14 @@ import { useTeam } from '@/contexts/teamContext';
|
||||
// Hooks
|
||||
import { useUserState } from '@/hooks/useUserState';
|
||||
// Services
|
||||
import { emitSendPosition } from '@/services/socket/emitters';
|
||||
import { emitLocation } from '@/services/socket/emitters';
|
||||
// Constants
|
||||
import { USER_STATE } from '@/constants';
|
||||
import { USER_STATE } from '@/config';
|
||||
|
||||
const Play = () => {
|
||||
const { t } = useTranslation();
|
||||
const { teamInfos, nextZoneDate } = useTeam();
|
||||
const { locationSendDeadline, hasHandicap, enemyLocation, lastSentLocation } = teamInfos;
|
||||
const { teamStateData } = useTeam();
|
||||
const { zoneTransitionDate, scanDate, hasHandicap, scanLocation, targetScanLocation } = teamStateData;
|
||||
const userState = useUserState();
|
||||
const [bottomContainerHeight, setBottomContainerHeight] = useState(0);
|
||||
|
||||
@@ -35,8 +35,8 @@ const Play = () => {
|
||||
</Show>
|
||||
<Show when={userState == USER_STATE.PLAYING}>
|
||||
<View style={styles.timerContainer}>
|
||||
<TimerMMSS style={styles.timer} title={t("play.info.zone_reduction_label")} date={nextZoneDate} />
|
||||
<TimerMMSS style={styles.timer} title={t("play.info.send_position_label")} date={locationSendDeadline} />
|
||||
<TimerMMSS style={styles.timer} title={t("play.info.zone_reduction_label")} date={zoneTransitionDate} />
|
||||
<TimerMMSS style={styles.timer} title={t("play.info.send_position_label")} date={scanDate} />
|
||||
</View>
|
||||
</Show>
|
||||
<View style={styles.mapContainer} onLayout={(event) => setBottomContainerHeight(event.nativeEvent.layout.height)}>
|
||||
@@ -48,13 +48,13 @@ const Play = () => {
|
||||
<GameZone/>
|
||||
</Show>
|
||||
<Show when={userState == USER_STATE.PLAYING && !hasHandicap}>
|
||||
<PositionMarker position={lastSentLocation} color={"grey"} onPress={() => Alert.alert(t("play.map.previous_marker_title"), t("play.map.previous_marker_description"))} />
|
||||
<PositionMarker position={enemyLocation} color={"red"} onPress={() => Alert.alert(t("play.map.enemy_marker_title"), t("play.map.enemy_marker_description"))} />
|
||||
<PositionMarker position={scanLocation} color={"grey"} onPress={() => Alert.alert(t("play.map.previous_marker_title"), t("play.map.previous_marker_description"))} />
|
||||
<PositionMarker position={targetScanLocation} color={"red"} onPress={() => Alert.alert(t("play.map.enemy_marker_title"), t("play.map.enemy_marker_description"))} />
|
||||
</Show>
|
||||
</Map>
|
||||
<LinearGradient colors={['rgba(0,0,0,0.3)', 'rgba(0,0,0,0)']} style={styles.gradient}/>
|
||||
<Show when={userState == USER_STATE.PLAYING && !hasHandicap}>
|
||||
<IconButton style={styles.updatePosition} source={require("@/assets/images/update_position.png")} onPress={emitSendPosition} />
|
||||
<IconButton style={styles.updatePosition} source={require("@/assets/images/update_position.png")} onPress={emitLocation} />
|
||||
</Show>
|
||||
<Toasts/>
|
||||
</View>
|
||||
|
||||
Reference in New Issue
Block a user