pnp / cli-microsoft365

Manage Microsoft 365 and SharePoint Framework projects on any platform
https://aka.ms/cli-m365
MIT License
886 stars 314 forks source link

Docusaurs: Add GitHub stats counter to the navbar #4880

Open Jwaegebaert opened 1 year ago

Jwaegebaert commented 1 year ago

The goal is to incorporate a GitHub stats counter into the navbar, similar to the one previously used in MKDocs. This counter will provide a convenient and easily accessible display of important information about our repository. It will showcase the number of stars and forks our repository has received, indicating the level of interest and engagement from the GitHub community.

Additionally, we may consider including the current version of our project alongside these stats, allowing users to quickly identify the version they are accessing.

e.g. afbeelding

Note!

When making a PR for this issue, make sure you target the branch docs-migration.


Related to #4396

Adam-it commented 1 year ago

@Jwaegebaert do you think I could give this one a shot?

Jwaegebaert commented 1 year ago

All yours!

Adam-it commented 1 year ago

@Jwaegebaert sorry for the little activity on this issue, I had a lot lately (nah... I always have a lot 😅). anyway if we run api /repos/pnp/cli-microsoft365 we get

{
  "id": 106723305,
  "node_id": "MDEwOlJlcG9zaXRvcnkxMDY3MjMzMDU=",
  "name": "cli-microsoft365",
  "full_name": "pnp/cli-microsoft365",
  "private": false,
  "owner": {
    "login": "pnp",
    "id": 31443929,
    "node_id": "MDEyOk9yZ2FuaXphdGlvbjMxNDQzOTI5",
    "avatar_url": "https://avatars.githubusercontent.com/u/31443929?v=4",
    "gravatar_id": "",
    "url": "https://api.github.com/users/pnp",
    "html_url": "https://github.com/pnp",
    "followers_url": "https://api.github.com/users/pnp/followers",
    "following_url": "https://api.github.com/users/pnp/following{/other_user}",
    "gists_url": "https://api.github.com/users/pnp/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/pnp/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/pnp/subscriptions",
    "organizations_url": "https://api.github.com/users/pnp/orgs",
    "repos_url": "https://api.github.com/users/pnp/repos",
    "events_url": "https://api.github.com/users/pnp/events{/privacy}",
    "received_events_url": "https://api.github.com/users/pnp/received_events",
    "type": "Organization",
    "site_admin": false
  },
  "html_url": "https://github.com/pnp/cli-microsoft365",
  "description": "Manage Microsoft 365 and SharePoint Framework projects on any platform",
  "fork": false,
  "url": "https://api.github.com/repos/pnp/cli-microsoft365",
  "forks_url": "https://api.github.com/repos/pnp/cli-microsoft365/forks",
  "keys_url": "https://api.github.com/repos/pnp/cli-microsoft365/keys{/key_id}",
  "collaborators_url": "https://api.github.com/repos/pnp/cli-microsoft365/collaborators{/collaborator}",
  "teams_url": "https://api.github.com/repos/pnp/cli-microsoft365/teams",
  "hooks_url": "https://api.github.com/repos/pnp/cli-microsoft365/hooks",
  "issue_events_url": "https://api.github.com/repos/pnp/cli-microsoft365/issues/events{/number}",
  "events_url": "https://api.github.com/repos/pnp/cli-microsoft365/events",
  "assignees_url": "https://api.github.com/repos/pnp/cli-microsoft365/assignees{/user}",
  "branches_url": "https://api.github.com/repos/pnp/cli-microsoft365/branches{/branch}",
  "tags_url": "https://api.github.com/repos/pnp/cli-microsoft365/tags",
  "blobs_url": "https://api.github.com/repos/pnp/cli-microsoft365/git/blobs{/sha}",
  "git_tags_url": "https://api.github.com/repos/pnp/cli-microsoft365/git/tags{/sha}",
  "git_refs_url": "https://api.github.com/repos/pnp/cli-microsoft365/git/refs{/sha}",
  "trees_url": "https://api.github.com/repos/pnp/cli-microsoft365/git/trees{/sha}",
  "statuses_url": "https://api.github.com/repos/pnp/cli-microsoft365/statuses/{sha}",
  "languages_url": "https://api.github.com/repos/pnp/cli-microsoft365/languages",
  "stargazers_url": "https://api.github.com/repos/pnp/cli-microsoft365/stargazers",
  "contributors_url": "https://api.github.com/repos/pnp/cli-microsoft365/contributors",
  "subscribers_url": "https://api.github.com/repos/pnp/cli-microsoft365/subscribers",
  "subscription_url": "https://api.github.com/repos/pnp/cli-microsoft365/subscription",
  "commits_url": "https://api.github.com/repos/pnp/cli-microsoft365/commits{/sha}",
  "git_commits_url": "https://api.github.com/repos/pnp/cli-microsoft365/git/commits{/sha}",
  "comments_url": "https://api.github.com/repos/pnp/cli-microsoft365/comments{/number}",
  "issue_comment_url": "https://api.github.com/repos/pnp/cli-microsoft365/issues/comments{/number}",
  "contents_url": "https://api.github.com/repos/pnp/cli-microsoft365/contents/{+path}",
  "compare_url": "https://api.github.com/repos/pnp/cli-microsoft365/compare/{base}...{head}",
  "merges_url": "https://api.github.com/repos/pnp/cli-microsoft365/merges",
  "archive_url": "https://api.github.com/repos/pnp/cli-microsoft365/{archive_format}{/ref}",
  "downloads_url": "https://api.github.com/repos/pnp/cli-microsoft365/downloads",
  "issues_url": "https://api.github.com/repos/pnp/cli-microsoft365/issues{/number}",
  "pulls_url": "https://api.github.com/repos/pnp/cli-microsoft365/pulls{/number}",
  "milestones_url": "https://api.github.com/repos/pnp/cli-microsoft365/milestones{/number}",
  "notifications_url": "https://api.github.com/repos/pnp/cli-microsoft365/notifications{?since,all,participating}",
  "labels_url": "https://api.github.com/repos/pnp/cli-microsoft365/labels{/name}",
  "releases_url": "https://api.github.com/repos/pnp/cli-microsoft365/releases{/id}",
  "deployments_url": "https://api.github.com/repos/pnp/cli-microsoft365/deployments",
  "created_at": "2017-10-12T17:18:21Z",
  "updated_at": "2023-06-10T21:29:18Z",
  "pushed_at": "2023-06-10T19:38:42Z",
  "git_url": "git://github.com/pnp/cli-microsoft365.git",
  "ssh_url": "git@github.com:pnp/cli-microsoft365.git",
  "clone_url": "https://github.com/pnp/cli-microsoft365.git",
  "svn_url": "https://github.com/pnp/cli-microsoft365",
  "homepage": "https://aka.ms/cli-m365",
  "size": 39208,
  "stargazers_count": 774,
  "watchers_count": 774,
  "language": "TypeScript",
  "has_issues": true,
  "has_projects": false,
  "has_downloads": true,
  "has_wiki": true,
  "has_pages": true,
  "has_discussions": true,
  "forks_count": 286,
  "mirror_url": null,
  "archived": false,
  "disabled": false,
  "open_issues_count": 249,
  "license": {
    "key": "mit",
    "name": "MIT License",
    "spdx_id": "MIT",
    "url": "https://api.github.com/licenses/mit",
    "node_id": "MDc6TGljZW5zZTEz"
  },
  "allow_forking": true,
  "is_template": false,
  "web_commit_signoff_required": false,
  "topics": [
    "azure",
    "azure-active-directory",
    "azure-ad",
    "cli",
    "hacktoberfest",
    "microsoft",
    "microsoft-365",
    "microsoft-graph",
    "microsoft-planner",
    "microsoft-power-apps",
    "microsoft-power-automate",
    "microsoft-teams",
    "microsoft365",
    "office-365",
    "office365",
    "sharepoint",
    "sharepoint-framework",
    "sharepoint-online",
    "spfx",
    "yammer"
  ],
  "visibility": "public",
  "forks": 286,
  "open_issues": 249,
  "watchers": 774,
  "default_branch": "main",
  "permissions": {
    "admin": false,
    "maintain": true,
    "push": true,
    "triage": true,
    "pull": true
  },
  "temp_clone_token": "",
  "allow_squash_merge": true,
  "allow_merge_commit": false,
  "allow_rebase_merge": true,
  "allow_auto_merge": false,
  "delete_branch_on_merge": false,
  "allow_update_branch": false,
  "use_squash_pr_title_as_default": false,
  "squash_merge_commit_message": "COMMIT_MESSAGES",
  "squash_merge_commit_title": "COMMIT_OR_PR_TITLE",
  "merge_commit_message": "PR_TITLE",
  "merge_commit_title": "MERGE_MESSAGE",
  "organization": {
    "login": "pnp",
    "id": 31443929,
    "node_id": "MDEyOk9yZ2FuaXphdGlvbjMxNDQzOTI5",
    "avatar_url": "https://avatars.githubusercontent.com/u/31443929?v=4",
    "gravatar_id": "",
    "url": "https://api.github.com/users/pnp",
    "html_url": "https://github.com/pnp",
    "followers_url": "https://api.github.com/users/pnp/followers",
    "following_url": "https://api.github.com/users/pnp/following{/other_user}",
    "gists_url": "https://api.github.com/users/pnp/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/pnp/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/pnp/subscriptions",
    "organizations_url": "https://api.github.com/users/pnp/orgs",
    "repos_url": "https://api.github.com/users/pnp/repos",
    "events_url": "https://api.github.com/users/pnp/events{/privacy}",
    "received_events_url": "https://api.github.com/users/pnp/received_events",
    "type": "Organization",
    "site_admin": false
  },
  "network_count": 286,
  "subscribers_count": 62
}

so we may get the start using stargazers_count and forks from forks_count. To get the latest tag we will need to run an additional request to api /repos/pnp/cli-microsoft365/tags.

The question is do we want to show something more? like watchers?

Adam-it commented 1 year ago

@Jwaegebaert BTW do you maybe know how to extend the navbar with a custom react component? I tried to do a quick check on the web but only find a hacky way to do it 🤔

milanholemans commented 1 year ago

@Jwaegebaert BTW do you maybe know how to extend the navbar with a custom react component? I tried to do a quick check on the web but only find a hacky way to do it 🤔

You could look at the component I made for our Team page. However, this doesn't use Swizzling. Something I fear is that we have to Swizzle the navigation bar to insert your component and that this will give us some struggles to integrate navigation labels and search engine in it.

Jwaegebaert commented 1 year ago

The stars, forks, and latest tag would be enough information to start with.

BTW do you maybe know how to extend the navbar with a custom react component?

The easiest approach will be to swizzle the navbar and then insert a custom component. You may need to swizzle an extra component for mobile view, I think.

Something I fear is that we have to Swizzle the navigation bar to insert your component and that this will give us some struggles to integrate navigation labels and search engine in it.

This should be a problem because we'll target navigation and not the searchbar. If we don't modify any logic in the navbar and just insert a custom component we won't run into any issues.

Adam-it commented 7 months ago

I have some prototypes done but seems like I am unable to get this issue done as always something with higher priority gets in the way. I order not to block this issue anymore and make a place for someone else who will maybe get the job done I will unassign myself from this one. I will still track this issue one my personal plan and if I find time to finish this off in the future I will gladly retake this activity. Sorry for the hold up 🙏