新增歷史戰績關閉按鈕並更新 README

This commit is contained in:
2026-04-16 15:23:09 +08:00
parent f50b11600e
commit af7ebda9f4
3 changed files with 55 additions and 9 deletions

View File

@@ -22,6 +22,7 @@
- 歷史戰績頁 - 歷史戰績頁
- 直接從資料庫 `history` 表讀取列表 - 直接從資料庫 `history` 表讀取列表
- 點擊任一筆可開啟得分紀錄彈窗 - 點擊任一筆可開啟得分紀錄彈窗
- 彈窗右上角提供 `X` 關閉按鈕,手機更容易操作
- 每筆資料可單獨刪除 - 每筆資料可單獨刪除
## 本機開發 ## 本機開發

View File

@@ -1212,6 +1212,7 @@
} }
.history-modal { .history-modal {
position: relative;
width: min(680px, 100%); width: min(680px, 100%);
display: grid; display: grid;
gap: 16px; gap: 16px;
@@ -1223,6 +1224,41 @@
inset 0 0 0 2px rgba(200, 140, 46, 0.45); inset 0 0 0 2px rgba(200, 140, 46, 0.45);
} }
.history-modal-close {
position: absolute;
top: 10px;
right: 10px;
width: 44px;
height: 44px;
border: 0;
border-radius: 999px;
cursor: pointer;
font: inherit;
font-size: 1.6rem;
line-height: 1;
color: #b34e3a;
background: linear-gradient(180deg, #ffe5bf, #f0bd7c);
box-shadow:
inset 0 0 0 1px rgba(199, 125, 63, 0.34),
0 10px 18px rgba(8, 47, 73, 0.16);
transition:
transform 0.16s ease,
box-shadow 0.16s ease,
filter 0.16s ease;
}
.history-modal-close:hover {
transform: translateY(-1px);
box-shadow:
inset 0 0 0 1px rgba(199, 125, 63, 0.42),
0 14px 22px rgba(8, 47, 73, 0.2);
}
.history-modal-close:active {
transform: translateY(0);
filter: brightness(0.98);
}
.history-modal-score { .history-modal-score {
display: grid; display: grid;
grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);

View File

@@ -46,7 +46,7 @@ export function HistoryPage() {
const handleDelete = async (item: HistoryListItem) => { const handleDelete = async (item: HistoryListItem) => {
const confirmed = window.confirm( const confirmed = window.confirm(
`確定要刪除筆戰績嗎?\n${item.leftTeamName} vs ${item.rightTeamName}`, `確定要刪除筆戰績嗎?\n${item.leftTeamName} vs ${item.rightTeamName}`,
) )
if (!confirmed) { if (!confirmed) {
@@ -74,7 +74,7 @@ export function HistoryPage() {
<p className="panel-kicker">History</p> <p className="panel-kicker">History</p>
<h2></h2> <h2></h2>
<p className="panel-copy"> <p className="panel-copy">
`history` `history`
</p> </p>
</article> </article>
@@ -82,7 +82,7 @@ export function HistoryPage() {
{loading ? ( {loading ? (
<div className="empty-state"> <div className="empty-state">
<h3></h3> <h3></h3>
<p></p> <p></p>
</div> </div>
) : error ? ( ) : error ? (
<div className="empty-state"> <div className="empty-state">
@@ -91,8 +91,8 @@ export function HistoryPage() {
</div> </div>
) : history.length === 0 ? ( ) : history.length === 0 ? (
<div className="empty-state"> <div className="empty-state">
<h3></h3> <h3></h3>
<p> `history` </p> <p> `history` </p>
</div> </div>
) : ( ) : (
<div className="history-list"> <div className="history-list">
@@ -112,7 +112,7 @@ export function HistoryPage() {
{item.leftTeamName} vs {item.rightTeamName} {item.leftTeamName} vs {item.rightTeamName}
</h3> </h3>
</div> </div>
<span className="winner-badge">{item.winnerTeamName}</span> <span className="winner-badge">{item.winnerTeamName}</span>
</div> </div>
<div className="history-meta"> <div className="history-meta">
@@ -120,7 +120,7 @@ export function HistoryPage() {
{item.score[0]} - {item.score[1]} {item.score[0]} - {item.score[1]}
</span> </span>
<span>{item.typeLabel}</span> <span>{item.typeLabel}</span>
<span>{item.winScore}</span> <span>{item.winScore}</span>
</div> </div>
</button> </button>
@@ -160,6 +160,15 @@ function HistoryReplayModal({ item, onClose }: HistoryReplayModalProps) {
role="dialog" role="dialog"
onClick={(event) => event.stopPropagation()} onClick={(event) => event.stopPropagation()}
> >
<button
aria-label="關閉戰績紀錄"
className="history-modal-close"
type="button"
onClick={onClose}
>
×
</button>
<p className="panel-kicker"></p> <p className="panel-kicker"></p>
<h3> <h3>
{item.leftTeamName} vs {item.rightTeamName} {item.leftTeamName} vs {item.rightTeamName}
@@ -180,12 +189,12 @@ function HistoryReplayModal({ item, onClose }: HistoryReplayModalProps) {
<div className="history-modal-summary"> <div className="history-modal-summary">
<span>{item.playedAt}</span> <span>{item.playedAt}</span>
<span>{item.typeLabel}</span> <span>{item.typeLabel}</span>
<span>{item.winnerTeamName}</span> <span>{item.winnerTeamName}</span>
</div> </div>
<div className="history-replay-list"> <div className="history-replay-list">
{item.scoreList.length === 0 ? ( {item.scoreList.length === 0 ? (
<p className="history-replay-empty"></p> <p className="history-replay-empty"></p>
) : ( ) : (
item.scoreList.map(([round, starter, winCount, winner]) => ( item.scoreList.map(([round, starter, winCount, winner]) => (
<div className="history-replay-row" key={`${item.id}-${round}`}> <div className="history-replay-row" key={`${item.id}-${round}`}>