From 24cf0d1e0dc0bbcb97f2906f078f61a8979b129c Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Fri, 17 Dec 2021 21:37:57 +0000 Subject: [PATCH] :sparkles: Adds GitHub profile stats widget --- docs/widgets.md | 33 +++++++++ src/components/Widgets/GitHubProfile.vue | 89 ++++++++++++++++++++++++ src/components/Widgets/WidgetBase.vue | 9 +++ src/utils/defaults.js | 1 + 4 files changed, 132 insertions(+) create mode 100644 src/components/Widgets/GitHubProfile.vue diff --git a/docs/widgets.md b/docs/widgets.md index ded52484..dd117b5d 100644 --- a/docs/widgets.md +++ b/docs/widgets.md @@ -18,6 +18,7 @@ Dashy has support for displaying dynamic content in the form of widgets. There a - [Stock Price History](#stock-price-history) - [Joke of the Day](#joke) - [Flight Data](#flight-data) + - [GitHub Profile Stats](#gitHub-profile-stats) - [Public IP Address](#public-ip) - [Self-Hosted Services Widgets](#dynamic-widgets) - [System Info](#system-info) @@ -431,6 +432,38 @@ Displays airport departure and arrival flights, using data from [AeroDataBox](ht --- +### GitHub Profile Stats + +Display stats from your GitHub profile, using embedded cards from [anuraghazra/github-readme-stats](https://github.com/anuraghazra/github-readme-stats) + +

+ +##### Options + +**Field** | **Type** | **Required** | **Description** +--- | --- | --- | --- +**`username`** | `string` | Required | The GitHub username to fetch info for. E.g. `lissy93`. (Not required if `hideProfileCard` and `hideLanguagesCard` are both set to `true`) +**`hideProfileCard`** | `boolean` | _Optional_ | If set to `true`, the users profile card will not be shown. Defaults to `false` +**`hideProfileCard`** | `boolean` | _Optional_ | If set to `true`, the users top languages card will not be shown. Defaults to `false` +**`repos`** | `array` | _Optional_ | If you'd like to also display stats for some GitHub reposotories, then add an array or repo names here. Specified as `[username]/[repo-name]`, e.g. `lissy93/dashy` + + +##### Example + + +```yaml +- type: github-profile-stats + options: + username: Lissy93 + hideLanguagesCard: true + repos: + - lissy93/dashy + - lissy93/personal-security-checklist + - lissy93/twitter-sentiment-visualisation +``` + +--- + ### Public IP Displays your public IP address, along with ISP name and approx location. Data is fetched from [IP-API.com](https://ip-api.com/). diff --git a/src/components/Widgets/GitHubProfile.vue b/src/components/Widgets/GitHubProfile.vue new file mode 100644 index 00000000..d45f5418 --- /dev/null +++ b/src/components/Widgets/GitHubProfile.vue @@ -0,0 +1,89 @@ + + + + + diff --git a/src/components/Widgets/WidgetBase.vue b/src/components/Widgets/WidgetBase.vue index f49bd345..ce9711f2 100644 --- a/src/components/Widgets/WidgetBase.vue +++ b/src/components/Widgets/WidgetBase.vue @@ -67,6 +67,13 @@ @error="handleError" :ref="widgetRef" /> +