Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions src/components/LoanCards/HoverLoanCard/HoverLoanCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
:loan="loan"
:percent-raised="percentRaised"
:expanded="expanded"
@update-detailed-loan-index="hoverCardSmallUpdateDetailedLoanIndex"
/>
<hover-loan-card-large
:amount-left="amountLeft"
Expand All @@ -34,7 +35,7 @@
:is-visitor="isVisitor"
:is-selected-by-another="isSelectedByAnother"
:items-in-basket="itemsInBasket"
@update-detailed-loan-index="updateDetailedLoanIndex"
@update-detailed-loan-index="hoverCardLargeUpdateDetailedLoanIndex"
/>
<div
class="more-details-wrapper"
Expand Down Expand Up @@ -93,6 +94,10 @@ export default {
type: Number,
default: 0,
},
preventUpdatingDetailedCard: {
type: Boolean,
default: false,
},
},
computed: {
expanded() {
Expand Down Expand Up @@ -133,7 +138,9 @@ export default {
methods: {
handleMouseEnter() {
if (this.rowHasDetailedLoan && !this.isDetailed) {
this.updateDetailedLoanIndex();
if (!this.preventUpdatingDetailedCard) {
this.updateDetailedLoanIndex();
}
} else if (this.hoverEffectActive()) {
this.updateHoverLoanIndex();
}
Expand Down Expand Up @@ -170,12 +177,22 @@ export default {
},
handleClick() {
if (!this.hoverEffectActive()) {
this.$emit('update-detailed-loan-index', this.loanIndex);
this.updateDetailedLoanIndex();
}
},
trackInteraction(args) {
this.$emit('track-interaction', args);
},
hoverCardLargeUpdateDetailedLoanIndex() {
if (!this.rowHasDetailedLoan) {
this.$emit('set-prevent-updating-detailed-card', true);
Copy link
Contributor Author

@ksekhri ksekhri Jul 24, 2019

Choose a reason for hiding this comment

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

Interaction 1: User clicks on Image or Read more inside HoverLoanCardLarge

  • This stops the mouseenter behavior of changing which loan is detailed

}
this.updateDetailedLoanIndex();
},
hoverCardSmallUpdateDetailedLoanIndex() {
this.$emit('set-prevent-updating-detailed-card', false);
this.updateDetailedLoanIndex();
Copy link
Contributor Author

@ksekhri ksekhri Jul 24, 2019

Choose a reason for hiding this comment

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

Interaction 2B: User explicitly clicks on a neighboring loan

  • This re-enables the mouseenter behavior

}
},
};
</script>
Expand Down
12 changes: 11 additions & 1 deletion src/components/LoanCards/HoverLoanCard/HoverLoanCardSmall.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@
:standard-image-url="loan.image.default"
:is-visitor="true"
:use-default-styles="false"
:disable-link="true"

@track-loan-card-interaction="trackInteraction"
@image-click="handleClick"
/>
<div class="hover-loan-card-data-wrap">
<div
class="hover-loan-card-data-wrap"
@click="handleClick"
>
<p class="name">
{{ loan.name }}
</p>
Expand Down Expand Up @@ -49,6 +54,11 @@ export default {
default: false,
},
},
methods: {
handleClick() {
this.$emit('update-detailed-loan-index');
},
},
};
</script>
<style lang="scss" scoped>
Expand Down
9 changes: 9 additions & 0 deletions src/components/LoanCards/LoanCardController.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@
:hover-loan-index="hoverLoanIndex"
:shift-increment="shiftIncrement"
:time-left-message="timeLeftMessage"
:prevent-updating-detailed-card="preventUpdatingDetailedCard"

@update-detailed-loan-index="updateDetailedLoanIndex"
@update-hover-loan-index="updateHoverLoanIndex"
@close-detailed-loan-card="handleCloseDetailedLoanCard"
@set-prevent-updating-detailed-card="handleSetPreventUpdatingDetailedCard"
/>
<!--
Blocks of attributes above:
Expand Down Expand Up @@ -155,6 +157,10 @@ export default {
type: Number,
default: 0,
},
preventUpdatingDetailedCard: {
type: Boolean,
default: false,
},
},
inject: ['apollo'],
computed: {
Expand Down Expand Up @@ -296,6 +302,9 @@ export default {
handleCloseDetailedLoanCard() {
this.$emit('close-detailed-loan-card');
},
handleSetPreventUpdatingDetailedCard(newState) {
this.$emit('set-prevent-updating-detailed-card', newState);
},
},
};
</script>
Expand Down
10 changes: 10 additions & 0 deletions src/components/LoansByCategory/CategoryRowHover.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@
:detailed-loan-index="detailedLoanIndex"
:hover-loan-index="hoverLoanIndex"
:shift-increment="calculateCardShiftIncrement(index)"
:prevent-updating-detailed-card="preventUpdatingDetailedCard"

@update-detailed-loan-index="updateDetailedLoanIndex"
@update-hover-loan-index="updateHoverLoanIndex"
@set-prevent-updating-detailed-card="handleSetPreventUpdatingDetailedCard"

ref="hoverLoanCards"
/>
Expand Down Expand Up @@ -176,6 +178,7 @@ export default {
detailedLoanIndex: null,
hoverLoanIndex: null,
cardWidth: hoverCardSmallWidthTotal,
preventUpdatingDetailedCard: false,
};
},
computed: {
Expand Down Expand Up @@ -390,6 +393,13 @@ export default {
},
handleMouseLeave() {
this.hoverLoanIndex = null;
this.setPreventUpdatingDetailedCard(false);
Copy link
Contributor Author

@ksekhri ksekhri Jul 24, 2019

Choose a reason for hiding this comment

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

Interaction 2A: User exits the row (entering the DetailedLoanCard)

  • This re-enables the mouseenter behavior

},
setPreventUpdatingDetailedCard(newState) {
this.preventUpdatingDetailedCard = newState;
},
handleSetPreventUpdatingDetailedCard(newState) {
this.setPreventUpdatingDetailedCard(newState);
},
},
};
Expand Down