|
13 | 13 | from potodo.potodo import scan_path |
14 | 14 | from jinja2 import Template |
15 | 15 |
|
16 | | -completion_progress = [] |
| 16 | +#completion_progress = [] |
17 | 17 | generation_time = datetime.now(timezone.utc) |
18 | 18 |
|
19 | 19 | with TemporaryDirectory() as tmpdir: |
|
39 | 39 | template = Template(""" |
40 | 40 | <html lang="en"> |
41 | 41 | <head> |
42 | | -<title>Python Docs Translation Dashboard</title> |
43 | | -<link rel="stylesheet" href="style.css"> |
| 42 | + <!-- Load Material Symbols font for both dark_mode and light_mode icons --> |
| 43 | + <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,[email protected],100..700,0..1,-50..200&icon_names=dark_mode,light_mode" /> |
| 44 | + <link rel="stylesheet" href="style.css"> |
| 45 | + <title>Python Docs Translation Dashboard</title> |
| 46 | +
|
| 47 | + <script> |
| 48 | + // Function to toggle between dark and light mode |
| 49 | + function toggleMode() { |
| 50 | + let element = document.body; |
| 51 | + let currentMode = element.className.includes('dark-mode') ? 'dark' : 'light'; |
| 52 | + let newMode = currentMode === 'dark' ? 'light' : 'dark'; |
| 53 | + element.className = newMode + '-mode'; |
| 54 | + updateIcon(newMode); // Update the icon when the mode changes |
| 55 | + } |
| 56 | +
|
| 57 | + // Function to update the icon class based on the current mode |
| 58 | + function updateIcon(mode) { |
| 59 | + const icon = document.getElementById('mode-icon'); |
| 60 | + if (mode === 'dark') { |
| 61 | + icon.textContent = 'light_mode'; // Set icon to light_mode |
| 62 | + } else { |
| 63 | + icon.textContent = 'dark_mode'; // Set icon to dark_mode |
| 64 | + } |
| 65 | + } |
| 66 | + </script> |
| 67 | + |
44 | 68 | </head> |
45 | 69 | <body> |
46 | | -<h1>Python Docs Translation Dashboard</h1> |
47 | | -<table> |
48 | | -<thead> |
49 | | -<tr><th>language</th><th>branch</th><th>completion</th></tr> |
50 | | -</thead> |
51 | | -<tbody> |
52 | | -{% for language, completion, branch in completion_progress | sort(attribute=1) | reverse %} |
53 | | -<tr> |
54 | | - <td data-label="language"> |
55 | | - <a href="https://github.com/python/python-docs-{{ language }}" target="_blank"> |
56 | | - {{ language }} |
57 | | - </a> |
58 | | - </td> |
59 | | - <td data-label="branch">{{ branch }}</td> |
60 | | - <td data-label="completion"> |
61 | | - <div class="progress-bar" style="width: {{ completion | round(2) }}%;">{{ completion | round(2) }}%</div> |
62 | | - </td> |
63 | | -</tr> |
64 | | -{% endfor %} |
65 | | -</tbody> |
66 | | -</table> |
67 | | -<p>Last updated at {{ generation_time.strftime('%A, %d %B %Y, %X %Z') }}.</p> |
| 70 | +
|
| 71 | + <h1>Python Docs Translation Dashboard</h1> |
| 72 | + |
| 73 | + <!-- Mode toggle button with an icon --> |
| 74 | + <button class="mode-toggle" onclick="toggleMode()"> |
| 75 | + <span id="mode-icon" class="material-symbols-outlined">dark_mode</span> |
| 76 | + </button> |
| 77 | + |
| 78 | + <!-- Table for displaying the data --> |
| 79 | + <table> |
| 80 | + <thead> |
| 81 | + <tr><th>Language</th><th>Branch</th><th>Completion %</th></tr> |
| 82 | + </thead> |
| 83 | + <tbody> |
| 84 | + {% for language, completion, branch in completion_progress | sort(attribute=1) | reverse %} |
| 85 | + <tr> |
| 86 | + <td data-label="language"> |
| 87 | + <a href="https://github.com/python/python-docs-{{ language }}" target="_blank"> |
| 88 | + {{ language }} |
| 89 | + </a> |
| 90 | + </td> |
| 91 | + <td data-label="branch">{{ branch }}</td> |
| 92 | + <td data-label="completion"> |
| 93 | + <div class="progress-bar" style="width: {{ completion | round(2) }}%;">{{ completion | round(2) }}%</div> |
| 94 | + </td> |
| 95 | + </tr> |
| 96 | + {% endfor %} |
| 97 | + </tbody> |
| 98 | + </table> |
| 99 | +
|
| 100 | + <p>Last updated at {{ generation_time.strftime('%A, %d %B %Y, %X %Z') }}.</p> |
68 | 101 | </body> |
69 | 102 | </html> |
70 | 103 | """) |
|
0 commit comments