chore: update
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
FlatList,
|
||||
RefreshControl,
|
||||
TouchableOpacity,
|
||||
TextInput as RNTextInput,
|
||||
} from "react-native";
|
||||
import { Ionicons } from "@expo/vector-icons";
|
||||
import { spacing, fontSize, borderRadius } from "../../theme";
|
||||
@@ -126,6 +127,7 @@ export default function UsersScreen() {
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [refreshing, setRefreshing] = useState(false);
|
||||
const [filter, setFilter] = useState<RoleFilter>("all");
|
||||
const [search, setSearch] = useState("");
|
||||
|
||||
// Edit client modal
|
||||
const [editClientModal, setEditClientModal] = useState<{
|
||||
@@ -224,6 +226,22 @@ export default function UsersScreen() {
|
||||
merged = merged.filter((u) => u.role === filter);
|
||||
}
|
||||
|
||||
if (search.trim()) {
|
||||
const q = search.trim().toLowerCase();
|
||||
merged = merged.filter((u) => {
|
||||
if (u.username.toLowerCase().includes(q)) return true;
|
||||
if (u.clientData) {
|
||||
const c = u.clientData;
|
||||
return (
|
||||
c.nom.toLowerCase().includes(q) ||
|
||||
c.prenom.toLowerCase().includes(q) ||
|
||||
c.telephone.toLowerCase().includes(q)
|
||||
);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
return merged;
|
||||
};
|
||||
|
||||
@@ -542,6 +560,26 @@ export default function UsersScreen() {
|
||||
marginTop: spacing.xxl,
|
||||
},
|
||||
|
||||
// Search bar
|
||||
searchContainer: {
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
marginHorizontal: spacing.m,
|
||||
marginBottom: spacing.s,
|
||||
paddingHorizontal: spacing.m,
|
||||
borderRadius: borderRadius.md,
|
||||
backgroundColor: colors.bgSecondary,
|
||||
borderWidth: 1,
|
||||
borderColor: colors.border,
|
||||
height: 44,
|
||||
gap: spacing.s,
|
||||
},
|
||||
searchInput: {
|
||||
flex: 1,
|
||||
color: colors.textWhite,
|
||||
fontSize: fontSize.sm,
|
||||
},
|
||||
|
||||
// Add button
|
||||
addButton: {
|
||||
flexDirection: "row",
|
||||
@@ -847,6 +885,26 @@ export default function UsersScreen() {
|
||||
})}
|
||||
</View>
|
||||
|
||||
{/* Search bar */}
|
||||
<View style={styles.searchContainer}>
|
||||
<Ionicons name="search-outline" size={18} color={colors.textMuted} />
|
||||
<RNTextInput
|
||||
style={styles.searchInput}
|
||||
placeholder="Rechercher par nom, username, téléphone..."
|
||||
placeholderTextColor={colors.textMuted}
|
||||
value={search}
|
||||
onChangeText={setSearch}
|
||||
autoCapitalize="none"
|
||||
autoCorrect={false}
|
||||
clearButtonMode="while-editing"
|
||||
/>
|
||||
{search.length > 0 && (
|
||||
<TouchableOpacity onPress={() => setSearch("")}>
|
||||
<Ionicons name="close-circle" size={18} color={colors.textMuted} />
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
</View>
|
||||
|
||||
{/* Add user button */}
|
||||
<TouchableOpacity
|
||||
style={styles.addButton}
|
||||
|
||||
Reference in New Issue
Block a user