mirror of
https://gitlab.com/aviortheking/code-stats-vscode.git
synced 2025-04-22 10:52:13 +00:00
Clean up
This commit is contained in:
parent
ed2b511762
commit
96bd68be7c
@ -16,8 +16,8 @@
|
|||||||
.circle-progress {
|
.circle-progress {
|
||||||
float: left;
|
float: left;
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 7rem;
|
width: 6rem;
|
||||||
height: 7rem;
|
height: 6rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.circle-progress .tooltiptext {
|
.circle-progress .tooltiptext {
|
||||||
@ -58,7 +58,7 @@ svg {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.language {
|
.language {
|
||||||
padding-top: 2.5rem;
|
padding-top: 2rem;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<link rel="stylesheet" href="file:///${profile.style}">
|
<link rel="stylesheet" href="file:///${style}">
|
||||||
<h3> ${profile.user} Level ${profile.level} (${profile.total_xp} XP)
|
<h3> ${profile.user} Level ${profile.level} (${profile.total_xp} XP)
|
||||||
<% if( profile.new_xp > 0 ) { %>
|
<% if( profile.new_xp > 0 ) { %>
|
||||||
<sup>(
|
<sup>(
|
||||||
@ -62,5 +62,3 @@
|
|||||||
</div>
|
</div>
|
||||||
<% } %>
|
<% } %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<circle cx="60" cy="60" r="50"/>
|
|
@ -50,33 +50,32 @@ export class ProfileProvider implements TextDocumentContentProvider {
|
|||||||
return [ xpP, nxpP ];
|
return [ xpP, nxpP ];
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSortedArray(profile: any, obj: string): any[] {
|
function getSortedArray(obj: any): any[] {
|
||||||
|
|
||||||
let langs = [];
|
let items = [];
|
||||||
let languages_object = profile[obj]
|
|
||||||
for( let lang in languages_object) {
|
for( let prop in obj) {
|
||||||
let percents = getLevelProgress(languages_object[lang].xps, languages_object[lang].new_xps);
|
let item = obj[prop];
|
||||||
langs.push(
|
let percents = getLevelProgress(item.xps, item.new_xps);
|
||||||
|
items.push(
|
||||||
{
|
{
|
||||||
name: lang,
|
name: prop,
|
||||||
level: getLevel(languages_object[lang].xps),
|
level: getLevel(item.xps),
|
||||||
xp: languages_object[lang].xps,
|
xp: item.xps,
|
||||||
new_xp: languages_object[lang].new_xps,
|
new_xp: item.new_xps,
|
||||||
progress: percents[0],
|
progress: percents[0],
|
||||||
new_progress: percents[1]
|
new_progress: percents[1]
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
langs = langs.sort( (a,b) => {return b.xp - a.xp;});
|
|
||||||
|
|
||||||
return langs;
|
return items.sort( (a,b) => {return b.xp - a.xp;});
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.api.getProfile().then(profile => {
|
return this.api.getProfile().then(profile => {
|
||||||
|
|
||||||
let htmlTemplate = fs.readFileSync(this.context.asAbsolutePath("assets/profile.html.eex"));
|
let htmlTemplate = fs.readFileSync(this.context.asAbsolutePath("assets/profile.html.eex"));
|
||||||
|
|
||||||
profile["style"] = this.context.asAbsolutePath("assets/profile.css");
|
|
||||||
profile["level"] = getLevel(profile["total_xp"]);
|
profile["level"] = getLevel(profile["total_xp"]);
|
||||||
|
|
||||||
let percents = getLevelProgress(profile["total_xp"], profile["new_xp"]);
|
let percents = getLevelProgress(profile["total_xp"], profile["new_xp"]);
|
||||||
@ -84,15 +83,12 @@ export class ProfileProvider implements TextDocumentContentProvider {
|
|||||||
profile["progress"] = percents[0];
|
profile["progress"] = percents[0];
|
||||||
profile["new_progress"] = percents[1];
|
profile["new_progress"] = percents[1];
|
||||||
|
|
||||||
let langs = getSortedArray(profile, "languages");
|
let languages = getSortedArray(profile["languages"]);
|
||||||
|
let machines = getSortedArray(profile["machines"]);
|
||||||
let machines = getSortedArray(profile, "machines");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let html = template(htmlTemplate);
|
let html = template(htmlTemplate);
|
||||||
|
|
||||||
return html({profile: profile, languages: langs, machines: machines});
|
return html({profile: profile, languages: languages, machines: machines, style: this.context.asAbsolutePath("assets/profile.css")});
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user