Skip to content

Commit ef97906

Browse files
init
1 parent 9239962 commit ef97906

File tree

6 files changed

+132
-84
lines changed

6 files changed

+132
-84
lines changed

.github/workflows/update.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- run: sudo apt-get install -y gettext
2222
- run: pip install -r requirements.txt
2323
- run: uv run generate.py # generates index.html and index.json
24-
- run: mkdir -p build && cp index.* style.css build
24+
# - run: mkdir -p build && cp index.* style.css build
2525
- name: Deploy 🚀
2626
if: github.event_name != 'pull_request'
2727
uses: JamesIves/github-pages-deploy-action@v4

generate.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,16 +93,17 @@ class LanguageProjectData:
9393
if __name__ == '__main__':
9494
logging.basicConfig(level=logging.INFO)
9595
logging.info(f'starting at {generation_time}')
96-
template = Template(Path('template.html.jinja').read_text())
97-
96+
Path('build').mkdir(parents=True, exist_ok=True)
97+
template = Template(Path('index.html.jinja').read_text())
9898
output = template.render(
9999
completion_progress=(completion_progress := list(get_completion_progress())),
100100
generation_time=generation_time,
101101
duration=(datetime.now(timezone.utc) - generation_time).seconds,
102102
counts=get_counts(Path('clones', 'cpython', 'Doc', 'build', 'gettext')),
103103
)
104-
105-
Path('index.html').write_text(output)
106-
Path('index.json').write_text(
104+
Path('build/style.css').write_bytes(Path('style.css').read_bytes())
105+
Path('build/logo.png').write_bytes(Path('logo.png').read_bytes())
106+
Path('build/index.html').write_text(output)
107+
Path('build/index.json').write_text(
107108
json.dumps(completion_progress, indent=2, default=asdict)
108109
)

generate_metadata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,4 @@ def get_language_repo_and_completion(
7171
duration=(datetime.now(timezone.utc) - generation_time).seconds,
7272
)
7373

74-
Path('metadata.html').write_text(output)
74+
Path('build/metadata.html').write_text(output)

index.html.jinja

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<!doctype html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
7+
<meta name="description" content="">
8+
<meta name="author" content="">
9+
10+
<title>Python Docs Translation Dashboard</title>
11+
12+
<!-- Bootstrap core CSS -->
13+
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet">
14+
15+
<link href="/style.css" rel="stylesheet">
16+
</head>
17+
18+
<body>
19+
<header>
20+
<nav class="navbar navbar-expand-md fixed-top">
21+
<div class="navbar-brand">
22+
<img src="/logo.png" style="height: 2rem;" alt="Translation dashboard">
23+
<span style="font-size: 1.25rem; font-weight: bold;">Docs Translation Dashboard</span>
24+
</div>
25+
26+
<div class="collapse navbar-collapse" id="navbarNavDropdown">
27+
<ul class="navbar-nav mr-auto">
28+
<li class="nav-item">
29+
<a class="nav-link" href="https://devguide.python.org/">Translating</a>
30+
<a class="nav-link" href="/metadata.html">Meta</a>
31+
</li>
32+
</ul>
33+
</div>
34+
</nav>
35+
</header>
36+
37+
<main role="main">
38+
<div class="row">
39+
<div class="card-container">
40+
<div class="card-columns">
41+
{% for project in completion_progress | sort(attribute='completion,translators.number') | reverse %}
42+
<a href="/{{ project.language.code }}" class="card mb-3">
43+
<div class="card-body">
44+
<h5 class="card-title">{{ project.language.name }} ({{ project.language.code }})</h5>
45+
46+
<h6 class="card-subtitle mb-2 text-muted">Completion: {{ '{:.2f}%'.format(project.completion) }}</h6>
47+
<h6 class="card-subtitle mb-2 text-muted">Translators: {{ project.translators.number }}</h6>
48+
</div>
49+
</a>
50+
{% endfor %}
51+
</div>
52+
</div>
53+
</div>
54+
55+
<!-- FOOTER -->
56+
<footer class="container">
57+
</footer>
58+
</main>
59+
</body>
60+
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
61+
</html>

logo.png

12.9 KB
Loading

style.css

Lines changed: 63 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,80 @@
1+
/* GLOBAL STYLES
2+
-------------------------------------------------- */
3+
/* Padding below the footer and lighter body text */
4+
15
body {
2-
font-family: -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif;
3-
}
4-
table {
5-
border-collapse: collapse;
6+
padding-top: 4.5rem;
7+
padding-left: .5rem;
8+
padding-right: .5rem;
9+
padding-bottom: 3rem;
10+
color: #5a5a5a;
11+
background-color: rgb(245, 245, 245);
12+
overflow-x: hidden; /* Risky, this need testing but I find scroll bar annoying */
613
}
7-
th, td {
8-
border: 1px solid #ddd;
9-
padding: 8px 12px;
10-
text-align: left;
11-
white-space: nowrap;
14+
15+
a {
16+
color: #0d0d0d;
1217
}
13-
th {
14-
background-color: #f4f4f4;
18+
19+
a:hover {
20+
color: #fe6615;
1521
}
16-
hr {
17-
color: #f4f4f4;
22+
23+
/* NAVAR
24+
* ----------------------------------------*/
25+
26+
.navbar {
27+
background-color: rgb(245, 245, 245);
28+
border-bottom: 0.25px solid #999;
1829
}
19-
.progress-bar {
20-
display: inline-block;
21-
color: white;
22-
height: 20px;
23-
line-height: 20px;
30+
31+
.navbar li {
32+
transition: 0.3s background-color;
2433
text-align: center;
25-
overflow: hidden;
26-
white-space: nowrap;
27-
box-sizing: border-box;
34+
background-color: transparent;
35+
padding: 0rem 1rem;
36+
text-decoration: none;
37+
border-radius: 0.3rem;
2838
}
29-
.progress-bar-outer-label {
30-
display: none;
31-
padding-left: .5em;
32-
height: 20px;
33-
line-height: 20px;
34-
overflow: hidden;
39+
40+
.navbar li:hover {
41+
background-color: #d0cccd;
3542
}
36-
.progress-bar.low {
37-
color: transparent;
38-
user-select: none;
43+
44+
.navbar li .nav-link {
45+
color: #0d0d0d;
3946
}
40-
.progress-bar.low + .progress-bar-outer-label {
41-
display: inline-block;
47+
48+
/* Cards and card columns
49+
----------------------------- */
50+
51+
.card-container {
52+
margin: 0 50px;
4253
}
43-
td[data-label="translators"], td[data-label="warnings"], td[data-label="lint"] {
44-
text-align: right;
54+
55+
.card-columns {
56+
flex-wrap: wrap;
4557
}
46-
td[data-label="completion"] {
47-
width: 100%;
48-
line-height: 0;
58+
59+
.card:hover {
60+
background: linear-gradient(90deg, #cc9add 8.06%, #ebad98 106.93%);
61+
text-decoration: none;
62+
transform: scale(1.05);
63+
transition: all 0.3s ease-in-out;
4964
}
50-
.switchpages{
51-
position: absolute;
52-
top: 10px;
53-
right: 10px;
54-
}
5565

56-
@media screen and (max-width: 675px) {
57-
.switchpages{
58-
all: unset;
59-
}
66+
.card:hover .card-title,
67+
.card:hover .card-subtitle,
68+
.card:hover .card-text {
69+
color: white;
6070
}
6171

62-
@media screen and (max-width: 600px) {
63-
table, thead, tbody, th, td, tr {
64-
display: block;
65-
}
66-
th {
67-
position: absolute;
68-
top: -9999px;
69-
left: -9999px;
70-
}
71-
tr {
72-
border: 1px solid #ccc;
73-
margin-bottom: 5px;
74-
}
75-
td {
76-
border: none;
77-
border-bottom: 1px solid #eee;
78-
padding-left: 50%;
79-
position: relative;
80-
}
81-
td:before {
82-
content: attr(data-label);
83-
font-weight: bold;
84-
left: 10px;
85-
position: absolute;
86-
}
87-
td[data-label="completion"] {
88-
width: inherit;
89-
}
90-
.progress-bar {
91-
min-width: 0;
92-
width: 100% !important;
72+
.card:hover .card-link {
73+
color: rgb(231, 231, 231);
74+
}
75+
76+
@media (min-width: 768px) {
77+
.card {
78+
flex-basis: calc(33.33% - 30px);
9379
}
9480
}

0 commit comments

Comments
 (0)