chore: Update buttons in custom role page (#11119)

This commit is contained in:
Sivin Varghese
2025-03-20 18:22:04 +05:30
committed by GitHub
parent 57a571ea87
commit f82dfee0a5
3 changed files with 32 additions and 30 deletions

View File

@@ -5,6 +5,7 @@ import BaseSettingsHeader from '../components/BaseSettingsHeader.vue';
import CustomRoleModal from './component/CustomRoleModal.vue'; import CustomRoleModal from './component/CustomRoleModal.vue';
import CustomRoleTableBody from './component/CustomRoleTableBody.vue'; import CustomRoleTableBody from './component/CustomRoleTableBody.vue';
import CustomRolePaywall from './component/CustomRolePaywall.vue'; import CustomRolePaywall from './component/CustomRolePaywall.vue';
import Button from 'dashboard/components-next/button/Button.vue';
import { computed, onMounted, ref } from 'vue'; import { computed, onMounted, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useStore, useMapGetter } from 'dashboard/composables/store'; import { useStore, useMapGetter } from 'dashboard/composables/store';
@@ -134,14 +135,12 @@ const confirmDeletion = () => {
feature-name="canned_responses" feature-name="canned_responses"
> >
<template #actions> <template #actions>
<woot-button <Button
class="rounded-md button nice" icon="i-lucide-circle-plus"
icon="add-circle" :label="$t('CUSTOM_ROLE.HEADER_BTN_TXT')"
:disabled="isBehindAPaywall" :disabled="isBehindAPaywall"
@click="openAddModal" @click="openAddModal"
> />
{{ $t('CUSTOM_ROLE.HEADER_BTN_TXT') }}
</woot-button>
</template> </template>
</BaseSettingsHeader> </BaseSettingsHeader>
</template> </template>

View File

@@ -12,7 +12,7 @@ import {
CONVERSATION_PARTICIPATING_PERMISSIONS, CONVERSATION_PARTICIPATING_PERMISSIONS,
} from 'dashboard/constants/permissions.js'; } from 'dashboard/constants/permissions.js';
import WootSubmitButton from 'dashboard/components/buttons/FormSubmitButton.vue'; import Button from 'dashboard/components-next/button/Button.vue';
const props = defineProps({ const props = defineProps({
mode: { mode: {
@@ -160,13 +160,12 @@ const isSubmitDisabled = computed(
/> />
<form class="flex flex-col w-full" @submit.prevent="handleCustomRole"> <form class="flex flex-col w-full" @submit.prevent="handleCustomRole">
<div class="w-full"> <div class="w-full">
<label> <label :class="{ error: v$.name.$error }">
{{ $t('CUSTOM_ROLE.FORM.NAME.LABEL') }} {{ $t('CUSTOM_ROLE.FORM.NAME.LABEL') }}
<input <input
ref="nameInput" ref="nameInput"
v-model.trim="name" v-model.trim="name"
type="text" type="text"
:class="{ error: v$.name.$error }"
:placeholder="$t('CUSTOM_ROLE.FORM.NAME.PLACEHOLDER')" :placeholder="$t('CUSTOM_ROLE.FORM.NAME.PLACEHOLDER')"
@blur="v$.name.$touch" @blur="v$.name.$touch"
/> />
@@ -174,13 +173,12 @@ const isSubmitDisabled = computed(
</div> </div>
<div class="w-full"> <div class="w-full">
<label> <label :class="{ error: v$.description.$error }">
{{ $t('CUSTOM_ROLE.FORM.DESCRIPTION.LABEL') }} {{ $t('CUSTOM_ROLE.FORM.DESCRIPTION.LABEL') }}
<textarea <textarea
v-model="description" v-model="description"
:rows="3" :rows="3"
:class="{ error: v$.description.$error }"
:placeholder="$t('CUSTOM_ROLE.FORM.DESCRIPTION.PLACEHOLDER')" :placeholder="$t('CUSTOM_ROLE.FORM.DESCRIPTION.PLACEHOLDER')"
@blur="v$.description.$touch" @blur="v$.description.$touch"
/> />
@@ -213,14 +211,19 @@ const isSubmitDisabled = computed(
</div> </div>
<div class="flex flex-row justify-end w-full gap-2 px-0 py-2"> <div class="flex flex-row justify-end w-full gap-2 px-0 py-2">
<WootSubmitButton <Button
:disabled="isSubmitDisabled" faded
:button-text="submitButtonText" slate
:loading="addCustomRole.showLoading" type="reset"
:label="$t('CUSTOM_ROLE.FORM.CANCEL_BUTTON_TEXT')"
@click.prevent="emit('close')"
/>
<Button
type="submit"
:label="submitButtonText"
:disabled="isSubmitDisabled"
:is-loading="addCustomRole.showLoading"
/> />
<button class="button clear" @click.prevent="emit('close')">
{{ $t('CUSTOM_ROLE.FORM.CANCEL_BUTTON_TEXT') }}
</button>
</div> </div>
</form> </form>
</div> </div>

View File

@@ -2,6 +2,8 @@
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { getI18nKey } from 'dashboard/routes/dashboard/settings/helper/settingsHelper'; import { getI18nKey } from 'dashboard/routes/dashboard/settings/helper/settingsHelper';
import Button from 'dashboard/components-next/button/Button.vue';
defineProps({ defineProps({
roles: { roles: {
type: Array, type: Array,
@@ -44,22 +46,20 @@ const getFormattedPermissions = role => {
{{ getFormattedPermissions(customRole) }} {{ getFormattedPermissions(customRole) }}
</td> </td>
<td class="flex justify-end gap-1 py-4"> <td class="flex justify-end gap-1 py-4">
<woot-button <Button
v-tooltip.top="$t('CUSTOM_ROLE.EDIT.BUTTON_TEXT')" v-tooltip.top="$t('CUSTOM_ROLE.EDIT.BUTTON_TEXT')"
variant="smooth" icon="i-lucide-pen"
size="tiny" slate
color-scheme="secondary" xs
class-names="grey-btn" faded
icon="edit"
@click="emit('edit', customRole)" @click="emit('edit', customRole)"
/> />
<woot-button <Button
v-tooltip.top="$t('CUSTOM_ROLE.DELETE.BUTTON_TEXT')" v-tooltip.top="$t('CUSTOM_ROLE.DELETE.BUTTON_TEXT')"
variant="smooth" icon="i-lucide-trash-2"
color-scheme="alert" xs
size="tiny" ruby
icon="dismiss-circle" faded
class-names="grey-btn"
:is-loading="loading[customRole.id]" :is-loading="loading[customRole.id]"
@click="emit('delete', customRole)" @click="emit('delete', customRole)"
/> />