Skip to content
Open
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
22 changes: 15 additions & 7 deletions src/components/profiles-modals/CreateProfileModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import { useProfilesComposable } from '../composables/ProfilesComposable';
import { computed, nextTick, ref, watch } from 'vue';
import { getStore } from '../../providers/generic/store/StoreProvider';
import { State } from '../../store';
import {useI18n} from "vue-i18n";

const store = getStore<State>();
const { t } = useI18n();

const {
doesProfileExist,
Expand Down Expand Up @@ -56,11 +58,13 @@ async function createProfile() {
<ModalCard id="create-profile-modal" v-if="isOpen" :is-active="isOpen" @close-modal="closeModal">

<template v-slot:header>
<h2 class="modal-title">Create a profile</h2>
<h2 class="modal-title">{{ t('translations.pages.profileSelection.createProfileModal.title') }}</h2>
</template>

<template v-slot:body>
<p>This profile will store its own mods independently from other profiles.</p>
<p>
{{ t('translations.pages.profileSelection.createProfileModal.description')}}
</p>
<br/>
<input
v-model="newProfileName"
Expand All @@ -72,19 +76,23 @@ async function createProfile() {
/>
<br/><br/>
<span class="tag is-dark" v-if="newProfileName === '' || makeProfileNameSafe(newProfileName) === ''">
Profile name required
{{ t('translations.pages.profileSelection.createProfileModal.tagStates.required') }}
</span>
<span class="tag is-success" v-else-if="!doesProfileExist(newProfileName)">
"{{makeProfileNameSafe(newProfileName)}}" is available
{{ t('translations.pages.profileSelection.createProfileModal.tagStates.valid', { profileName: makeProfileNameSafe(newProfileName) }) }}
</span>
<span class="tag is-danger" v-else-if="doesProfileExist(newProfileName)">
"{{makeProfileNameSafe(newProfileName)}}" is either already in use, or contains invalid characters
{{ t('translations.pages.profileSelection.createProfileModal.tagStates.error', { profileName: makeProfileNameSafe(newProfileName) }) }}
</span>
</template>

<template v-slot:footer>
<button id="modal-create-profile-invalid" class="button is-danger" v-if="doesProfileExist(newProfileName)" disabled>Create</button>
<button id="modal-create-profile" class="button is-info" @click="createProfile()" :disabled="creatingInProgress" v-else>Create</button>
<button id="modal-create-profile-invalid" class="button is-danger" v-if="doesProfileExist(newProfileName)" disabled>
{{ t('translations.pages.profileSelection.createProfileModal.actions.create') }}
</button>
<button id="modal-create-profile" class="button is-info" @click="createProfile()" :disabled="creatingInProgress" v-else>
{{ t('translations.pages.profileSelection.createProfileModal.actions.create') }}
</button>
</template>

</ModalCard>
Expand Down
21 changes: 15 additions & 6 deletions src/components/profiles-modals/DeleteProfileModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import R2Error from "../../model/errors/R2Error";
import { computed, ref } from 'vue';
import { getStore } from '../../providers/generic/store/StoreProvider';
import { State } from '../../store';
import {useI18n} from "vue-i18n";

const store = getStore<State>();
const { t } = useI18n();

const deletingInProgress = ref<boolean>(false);
const isOpen = computed(() => store.state.modals.isDeleteProfileModalOpen);
Expand Down Expand Up @@ -34,19 +36,26 @@ async function removeProfile() {
<ModalCard id="delete-profile-modal" v-if="isOpen" :is-active="isOpen" @close-modal="closeDeleteProfileModal">

<template v-slot:header>
<h2 class="modal-title">Delete profile</h2>
<h2 class="modal-title">
{{ t('translations.pages.profileSelection.deleteProfileModal.title') }}
</h2>
</template>
<template v-slot:body>
<p>This will remove all mods, and their config files, installed within this profile.</p>
<p>If this was an accident, click either the darkened area, or the cross inside located in the top right.</p>
<p>Are you sure you'd like to delete this profile?</p>
<p>
{{ t('translations.pages.profileSelection.deleteProfileModal.content.resultingAction') }}
</p>
<p>
{{ t('translations.pages.profileSelection.deleteProfileModal.content.preventAction') }}
</p>
<p>{{ t('translations.pages.profileSelection.deleteProfileModal.content.confirmation') }}</p>
</template>
<template v-slot:footer>
<button
:disabled="deletingInProgress"
class="button is-danger"
@click="removeProfile()"
>Delete profile</button>
@click="removeProfile()">
{{ t('translations.pages.profileSelection.deleteProfileModal.actions.delete') }}
</button>
</template>

</ModalCard>
Expand Down
Loading
Loading