Browse Source

Updates completed steps on home

main
Keith Daulton 2 years ago
parent
commit
ce24429e10
1 changed files with 14 additions and 6 deletions
  1. +14
    -6
      src/webviews/apps/home/home.ts

+ 14
- 6
src/webviews/apps/home/home.ts View File

@ -153,13 +153,21 @@ export class HomeApp extends App {
$headerContent.setAttribute('image', avatar);
}
$headerContent.setAttribute('name', subscription.account?.name ?? '');
const steps = this.$steps?.length;
let completed = completedSteps?.length;
if (forceShowPlus && completedSteps != null && this.$steps != null && steps === completed) {
completed -= 1;
const steps = this.$steps?.length ?? 0;
let completed = completedSteps?.length ?? 0;
if (steps > 0 && completed > 0) {
const stepIds = this.$steps.map(el => el.id);
const availableCompleted = completedSteps!.filter(name => stepIds.includes(name));
completed = availableCompleted.length;
if (forceShowPlus && availableCompleted.includes('plus')) {
completed -= 1;
}
}
$headerContent.setAttribute('steps', steps?.toString() ?? '');
$headerContent.setAttribute('completed', completed?.toString() ?? '');
$headerContent.setAttribute('steps', steps.toString());
$headerContent.setAttribute('completed', completed.toString());
$headerContent.setAttribute('state', subscription.state.toString());
$headerContent.setAttribute('plan', subscription.plan.effective.name);
$headerContent.setAttribute('days', days.toString());

Loading…
Cancel
Save