chore: build
This commit is contained in:
@@ -246,6 +246,11 @@ func InitDB() *Database {
|
|||||||
log.Fatalf("❌ Erreur migration products.coming_soon: %v", err)
|
log.Fatalf("❌ Erreur migration products.coming_soon: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Migration: prix actif/inactif sur les prix de produits
|
||||||
|
if _, err = database.Exec(`ALTER TABLE product_prices ADD COLUMN IF NOT EXISTS active_price BOOLEAN NOT NULL DEFAULT TRUE`); err != nil {
|
||||||
|
log.Fatalf("❌ Erreur migration product_prices.active_price: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
// Migration: table contacts (SAV Telegram)
|
// Migration: table contacts (SAV Telegram)
|
||||||
if _, err = database.Exec(`CREATE TABLE IF NOT EXISTS contacts (
|
if _, err = database.Exec(`CREATE TABLE IF NOT EXISTS contacts (
|
||||||
id SERIAL PRIMARY KEY,
|
id SERIAL PRIMARY KEY,
|
||||||
|
|||||||
@@ -851,7 +851,7 @@ export default function ProductsScreen() {
|
|||||||
key={i}
|
key={i}
|
||||||
style={[
|
style={[
|
||||||
styles.info,
|
styles.info,
|
||||||
!p.active_price && {
|
p.active_price === false && {
|
||||||
textDecorationLine: "line-through",
|
textDecorationLine: "line-through",
|
||||||
color: colors.textMuted,
|
color: colors.textMuted,
|
||||||
opacity: 0.5,
|
opacity: 0.5,
|
||||||
|
|||||||
@@ -1859,6 +1859,7 @@ export interface PublicSettings {
|
|||||||
nowpayments_currencies: string[];
|
nowpayments_currencies: string[];
|
||||||
shop_name: string;
|
shop_name: string;
|
||||||
two_fa_enabled: boolean;
|
two_fa_enabled: boolean;
|
||||||
|
contact_telegram: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getPublicSettings = async (): Promise<PublicSettings> => {
|
export const getPublicSettings = async (): Promise<PublicSettings> => {
|
||||||
@@ -1875,6 +1876,7 @@ export const getPublicSettings = async (): Promise<PublicSettings> => {
|
|||||||
nowpayments_currencies: [],
|
nowpayments_currencies: [],
|
||||||
shop_name: "Milieu-Nantais",
|
shop_name: "Milieu-Nantais",
|
||||||
two_fa_enabled: false,
|
two_fa_enabled: false,
|
||||||
|
contact_telegram: "",
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${API_URL}/app-settings`);
|
const response = await fetch(`${API_URL}/app-settings`);
|
||||||
@@ -1898,6 +1900,7 @@ export const getPublicSettings = async (): Promise<PublicSettings> => {
|
|||||||
: [],
|
: [],
|
||||||
shop_name: data.shop_name || "Milieu-Nantais",
|
shop_name: data.shop_name || "Milieu-Nantais",
|
||||||
two_fa_enabled: data.two_fa_enabled ?? false,
|
two_fa_enabled: data.two_fa_enabled ?? false,
|
||||||
|
contact_telegram: data.contact_telegram || "",
|
||||||
};
|
};
|
||||||
} catch {
|
} catch {
|
||||||
return defaults;
|
return defaults;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { useState, useEffect, useRef } from 'react';
|
import { useState, useEffect, useRef } from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import { useCart } from '../../context/useCart';
|
import { useCart } from '../../context/useCart';
|
||||||
import { createCheckout, clearCart, extractUsernameFromToken, isUserAuthenticated, getReferralBalance, getPublicSettings, getMyProfile, getCryptoPaymentStatus, getProductById, getMediaUrl } from '../../api/api';
|
import { createCheckout, clearCart, extractUsernameFromToken, isUserAuthenticated, getReferralBalance, getPublicSettings, getMyProfile, getCryptoPaymentStatus, getProductById, getMediaUrl, getTelegramStatus } from '../../api/api';
|
||||||
import type { CheckoutData, CryptoPaymentStatus } from '../../api/api';
|
import type { CheckoutData, CryptoPaymentStatus } from '../../api/api';
|
||||||
import type { Product } from '../../api/api';
|
import type { Product } from '../../api/api';
|
||||||
import Navbar from '../../components/Navbar';
|
import Navbar from '../../components/Navbar';
|
||||||
@@ -80,6 +80,9 @@ function Checkout() {
|
|||||||
const [referralEnabled, setReferralEnabled] = useState(false);
|
const [referralEnabled, setReferralEnabled] = useState(false);
|
||||||
const [useReferral, setUseReferral] = useState(false);
|
const [useReferral, setUseReferral] = useState(false);
|
||||||
|
|
||||||
|
// Telegram
|
||||||
|
const [telegramLinked, setTelegramLinked] = useState(false);
|
||||||
|
|
||||||
// Crypto
|
// Crypto
|
||||||
const [cryptoEnabled, setCryptoEnabled] = useState(false);
|
const [cryptoEnabled, setCryptoEnabled] = useState(false);
|
||||||
const [cryptoOnly, setCryptoOnly] = useState(false);
|
const [cryptoOnly, setCryptoOnly] = useState(false);
|
||||||
@@ -129,6 +132,10 @@ function Checkout() {
|
|||||||
if (res.client.prenom) setFirstName(res.client.prenom);
|
if (res.client.prenom) setFirstName(res.client.prenom);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
getTelegramStatus().then((res) => {
|
||||||
|
if (res.linked) setTelegramLinked(true);
|
||||||
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// Charger settings publics (parrainage + crypto)
|
// Charger settings publics (parrainage + crypto)
|
||||||
@@ -578,6 +585,7 @@ function Checkout() {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{!telegramLinked && (
|
||||||
<div className="checkout-telegram-note">
|
<div className="checkout-telegram-note">
|
||||||
<i className="fab fa-telegram" />
|
<i className="fab fa-telegram" />
|
||||||
<div>
|
<div>
|
||||||
@@ -588,6 +596,7 @@ function Checkout() {
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
<div className="form-actions">
|
<div className="form-actions">
|
||||||
<button
|
<button
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import { getReferralBalance, isUserAuthenticated, getPublicSettings } from '../.
|
|||||||
import type { PublicSettings } from '../../api/api';
|
import type { PublicSettings } from '../../api/api';
|
||||||
import './Parrainage.css';
|
import './Parrainage.css';
|
||||||
|
|
||||||
const TELEGRAM_URL = 'https://t.me/';
|
|
||||||
|
|
||||||
const steps = [
|
const steps = [
|
||||||
{
|
{
|
||||||
@@ -140,21 +139,23 @@ export default function Parrainage() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Bouton Telegram */}
|
{/* Bouton Telegram */}
|
||||||
|
{settings?.contact_telegram && (
|
||||||
<div className="parrainage-cta">
|
<div className="parrainage-cta">
|
||||||
<p className="cta-text">
|
<p className="cta-text">
|
||||||
Prêt à parrainer ? Contactez-nous sur Telegram pour enregistrer votre
|
Prêt à parrainer ? Contactez-nous sur Telegram pour enregistrer votre
|
||||||
filleul.
|
filleul.
|
||||||
</p>
|
</p>
|
||||||
<a
|
<a
|
||||||
href={TELEGRAM_URL}
|
href={`https://t.me/${settings.contact_telegram}`}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
className="telegram-btn"
|
className="telegram-btn"
|
||||||
>
|
>
|
||||||
<i className="fab fa-telegram telegram-icon"></i>
|
<i className="fab fa-telegram telegram-icon"></i>
|
||||||
Contacter sur Telegram
|
Contacter @{settings.contact_telegram}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -777,6 +777,7 @@ export interface PublicSettings {
|
|||||||
nowpayments_currencies: string[];
|
nowpayments_currencies: string[];
|
||||||
telegram_notifications_enabled: boolean;
|
telegram_notifications_enabled: boolean;
|
||||||
two_fa_enabled: boolean;
|
two_fa_enabled: boolean;
|
||||||
|
contact_telegram: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getPublicSettings = async (): Promise<PublicSettings> => {
|
export const getPublicSettings = async (): Promise<PublicSettings> => {
|
||||||
@@ -792,6 +793,7 @@ export const getPublicSettings = async (): Promise<PublicSettings> => {
|
|||||||
nowpayments_currencies: [],
|
nowpayments_currencies: [],
|
||||||
telegram_notifications_enabled: false,
|
telegram_notifications_enabled: false,
|
||||||
two_fa_enabled: false,
|
two_fa_enabled: false,
|
||||||
|
contact_telegram: "",
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
const { data } = await apiClient.get(`${V1}/app-settings`);
|
const { data } = await apiClient.get(`${V1}/app-settings`);
|
||||||
@@ -813,6 +815,7 @@ export const getPublicSettings = async (): Promise<PublicSettings> => {
|
|||||||
telegram_notifications_enabled:
|
telegram_notifications_enabled:
|
||||||
data.telegram_notifications_enabled ?? false,
|
data.telegram_notifications_enabled ?? false,
|
||||||
two_fa_enabled: data.two_fa_enabled ?? false,
|
two_fa_enabled: data.two_fa_enabled ?? false,
|
||||||
|
contact_telegram: data.contact_telegram || "",
|
||||||
};
|
};
|
||||||
} catch {
|
} catch {
|
||||||
return defaults;
|
return defaults;
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import {
|
|||||||
getReferralBalance,
|
getReferralBalance,
|
||||||
getPublicSettings,
|
getPublicSettings,
|
||||||
getCryptoPaymentStatus,
|
getCryptoPaymentStatus,
|
||||||
|
getTelegramStatus,
|
||||||
} from "../../api/api";
|
} from "../../api/api";
|
||||||
import type { CryptoPaymentStatus } from "../../api/api";
|
import type { CryptoPaymentStatus } from "../../api/api";
|
||||||
import type { ClientStackParamList } from "../../navigation/types";
|
import type { ClientStackParamList } from "../../navigation/types";
|
||||||
@@ -57,6 +58,7 @@ export default function CheckoutScreen() {
|
|||||||
// Notif telegram
|
// Notif telegram
|
||||||
const [telegramNotificationEnabled, setTelegramNotificationEnabled] =
|
const [telegramNotificationEnabled, setTelegramNotificationEnabled] =
|
||||||
useState(false);
|
useState(false);
|
||||||
|
const [telegramLinked, setTelegramLinked] = useState(false);
|
||||||
|
|
||||||
// Crypto
|
// Crypto
|
||||||
const [cryptoEnabled, setCryptoEnabled] = useState(false);
|
const [cryptoEnabled, setCryptoEnabled] = useState(false);
|
||||||
@@ -105,6 +107,10 @@ export default function CheckoutScreen() {
|
|||||||
if (savedPhone) setTelephone(savedPhone);
|
if (savedPhone) setTelephone(savedPhone);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
getTelegramStatus().then((res) => {
|
||||||
|
if (res.linked) setTelegramLinked(true);
|
||||||
|
});
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
if (pollRef.current) clearInterval(pollRef.current);
|
if (pollRef.current) clearInterval(pollRef.current);
|
||||||
};
|
};
|
||||||
@@ -1027,7 +1033,7 @@ export default function CheckoutScreen() {
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Note Telegram */}
|
{/* Note Telegram */}
|
||||||
{telegramNotificationEnabled && (
|
{telegramNotificationEnabled && !telegramLinked && (
|
||||||
<View style={styles.telegramNote}>
|
<View style={styles.telegramNote}>
|
||||||
<Ionicons
|
<Ionicons
|
||||||
name="paper-plane-outline"
|
name="paper-plane-outline"
|
||||||
|
|||||||
@@ -5,27 +5,36 @@ import {
|
|||||||
ScrollView,
|
ScrollView,
|
||||||
StyleSheet,
|
StyleSheet,
|
||||||
Linking,
|
Linking,
|
||||||
|
TouchableOpacity,
|
||||||
} from "react-native";
|
} from "react-native";
|
||||||
import { Ionicons } from "@expo/vector-icons";
|
import { Ionicons } from "@expo/vector-icons";
|
||||||
import { useTheme } from "../../context/ThemeContext";
|
import { useTheme } from "../../context/ThemeContext";
|
||||||
import { spacing, borderRadius, fontSize, fontWeight } from "../../theme";
|
import { spacing, borderRadius, fontSize, fontWeight } from "../../theme";
|
||||||
import { getReferralBalance } from "../../api/api";
|
import { getReferralBalance, getPublicSettings } from "../../api/api";
|
||||||
|
|
||||||
export default function ParrainageScreen() {
|
export default function ParrainageScreen() {
|
||||||
const { colors } = useTheme();
|
const { colors } = useTheme();
|
||||||
const [balance, setBalance] = useState<number>(0);
|
const [balance, setBalance] = useState<number>(0);
|
||||||
|
const [contactTelegram, setContactTelegram] = useState<string>("");
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getReferralBalance().then((res) => {
|
getReferralBalance().then((res) => {
|
||||||
if (res.success) setBalance(res.balance);
|
if (res.success) setBalance(res.balance);
|
||||||
});
|
});
|
||||||
|
getPublicSettings().then((settings) => {
|
||||||
|
if (settings.contact_telegram) {
|
||||||
|
setContactTelegram(settings.contact_telegram);
|
||||||
|
}
|
||||||
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const steps = [
|
const steps = [
|
||||||
{
|
{
|
||||||
icon: "chatbubble-ellipses-outline" as const,
|
icon: "chatbubble-ellipses-outline" as const,
|
||||||
title: "1. Contacte-nous sur Telegram",
|
title: "1. Contacte-nous sur Telegram",
|
||||||
desc: "Envoie un message à @milieu_nantais en indiquant ton username et le username de la personne que tu as parrainée.",
|
desc: contactTelegram
|
||||||
|
? `Envoie un message à @${contactTelegram} en indiquant ton username et le username de la personne que tu as parrainée.`
|
||||||
|
: "Envoie-nous un message sur Telegram en indiquant ton username et le username de la personne que tu as parrainée.",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: "checkmark-circle-outline" as const,
|
icon: "checkmark-circle-outline" as const,
|
||||||
@@ -152,6 +161,12 @@ export default function ParrainageScreen() {
|
|||||||
[colors],
|
[colors],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const handleTelegramPress = () => {
|
||||||
|
if (contactTelegram) {
|
||||||
|
Linking.openURL(`https://t.me/${contactTelegram}`);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ScrollView style={styles.container} contentContainerStyle={styles.content}>
|
<ScrollView style={styles.container} contentContainerStyle={styles.content}>
|
||||||
{/* Solde actuel */}
|
{/* Solde actuel */}
|
||||||
@@ -190,18 +205,14 @@ export default function ParrainageScreen() {
|
|||||||
</View>
|
</View>
|
||||||
|
|
||||||
{/* Bouton Telegram */}
|
{/* Bouton Telegram */}
|
||||||
<View
|
{contactTelegram ? (
|
||||||
style={styles.telegramBtn}
|
<TouchableOpacity style={styles.telegramBtn} onPress={handleTelegramPress}>
|
||||||
// Utiliser TouchableOpacity si besoin d'interaction
|
|
||||||
>
|
|
||||||
<Ionicons name="paper-plane-outline" size={20} color="#fff" />
|
<Ionicons name="paper-plane-outline" size={20} color="#fff" />
|
||||||
<Text
|
<Text style={styles.telegramText}>
|
||||||
style={styles.telegramText}
|
Contacter @{contactTelegram}
|
||||||
onPress={() => Linking.openURL("https://t.me/milieu_nantais")}
|
|
||||||
>
|
|
||||||
Contacter @milieu_nantais
|
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</TouchableOpacity>
|
||||||
|
) : null}
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user