LAUNCHER-4 chore: Changed DeleteModal text for various delete actions

This commit is contained in:
LynithDev 2024-12-27 13:02:20 +01:00
parent de70230645
commit 2a85623da6
4 changed files with 25 additions and 14 deletions

View file

@ -207,6 +207,8 @@ type ModalDeleteProps = MakeOptional<ModalSimpleProps, 'title'> & {
onDelete?: () => void;
timeLeft?: number;
deleteBtnText?: string;
name?: string;
description?: string;
};
Modal.Delete = function (props: ModalDeleteProps) {
@ -232,7 +234,10 @@ Modal.Delete = function (props: ModalDeleteProps) {
return;
clearIntervalId();
setTimeLeft(split.timeLeft || 3);
setTimeLeft(split.timeLeft ?? 3);
if (split.timeLeft === 0)
return;
const intervalId = setInterval(() => {
setTimeLeft((prev) => {
@ -283,19 +288,14 @@ Modal.Delete = function (props: ModalDeleteProps) {
{split.children || (
<>
<div class="flex flex-col items-center justify-center gap-y-3">
<p>Are you sure you want to delete this item?</p>
<p>
Are you sure you want to delete
{' '}
{props.name || 'this item'}
?
</p>
<p class="w-82 text-danger line-height-normal uppercase">
Doing this will
{' '}
<span class="font-bold underline">delete</span>
{' '}
your entire
{' '}
<br />
data
{' '}
<span class="font-bold underline">FOREVER</span>
.
{props.description || `${props.name || 'It'} will not be recoverable if you proceed!`}
</p>
</div>
</>

View file

@ -28,7 +28,15 @@ export function AccountControllerProvider(props: ParentProps) {
));
const deleteAccountModal = createModal(props => (
<Modal.Delete {...props} onDelete={() => _forceRemoveAccount(deleteModalUuid())} />
<Modal.Delete
{...props}
children="Are you sure you want to remove this account?"
deleteBtnText="Remove $1"
name="Account"
onDelete={() => _forceRemoveAccount(deleteModalUuid())}
timeLeft={0}
title="Remove Account"
/>
));
function refetch() {

View file

@ -40,7 +40,9 @@ function ClusterOverview() {
const deleteModal = createModal(props => (
<Modal.Delete
{...props}
name={cluster() ? `'${cluster()?.meta.name}'` : 'The Cluster'}
onDelete={deleteCluster}
title="Confirm Cluster Deletion"
/>
));

View file

@ -61,6 +61,7 @@ function WorldEntry(props: { name: string; cluster_path: string }) {
const deleteModal = createModal(self => (
<Modal.Delete
{...self}
name={`world '${props.name}'`}
onDelete={() => {
// bridge.commands.deleteWorld(props.name);
self.hide();