Skip to content

Commit

Permalink
Fix docker compose and added message on approve new ambassador
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksey2299-1 committed Mar 11, 2024
1 parent 54c93a5 commit 26b197d
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 40 deletions.
2 changes: 2 additions & 0 deletions backend/ambassadors/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
)
from ambassadors.validators import gender_validator, tg_acc_validator
from content.models import Content, Promocode
from mailing.utils import send_to_ambassadors_tg


class YandexProgrammSerializer(serializers.ModelSerializer):
Expand Down Expand Up @@ -162,6 +163,7 @@ def update(self, instance: Ambassador, validated_data: dict) -> Ambassador:
validated_data["status"] == "Active"
and instance.status == "Clarify"
):
send_to_ambassadors_tg(instance, "Вы приняты!")
validated_data["created"] = timezone.now()
if "ya_programm" in validated_data:
ya_programm = validated_data.pop("ya_programm")
Expand Down
12 changes: 0 additions & 12 deletions backend/websocket/views.py

This file was deleted.

1 change: 1 addition & 0 deletions docker-compose.production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ services:
- static:/static/
- media:/media/
- certs:/etc/letsencrypt
- bot_static:/bot_static/

frontend:
env_file: .env
Expand Down
60 changes: 32 additions & 28 deletions webapp_bot/src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,48 +1,52 @@
import { useEffect, useState } from 'react'
import './App.css'
import { useTelegram } from './hooks/useTelegram'
import ColorTabs from './components/Tabs/Tabs'
import Profile from './pages/Profile'
import Achievements from './pages/Achievements'
import { useEffect, useState } from "react";
import "./App.css";
import { useTelegram } from "./hooks/useTelegram";
import ColorTabs from "./components/Tabs/Tabs";
import Profile from "./pages/Profile";
import Achievements from "./pages/Achievements";

export default function App() {
const {webApp, user} = useTelegram()
const [currentTab, setCurrentTab] = useState('profile')
const [ambassador, setAmbassador] = useState()
const { webApp, user } = useTelegram();
const [currentTab, setCurrentTab] = useState("profile");
const [ambassador, setAmbassador] = useState();

useEffect(() => {
webApp.ready()
}, [])
webApp.ready();
}, []);

useEffect(() => {
if (user) {
const fetchData = async () => {
try {
const response = await fetch('/api/v1/ambassador_by_tg_username/' + user.username)
const jsonData = await response.json()
setAmbassador(jsonData)
const response = await fetch(
"/api/v1/ambassador_by_tg_username/" + user.username
);
const jsonData = await response.json();
setAmbassador(jsonData);
} catch (error) {
console.error('Ошибка при получении данных:', error)
console.error("Ошибка при получении данных:", error);
}
}
fetchData()
};
fetchData();
}
}, [])
}, []);

function onChangeTab (value) {
setCurrentTab(value)
function onChangeTab(value) {
setCurrentTab(value);
}

return (
<>
{user && <>
<ColorTabs onClick={onChangeTab} currentTab={currentTab}/>
{/* <Header /> */}
{currentTab === "profile" && <Profile data={ambassador}/>}
{currentTab === "achievements" && <Achievements />}
{/* {currentTab === "statistic" && <Statistic />} */}
{/* <button onClick={onToogleButton}>toogle</button> */}
</>}
{user && (
<>
<ColorTabs onClick={onChangeTab} currentTab={currentTab} />
{/* <Header /> */}
{currentTab === "profile" && <Profile data={ambassador} />}
{currentTab === "achievements" && <Achievements />}
{/* {currentTab === "statistic" && <Statistic />} */}
{/* <button onClick={onToogleButton}>toogle</button> */}
</>
)}
</>
);
}

0 comments on commit 26b197d

Please sign in to comment.