|
| 1 | +{# Pagination for regular pages #} |
| 2 | +{% macro pagination(current_page, total_pages) %} |
| 3 | +{% if total_pages <= 1 %} |
| 4 | +<div class="pagination"><a href="index.html" class="index-link">Index</a></div> |
| 5 | +{%- else %} |
| 6 | +<div class="pagination"> |
| 7 | +<a href="index.html" class="index-link">Index</a> |
| 8 | +{% if current_page > 1 -%} |
| 9 | +<a href="page-{{ '%03d'|format(current_page - 1) }}.html">← Prev</a> |
| 10 | +{%- else -%} |
| 11 | +<span class="disabled">← Prev</span> |
| 12 | +{%- endif %} |
| 13 | +{% for page in range(1, total_pages + 1) -%} |
| 14 | +{% if page == current_page -%} |
| 15 | +<span class="current">{{ page }}</span> |
| 16 | +{%- else -%} |
| 17 | +<a href="page-{{ '%03d'|format(page) }}.html">{{ page }}</a> |
| 18 | +{%- endif %} |
| 19 | +{% endfor -%} |
| 20 | +{% if current_page < total_pages -%} |
| 21 | +<a href="page-{{ '%03d'|format(current_page + 1) }}.html">Next →</a> |
| 22 | +{%- else -%} |
| 23 | +<span class="disabled">Next →</span> |
| 24 | +{%- endif %} |
| 25 | +</div> |
| 26 | +{%- endif %} |
| 27 | +{% endmacro %} |
| 28 | + |
| 29 | +{# Pagination for index page #} |
| 30 | +{% macro index_pagination(total_pages) %} |
| 31 | +{% if total_pages < 1 %} |
| 32 | +<div class="pagination"><span class="current">Index</span></div> |
| 33 | +{%- else %} |
| 34 | +<div class="pagination"> |
| 35 | +<span class="current">Index</span> |
| 36 | +<span class="disabled">← Prev</span> |
| 37 | +{% for page in range(1, total_pages + 1) -%} |
| 38 | +<a href="page-{{ '%03d'|format(page) }}.html">{{ page }}</a> |
| 39 | +{% endfor -%} |
| 40 | +{% if total_pages >= 1 -%} |
| 41 | +<a href="page-001.html">Next →</a> |
| 42 | +{%- else -%} |
| 43 | +<span class="disabled">Next →</span> |
| 44 | +{%- endif %} |
| 45 | +</div> |
| 46 | +{%- endif %} |
| 47 | +{% endmacro %} |
| 48 | + |
| 49 | +{# Todo list #} |
| 50 | +{% macro todo_list(todos, tool_id) %} |
| 51 | +<div class="todo-list" data-tool-id="{{ tool_id }}"><div class="todo-header"><span class="todo-header-icon">☰</span> Task List</div><ul class="todo-items"> |
| 52 | +{%- for todo in todos -%} |
| 53 | +{%- set status = todo.status|default('pending') -%} |
| 54 | +{%- set content = todo.content|default('') -%} |
| 55 | +{%- if status == 'completed' -%} |
| 56 | +{%- set icon = '✓' -%} |
| 57 | +{%- set status_class = 'todo-completed' -%} |
| 58 | +{%- elif status == 'in_progress' -%} |
| 59 | +{%- set icon = '→' -%} |
| 60 | +{%- set status_class = 'todo-in-progress' -%} |
| 61 | +{%- else -%} |
| 62 | +{%- set icon = '○' -%} |
| 63 | +{%- set status_class = 'todo-pending' -%} |
| 64 | +{%- endif -%} |
| 65 | +<li class="todo-item {{ status_class }}"><span class="todo-icon">{{ icon }}</span><span class="todo-content">{{ content }}</span></li> |
| 66 | +{%- endfor -%} |
| 67 | +</ul></div> |
| 68 | +{%- endmacro %} |
| 69 | + |
| 70 | +{# Write tool #} |
| 71 | +{% macro write_tool(file_path, content, tool_id) %} |
| 72 | +{%- set filename = file_path.split('/')[-1] if '/' in file_path else file_path -%} |
| 73 | +<div class="file-tool write-tool" data-tool-id="{{ tool_id }}"> |
| 74 | +<div class="file-tool-header write-header"><span class="file-tool-icon">📝</span> Write <span class="file-tool-path">{{ filename }}</span></div> |
| 75 | +<div class="file-tool-fullpath">{{ file_path }}</div> |
| 76 | +<div class="truncatable"><div class="truncatable-content"><pre class="file-content">{{ content }}</pre></div><button class="expand-btn">Show more</button></div> |
| 77 | +</div> |
| 78 | +{%- endmacro %} |
| 79 | + |
| 80 | +{# Edit tool #} |
| 81 | +{% macro edit_tool(file_path, old_string, new_string, replace_all, tool_id) %} |
| 82 | +{%- set filename = file_path.split('/')[-1] if '/' in file_path else file_path -%} |
| 83 | +<div class="file-tool edit-tool" data-tool-id="{{ tool_id }}"> |
| 84 | +<div class="file-tool-header edit-header"><span class="file-tool-icon">✏️</span> Edit <span class="file-tool-path">{{ filename }}</span>{% if replace_all %} <span class="edit-replace-all">(replace all)</span>{% endif %}</div> |
| 85 | +<div class="file-tool-fullpath">{{ file_path }}</div> |
| 86 | +<div class="truncatable"><div class="truncatable-content"> |
| 87 | +<div class="edit-section edit-old"><div class="edit-label">−</div><pre class="edit-content">{{ old_string }}</pre></div> |
| 88 | +<div class="edit-section edit-new"><div class="edit-label">+</div><pre class="edit-content">{{ new_string }}</pre></div> |
| 89 | +</div><button class="expand-btn">Show more</button></div> |
| 90 | +</div> |
| 91 | +{%- endmacro %} |
| 92 | + |
| 93 | +{# Bash tool #} |
| 94 | +{% macro bash_tool(command, description, tool_id) %} |
| 95 | +<div class="tool-use bash-tool" data-tool-id="{{ tool_id }}"> |
| 96 | +<div class="tool-header"><span class="tool-icon">$</span> Bash</div> |
| 97 | +{%- if description %} |
| 98 | +<div class="tool-description">{{ description }}</div> |
| 99 | +{%- endif -%} |
| 100 | +<div class="truncatable"><div class="truncatable-content"><pre class="bash-command">{{ command }}</pre></div><button class="expand-btn">Show more</button></div> |
| 101 | +</div> |
| 102 | +{%- endmacro %} |
| 103 | + |
| 104 | +{# Generic tool use - input_json is pre-formatted so needs |safe #} |
| 105 | +{% macro tool_use(tool_name, description, input_json, tool_id) %} |
| 106 | +<div class="tool-use" data-tool-id="{{ tool_id }}"><div class="tool-header"><span class="tool-icon">⚙</span> {{ tool_name }}</div> |
| 107 | +{%- if description -%} |
| 108 | +<div class="tool-description">{{ description }}</div> |
| 109 | +{%- endif -%} |
| 110 | +<div class="truncatable"><div class="truncatable-content"><pre class="json">{{ input_json }}</pre></div><button class="expand-btn">Show more</button></div></div> |
| 111 | +{%- endmacro %} |
| 112 | + |
| 113 | +{# Tool result - content_html is pre-rendered so needs |safe #} |
| 114 | +{% macro tool_result(content_html, is_error) %} |
| 115 | +{%- set error_class = ' tool-error' if is_error else '' -%} |
| 116 | +<div class="tool-result{{ error_class }}"><div class="truncatable"><div class="truncatable-content">{{ content_html|safe }}</div><button class="expand-btn">Show more</button></div></div> |
| 117 | +{%- endmacro %} |
| 118 | + |
| 119 | +{# Thinking block - content_html is pre-rendered markdown so needs |safe #} |
| 120 | +{% macro thinking(content_html) %} |
| 121 | +<div class="thinking"><div class="thinking-label">Thinking</div>{{ content_html|safe }}</div> |
| 122 | +{%- endmacro %} |
| 123 | + |
| 124 | +{# Assistant text - content_html is pre-rendered markdown so needs |safe #} |
| 125 | +{% macro assistant_text(content_html) %} |
| 126 | +<div class="assistant-text">{{ content_html|safe }}</div> |
| 127 | +{%- endmacro %} |
| 128 | + |
| 129 | +{# User content - content_html is pre-rendered so needs |safe #} |
| 130 | +{% macro user_content(content_html) %} |
| 131 | +<div class="user-content">{{ content_html|safe }}</div> |
| 132 | +{%- endmacro %} |
| 133 | + |
| 134 | +{# Commit card (in tool results) #} |
| 135 | +{% macro commit_card(commit_hash, commit_msg, github_repo) %} |
| 136 | +{%- if github_repo -%} |
| 137 | +{%- set github_link = 'https://github.com/' ~ github_repo ~ '/commit/' ~ commit_hash -%} |
| 138 | +<div class="commit-card"><a href="{{ github_link }}"><span class="commit-card-hash">{{ commit_hash[:7] }}</span> {{ commit_msg }}</a></div> |
| 139 | +{%- else -%} |
| 140 | +<div class="commit-card"><span class="commit-card-hash">{{ commit_hash[:7] }}</span> {{ commit_msg }}</div> |
| 141 | +{%- endif %} |
| 142 | +{%- endmacro %} |
| 143 | + |
| 144 | +{# Message wrapper - content_html is pre-rendered so needs |safe #} |
| 145 | +{% macro message(role_class, role_label, msg_id, timestamp, content_html) %} |
| 146 | +<div class="message {{ role_class }}" id="{{ msg_id }}"><div class="message-header"><span class="role-label">{{ role_label }}</span><a href="#{{ msg_id }}" class="timestamp-link"><time datetime="{{ timestamp }}" data-timestamp="{{ timestamp }}">{{ timestamp }}</time></a></div><div class="message-content">{{ content_html|safe }}</div></div> |
| 147 | +{%- endmacro %} |
| 148 | + |
| 149 | +{# Continuation wrapper - content_html is pre-rendered so needs |safe #} |
| 150 | +{% macro continuation(content_html) %} |
| 151 | +<details class="continuation"><summary>Session continuation summary</summary>{{ content_html|safe }}</details> |
| 152 | +{%- endmacro %} |
| 153 | + |
| 154 | +{# Index item (prompt) - rendered_content and stats_html are pre-rendered so need |safe #} |
| 155 | +{% macro index_item(prompt_num, link, timestamp, rendered_content, stats_html) %} |
| 156 | +<div class="index-item"><a href="{{ link }}"><div class="index-item-header"><span class="index-item-number">#{{ prompt_num }}</span><time datetime="{{ timestamp }}" data-timestamp="{{ timestamp }}">{{ timestamp }}</time></div><div class="index-item-content">{{ rendered_content|safe }}</div></a>{{ stats_html|safe }}</div> |
| 157 | +{%- endmacro %} |
| 158 | + |
| 159 | +{# Index commit #} |
| 160 | +{% macro index_commit(commit_hash, commit_msg, timestamp, github_repo) %} |
| 161 | +{%- if github_repo -%} |
| 162 | +{%- set github_link = 'https://github.com/' ~ github_repo ~ '/commit/' ~ commit_hash -%} |
| 163 | +<div class="index-commit"><a href="{{ github_link }}"><div class="index-commit-header"><span class="index-commit-hash">{{ commit_hash[:7] }}</span><time datetime="{{ timestamp }}" data-timestamp="{{ timestamp }}">{{ timestamp }}</time></div><div class="index-commit-msg">{{ commit_msg }}</div></a></div> |
| 164 | +{%- else -%} |
| 165 | +<div class="index-commit"><div class="index-commit-header"><span class="index-commit-hash">{{ commit_hash[:7] }}</span><time datetime="{{ timestamp }}" data-timestamp="{{ timestamp }}">{{ timestamp }}</time></div><div class="index-commit-msg">{{ commit_msg }}</div></div> |
| 166 | +{%- endif %} |
| 167 | +{%- endmacro %} |
| 168 | + |
| 169 | +{# Index stats - tool_stats_str and long_texts_html are pre-rendered so need |safe #} |
| 170 | +{% macro index_stats(tool_stats_str, long_texts_html) %} |
| 171 | +{%- if tool_stats_str or long_texts_html -%} |
| 172 | +<div class="index-item-stats"> |
| 173 | +{%- if tool_stats_str -%}<span>{{ tool_stats_str }}</span>{%- endif -%} |
| 174 | +{{ long_texts_html|safe }} |
| 175 | +</div> |
| 176 | +{%- endif %} |
| 177 | +{%- endmacro %} |
| 178 | + |
| 179 | +{# Long text in index - rendered_content is pre-rendered markdown so needs |safe #} |
| 180 | +{% macro index_long_text(rendered_content) %} |
| 181 | +<div class="index-item-long-text"><div class="truncatable"><div class="truncatable-content"><div class="index-item-long-text-content">{{ rendered_content|safe }}</div></div><button class="expand-btn">Show more</button></div></div> |
| 182 | +{%- endmacro %} |
0 commit comments