Skip to content

Commit 33b8189

Browse files
committed
add test endpoint
1 parent 4a09c8c commit 33b8189

File tree

5 files changed

+173
-0
lines changed

5 files changed

+173
-0
lines changed

app/routes/interview.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from flask import Blueprint, render_template
2+
3+
routes_interview = Blueprint('routes_interview', __name__)
4+
5+
@routes_interview.route('/interview', methods=['GET'])
6+
def interview_page():
7+
return render_template(
8+
'interview.html'
9+
), 200

app/static/css/interview.css

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
.interview-container {
2+
position: relative;
3+
min-height: 100vh;
4+
display: flex;
5+
justify-content: center;
6+
align-items: flex-start;
7+
padding-top: 50px;
8+
}
9+
10+
.placeholder-photo {
11+
width: 250px;
12+
height: 250px;
13+
background-color: black;
14+
margin: 0 auto;
15+
border-radius: 10px;
16+
}
17+
18+
.mic-icon {
19+
font-size: 2.5rem;
20+
color: #007bff;
21+
}
22+
23+
.mic-circle-wrapper {
24+
width: 60px;
25+
height: 60px;
26+
background-color: #007bff;
27+
border-radius: 50%;
28+
display: flex;
29+
justify-content: center;
30+
align-items: center;
31+
margin: 15px auto 0 auto;
32+
cursor: pointer;
33+
transition: background-color 0.2s, transform 0.2s;
34+
}
35+
36+
.mic-circle-wrapper:hover {
37+
background-color: #0056b3;
38+
transform: scale(1.1);
39+
}
40+
41+
.mic-circle-wrapper i {
42+
color: white;
43+
font-size: 1.5rem;
44+
}
45+
46+
#start-btn {
47+
display: block;
48+
margin: 15px auto 0 auto;
49+
padding: 15px 40px;
50+
font-size: 1.3rem;
51+
border-radius: 12px;
52+
background-color: #363773;
53+
border: none;
54+
color: white;
55+
font-weight: bold;
56+
transition: background-color 0.2s;
57+
}
58+
#start-btn:hover {
59+
background-color: #218838;
60+
}
61+
62+
.stop-btn {
63+
position: fixed;
64+
bottom: 20px;
65+
left: 20px;
66+
padding: 15px 30px;
67+
font-size: 1.2rem;
68+
border-radius: 12px;
69+
background-color: #9F0F0F;
70+
border: none;
71+
color: white;
72+
font-weight: bold;
73+
transition: background-color 0.2s;
74+
}
75+
.stop-btn:hover {
76+
background-color: #c82333;
77+
}
78+
79+
.timer-section {
80+
position: absolute;
81+
top: 50px;
82+
right: 50px;
83+
text-align: left;
84+
max-width: 350px;
85+
font-family: Arial, sans-serif;
86+
}
87+
88+
#timer {
89+
font-size: 2.5rem;
90+
font-weight: bold;
91+
color: #343a40;
92+
}
93+
94+
#question-number {
95+
font-size: 2.2rem;
96+
font-weight: bold;
97+
}
98+
99+
#question-text {
100+
font-size: 2.2rem;
101+
margin-top: 5px;
102+
}

app/static/js/interview.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
let timerElement = document.getElementById("timer");
2+
let startBtn = document.getElementById("start-btn");
3+
let stopBtn = document.getElementById("stop-btn");
4+
5+
let seconds = 0;
6+
let timer = null;
7+
8+
function updateTimer() {
9+
let mins = Math.floor(seconds / 60);
10+
let secs = seconds % 60;
11+
timerElement.textContent =
12+
`${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`;
13+
}
14+
15+
startBtn?.addEventListener("click", () => {
16+
if (timer) return;
17+
timer = setInterval(() => {
18+
seconds++;
19+
updateTimer();
20+
}, 1000);
21+
});
22+
23+
stopBtn?.addEventListener("click", () => {
24+
if (confirm("Вы уверены, что хотите прервать сессию?")) {
25+
clearInterval(timer);
26+
timer = null;
27+
seconds = 0;
28+
updateTimer();
29+
}
30+
});

app/templates/interview.html

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{% extends "base.html" %}
2+
{% block header %}
3+
<link rel="stylesheet" href="/static/css/interview.css">
4+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css">
5+
{% endblock %}
6+
{% block content %}
7+
<div class="interview-container">
8+
9+
<div class="top-center text-center">
10+
<div class="placeholder-photo"></div>
11+
<div class="mt-3">
12+
<button id="start-btn" class="btn btn-success px-4 py-2">Начать</button>
13+
</div>
14+
<div class="mic-circle-wrapper">
15+
<i class="bi bi-mic-fill"></i>
16+
</div>
17+
</div>
18+
19+
<div class="timer-section">
20+
<h3 id="timer">00:00</h3>
21+
<h3 class="mt-3">Вопрос № <span id="question-number">1</span></h3>
22+
<p id="question-text" class="mt-2">
23+
Расскажите о своем опыте работы с Python.
24+
</p>
25+
</div>
26+
27+
<button id="stop-btn" class="btn btn-danger stop-btn">Прервать сессию</button>
28+
<script src="{{ url_for('static', filename='js/interview.js') }}"></script>
29+
</div>
30+
{% endblock %}

app/web_speech_trainer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
from app.routes.task_attempts import routes_task_attempts
3333
from app.routes.version import routes_version
3434
from app.routes.capacity import routes_capacity
35+
from app.routes.interview import routes_interview
3536
from app.status import PassBackStatus, TrainingStatus
3637
from app.training_manager import TrainingManager
3738
from app.utils import ALLOWED_EXTENSIONS, DEFAULT_EXTENSION
@@ -57,6 +58,7 @@
5758
app.register_blueprint(routes_task_attempts)
5859
app.register_blueprint(routes_version)
5960
app.register_blueprint(routes_capacity)
61+
app.register_blueprint(routes_interview)
6062

6163
logger = get_root_logger(service_name='web')
6264

0 commit comments

Comments
 (0)