Skip to content

receipts view#15

Merged
iisa merged 37 commits intomainfrom
receipts-view
Jan 30, 2025
Merged

receipts view#15
iisa merged 37 commits intomainfrom
receipts-view

Conversation

@iisa
Copy link
Contributor

@iisa iisa commented Dec 13, 2024

@github-actions
Copy link

github-actions bot commented Dec 13, 2024

PR Preview Action v1.6.0
Preview removed because the pull request was closed.
2025-01-30 21:36 UTC

export class MonthlyGivingCircle extends LitElement {
@property({ type: String }) patronName: string = '';

@property({ type: Array }) receipts = [];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can become

@property({ type: Array }) receipts: aReceipt[] = [];

so TS knows the type of data its working with and help the developer out during development.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for catch, will update. i will keep class and decorate this list

<th class="amount">Amount</th>
<th class="action">Action</th>
</tr>
${this.receipts.length
Copy link
Contributor

@jbuckner jbuckner Jan 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor, but to make this render() method a bit easier to read, I might split out the receipts list view, ie:

${this.receipts.length > 0 : this.receiptsListView : html`<p>No recent donations found</p>`}

private receiptsListView(): TemplateResult {
  return html`...`
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i did want to show the table row markup inside the context of the table draw function. there aren't any other views to switch from at this level so i think it makes sense to keep in-line. 👍

<button
?disabled=${this.isDisabled}
@click=${() => {
if (this.isDisabled) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need this disabled check? The ?disabled above should be making it unclickable, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the disabled check ensures the button does not re-fire.

export class IauxButton extends LitElement {
@property({ type: Boolean, reflect: true }) isDisabled = false;

@property({ type: Function }) clickHandler: Function | undefined;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is type: Function valid? I get an error when I tried using that. I think it would be type: Object

Copy link
Contributor

@jbuckner jbuckner Jan 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make this callback similar to an HTML button and help the developer know what the clickHandler looks like, I might make this type as (e: Event) => void, ie:

@property({ type: Object }) clickHandler?: (e: Event) => void;
...
<button @click=${(e: Event) => { this.clickHandler(e) }>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you know, that's from copilot 😅 i wanted to believe

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks again for the feedback. i've got a good fix around this. we aren't bubbling up the click event, but i'll take a look at switching to passing event.


if (this.clickHandler) {
this?.clickHandler(this);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The this isn't optional so you shouldn't need the question mark.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clickhandler can be undefined


type receiptEmailStatus = {
id: string;
emailStatus: 'success' | 'fail' | 'pending' | '';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does a status of '' mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

empty string. i wanted to use same type and default to falsey.

Copy link
Contributor Author

@iisa iisa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks so much for the care @jbuckner and @nsharma123 🙌


if (this.clickHandler) {
this?.clickHandler(this);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clickhandler can be undefined

<button
?disabled=${this.isDisabled}
@click=${() => {
if (this.isDisabled) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the disabled check ensures the button does not re-fire.


type receiptEmailStatus = {
id: string;
emailStatus: 'success' | 'fail' | 'pending' | '';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

empty string. i wanted to use same type and default to falsey.

<th class="amount">Amount</th>
<th class="action">Action</th>
</tr>
${this.receipts.length
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i did want to show the table row markup inside the context of the table draw function. there aren't any other views to switch from at this level so i think it makes sense to keep in-line. 👍

@iisa iisa merged commit dc2493e into main Jan 30, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants