Spaces:
Running
Running
<html lang="ja"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>会話フィードバック画面</title> | |
<link | |
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" | |
rel="stylesheet" | |
/> | |
<style> | |
body { | |
font-family: Arial, sans-serif; | |
display: flex; | |
justify-content: center; | |
align-items: center; | |
height: 100vh; | |
margin: 0; | |
background-color: #f5f5f5; | |
} | |
.card { | |
border: 2px solid #000; | |
border-radius: 20px; | |
padding: 30px; | |
width: 500px; | |
text-align: center; | |
background-color: white; | |
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); | |
} | |
.level { | |
font-size: 28px; | |
font-weight: bold; | |
margin-bottom: 20px; | |
} | |
.message { | |
margin: 15px 0; | |
font-size: 20px; | |
font-weight: bold; | |
color: #333; | |
} | |
.bar-container { | |
display: flex; | |
align-items: center; | |
margin: 8px 0; | |
} | |
.bar-label { | |
width: 60px; | |
margin-right: 10px; | |
font-weight: bold; | |
} | |
.bar { | |
flex: 1; | |
height: 25px; | |
background-color: lightgray; | |
border-radius: 5px; | |
overflow: hidden; | |
} | |
.bar-fill { | |
height: 100%; | |
border-radius: 5px; | |
} | |
.back-button, | |
.history-button { | |
margin-top: 20px; | |
margin-left: 20px; | |
padding: 10px 20px; | |
background-color: #007bff; | |
color: white; | |
border: none; | |
border-radius: 5px; | |
cursor: pointer; | |
} | |
.back-button:hover, | |
.history-button:hover { | |
background-color: #0056b3; | |
} | |
.flex { | |
display: flex; | |
justify-content: center; | |
} | |
</style> | |
<script> | |
function getMessage(level) { | |
if (level < 20) return "やばい"; | |
if (level < 40) return "気をつけよう"; | |
if (level < 60) return "まずまずですね"; | |
if (level < 80) return "がんばれあとちょっと"; | |
return "素晴らしい"; | |
} | |
window.onload = function () { | |
const level = 73; // レベル値 | |
const percentages = [80, 50, 60, 100, 30]; // 各バーのパーセンテージ | |
const labels = ["項目1", "項目2", "項目3", "項目4", "項目5"]; // 各項目名 | |
const message = getMessage(level); | |
document.getElementById("level").innerText = `話者Lv: ${level}`; | |
document.getElementById("message").innerText = message; | |
const barElements = document.getElementsByClassName("bar-fill"); | |
const labelElements = document.getElementsByClassName("bar-label"); | |
for (let i = 0; i < barElements.length; i++) { | |
barElements[i].style.width = `${percentages[i]}%`; | |
labelElements[i].innerText = labels[i]; | |
} | |
}; | |
function showRecorder() { | |
// 録音画面へ遷移 | |
window.location.href = "index"; | |
} | |
function showTalkDetil() { | |
// 会話詳細へ遷移 | |
window.location.href = "talk_detail"; | |
} | |
</script> | |
</head> | |
<body> | |
<h1 class="mb-4">ようこそ, {{ user.name }} さん!</h1> | |
<div class="card"> | |
<div class="level" id="level">話者Lv: 85</div> | |
<div class="message" id="message">素晴らしい</div> | |
<div class="bar-container"> | |
<span class="bar-label"></span> | |
<div class="bar"> | |
<div class="bar-fill" style="background-color: lightblue"></div> | |
</div> | |
</div> | |
<div class="bar-container"> | |
<span class="bar-label"></span> | |
<div class="bar"> | |
<div class="bar-fill" style="background-color: peachpuff"></div> | |
</div> | |
</div> | |
<div class="bar-container"> | |
<span class="bar-label"></span> | |
<div class="bar"> | |
<div class="bar-fill" style="background-color: lightblue"></div> | |
</div> | |
</div> | |
<div class="bar-container"> | |
<span class="bar-label"></span> | |
<div class="bar"> | |
<div class="bar-fill" style="background-color: peachpuff"></div> | |
</div> | |
</div> | |
<div class="bar-container"> | |
<span class="bar-label"></span> | |
<div class="bar"> | |
<div class="bar-fill" style="background-color: lightcoral"></div> | |
</div> | |
</div> | |
<div class="flex"> | |
<!-- | |
<form method="POST" action="/index"> | |
<div class="feedback-space"> | |
<input | |
class="history-button" | |
id="indexButton" | |
type="submit" | |
name="submit" | |
value="録音画面を表示" | |
/> | |
</div> | |
</form>--> | |
<button | |
class="history-button" | |
id="detailButton" | |
onclick="showRecorder()" | |
> | |
録音画面を表示 | |
</button> | |
<button | |
class="history-button" | |
id="detailButton" | |
onclick="showTalkDetil()" | |
> | |
会話詳細を表示 | |
</button> | |
<!--<form method="POST" action="/talk_detail"> | |
<div class="feedback-space"> | |
<input | |
class="history-button" | |
id="detailButton" | |
type="submit" | |
name="submit" | |
value="会話詳細を表示" | |
/> | |
</div> | |
</form>--> | |
</div> | |
</div> | |
</body> | |
</html> | |