Skip to content

fix to passive ux. #277

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

Merged
merged 1 commit into from
Oct 31, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,28 @@
top: 37px;
text-align: center;
height: 100px;
max-height: 272px;
animation: fadeInSlide 1s;
overflow: scroll;
}
.discountTicketContainer, .discountAppliedContainer {
.discountTicketContainer {
max-height: 272px;
animation: fadeIn 1s;
overflow: scroll;
}

@keyframes fadeIn {
0% { opacity: 0; }
50% { opacity: 0; }
50% { opacity: 0; }
100% { opacity: 1; }
}

@keyframes fadeInSlide {
0% { opacity: 0; transform: translateY(-100%); }
50% { opacity: 0; }
100% { opacity: 1; transform: translateY(0); }
}

.smallCopy {
font-weight: 500;
text-align: center;
Expand All @@ -60,6 +70,10 @@
transform: scale(0.9);
}

.ticketWrapper {
transform: scale(0.9);
}

/* override Google Material */

.MuiDialogActions-root {
Expand Down
32 changes: 21 additions & 11 deletions hotel-bogota-passive-negotiation-website/src/BookingModal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export default function BookingModal({
}) {
// Modal State (open boolean)
const [open, setOpen] = React.useState(false);
const [loading, setLoading] = React.useState(true);

// Form state.
const [formInput, setFormInput] = useReducer(
Expand Down Expand Up @@ -74,8 +75,13 @@ export default function BookingModal({
localStorage.removeItem("booking-room-type");
setOpen(true);
}
setTimeout(() => {
setLoading(false);
}, 2000);
}, [discount]);



return (
<div>
<Button size="small" color="primary" onClick={handleClickOpen}>
Expand Down Expand Up @@ -127,15 +133,17 @@ export default function BookingModal({
{discount.value ? `🎉 ${discount.value}% discount has been applied to your hotel booking 🎉` : ""}
</DialogTitle>
}
{!discount.value &&
{!discount.value && loading === false &&
<div style={{ paddingTop: "20px" }}>
{tokens.length > 0 && (
<p className="smallCopy">
select token(s) to apply discount:
</p>
)}
</div>
}
{!discount.value && loading === false &&
<div className="discountTicketContainer">
<div style={{ paddingTop: "20px" }}>
{tokens.length > 0 && (
<p className="smallCopy">
select token(s) to apply discount:
</p>
)}
</div>
<div className="ticketWrapper">
{tokens?.map((token, index) => (
<div key={index}>
Expand All @@ -153,11 +161,13 @@ export default function BookingModal({
</div>
))}
</div>
<Button className="applyDiscount" disabled={!selectedPendingTokenInstances.length} onClick={applyDiscount} color="primary" variant="contained">
Apply Discount
</Button>
</div>
}
{!discount.value && loading === false &&
<Button className="applyDiscount" disabled={!selectedPendingTokenInstances.length} onClick={applyDiscount} color="primary" variant="contained">
Apply Discount
</Button>
}
<div className="divider"></div>
<TextField
id="booking-name"
Expand Down