-
Notifications
You must be signed in to change notification settings - Fork 20
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
Conversation
There was a problem hiding this 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 /> |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
<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> |
There was a problem hiding this comment.
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!
<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> |
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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!
<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> |
There was a problem hiding this comment.
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!
moneyColumns: ['amount', 'amount_captured', 'amount_refunded', 'application_fee_amount', ], | ||
dateColumns: ['created'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So clever.
Fantastic work @faxblaster! |
This PR adds a dropdown with checkboxes for all available columns. We're initially loading with our previously static columns (
id
,amount
,created date
, andstatus
), but adding the options to select from any of the available data for a Charge.Screenshots
