From 95ad6f7b335fd1d1f70608990766817bf6215fab Mon Sep 17 00:00:00 2001 From: Xor290 Date: Sun, 1 Mar 2026 13:31:57 +0100 Subject: [PATCH] chore: delete register page --- .github/workflows/frontend-client-build.yml | 31 +- mobile/src/screens/HomeScreen.tsx | 11 - mobile/src/screens/auth/RegisterScreen.tsx | 330 -------------------- 3 files changed, 4 insertions(+), 368 deletions(-) delete mode 100644 mobile/src/screens/auth/RegisterScreen.tsx diff --git a/.github/workflows/frontend-client-build.yml b/.github/workflows/frontend-client-build.yml index dfd1e956..1bc1deb0 100644 --- a/.github/workflows/frontend-client-build.yml +++ b/.github/workflows/frontend-client-build.yml @@ -1,14 +1,10 @@ -name: Frontend Client - EAS Build +name: Frontend Client - EAS Update on: push: branches: [main] paths: - "mobile/**" - pull_request: - branches: [main] - paths: - - "mobile/**" jobs: typecheck: @@ -32,7 +28,7 @@ jobs: working-directory: mobile run: npx tsc --noEmit - build-apk-prod: + eas-update: needs: typecheck runs-on: ubuntu-latest @@ -62,25 +58,6 @@ jobs: jq '.expo.extra.eas.projectId = "${{ secrets.EXPO_PROJECT_ID_CLIENT }}"' app.json > app.tmp.json mv app.tmp.json app.json - - name: Debug app.json + - name: Publish OTA update working-directory: mobile - run: cat app.json - - - name: Build production APK - working-directory: mobile - env: - EAS_BUILD_NO_EXPO_GO_WARNING: true - run: eas build --platform android --profile production --non-interactive - - - name: Download production APK - working-directory: mobile - run: | - APK_URL=$(eas build:list --platform android --status finished --limit 1 --json --non-interactive | jq -r '.[0].artifacts.buildUrl') - curl -L -o client-panel-prod.apk "$APK_URL" - - - name: Upload production APK artifact - uses: actions/upload-artifact@v4 - with: - name: client-panel-android-prod-apk - path: mobile/client-panel-prod.apk - retention-days: 14 + run: eas update --channel production --message "${{ github.event.head_commit.message }}" --non-interactive diff --git a/mobile/src/screens/HomeScreen.tsx b/mobile/src/screens/HomeScreen.tsx index ea3458b2..1394a46c 100644 --- a/mobile/src/screens/HomeScreen.tsx +++ b/mobile/src/screens/HomeScreen.tsx @@ -27,17 +27,6 @@ export default function HomeScreen({ navigation }: Props) { > Se connecter - - navigation.navigate("register")} - > - - Créer un compte - - ); diff --git a/mobile/src/screens/auth/RegisterScreen.tsx b/mobile/src/screens/auth/RegisterScreen.tsx deleted file mode 100644 index 71793783..00000000 --- a/mobile/src/screens/auth/RegisterScreen.tsx +++ /dev/null @@ -1,330 +0,0 @@ -import React, { useState } from "react"; -import { - View, - Text, - TextInput, - TouchableOpacity, - StyleSheet, - ScrollView, - ActivityIndicator, -} from "react-native"; -import { Feather, FontAwesome } from "@expo/vector-icons"; -import { useNavigation } from "@react-navigation/native"; -import type { NativeStackNavigationProp } from "@react-navigation/native-stack"; -import type { RootStackParamList } from "../../navigation/types"; -import { registerUser } from "../../api/api"; -import { useAuth } from "../../auth/AuthContext"; -import { useTheme } from "../../context/ThemeContext"; - -type RegisterScreenNavigationProp = NativeStackNavigationProp< - RootStackParamList, - "register" ->; - -const RegisterScreen = () => { - const navigation = useNavigation(); - const { loginClient } = useAuth(); - const { colors } = useTheme(); - - const [formData, setFormData] = useState({ - nom: "", - prenom: "", - telephone: "", - username: "", - password: "", - }); - const [showPassword, setShowPassword] = useState(false); - const [errors, setErrors] = useState<{ [key: string]: string | undefined }>( - {}, - ); - const [apiError, setApiError] = useState(""); - const [isLoading, setIsLoading] = useState(false); - - const handleChange = (name: string, value: string) => { - setFormData((prev) => ({ ...prev, [name]: value })); - setErrors((prev) => ({ ...prev, [name]: undefined })); - if (apiError) setApiError(""); - }; - - const validateForm = () => { - const newErrors: typeof errors = {}; - if (!formData.nom.trim()) newErrors.nom = "Le nom est requis"; - if (!formData.prenom.trim()) newErrors.prenom = "Le prénom est requis"; - const cleanPhone = formData.telephone.replace(/\s/g, ""); - if (!formData.telephone.trim()) - newErrors.telephone = "Le numéro de téléphone est requis"; - else if (!/^[0-9+]{10,15}$/.test(cleanPhone)) - newErrors.telephone = - "Numéro de téléphone invalide (10-15 chiffres)"; - if (!formData.username.trim()) - newErrors.username = "Le nom d'utilisateur est requis"; - else if (formData.username.length < 3) - newErrors.username = "Au moins 3 caractères requis"; - if (!formData.password) - newErrors.password = "Le mot de passe est requis"; - else if (formData.password.length < 8) - newErrors.password = "Au moins 8 caractères requis"; - setErrors(newErrors); - return Object.keys(newErrors).length === 0; - }; - - const handleRegister = async () => { - if (!validateForm()) return; - setIsLoading(true); - setApiError(""); - try { - const result = await registerUser( - formData.username, - formData.password, - formData.nom, - formData.prenom, - formData.telephone, - ); - if (result.success && result.access_token) { - await loginClient(result.access_token); - } else { - const message = - result.message || "Erreur lors de l'inscription"; - setApiError(message); - setErrors({ username: message }); - } - } catch (err: any) { - setApiError(err.message || "Erreur serveur"); - } finally { - setIsLoading(false); - } - }; - - return ( - - - - - - - - Créer un compte - - - {apiError ? ( - {apiError} - ) : null} - - {/* Nom */} - - - handleChange("nom", value)} - /> - {errors.nom && ( - {errors.nom} - )} - - - {/* Prénom */} - - - handleChange("prenom", value)} - /> - {errors.prenom && ( - {errors.prenom} - )} - - - {/* Téléphone */} - - - - handleChange("telephone", value) - } - /> - {errors.telephone && ( - {errors.telephone} - )} - - - {/* Username */} - - - - handleChange("username", value) - } - /> - {errors.username && ( - {errors.username} - )} - - - {/* Password */} - - - - handleChange("password", value) - } - /> - setShowPassword(!showPassword)} - > - - - {errors.password && ( - {errors.password} - )} - - - - {isLoading ? ( - - ) : ( - Créer mon compte - )} - - - navigation.navigate("login")}> - - Vous avez déjà un compte ? Se connecter - - - - - ); -}; - -export default RegisterScreen; - -const styles = StyleSheet.create({ - container: { - flexGrow: 1, - justifyContent: "center", - alignItems: "center", - padding: 16, - }, - card: { width: "100%", maxWidth: 400, borderRadius: 16, padding: 24 }, - iconContainer: { alignItems: "center", marginBottom: 16 }, - title: { - fontSize: 24, - fontWeight: "bold", - marginBottom: 24, - textAlign: "center", - }, - inputGroup: { marginBottom: 16, position: "relative" }, - icon: { position: "absolute", left: 12, top: 12 }, - input: { height: 40, paddingLeft: 40, borderWidth: 1, borderRadius: 8 }, - inputError: { borderColor: "#ef4444" }, - eyeButton: { position: "absolute", right: 12, top: 8 }, - errorText: { color: "#f87171", marginTop: 4 }, - apiError: { color: "#f87171", textAlign: "center", marginBottom: 12 }, - submitButton: { - backgroundColor: "#7c3aed", - borderRadius: 8, - padding: 12, - alignItems: "center", - marginTop: 8, - }, - submitText: { color: "white", fontWeight: "600" }, - loginText: { textAlign: "center", marginTop: 16 }, -});