Skip to content

Commit

Permalink
Fixed account deletion and reset
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamKyle committed Oct 12, 2024
1 parent cd61c14 commit 03ba177
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/AccountDeletionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function resetAccount(Request $request, User $user, CharacterDeletion $ch
$data['race_id'] = ! is_null($request->race) ? $request->race : $character->race->id;
}

$data['guide'] = $request->has('guide_enabled');
$data['guide'] = true;

$characterDeletion->deleteCharacterFromUser($character, $data);

Expand Down
42 changes: 41 additions & 1 deletion resources/js/vendor/theme-script.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import tippy, {delegate} from 'tippy.js';
import tippy, { delegate } from 'tippy.js';

// Event delegation
const on = (selector, eventType, childSelector, eventHandler) => {
Expand Down Expand Up @@ -706,3 +706,43 @@ const customTippy = () => {

customTippy();

// Modal
const modal = () => {
// Show
const showModal = (modal) => {
showOverlay();
modal.classList.add("active");
const animation = modal.dataset.animations.split(", ")[0];
const modalContent = modal.querySelector(".modal-content");
animateCSS(modalContent, animation);

modal.addEventListener("click", (event) => {
if (modal.dataset.staticBackdrop !== undefined) return;
if (modal !== event.target) return;
closeModal(modal);
});
};

on("body", "click", '[data-toggle="modal"]', (event) => {
const modal = document.querySelector(event.target.dataset.target);
showModal(modal);
});

// Close
const closeModal = (modal) => {
hideOverlay();
const animation = modal.dataset.animations.split(", ")[1];
const modalContent = modal.querySelector(".modal-content");
animateCSS(modalContent, animation).then(() => {
modal.classList.remove("active");
});
};

on(".modal", "click", '[data-dismiss="modal"]', (event) => {
const modal = event.target.closest(".modal");
closeModal(modal);
});
};

modal();

Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
By selecting any of these options your character will be re-rolled with them. You can reset your account as many times as you want, however, realise you <strong>lose a lot
of progression when you do that</strong>.
</p>
<x-core.alerts.info-alert title="ATTN!">
Please be aware that the Guide quest will be enabled for all characters and there no way to disabled them.
You will restart your progress in sdaid guide quests when you re-roll your character.
</x-core.alerts.info-alert>
<p class="mb-4">
By selecting Enable Guide, we will not show you the initial popup, instead: Click the Guide Quest in the top navigation after resetting the account.
</p>
Expand Down Expand Up @@ -54,13 +58,6 @@
</div>
@enderror
</div>
<div class="mt-5">
<label class="custom-checkbox" for="enable_guide">
<input type="checkbox" name="guide_enabled" id="enable_guide">
<span></span>
<span>Enable Guide? <a href="#no-link" data-toggle="modal" data-target="#guide-explanation">(Help)</a></span>
</label>
</div>
</form>
</x-core.modals.modal>

Expand Down

0 comments on commit 03ba177

Please sign in to comment.