Skip to content

Commit

Permalink
Approver list refactor and bug fix (#184)
Browse files Browse the repository at this point in the history
* Add badge to Approvers list (owner view)

* Component-ize Approvers
  • Loading branch information
jeffdaley authored May 30, 2023
1 parent a2392b6 commit 6f36db0
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 13 deletions.
8 changes: 2 additions & 6 deletions web/app/components/document/sidebar.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@
<ol class="person-list">
{{#each this.approvers as |approver|}}
<li>
<Person
<Person::Approver
@imgURL={{approver.imgURL}}
@email={{approver.email}}
/>
Expand All @@ -240,11 +240,7 @@
<ol class="person-list">
{{#each this.approvers as |approver|}}
<li>
<Person
@badge={{if
(has-approved-doc @document approver.email)
"approved"
}}
<Person::Approver
@imgURL={{approver.imgURL}}
@email={{approver.email}}
/>
Expand Down
7 changes: 0 additions & 7 deletions web/app/components/person.js

This file was deleted.

5 changes: 5 additions & 0 deletions web/app/components/person/approver.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Person
@badge={{if (has-approved-doc @email) "approved"}}
@imgURL={{@imgURL}}
@email={{@email}}
/>
20 changes: 20 additions & 0 deletions web/app/components/person/approver.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import Component from "@glimmer/component";

interface PersonApproverComponentSignature {
Element: HTMLDivElement;
Args: {
email: string;
imgURL?: string;
};
Blocks: {
default: [];
};
}

export default class PersonApproverComponent extends Component<PersonApproverComponentSignature> {}

declare module "@glint/environment-ember-loose/registry" {
export default interface Registry {
"Person::Approver": typeof PersonApproverComponent;
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{! @glint-nocheck - not typesafe yet}}
{{#unless this.isHidden}}
<div class="flex space-x-2 w-full" ...attributes>
<div class="relative">
Expand Down
23 changes: 23 additions & 0 deletions web/app/components/person/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import Component from "@glimmer/component";

interface PersonComponentSignature {
Element: HTMLDivElement;
Args: {
email: string;
imgURL?: string;
ignoreUnknown?: boolean;
badge?: string;
};
}

export default class PersonComponent extends Component<PersonComponentSignature> {
get isHidden() {
return this.args.ignoreUnknown && !this.args.email;
}
}

declare module "@glint/environment-ember-loose/registry" {
export default interface Registry {
Person: typeof PersonComponent;
}
}

0 comments on commit 6f36db0

Please sign in to comment.