refactor(UserEditModal): format alert message for better readability
Updated the alert message in the UserEditModal component to improve code readability by formatting the function call across multiple lines. This change enhances maintainability and aligns with the project's coding standards.
This commit is contained in:
parent
3b86c2c72f
commit
c0428bb65d
@ -150,9 +150,14 @@ const UserEditModal = ({ isOpen, onOpenChange, user, currentAdminId, onSuccess }
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!isSelfEdit && values.status === 'suspended' && initial.status !== 'suspended') {
|
if (!isSelfEdit && values.status === 'suspended' && initial.status !== 'suspended') {
|
||||||
showAlert('این کاربر معلق شود؟ کاربر تا فعالسازی مجدد امکان استفاده از حساب را نخواهد داشت.', () => submitUpdate(values), undefined, {
|
showAlert(
|
||||||
dangerAccept: true,
|
'این کاربر معلق شود؟ کاربر تا فعالسازی مجدد امکان استفاده از حساب را نخواهد داشت.',
|
||||||
})
|
() => submitUpdate(values),
|
||||||
|
undefined,
|
||||||
|
{
|
||||||
|
dangerAccept: true,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,9 +4,10 @@ import type { AdminEventDetailData } from './types'
|
|||||||
import { cleanup, fireEvent, render, screen } from '@testing-library/react'
|
import { cleanup, fireEvent, render, screen } from '@testing-library/react'
|
||||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||||
|
|
||||||
import AdminEventLifecycleActions from './AdminEventLifecycleActions'
|
|
||||||
import { texts } from '@/texts'
|
import { texts } from '@/texts'
|
||||||
|
|
||||||
|
import AdminEventLifecycleActions from './AdminEventLifecycleActions'
|
||||||
|
|
||||||
vi.mock('@/components/formElements/Button', () => ({
|
vi.mock('@/components/formElements/Button', () => ({
|
||||||
default: ({ children, onClick, to }: { children: ReactNode; onClick?: () => void; to?: string }) => (
|
default: ({ children, onClick, to }: { children: ReactNode; onClick?: () => void; to?: string }) => (
|
||||||
<button
|
<button
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
import { describe, expect, it } from 'vitest'
|
|
||||||
|
|
||||||
import type { AdminEventDetailData } from './types'
|
import type { AdminEventDetailData } from './types'
|
||||||
|
|
||||||
import { resolveAdminEventLifecycleHint } from './adminEventLifecycleHints'
|
import { describe, expect, it } from 'vitest'
|
||||||
|
|
||||||
import { texts } from '@/texts'
|
import { texts } from '@/texts'
|
||||||
|
|
||||||
|
import { resolveAdminEventLifecycleHint } from './adminEventLifecycleHints'
|
||||||
|
|
||||||
const baseEvent = {
|
const baseEvent = {
|
||||||
id: 'event-1',
|
id: 'event-1',
|
||||||
adminApprovedAt: null,
|
adminApprovedAt: null,
|
||||||
@ -29,6 +30,8 @@ describe('resolveAdminEventLifecycleHint', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('explains complete and cancel on live events', () => {
|
it('explains complete and cancel on live events', () => {
|
||||||
expect(resolveAdminEventLifecycleHint({ ...baseEvent, status: 'published', bookedCount: 2 })).toBe(texts.events.adminLifecycleHintPublished)
|
expect(resolveAdminEventLifecycleHint({ ...baseEvent, status: 'published', bookedCount: 2 })).toBe(
|
||||||
|
texts.events.adminLifecycleHintPublished
|
||||||
|
)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user