feat: add popover to confirm abandon
This commit is contained in:
@@ -631,6 +631,78 @@ body {
|
|||||||
background: #fef2f2;
|
background: #fef2f2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.abandon-wrapper {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.abandon-popover {
|
||||||
|
display: none;
|
||||||
|
position: absolute;
|
||||||
|
top: calc(100% + 8px);
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
background: var(--surface);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: var(--radius-md);
|
||||||
|
padding: 14px 16px;
|
||||||
|
box-shadow: 0 4px 16px var(--shadow-warm);
|
||||||
|
z-index: 100;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.abandon-popover.open {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.abandon-popover-text {
|
||||||
|
margin: 0 0 10px;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: var(--text);
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.abandon-popover-actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-abandon-confirm {
|
||||||
|
padding: 6px 14px;
|
||||||
|
background: #dc2626;
|
||||||
|
color: #fff;
|
||||||
|
border: none;
|
||||||
|
border-radius: 100px;
|
||||||
|
font-family: 'Inter', sans-serif;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background 0.15s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-abandon-confirm:hover {
|
||||||
|
background: #b91c1c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-abandon-cancel {
|
||||||
|
padding: 6px 14px;
|
||||||
|
background: none;
|
||||||
|
color: var(--text);
|
||||||
|
border: 1.5px solid var(--border);
|
||||||
|
border-radius: 100px;
|
||||||
|
font-family: 'Inter', sans-serif;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: border-color 0.15s, background 0.15s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-abandon-cancel:hover {
|
||||||
|
background: var(--surface-hover, #f5f5f5);
|
||||||
|
border-color: var(--text);
|
||||||
|
}
|
||||||
|
|
||||||
.game-start-container {
|
.game-start-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|||||||
@@ -4,10 +4,37 @@
|
|||||||
{% if game %}
|
{% if game %}
|
||||||
<div class="game-container">
|
<div class="game-container">
|
||||||
<div class="game-actions">
|
<div class="game-actions">
|
||||||
<form method="post" action="{{ path('app_game_abandon', {id: game.id}) }}">
|
<div class="abandon-wrapper">
|
||||||
<input type="hidden" name="_token" value="{{ csrf_token('game_abandon') }}">
|
<button type="button" class="btn btn-abandon" id="abandon-trigger">Abandonner</button>
|
||||||
<button type="submit" class="btn btn-abandon">Abandonner</button>
|
<div class="abandon-popover" id="abandon-popover">
|
||||||
</form>
|
<p class="abandon-popover-text">Êtes-vous sûr de vouloir abandonner ?</p>
|
||||||
|
<div class="abandon-popover-actions">
|
||||||
|
<form method="post" action="{{ path('app_game_abandon', {id: game.id}) }}">
|
||||||
|
<input type="hidden" name="_token" value="{{ csrf_token('game_abandon') }}">
|
||||||
|
<button type="submit" class="btn btn-abandon-confirm">Abandonner</button>
|
||||||
|
</form>
|
||||||
|
<button type="button" class="btn btn-abandon-cancel" id="abandon-cancel">Non, continuer</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
(function() {
|
||||||
|
var trigger = document.getElementById('abandon-trigger');
|
||||||
|
var popover = document.getElementById('abandon-popover');
|
||||||
|
var cancel = document.getElementById('abandon-cancel');
|
||||||
|
trigger.addEventListener('click', function() {
|
||||||
|
popover.classList.toggle('open');
|
||||||
|
});
|
||||||
|
cancel.addEventListener('click', function() {
|
||||||
|
popover.classList.remove('open');
|
||||||
|
});
|
||||||
|
document.addEventListener('click', function(e) {
|
||||||
|
if (!popover.contains(e.target) && e.target !== trigger) {
|
||||||
|
popover.classList.remove('open');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div {{ react_component('GameGrid', {
|
<div {{ react_component('GameGrid', {
|
||||||
|
|||||||
Reference in New Issue
Block a user