chore: build
This commit is contained in:
@@ -1050,17 +1050,11 @@ export interface AppSettings {
|
||||
telegram_bot_username: string;
|
||||
telegram_notifications_enabled: boolean;
|
||||
telegram_2fa_enabled: boolean;
|
||||
telegram_notif_bots: TelegramBotConfig[];
|
||||
delivery_mode: DeliveryModeConfig;
|
||||
shop_name: string;
|
||||
contact_telegram: string;
|
||||
}
|
||||
|
||||
export type TelegramBotConfig = {
|
||||
token: string;
|
||||
username: string;
|
||||
};
|
||||
|
||||
export const getSettings = async (): Promise<{
|
||||
success: boolean;
|
||||
settings?: AppSettings;
|
||||
|
||||
@@ -16,7 +16,7 @@ import { Ionicons } from "@expo/vector-icons";
|
||||
import { spacing, fontSize, borderRadius } from "../../theme";
|
||||
import { useTheme } from "../../context/ThemeContext";
|
||||
import { getSettings, updateSettings, getCategories, getAvailableDeliveryPersons, getAllProductsAdmin, DEFAULT_DELIVERY_SCHEDULE, DEFAULT_POSTAL_ZONES } from "../../api/api_admin";
|
||||
import type { AppSettings, Category, CategoryRoute, DeliveryModeConfig, PointsTier, PointsPool, PointsReward, RewardCategoryConfig, DaySchedule, DeliverySchedule, PostalZone, TelegramBotConfig } from "../../api/api_admin";
|
||||
import type { AppSettings, Category, CategoryRoute, DeliveryModeConfig, PointsTier, PointsPool, PointsReward, RewardCategoryConfig, DaySchedule, DeliverySchedule, PostalZone } from "../../api/api_admin";
|
||||
import type { Product } from "../../api/types";
|
||||
import AlertModal from "../../components/ui/AlertModal";
|
||||
import { useAlert } from "../../hooks/useAlert";
|
||||
@@ -1032,7 +1032,6 @@ export default function SettingsScreen() {
|
||||
telegram_bot_username: "",
|
||||
telegram_notifications_enabled: false,
|
||||
telegram_2fa_enabled: false,
|
||||
telegram_notif_bots: [],
|
||||
delivery_mode: { mode: "single" as const, category_routes: [] },
|
||||
shop_name: "Milieu-Nantais",
|
||||
contact_telegram: "",
|
||||
@@ -1905,66 +1904,6 @@ export default function SettingsScreen() {
|
||||
)}
|
||||
</View>
|
||||
|
||||
{/* Bots de notification (failover) */}
|
||||
<View style={{ paddingHorizontal: spacing.l, paddingTop: spacing.l }}>
|
||||
<Text style={[s.rowLabel, { marginBottom: spacing.xs }]}>Bots de notification (failover)</Text>
|
||||
<Text style={[s.hint, { marginBottom: spacing.m }]}>
|
||||
Les notifications sont envoyées par le premier bot. En cas de rate-limit ou d'erreur, le suivant prend le relais.
|
||||
Si aucun bot n'est configuré ici, le bot principal est utilisé.
|
||||
</Text>
|
||||
{(settings.telegram_notif_bots ?? []).map((bot, idx) => (
|
||||
<View key={idx} style={{ flexDirection: "row", gap: spacing.s, marginBottom: spacing.s, alignItems: "flex-start" }}>
|
||||
<View style={{ flex: 1, gap: spacing.xs }}>
|
||||
<TextInput
|
||||
style={[s.input, { marginBottom: 0 }]}
|
||||
placeholder={`Token bot ${idx + 1}`}
|
||||
placeholderTextColor={colors.textSecondary}
|
||||
value={bot.token}
|
||||
onChangeText={(v) => setSettings((p) => {
|
||||
const bots = [...(p.telegram_notif_bots ?? [])];
|
||||
bots[idx] = { ...bots[idx], token: v };
|
||||
return { ...p, telegram_notif_bots: bots };
|
||||
})}
|
||||
autoCapitalize="none"
|
||||
autoCorrect={false}
|
||||
secureTextEntry
|
||||
/>
|
||||
<TextInput
|
||||
style={[s.input, { marginBottom: 0 }]}
|
||||
placeholder={`@username bot ${idx + 1}`}
|
||||
placeholderTextColor={colors.textSecondary}
|
||||
value={bot.username}
|
||||
onChangeText={(v) => setSettings((p) => {
|
||||
const bots = [...(p.telegram_notif_bots ?? [])];
|
||||
bots[idx] = { ...bots[idx], username: v };
|
||||
return { ...p, telegram_notif_bots: bots };
|
||||
})}
|
||||
autoCapitalize="none"
|
||||
autoCorrect={false}
|
||||
/>
|
||||
</View>
|
||||
<TouchableOpacity
|
||||
onPress={() => setSettings((p) => ({
|
||||
...p,
|
||||
telegram_notif_bots: (p.telegram_notif_bots ?? []).filter((_, i) => i !== idx),
|
||||
}))}
|
||||
style={{ padding: spacing.s, marginTop: spacing.xs }}
|
||||
>
|
||||
<Ionicons name="trash-outline" size={20} color={colors.danger} />
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
))}
|
||||
<TouchableOpacity
|
||||
onPress={() => setSettings((p) => ({
|
||||
...p,
|
||||
telegram_notif_bots: [...(p.telegram_notif_bots ?? []), { token: "", username: "" }],
|
||||
}))}
|
||||
style={{ flexDirection: "row", alignItems: "center", gap: spacing.s, paddingVertical: spacing.s }}
|
||||
>
|
||||
<Ionicons name="add-circle-outline" size={20} color={colors.accent} />
|
||||
<Text style={{ color: colors.accent, fontSize: fontSize.sm }}>Ajouter un bot de notification</Text>
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user