feat(plugins/sponsors): improve display [skip ci]
This commit is contained in:
@@ -7,7 +7,7 @@ export default async function({login, q, imports, data, graphql, queries, accoun
|
|||||||
return null
|
return null
|
||||||
|
|
||||||
//Load inputs
|
//Load inputs
|
||||||
const {size, sections, past} = await imports.metadata.plugins.sponsors.inputs({data, account, q})
|
let {size, sections, past} = await imports.metadata.plugins.sponsors.inputs({data, account, q})
|
||||||
|
|
||||||
//Query description and goal
|
//Query description and goal
|
||||||
console.debug(`metrics/compute/${login}/plugins > sponsors > querying sponsors and goal`)
|
console.debug(`metrics/compute/${login}/plugins > sponsors > querying sponsors and goal`)
|
||||||
@@ -15,6 +15,8 @@ export default async function({login, q, imports, data, graphql, queries, accoun
|
|||||||
const about = await imports.markdown(fullDescription, {mode: "multiline"})
|
const about = await imports.markdown(fullDescription, {mode: "multiline"})
|
||||||
const goal = activeGoal ? {progress: activeGoal.percentComplete, title: activeGoal.title, description: await imports.markdown(activeGoal.description)} : null
|
const goal = activeGoal ? {progress: activeGoal.percentComplete, title: activeGoal.title, description: await imports.markdown(activeGoal.description)} : null
|
||||||
const count = {total: {count: 0, user: 0, organization: 0}, active: {total: 0, user: 0, organization: 0}, past: {total: 0, user: 0, organization: 0}}
|
const count = {total: {count: 0, user: 0, organization: 0}, active: {total: 0, user: 0, organization: 0}, past: {total: 0, user: 0, organization: 0}}
|
||||||
|
if (!goal)
|
||||||
|
sections = sections.filter(section => section.name !== "goal")
|
||||||
|
|
||||||
//Query active sponsors
|
//Query active sponsors
|
||||||
let list = []
|
let list = []
|
||||||
@@ -73,7 +75,7 @@ export default async function({login, q, imports, data, graphql, queries, accoun
|
|||||||
|
|
||||||
//Results
|
//Results
|
||||||
list = list.sort((a, b) => a.past === b.past ? b.amount - a.amount : a.past - b.past)
|
list = list.sort((a, b) => a.past === b.past ? b.amount - a.amount : a.past - b.past)
|
||||||
return {sections, about, list, count, goal, size}
|
return {sections, about, list, count, goal, size, past}
|
||||||
}
|
}
|
||||||
//Handle errors
|
//Handle errors
|
||||||
catch (error) {
|
catch (error) {
|
||||||
|
|||||||
@@ -24,10 +24,11 @@ inputs:
|
|||||||
Displayed sections
|
Displayed sections
|
||||||
- `goal`: display GitHub active goal
|
- `goal`: display GitHub active goal
|
||||||
- `about`: display GitHub sponsors introduction
|
- `about`: display GitHub sponsors introduction
|
||||||
|
- `list`: display GitHub sponsors list
|
||||||
type: array
|
type: array
|
||||||
format: comma-separated
|
format: comma-separated
|
||||||
default: goal, about
|
default: goal, list, about
|
||||||
example: goal, about
|
example: goal, list, about
|
||||||
values:
|
values:
|
||||||
- goal
|
- goal
|
||||||
- about
|
- about
|
||||||
|
|||||||
@@ -46,8 +46,18 @@
|
|||||||
</div>
|
</div>
|
||||||
<% if ((section === "list")||(plugins.sponsors.sections.includes("list"))) { %>
|
<% if ((section === "list")||(plugins.sponsors.sections.includes("list"))) { %>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<% for (const user of plugins.sponsors.list) { %><img class="avatar <%= user.type === "organization" ? "organization" : "" %> <%= user.past ? "past" : "" %>" src="<%= user.avatar %>" width="<%= plugins.sponsors.size %>" height="<%= plugins.sponsors.size %>" alt="" /><% } %>
|
<% for (const user of plugins.sponsors.list.filter(({past}) => !past)) { %><img class="avatar <%= user.type === "organization" ? "organization" : "" %>" src="<%= user.avatar %>" width="<%= plugins.sponsors.size %>" height="<%= plugins.sponsors.size %>" alt="" /><% } %>
|
||||||
</div>
|
</div>
|
||||||
|
<% if ((plugins.sponsors.past)&&(plugins.sponsors.count.past.total)) { %>
|
||||||
|
<div class="past-text">
|
||||||
|
<span>
|
||||||
|
<%= plugins.sponsors.count.past.total %> sponsor<%= s(plugins.sponsors.count.past.total) %> helped <%= user.login %> in the past
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<% for (const user of plugins.sponsors.list.filter(({past}) => past)) { %><img class="avatar past <%= user.type === "organization" ? "organization" : "" %>" src="<%= user.avatar %>" width="<%= 0.8*plugins.sponsors.size %>" height="<%= 0.8*plugins.sponsors.size %>" alt="" /><% } %>
|
||||||
|
</div>
|
||||||
|
<% } %>
|
||||||
<% } %>
|
<% } %>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -147,9 +147,6 @@
|
|||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
margin: 0 6px;
|
margin: 0 6px;
|
||||||
}
|
}
|
||||||
.avatar.past {
|
|
||||||
filter: opacity(0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
.organization.avatar {
|
.organization.avatar {
|
||||||
border-radius: 15%;
|
border-radius: 15%;
|
||||||
@@ -1069,13 +1066,16 @@
|
|||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
background-color: #7777771F;
|
background-color: #7777771F;
|
||||||
}
|
}
|
||||||
.sponsors .goal-text {
|
.sponsors .goal-text, .sponsors .past-text {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
font-size: 10px;
|
font-size: 12px;
|
||||||
margin-bottom: 4px;
|
margin-bottom: 4px;
|
||||||
}
|
}
|
||||||
|
.sponsors .past-text {
|
||||||
|
margin: 8px 0 2px;
|
||||||
|
}
|
||||||
.sponsors .avatar {
|
.sponsors .avatar {
|
||||||
margin: 2px;
|
margin: 2px;
|
||||||
}
|
}
|
||||||
@@ -1405,20 +1405,6 @@
|
|||||||
height: auto;
|
height: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fade animation */
|
|
||||||
.af {
|
|
||||||
opacity: 0;
|
|
||||||
animation: animation-fade 1s ease forwards;
|
|
||||||
}
|
|
||||||
@keyframes animation-fade {
|
|
||||||
from {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Twemoji and GitHub emoji */
|
/* Twemoji and GitHub emoji */
|
||||||
.twemoji, .gemoji {
|
.twemoji, .gemoji {
|
||||||
height: 1em;
|
height: 1em;
|
||||||
|
|||||||
Reference in New Issue
Block a user