Skip to content

Commit 9796df7

Browse files
committed
feat(web): say who created cstudy on the About view
1 parent fa82185 commit 9796df7

16 files changed

Lines changed: 33 additions & 16 deletions

File tree

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,19 @@ class CreditSection:
5151
credits: tuple[Credit, ...]
5252

5353

54+
CREDIT_PREFIX = "Created by"
55+
56+
5457
@dataclass(frozen=True, slots=True)
5558
class Author:
5659
name: str
5760
link: Link
5861

62+
@property
63+
def credit(self) -> str:
64+
"""The line that credits the author, which the page and the command both print."""
65+
return f"{CREDIT_PREFIX} {self.name}"
66+
5967

6068
@dataclass(frozen=True, slots=True)
6169
class About:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def about(
4848

4949
def _summary_lines(found: About) -> list[Text]:
5050
return [
51-
Text(found.author.name),
51+
Text(found.author.credit),
5252
Text(found.author.link.url),
5353
*(
5454
labelled("sponsor" if index == 0 else "", link.url)

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@ 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)},
59+
"author": {
60+
"name": about.author.name,
61+
"credit": about.author.credit,
62+
"link": _link_value(about.author.link),
63+
},
6064
"version": about.version,
6165
"license": about.license,
6266
"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-3KPC3UIU.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-757BD5PA.js‎

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

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"files": {
44
"THIRD_PARTY_LICENSES.txt": "16e05881b179ed03f4f9a37e41349e8fedc144c6568aa12e4fccc9190e0907b9",
55
"app.css": "3540242ce140a50f17d54c335082320161d5ca0dd1c65d9cee81f3e24f5eedab",
6-
"app.js": "fdfee0048f5462e8b5af795ff0a01528c637c5d39d18a2ac5bd0817890eeec12",
7-
"chunks/about-757BD5PA.js": "f2fcab356cc8f601b03849d6a51ce9a8e12dbdfd57996043683733cfac46155e",
6+
"app.js": "fbd38890b10b66d78ca66c710e195980bd0e4290868cfe86fbef91ded4054b2f",
7+
"chunks/about-3KPC3UIU.js": "e7e859616073a529b484138549af0dd2693ebd0371caea311bec588313fbb4fa",
88
"chunks/about-SWJJR6KJ.css": "75b67c44aa4740dc65323a36dc37500604a682587a85dfe3ed79d7a151eeb1af",
99
"chunks/chunk-4H53P3R3.js": "d5d049301c51a4280b42d38736639040dd25fd389d568351462365783c72cd0d",
1010
"chunks/chunk-4SAJJHEE.js": "509f2753ec699cbfa697968ea8f5af71079761505c931ed6b2ecc16e89fe0e80",

‎cli/tests/application/test_about.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ def test_about_names_the_author():
6969
assert read_about("1.2.3", FakePackages()).author.name == AUTHOR_NAME == "Bastian Kuberek"
7070

7171

72+
def test_the_author_is_credited_as_the_creator():
73+
assert read_about("1.2.3", FakePackages()).author.credit == "Created by Bastian Kuberek"
74+
75+
7276
def test_the_author_link_reads_bkuberek_com():
7377
assert read_about("1.2.3", FakePackages()).author.link.label == "bkuberek.com"
7478

‎cli/tests/entrypoints/commands/test_about.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def test_about_exits_with_success():
2323

2424

2525
def test_about_names_the_author_first():
26-
assert about().stdout.splitlines()[0] == "Bastian Kuberek"
26+
assert about().stdout.splitlines()[0] == "Created by Bastian Kuberek"
2727

2828

2929
def test_about_links_to_the_authors_site_with_its_tags():

‎cli/tests/entrypoints/web/test_about_api.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ def test_about_names_the_author_and_links_to_the_authors_site(app):
5050
author = read(app, ABOUT).json()["author"]
5151
assert author == {
5252
"name": "Bastian Kuberek",
53+
"credit": "Created by Bastian Kuberek",
5354
"link": {"label": "bkuberek.com", "url": AUTHOR_LINK.url},
5455
}
5556

0 commit comments

Comments
 (0)