Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add column selection to Charges listing #35

Merged
merged 5 commits into from
Aug 18, 2021
Merged

Conversation

faxblaster
Copy link
Contributor

This PR adds a dropdown with checkboxes for all available columns. We're initially loading with our previously static columns (id, amount, created date, and status), but adding the options to select from any of the available data for a Charge.

Screenshots
Screen Shot 2021-08-16 at 2 43 14 PM

Screen Shot 2021-08-16 at 2 43 21 PM

Copy link
Contributor

@rissajackson rissajackson left a comment

Choose a reason for hiding this comment

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

Approve with questions 😃 Great work!!

@@ -2,24 +2,36 @@
<div>
<heading class="mb-6">Stripe Dashboard</heading>

<balance-card></balance-card>
<balance-card />
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: What does this do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just a different syntax for a component! Since we don't have any content inside the component tags, it's generally preferred to do this (it's called self-closing).

Here are some more details from the style guide: https://vuejs.org/v2/style-guide/#Self-closing-components-strongly-recommended

Comment on lines +13 to +19
<tr>
<!-- Id, Amount, Created date, Status-->
<th v-if="columns" v-for="column in columns" class="text-left">
<span class="inline-flex items-center capitalize">
{{ column.replaceAll('_', ' ') }}
</span>
</th>
Copy link
Contributor

Choose a reason for hiding this comment

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

Praise: This looks so much better and cleaner!

Comment on lines +26 to +31
<td v-for="column in columns">
<span v-if="moneyColumns.find(moneyColumn => moneyColumn === column)">{{ charge.currency | money(charge[column]) }}</span>
<span v-else-if="dateColumns.find(dateColumn => dateColumn === column)">{{ charge[column] | date }}</span>
<span v-else-if="column === 'status'" class="rounded-lg px-3 py-1 capitalize text-xs font-black" :class="statusClass(charge.status)">{{ charge.refunded ? 'Refunded' : charge.status }}</span>
<span v-else>{{ charge[column] }}</span>
</td>
Copy link
Contributor

Choose a reason for hiding this comment

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

Praise: The formats on these look great!

Copy link
Member

Choose a reason for hiding this comment

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

This is a really clever way to do it!

Comment on lines +26 to +31
<td v-for="column in columns">
<span v-if="moneyColumns.find(moneyColumn => moneyColumn === column)">{{ charge.currency | money(charge[column]) }}</span>
<span v-else-if="dateColumns.find(dateColumn => dateColumn === column)">{{ charge[column] | date }}</span>
<span v-else-if="column === 'status'" class="rounded-lg px-3 py-1 capitalize text-xs font-black" :class="statusClass(charge.status)">{{ charge.refunded ? 'Refunded' : charge.status }}</span>
<span v-else>{{ charge[column] }}</span>
</td>
Copy link
Member

Choose a reason for hiding this comment

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

This is a really clever way to do it!

Comment on lines +77 to +78
moneyColumns: ['amount', 'amount_captured', 'amount_refunded', 'application_fee_amount', ],
dateColumns: ['created'],
Copy link
Member

Choose a reason for hiding this comment

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

So clever.

@mattstauffer mattstauffer merged commit 1ee4886 into main Aug 18, 2021
@mattstauffer mattstauffer deleted the alk/select-column branch August 18, 2021 21:42
@mattstauffer
Copy link
Member

Fantastic work @faxblaster!

@faxblaster faxblaster mentioned this pull request Oct 1, 2022
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