Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .vscode/mcp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"servers": {
"github-mcp-server": {
"url": "https://api.githubcopilot.com/mcp",
"type": "http"
}
},
"inputs": []
}
10 changes: 10 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from flask import Flask, render_template

app = Flask(__name__)

@app.route("/")
def index():
return render_template("index.html")

if __name__ == "__main__":
app.run(debug=True)
13 changes: 13 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Fibonacci数列を計算する関数
def fibonacci(n):
if n <= 0:
return "Input should be a positive integer."
elif n == 1:
return 0
elif n == 2:
return 1
else:
a, b = 0, 1
for _ in range(2, n):
a, b = b, a + b
return b
16 changes: 16 additions & 0 deletions point.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import math

class Point3D:
def __init__(self, x, y, z):
self.x = x
self.y = y
self.z = z

def distance_to(self, other):
dx = self.x - other.x
dy = self.y - other.y
dz = self.z - other.z
return math.sqrt(dx * dx + dy * dy + dz * dz)

def __str__(self):
return f"Point3D({self.x}, {self.y}, {self.z})"
81 changes: 81 additions & 0 deletions static/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
body {
background: #7b6ef6;
font-family: 'Segoe UI', sans-serif;
}
.container {
background: #fff;
border-radius: 24px;
width: 340px;
margin: 40px auto;
padding: 32px 24px 24px 24px;
box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}
h2 {
margin: 0 0 16px 0;
font-size: 1.3em;
color: #333;
}
.timer-circle {
position: relative;
width: 180px;
height: 180px;
margin: 0 auto 16px auto;
}
.timer-label {
position: absolute;
top: 48px;
left: 0;
width: 100%;
text-align: center;
color: #888;
font-size: 1.1em;
}
.timer-time {
position: absolute;
top: 70px;
left: 0;
width: 100%;
text-align: center;
font-size: 2.5em;
font-weight: bold;
color: #222;
}
.buttons {
display: flex;
justify-content: center;
gap: 16px;
margin-bottom: 24px;
}
#start-btn {
background: linear-gradient(90deg, #7b6ef6, #5f5be6);
color: #fff;
border: none;
border-radius: 24px;
padding: 10px 32px;
font-size: 1em;
cursor: pointer;
}
#reset-btn {
background: #fff;
color: #7b6ef6;
border: 2px solid #7b6ef6;
border-radius: 24px;
padding: 10px 32px;
font-size: 1em;
cursor: pointer;
}
.progress {
background: #f5f6fa;
border-radius: 12px;
padding: 16px;
margin-top: 16px;
text-align: center;
}
.progress-row {
display: flex;
justify-content: space-around;
margin-top: 8px;
}
.progress-row div {
font-size: 1.1em;
}
50 changes: 50 additions & 0 deletions static/timer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
let duration = 25 * 60;
let timeLeft = duration;
let timerInterval = null;
let running = false;
let pomodoroCount = 4;
let focusSeconds = 100 * 60; // 1時間40分

function updateTimerDisplay() {
const min = String(Math.floor(timeLeft / 60)).padStart(2, '0');
const sec = String(timeLeft % 60).padStart(2, '0');
document.getElementById('timer').textContent = `${min}:${sec}`;
// 円グラフ進捗
const progress = document.getElementById('progress');
const percent = (duration - timeLeft) / duration;
progress.setAttribute('stroke-dashoffset', 502 * (1 - percent));
}

function startTimer() {
if (running) return;
running = true;
document.getElementById('start-btn').disabled = true;
timerInterval = setInterval(() => {
if (timeLeft > 0) {
timeLeft--;
updateTimerDisplay();
} else {
clearInterval(timerInterval);
running = false;
document.getElementById('start-btn').disabled = false;
pomodoroCount++;
focusSeconds += duration;
document.getElementById('pomodoro-count').textContent = pomodoroCount;
document.getElementById('focus-time').textContent =
`${Math.floor(focusSeconds/60/60)}時間${Math.floor((focusSeconds/60)%60)}分`;
}
}, 1000);
}

function resetTimer() {
clearInterval(timerInterval);
timeLeft = duration;
running = false;
updateTimerDisplay();
document.getElementById('start-btn').disabled = false;
}

document.getElementById('start-btn').onclick = startTimer;
document.getElementById('reset-btn').onclick = resetTimer;

updateTimerDisplay();
38 changes: 38 additions & 0 deletions templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>ポモドーロタイマー</title>
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
</head>
<body>
<div class="container">
<h2>ポモドーロタイマー</h2>
<div class="timer-circle">
<svg width="180" height="180">
<circle cx="90" cy="90" r="80" stroke="#e5e7eb" stroke-width="12" fill="none"/>
<circle id="progress" cx="90" cy="90" r="80" stroke="#7b6ef6" stroke-width="12" fill="none"
stroke-dasharray="502" stroke-dashoffset="0" transform="rotate(-90 90 90)"/>
</svg>
<div class="timer-label" id="timer-label">作業中</div>
<div class="timer-time" id="timer">25:00</div>
</div>
<div class="buttons">
<button id="start-btn">開始</button>
<button id="reset-btn">リセット</button>
</div>
<div class="progress">
<div>今日の進捗</div>
<div class="progress-row">
<div>
<span id="pomodoro-count">4</span><br>完了
</div>
<div>
<span id="focus-time">1時間40分</span><br>集中時間
</div>
</div>
</div>
</div>
<script src="{{ url_for('static', filename='timer.js') }}"></script>
</body>
</html>