File size: 6,279 Bytes
67041f9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a09ca12
 
 
 
 
 
 
 
 
 
 
 
 
 
67041f9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<!DOCTYPE html>
<html lang="ja">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>履歴</title>
    <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
    <style>
        /* サムネイル用のスタイルを追加 (任意) */
        .list-item-thumbnail {
            width: 80px; /* 幅を調整 */
            height: 45px; /* 高さを調整 (16:9) */
            object-fit: cover; /* 画像のアスペクト比を保ちつつコンテナにフィット */
            margin-right: 10px; /* テキストとの間隔 */
            border-radius: 4px; /* 角丸 */
            flex-shrink: 0; /* コンテナが縮んでも画像サイズを維持 */
        }
        .list-item-content {
            display: flex; /* サムネイルとテキストを横並び */
            align-items: center; /* 垂直方向中央揃え */
            flex-grow: 1; /* 利用可能なスペースを埋める */
            overflow: hidden; /* はみ出したタイトルを隠す */
        }
        .list-item-text h3 {
            white-space: nowrap; /* タイトルを1行に */
            overflow: hidden; /* はみ出しを隠す */
            text-overflow: ellipsis; /* はみ出しを...で表示 */
            margin-bottom: 4px; /* 日付との間隔 */
        }
        .list-item-text p {
             font-size: 0.8em; /* 日付のフォントサイズ */
             color: #666;    /* 日付の色 */
             margin: 0;
        }
        .list-item-empty, .list-item-error {
            text-align: center;
            color: #888;
            padding: 20px;
        }
        .list-item-error {
            color: red;
        }
    </style>
</head>
<body>
    <div class="screen">
        <header class="header">
            <button class="menu-btn" aria-label="メニュー" onclick="openMenu()"></button>
            <h1 class="title">履歴</h1>
            <button class="action-btn" aria-label="アクション"></button> <!-- 右上のボタンは不要なら削除 -->
        </header>
        <main>
            <ul class="list" id="history-list">
                {# エラーメッセージがあれば表示 #}
                {% if error_message %}
                    <li class="list-item-error">履歴の取得に失敗しました: {{ error_message }}</li>
                {% endif %}

                {# 履歴アイテムがあればループ処理 #}
                {% if history_items %}
                    {% for item in history_items %}
                    <li class="list-item">
                        {# 各アイテムに学習ページへのリンクを設定 #}
                        <a href="{{ url_for('learning_page', id=item.id) }}" class="list-item-button">
                            <div class="list-item-content">
                                {# サムネイルがあれば表示、なければデフォルトアイコン #}
                                {% if item.thumbnail %}
                                    <img src="{{ item.thumbnail }}" alt="Thumbnail" class="list-item-thumbnail" onerror="this.style.display='none'; this.nextElementSibling.style.display='inline-block';"> {# 画像読み込み失敗時の代替アイコン表示用 #}
                                    <span class="list-item-icon" style="display: none;">📄</span> {# 代替アイコン (最初は非表示) #}
                                {% else %}
                                    {# typeがないのでデフォルトアイコン #}
                                    <span class="list-item-icon">📄</span>
                                {% endif %}
                                <div class="list-item-text">
                                    {# タイトルと日付を表示 #}
                                    <h3>{{ item.title }}</h3>
                                    <p>{{ item.date }}</p>
                                </div>
                            </div>
                            <span class="list-arrow">></span>
                        </a>
                    </li>
                    {% endfor %}
                {# 履歴アイテムがなく、エラーもない場合は「履歴なし」メッセージ #}
                {% elif not error_message %}
                    <li class="list-item-empty">履歴はありません。</li>
                {% endif %}
            </ul>
             <!-- ★★★ ここからサイドメニューとオーバーレイを追加 ★★★ -->
    <div id="menu-overlay" class="menu-overlay" onclick="closeMenu()"></div>
    <nav id="side-menu" class="side-menu" aria-label="サイドメニュー">
        <button class="close-menu-btn" onclick="closeMenu()" aria-label="メニューを閉じる">×</button>
        <h2>メニュー</h2>
        <ul>
            <li><button onclick="goToInput()">➕ 入力</button></li>
            <li><button onclick="goToHistory()">🕒 履歴</button></li>
            <li><button onclick="goToSettings()">⚙️ 設定</button></li>
            <!-- 他に必要なメニュー項目を追加 -->
            <li><hr></li>
            <li><button onclick="handleLogout()" class="logout-menu-item">ログアウト</button></li>
        </ul>
    </nav>
        </main>
        <!-- フッターナビゲーション -->
        <footer class="footer-nav">
            <button onclick="goToInput()" aria-label="入力">
                 <span class="nav-icon"></span>
                 <span class="nav-text">入力</span>
            </button>
            <button onclick="goToHistory()" aria-label="履歴" class="active"> {# 現在のページをアクティブに #}
                 <span class="nav-icon">🕒</span>
                 <span class="nav-text">履歴</span>
            </button>
            <button onclick="goToSettings()" aria-label="設定">
                 <span class="nav-icon">⚙️</span>
                 <span class="nav-text">設定</span>
            </button>
        </footer>
    </div>
    {# script.js はナビゲーション用などに必要なら残す #}
    <script src="{{ url_for('static', filename='script.js') }}"></script>
</body>
</html>