This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking-website.git


The following commit(s) were added to refs/heads/master by this push:
     new 7da5e4a897c feat: Search contributor information (#673)
7da5e4a897c is described below

commit 7da5e4a897c97d88a5bee4ed26e896f851e152df
Author: Juntao Zhang <[email protected]>
AuthorDate: Sat Jan 20 17:55:13 2024 +0800

    feat: Search contributor information (#673)
---
 assets/scss/_custom_contributors.scss              | 149 +++++++++++++++++++++
 assets/scss/_custom_team.scss                      |  26 ++++
 content/contributors/_index.md                     |   9 ++
 layouts/shortcodes/contributors-search.html        |  59 ++++++++
 layouts/shortcodes/contributors.html               |  14 +-
 themes/docsy/assets/scss/_custom_contributors.scss |   0
 themes/docsy/assets/scss/_styles_project.scss      |   1 +
 themes/docsy/layouts/contributors/baseof.html      |  25 ++++
 themes/docsy/layouts/contributors/list.html        |  11 ++
 themes/docsy/layouts/partials/script-search.html   |  23 ++++
 themes/docsy/layouts/partials/script-team.html     |  13 +-
 11 files changed, 325 insertions(+), 5 deletions(-)

diff --git a/assets/scss/_custom_contributors.scss 
b/assets/scss/_custom_contributors.scss
new file mode 100644
index 00000000000..08ad5a2ef13
--- /dev/null
+++ b/assets/scss/_custom_contributors.scss
@@ -0,0 +1,149 @@
+.td-contributors {
+  .page-title {
+    margin-bottom: 0.5em;
+  }
+  .head-wrapper {
+    display: flex;
+    line-height: 40px;
+    font-size: 15px;
+    font-weight: bold;
+    background-color: #f6f8fa;
+    padding: 0 0.4em;
+    position: sticky;
+
+    .title {
+      flex: 1;
+      padding: 0.6em;
+
+      &:nth-child(1) {
+        flex: 1.8;
+      }
+    }
+  }
+
+  .contributors-wrapper {
+    font-size: 14px;
+    display: flex;
+    flex-direction: column;
+
+    .item-wrapper {
+      min-height: 55px;
+      flex-wrap: wrap;
+      padding: 0 0.4em;
+      display: none;
+
+      &.show {
+        display: flex;
+
+        &:nth-child(even) {
+          background-color: #f6f8fa;
+        }
+      }
+
+      .item {
+        flex: 1;
+        padding: 0 0.6em;
+        display: flex;
+        align-items: center;
+
+        &:nth-child(1) {
+          flex: 0.9;
+        }
+
+        .total {
+          font-size: 16px;
+        }
+
+        .item-text {
+          display: flex;
+          align-items: center;
+
+          img {
+            margin-right: 0.3rem;
+          }
+        }
+      }
+    }
+
+    .item-contributors {
+      flex: 1;
+
+      .d-flex {
+        align-items: center;
+        .dn {
+          display: none!important;
+        }
+        > div {
+          line-height: 55px;
+          padding: 0 0.6em;
+          display: none;
+          width: 50%;
+        }
+      }
+
+      ul, li {
+        margin: 0;
+        padding: 0;
+      }
+
+      li {
+        position: relative;
+        border: 1px solid #eaecef;
+        border-radius: 4px;
+        padding: 4px 7px;
+        box-shadow: #f8f9fa 0px 1px 2px 0px;
+
+        a {
+          color: #2c3e50;
+        }
+
+        .contributions-count {
+          color: #999;
+        }
+
+        &.active {
+          color: #1e80ff;
+          background: linear-gradient(180deg, #479EEB 0%, #3788D0 100%);
+          box-shadow: 0px 2px 6px #ABD1F2;
+
+          .contributions-count {
+            color: #666;
+          }
+        }
+
+      }
+    }
+
+  }
+
+  .search-tips {
+    text-align: center;
+    padding: 3em;
+    font-size: 16px;
+    color: #999;
+  }
+
+  @media (max-width: 992px) {
+    .contributors-wrapper {
+      .head-wrapper {
+        .title {
+          &:nth-child(1) {
+            flex: 3.8;
+          }
+        }
+      }
+      img {
+        display: none;
+      }
+
+      .item-contributors {
+        .item {
+          &:nth-child(1) {
+            flex: 1.8;
+          }
+        }
+      }
+    }
+  }
+}
+
diff --git a/assets/scss/_custom_team.scss b/assets/scss/_custom_team.scss
index c93d72f1aac..afa35f1c779 100644
--- a/assets/scss/_custom_team.scss
+++ b/assets/scss/_custom_team.scss
@@ -87,6 +87,32 @@
     }
   }
 
+  .team-input-group {
+    width: 300px;
+    padding-bottom: 1em;
+    .form-control {
+      border: solid 1px #dfdfdf;
+      border-radius: 3px;
+      &:focus-visible {
+        outline: none;
+        box-shadow: none;
+      }
+    }
+    .btn-outline-success {
+      border: solid 1px #dfdfdf;
+      color: #2c3e50;
+      &:focus,
+      &:active,
+      &:hover {
+        z-index: 9;
+        background-color: #3788d0d6;
+        border-color: #3788d0d6;
+        color: #fff;
+        box-shadow: none!important;
+      }
+    }
+  }
+
   .contributors-wrapper {
     .item-wrapper {
       display: flex;
diff --git a/content/contributors/_index.md b/content/contributors/_index.md
new file mode 100644
index 00000000000..0e71972ebc0
--- /dev/null
+++ b/content/contributors/_index.md
@@ -0,0 +1,9 @@
+---
+title: Contributors
+linkTitle: Contributors
+description: About SkyWalking Contributors.
+---
+
+{{< contributors-search >}}
+
+
diff --git a/layouts/shortcodes/contributors-search.html 
b/layouts/shortcodes/contributors-search.html
new file mode 100644
index 00000000000..8d05c514a8c
--- /dev/null
+++ b/layouts/shortcodes/contributors-search.html
@@ -0,0 +1,59 @@
+<div>
+    <h2 class="page-title">
+        Contributor
+        <span class="current-contributor"></span>
+    </h2>
+
+    <div class="head-wrapper">
+        <div class="title">Project</div>
+        <div class="title">Contributions</div>
+        <div class="title">Ranking</div>
+    </div>
+    <div class="contributors-wrapper">
+        {{range .Site.Data.team.projects}}
+        {{range $index, $element := .list}}
+        {{$name := .name }}
+        {{$id := .repo }}
+        {{if .user}}
+        <div class="item-wrapper">
+            <div class="item" data-name="{{.name}}" data-icon="{{.icon}}">
+                <div class="item-text">
+                    {{if .icon}}
+                    <img data-nolightbox="true" width="36" height="36" 
src="/images/project/{{.icon}}.svg" alt="">
+                    {{end}}
+                    <span class="name">
+            {{.name}}
+            </span>
+                </div>
+            </div>
+
+            <div id="{{$id}}" class="item-contributors">
+                <div class="d-flex">
+                    {{range $index, $element := .contributors}}
+                    {{$ranking := add $index 1 }}
+
+                    <span class="{{.login}} dn">
+                        {{if eq .type "Anonymous"}}
+                        <a>
+                              <i class="iconfont icon-github"></i>
+                              {{.login}}
+                        </a>
+                        {{else}}
+                        <a class="link" href="{{.html_url}}" target="_blank">
+                              <i class="iconfont icon-github"></i>
+                              {{.login}}
+                        </a>
+                        {{end}}
+                    </span>
+                    <div class="{{.login}}">{{.contributions}}</div>
+                    <div class="{{.login}}">{{$ranking}}</div>
+                    {{end}}
+                </div>
+            </div>
+        </div>
+        {{end}}
+        {{end}}
+        {{end}}
+    </div>
+    <div class="search-tips">Loading...</div>
+</div>
diff --git a/layouts/shortcodes/contributors.html 
b/layouts/shortcodes/contributors.html
index 4f553d5af63..df4855baa2c 100644
--- a/layouts/shortcodes/contributors.html
+++ b/layouts/shortcodes/contributors.html
@@ -3,6 +3,12 @@
     Contributors
     <span class="total">{{.Site.Data.team.totalCount }}</span>
   </h2>
+  <div class="input-group input-group-sm team-input-group">
+    <input type="text" id="team-contributor-input" class="form-control" 
placeholder="Search GitHub name" aria-label="Search">
+    <div class="input-group-append">
+      <button class="btn btn-outline-success team-contributor-search" 
type="button">Search</button>
+    </div>
+  </div>
   <div class="contributors-wrapper">
     {{ range .Site.Data.team.projects }}
     <div class="item-wrapper">
@@ -34,13 +40,13 @@
           <li class="mb-2 mr-2">
             {{if eq .type "Anonymous"}}
             <a>
-              <i class="fas fa-envelope"></i>
-              {{.login }}
+              <i class="iconfont icon-github"></i>
+              {{.login}}
             </a>
             {{else}}
             <a class="link" href="{{.html_url}}" target="_blank">
-              <i class="fab fa-github"></i>
-              {{.login }}
+              <i class="iconfont icon-github"></i>
+              {{.login}}
             </a>
           </li>
           {{end}}
diff --git a/themes/docsy/assets/scss/_custom_contributors.scss 
b/themes/docsy/assets/scss/_custom_contributors.scss
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/themes/docsy/assets/scss/_styles_project.scss 
b/themes/docsy/assets/scss/_styles_project.scss
index 59c5cc7dfa9..9fd338ed88a 100644
--- a/themes/docsy/assets/scss/_styles_project.scss
+++ b/themes/docsy/assets/scss/_styles_project.scss
@@ -13,6 +13,7 @@ assets/scss/_styles_project.scss
 @import "custom_project_doc.scss";
 @import "sidebar-menu";
 @import "custom_team";
+@import "custom_contributors";
 @import "event-popup";
 
 //common
diff --git a/themes/docsy/layouts/contributors/baseof.html 
b/themes/docsy/layouts/contributors/baseof.html
new file mode 100644
index 00000000000..a74f0f4c728
--- /dev/null
+++ b/themes/docsy/layouts/contributors/baseof.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<html lang="{{ .Site.Language.Lang }}" class="no-js">
+  <head>
+    {{ partial "head.html" . }}
+    <title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} 
| {{ end }}{{ .Site.Title }}{{ end }}</title>
+  </head>
+  <body class="td-{{ .Kind }}">
+    <header>
+      {{ partial "navbar.html" . }}
+    </header>
+    <div class="container-fluid td-outer">
+      <div class="td-main td-contributors">
+        <main class="" role="main">
+          {{ block "main" . }}{{ end }}
+        </main>
+      </div>
+      {{ partial "footer.html" . }}
+    </div>
+    {{ partial "event-popup.html" . }}
+    {{ partial "lightbox.html" . }}
+    {{ partial "sidebar-skywalking.html" . }}
+    {{ partial "scripts.html" . }}
+    {{ partial "script-search.html" . }}
+  </body>
+</html>
diff --git a/themes/docsy/layouts/contributors/list.html 
b/themes/docsy/layouts/contributors/list.html
new file mode 100644
index 00000000000..2daa4b129f4
--- /dev/null
+++ b/themes/docsy/layouts/contributors/list.html
@@ -0,0 +1,11 @@
+{{ define "main" }}
+
+<section class="section">
+  <div class="container">
+      <div class="content">
+        {{ .Content }}
+      </div>
+  </div>
+</section>
+
+{{ end }}
diff --git a/themes/docsy/layouts/partials/script-search.html 
b/themes/docsy/layouts/partials/script-search.html
new file mode 100644
index 00000000000..6101edcf5ae
--- /dev/null
+++ b/themes/docsy/layouts/partials/script-search.html
@@ -0,0 +1,23 @@
+<!--script-search.html-->
+<script>
+  $(function () {
+    var params = new URLSearchParams(window.location.search);
+    var contributor = params.get('contributor');
+    var ele = $("." + contributor)
+    if (ele.length > 0) {
+      const contributor = ele.first().clone();
+      $('.current-contributor').html(contributor);
+      $(contributor).fadeIn();
+      ele.show().parents('.item-wrapper').addClass('show');
+      $.each($('.contributors-wrapper .item-wrapper'), (index, item) => {
+        if (!$(item).hasClass('show')) {
+          $(item).remove();
+        }
+      })
+      $('.search-tips').hide();
+    } else {
+      $('.head-wrapper').hide()
+      $('.search-tips').text('No data')
+    }
+  })
+</script>
diff --git a/themes/docsy/layouts/partials/script-team.html 
b/themes/docsy/layouts/partials/script-team.html
index 2697fc8abad..e7fe49daf69 100644
--- a/themes/docsy/layouts/partials/script-team.html
+++ b/themes/docsy/layouts/partials/script-team.html
@@ -2,7 +2,7 @@
 <!--<script src="/js/mergedData.js"></script>-->
 <!--<script src="/js/initMergedGraph.js?t=20220810"></script>-->
 <script>
-  $('.item').on('click', function (e) {
+  $('.contributors-wrapper .item').on('click', function (e) {
     e.preventDefault();
     var $item = $(e.currentTarget)
     var name = $item.data('name') + ' contributors';
@@ -19,4 +19,15 @@
   $('.btn-back').on('click', function () {
     $('.modal-wrapper').fadeOut();
   });
+  // search
+  var doSearch = function (){
+    var contributor = $('#team-contributor-input').val();
+    window.open('/contributors/?contributor=' + contributor, '_blank');
+  }
+  $('.team-contributor-search').on('click', doSearch);
+  $('#team-contributor-input').on('keydown', function (e) {
+    if (e.keyCode === 13) {
+      doSearch();
+    }
+  });
 </script>

Reply via email to