feat(plugins/sponsors): improve display [skip ci]

This commit is contained in:
lowlighter
2022-04-23 21:05:06 -04:00
parent 30bf208c24
commit 9d1083f263
4 changed files with 23 additions and 24 deletions

View File

@@ -7,7 +7,7 @@ export default async function({login, q, imports, data, graphql, queries, accoun
return null
//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
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 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}}
if (!goal)
sections = sections.filter(section => section.name !== "goal")
//Query active sponsors
let list = []
@@ -73,7 +75,7 @@ export default async function({login, q, imports, data, graphql, queries, accoun
//Results
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
catch (error) {

View File

@@ -24,10 +24,11 @@ inputs:
Displayed sections
- `goal`: display GitHub active goal
- `about`: display GitHub sponsors introduction
- `list`: display GitHub sponsors list
type: array
format: comma-separated
default: goal, about
example: goal, about
default: goal, list, about
example: goal, list, about
values:
- goal
- about