diff --git a/sass/_extra.scss b/sass/_extra.scss index c79c2d62..81fee603 100644 --- a/sass/_extra.scss +++ b/sass/_extra.scss @@ -45,6 +45,11 @@ height: 256px; } +.ui.cards > .card > .content > .header:not(.ui), .ui.card > .content > .header:not(.ui) { + display: inline-block; + margin-bottom: 0; +} + .ui.card > .image > img, .ui.cards > .card > .image > img { object-fit: cover; width: 100%; @@ -57,6 +62,22 @@ margin-right: 0.5em; } +ul.ui.horizontal.list { + margin: 0; +} + +ul.ui.list li::before { + content: none; +} + +.ui.label > .icon { + margin-right: 0.25em; +} + +.ui.label > .detail { + margin-left: 0.5em; +} + @media only screen and (max-width: 991px) { .masthead .ui.menu a.item { display: none; diff --git a/sass/_semantic.scss b/sass/_semantic.scss index 64094c55..a8a7134f 100644 --- a/sass/_semantic.scss +++ b/sass/_semantic.scss @@ -8,7 +8,7 @@ @import 'semantic/icon'; @import 'semantic/image'; // @import 'semantic/input'; -// @import 'semantic/label'; +@import 'semantic/label'; @import 'semantic/list'; //@import 'semantic/loader'; //@import 'semantic/placeholder'; diff --git a/sass/semantic/_label.scss b/sass/semantic/_label.scss index 02183579..72107d7c 100755 --- a/sass/semantic/_label.scss +++ b/sass/semantic/_label.scss @@ -351,7 +351,7 @@ a.ui.label { } .ui.card .image > .ui.ribbon.label, .ui.image > .ui.ribbon.label { - left: calc(--0.05rem - 1.2em); + left: calc(-0.05rem - 1.2em); } .ui.card .image > .ui[class*="right ribbon"].label, .ui.image > .ui[class*="right ribbon"].label { diff --git a/templates/categories/macros.html b/templates/categories/macros.html index c0d705b9..cb6ca57f 100644 --- a/templates/categories/macros.html +++ b/templates/categories/macros.html @@ -1,31 +1,39 @@ {% macro info(item, section, archived=false) %} +{% set github_token = get_env(name="GITHUB_TOKEN") %} + {% if item.name %} {% set name = item.name %} {% endif %} -{% if item.source %} - {% if item.source == 'crates' %} - {% set data = load_data(url = "https://crates.io/api/v1/crates/" ~ item.name ~ "?include=", format="json", headers=["User-Agent=arewegameyet (gamedev-wg@rust-lang.org)"]) %} - {# human readable name #} - {% set name = data.crate.name %} - {# Github/Gitlab/Etc. repository #} - {% set repository_url = data.crate.repository %} - {% set crate_url = 'https://crates.io/crates/' ~ name %} - {% set description = data.crate.description %} - {% if data.crate.homepage %} - {% set homepage_url = data.crate.homepage %} - {% endif %} - {% elif item.source == 'github' %} - {% set data = load_data(url="https://api.github.com/repos/" ~ item.name, format="json") %} - {% set name = data.name %} - {% set repository_url = data.html_url %} - {# Org or User name #} - {% set owner = data.owner.login %} - {% if data.homepage != "" %} - {% set homepage_url = data.homepage %} - {% endif %} - {% set description = data.description %} +{% if item.source and item.source == 'crates' %} + {% set data = load_data(url = "https://crates.io/api/v1/crates/" ~ item.name ~ "?include=downloads,default_version", format="json", headers=["User-Agent=arewegameyet (gamedev-wg@rust-lang.org)"]) %} + + {% set name = data.crate.name %} + {% set description = data.crate.description %} + {% set repository_url = data.crate.repository %} + {% set crate_url = 'https://crates.io/crates/' ~ name %} + {% set latest_version = data.crate.default_version %} + {% set downloads = data.crate.downloads %} + {% set recent_downloads = data.crate.recent_downloads %} + {% set license = data.versions | first | get(key="license") %} + + {% if data.crate.homepage %} + {% set homepage_url = data.crate.homepage %} + {% endif %} +{% elif item.source and item.source == 'github' %} + {% set data = load_data(url="https://api.github.com/repos/" ~ item.name, headers=["Authorization=Bearer " ~ github_token], format="json") %} + + {% set name = data.name %} + {% set description = data.description %} + {% set repository_url = data.html_url %} + + {% if data.license and data.license.key != "other" %} + {% set license = data.license.name %} + {% endif %} + + {% if data.homepage %} + {% set homepage_url = data.homepage %} {% endif %} {% endif %} @@ -45,6 +53,35 @@ {% set primary_url = repository_url %} {% endif %} +{# Fetch repository stats #} +{% if repository_url and repository_url is containing("github.com/") %} + {% set repo_icon = "github" %} + {% set repo_id = repository_url | split(pat="github.com/") | last | trim_end_matches(pat="/") | trim_end_matches(pat=".git") %} + + {% set data = load_data(url="https://api.github.com/repos/" ~ repo_id, headers=["Authorization=Bearer " ~ github_token], format="json", required=false) %} + {% if data %} + {% set stars = data.stargazers_count %} + {% set last_activity = data.pushed_at %} + {% endif %} +{% elif repository_url and repository_url is containing("gitlab.com/") %} + {% set repo_icon = "gitlab" %} + {% set repo_id = repository_url | split(pat="gitlab.com/") | last | trim_end_matches(pat="/") | trim_end_matches(pat=".git") | urlencode_strict %} + + {% set data = load_data(url="https://gitlab.com/api/v4/projects/" ~ repo_id, format="json", required=false) %} + {% if data %} + {% set stars = data.star_count %} + {% set last_activity = data.last_activity_at %} + {% endif %} +{% elif repository_url and repository_url is containing("gitea.com/") %} + {% set repo_id = repository_url | split(pat="gitea.com/") | last | trim_end_matches(pat="/") | trim_end_matches(pat=".git") %} + + {% set data = load_data(url="https://gitea.com/api/v1/repos/" ~ repo_id, format="json", required=false) %} + {% if data %} + {% set stars = data.stars_count %} + {% set last_activity = data.updated_at %} + {% endif %} +{% endif %} +
  • {% if item.image %} {% if primary_url %} @@ -61,35 +98,35 @@ {% endif %}
    - - +

    + {% if primary_url %} + {{ name }} + {% else %} + {{ name }} + {% endif %} +

    + + + {% if repository_url %} - - + + {% endif %} {% if crate_url %} - - + + {% endif %} {% if homepage_url %} - - + + {% endif %} - -
    - {% if primary_url %} - {{ name }} - {% else %} - {{ name }} - {% endif %} -
    {% for category in item.categories %} @@ -105,66 +142,86 @@
    - {% if item.source or gitter_url %} + {% if item.source or repository_url or gitter_url %}
    - -
    - {% if item.source and item.source == 'crates' %} -
    +
    -
  • + {% endif %} + {% if latest_version %} +
  • - - Download count for {{ name }} - +
    + + Latest version: +
    {{ latest_version }}
    +
    - -
  • + {% endif %} + {% if downloads %} +
  • - - Recent download count for {{ name }} - +
    + + Downloads: +
    {{ downloads | num_format }}
    +
    - -
  • + {% endif %} + {% if recent_downloads %} +
  • - - License for {{ name }} - +
    + + Recent downloads: +
    {{ recent_downloads | num_format }}
    +
    - +
  • {% endif %} - {% if item.source and item.source == 'github' %} - - + {% endif %} - {% if gitter_url %} -
    + {% if last_activity %} +
  • - - - +
    + + Last activity: +
    {{ last_activity | date }}
    +
    -
  • + {% endif %} - + {% endif %} diff --git a/templates/categories/page.html b/templates/categories/page.html index 45fa93ee..2f1b8b47 100644 --- a/templates/categories/page.html +++ b/templates/categories/page.html @@ -23,7 +23,7 @@ {# Heading #}

    - + {{ page.title }}

    @@ -51,7 +51,7 @@

    - + {{ section.extra.plural | title }}

    @@ -71,7 +71,7 @@

    - + Archived

    @@ -79,7 +79,7 @@

    - + These {{ section.extra.plural }} are no longer maintained, but may still be of interest.
    @@ -96,7 +96,7 @@

    - + Contribute

    diff --git a/templates/master.html b/templates/master.html index 479fac55..38cf4512 100644 --- a/templates/master.html +++ b/templates/master.html @@ -106,7 +106,13 @@

    About

    Arewegameyet?

    -

    Creative Commons License
    This work is licensed under a Creative Commons Attribution 4.0 International License.

    +

    + Creative Commons License +
    + This work is licensed under a Creative Commons Attribution 4.0 International License. +
    + Page generated at {{ now() | date(format="%Y-%m-%d %H:%M") }}. +

    Get involved