Skip to content

Commit b6bfd8a

Browse files
committed
feat(web): credit the author at the top of About
1 parent 862cc94 commit b6bfd8a

20 files changed

Lines changed: 148 additions & 31 deletions

File tree

‎cli/src/coding_study/application/about.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@
33

44
from coding_study.application.ports import InstalledPackages
55
from coding_study.domain.about import (
6+
AUTHOR_LINK,
7+
AUTHOR_NAME,
68
LICENSE_NAME,
79
NOTICE_RULE_WIDTH,
810
PROJECT_LINKS,
911
SPONSOR_LINKS,
1012
TOOLCHAINS,
1113
WEBSITE_LINK,
1214
About,
15+
Author,
1316
Credit,
1417
CreditSection,
1518
web_ui_credits,
@@ -22,6 +25,7 @@
2225

2326
def read_about(version: str, packages: InstalledPackages) -> About:
2427
return About(
28+
author=Author(AUTHOR_NAME, AUTHOR_LINK),
2529
version=version,
2630
license=LICENSE_NAME,
2731
website=WEBSITE_LINK,

‎cli/src/coding_study/domain/about.py‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ class Link:
1515
url: str
1616

1717

18+
AUTHOR_NAME = "Bastian Kuberek"
19+
AUTHOR_LINK = Link(
20+
"bkuberek.com", "https://bkuberek.com/?utm_source=cstudy&utm_medium=app&utm_campaign=about"
21+
)
22+
"""The tags are fixed text: the address carries nothing of the version, the user or the machine."""
1823
WEBSITE_LINK = Link("Website", WEBSITE)
1924
PROJECT_LINKS = (
2025
Link("Source", SOURCE),
@@ -46,8 +51,15 @@ class CreditSection:
4651
credits: tuple[Credit, ...]
4752

4853

54+
@dataclass(frozen=True, slots=True)
55+
class Author:
56+
name: str
57+
link: Link
58+
59+
4960
@dataclass(frozen=True, slots=True)
5061
class About:
62+
author: Author
5163
version: str
5264
license: str
5365
website: Link

‎cli/src/coding_study/entrypoints/commands/about.py‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,18 @@ def about(
4848

4949
def _summary_lines(found: About) -> list[Text]:
5050
return [
51-
Text(f"cstudy {found.version}"),
52-
labelled("license", found.license),
53-
labelled(found.website.label.lower(), found.website.url),
54-
*(labelled(link.label.lower(), link.url) for link in found.links),
51+
Text(found.author.name),
52+
Text(found.author.link.url),
5553
*(
5654
labelled("sponsor" if index == 0 else "", link.url)
5755
for index, link in enumerate(found.sponsor)
5856
),
5957
Text(),
58+
Text(f"cstudy {found.version}"),
59+
labelled("license", found.license),
60+
labelled(found.website.label.lower(), found.website.url),
61+
*(labelled(link.label.lower(), link.url) for link in found.links),
62+
Text(),
6063
labelled("credits", "cstudy about --credits"),
6164
labelled("licenses", "cstudy about --licenses"),
6265
]

‎cli/src/coding_study/entrypoints/web/documents.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ def session_document(environment: Environment, port: int, version: str) -> dict[
5656
def about_document(about: About) -> dict[str, JsonValue]:
5757
"""`GET /api/v1/about`: what `cstudy about` and `cstudy about --credits` print."""
5858
return {
59+
"author": {"name": about.author.name, "link": _link_value(about.author.link)},
5960
"version": about.version,
6061
"license": about.license,
6162
"website": _link_value(about.website),

‎cli/src/coding_study/entrypoints/web/static/app.js‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎cli/src/coding_study/entrypoints/web/static/chunks/about-757BD5PA.js‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎cli/src/coding_study/entrypoints/web/static/chunks/about-CVSSI3KR.js‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

cli/src/coding_study/entrypoints/web/static/chunks/about-WJRIWAJJ.css renamed to cli/src/coding_study/entrypoints/web/static/chunks/about-SWJJR6KJ.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎cli/src/coding_study/entrypoints/web/static/manifest.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
"files": {
44
"THIRD_PARTY_LICENSES.txt": "16e05881b179ed03f4f9a37e41349e8fedc144c6568aa12e4fccc9190e0907b9",
55
"app.css": "3540242ce140a50f17d54c335082320161d5ca0dd1c65d9cee81f3e24f5eedab",
6-
"app.js": "857e4be42c47df0ca6ed86fef22f35f14d6f847396799707897cafc07d25718b",
7-
"chunks/about-CVSSI3KR.js": "d7c769c749377617af01d17ee90f840bfdce6209c1864ed5fed9ce3dc91ff609",
8-
"chunks/about-WJRIWAJJ.css": "629e3086290986c628297ef3355bf11aef20b8ab092fa3775d7e28c2960a496b",
6+
"app.js": "fdfee0048f5462e8b5af795ff0a01528c637c5d39d18a2ac5bd0817890eeec12",
7+
"chunks/about-757BD5PA.js": "f2fcab356cc8f601b03849d6a51ce9a8e12dbdfd57996043683733cfac46155e",
8+
"chunks/about-SWJJR6KJ.css": "75b67c44aa4740dc65323a36dc37500604a682587a85dfe3ed79d7a151eeb1af",
99
"chunks/chunk-4H53P3R3.js": "d5d049301c51a4280b42d38736639040dd25fd389d568351462365783c72cd0d",
1010
"chunks/chunk-4SAJJHEE.js": "509f2753ec699cbfa697968ea8f5af71079761505c931ed6b2ecc16e89fe0e80",
1111
"chunks/chunk-5JJK2J4Y.js": "065fc4b1b2e58dde2295dea0f15e2f3fa63a65d28a488886b766ead757ac8c4f",

‎cli/tests/application/test_about.py‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
from coding_study.application.about import read_about, read_license_texts
1111
from coding_study.domain.about import (
12+
AUTHOR_NAME,
1213
LICENSE_NAME,
1314
SPONSOR_LINKS,
1415
WEBSITE,
@@ -64,6 +65,23 @@ def sections(notice: str | None = NOTICE):
6465
return {section.title: section for section in read_about("1.2.3", FakePackages(notice)).credits}
6566

6667

68+
def test_about_names_the_author():
69+
assert read_about("1.2.3", FakePackages()).author.name == AUTHOR_NAME == "Bastian Kuberek"
70+
71+
72+
def test_the_author_link_reads_bkuberek_com():
73+
assert read_about("1.2.3", FakePackages()).author.link.label == "bkuberek.com"
74+
75+
76+
def test_the_author_link_carries_static_utm_tags_only():
77+
url = read_about("1.2.3", FakePackages()).author.link.url
78+
assert url == "https://bkuberek.com/?utm_source=cstudy&utm_medium=app&utm_campaign=about"
79+
80+
81+
def test_the_author_link_carries_nothing_of_the_version():
82+
assert "1.2.3" not in read_about("1.2.3", FakePackages()).author.link.url
83+
84+
6785
def test_about_names_the_version_it_is_given():
6886
assert read_about("1.2.3", FakePackages()).version == "1.2.3"
6987

@@ -102,7 +120,7 @@ def test_about_offers_the_sponsor_links():
102120

103121
def test_every_link_is_https():
104122
about = read_about("1.2.3", FakePackages())
105-
links = (about.website, *about.links, *about.sponsor)
123+
links = (about.author.link, about.website, *about.links, *about.sponsor)
106124
assert all(link.url.startswith("https://") for link in links)
107125

108126

0 commit comments

Comments
 (0)