chore: set toast color (#326)
This commit is contained in:
@@ -84,7 +84,8 @@ export default function AdminPage({ messages, locale }: Props) {
|
|||||||
const data = await updateUserRole(tokenContext.token.access_token, userEdit.id, role);
|
const data = await updateUserRole(tokenContext.token.access_token, userEdit.id, role);
|
||||||
if (data.user) {
|
if (data.user) {
|
||||||
addToast({
|
addToast({
|
||||||
title: 'Info',
|
title: 'Success',
|
||||||
|
color: 'success',
|
||||||
description: messages.roleChanged,
|
description: messages.roleChanged,
|
||||||
});
|
});
|
||||||
setUsers((prevUsers) => {
|
setUsers((prevUsers) => {
|
||||||
@@ -106,13 +107,16 @@ export default function AdminPage({ messages, locale }: Props) {
|
|||||||
|
|
||||||
if (data && data.user) {
|
if (data && data.user) {
|
||||||
addToast({
|
addToast({
|
||||||
title: 'Info',
|
title: 'Success',
|
||||||
|
color: 'success',
|
||||||
description: messages.lostAdminAuth,
|
description: messages.lostAdminAuth,
|
||||||
});
|
});
|
||||||
router.push(`/`, { locale: locale });
|
router.push(`/`, { locale: locale });
|
||||||
} else {
|
} else {
|
||||||
|
setIsConfirmDialogOpen(false);
|
||||||
addToast({
|
addToast({
|
||||||
title: 'Info',
|
title: 'Error',
|
||||||
|
color: 'danger',
|
||||||
description: messages.atLeast,
|
description: messages.atLeast,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -273,7 +273,8 @@ export default function CaseEditor({
|
|||||||
await updateCaseTags(tokenContext.token.access_token, Number(caseId), tagIds, projectId);
|
await updateCaseTags(tokenContext.token.access_token, Number(caseId), tagIds, projectId);
|
||||||
|
|
||||||
addToast({
|
addToast({
|
||||||
title: 'Info',
|
title: 'Success',
|
||||||
|
color: 'success',
|
||||||
description: messages.updatedTestCase,
|
description: messages.updatedTestCase,
|
||||||
});
|
});
|
||||||
setIsDirty(false);
|
setIsDirty(false);
|
||||||
|
|||||||
@@ -192,7 +192,8 @@ export default function RunEditor({
|
|||||||
await initTestCases();
|
await initTestCases();
|
||||||
|
|
||||||
addToast({
|
addToast({
|
||||||
title: 'Info',
|
title: 'Success',
|
||||||
|
color: 'success',
|
||||||
description: messages.updatedTestRun,
|
description: messages.updatedTestRun,
|
||||||
});
|
});
|
||||||
setIsUpdating(false);
|
setIsUpdating(false);
|
||||||
|
|||||||
@@ -71,12 +71,14 @@ export default function ProjectTagsManager({ projectId, messages }: ProjectTagsM
|
|||||||
setTagName('');
|
setTagName('');
|
||||||
addToast({
|
addToast({
|
||||||
title: 'Success',
|
title: 'Success',
|
||||||
|
color: 'success',
|
||||||
description: messages.tagCreated,
|
description: messages.tagCreated,
|
||||||
});
|
});
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
const errorMessage = error instanceof Error ? error.message : messages.tagErrorCreate;
|
const errorMessage = error instanceof Error ? error.message : messages.tagErrorCreate;
|
||||||
addToast({
|
addToast({
|
||||||
title: 'Error',
|
title: 'Error',
|
||||||
|
color: 'danger',
|
||||||
description: errorMessage,
|
description: errorMessage,
|
||||||
});
|
});
|
||||||
logError('Error creating tag:', error);
|
logError('Error creating tag:', error);
|
||||||
@@ -97,12 +99,14 @@ export default function ProjectTagsManager({ projectId, messages }: ProjectTagsM
|
|||||||
setEditErrorMessage('');
|
setEditErrorMessage('');
|
||||||
addToast({
|
addToast({
|
||||||
title: 'Success',
|
title: 'Success',
|
||||||
|
color: 'success',
|
||||||
description: messages.tagUpdated,
|
description: messages.tagUpdated,
|
||||||
});
|
});
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
const errorMessage = error instanceof Error ? error.message : messages.tagErrorUpdate;
|
const errorMessage = error instanceof Error ? error.message : messages.tagErrorUpdate;
|
||||||
addToast({
|
addToast({
|
||||||
title: 'Error',
|
title: 'Error',
|
||||||
|
color: 'danger',
|
||||||
description: errorMessage,
|
description: errorMessage,
|
||||||
});
|
});
|
||||||
logError('Error updating tag:', error);
|
logError('Error updating tag:', error);
|
||||||
@@ -116,12 +120,14 @@ export default function ProjectTagsManager({ projectId, messages }: ProjectTagsM
|
|||||||
setOpenPopoverTagId(null);
|
setOpenPopoverTagId(null);
|
||||||
addToast({
|
addToast({
|
||||||
title: 'Success',
|
title: 'Success',
|
||||||
|
color: 'success',
|
||||||
description: messages.tagDeleted,
|
description: messages.tagDeleted,
|
||||||
});
|
});
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
const errorMessage = error instanceof Error ? error.message : messages.tagErrorDelete;
|
const errorMessage = error instanceof Error ? error.message : messages.tagErrorDelete;
|
||||||
addToast({
|
addToast({
|
||||||
title: 'Error',
|
title: 'Error',
|
||||||
|
color: 'danger',
|
||||||
description: errorMessage,
|
description: errorMessage,
|
||||||
});
|
});
|
||||||
logError('Error deleting tag:', error);
|
logError('Error deleting tag:', error);
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ const TokenProvider = ({ toastMessages, locale, children }: TokenProps) => {
|
|||||||
if (ret.reason === 'notoken') {
|
if (ret.reason === 'notoken') {
|
||||||
if (toastMessages) {
|
if (toastMessages) {
|
||||||
addToast({
|
addToast({
|
||||||
title: 'Info',
|
title: 'Error',
|
||||||
description: toastMessages.needSignedIn,
|
description: toastMessages.needSignedIn,
|
||||||
color: 'danger',
|
color: 'danger',
|
||||||
});
|
});
|
||||||
@@ -147,7 +147,7 @@ const TokenProvider = ({ toastMessages, locale, children }: TokenProps) => {
|
|||||||
} else if (ret.reason === 'expired') {
|
} else if (ret.reason === 'expired') {
|
||||||
if (toastMessages) {
|
if (toastMessages) {
|
||||||
addToast({
|
addToast({
|
||||||
title: 'Info',
|
title: 'Error',
|
||||||
description: toastMessages.sessionExpired,
|
description: toastMessages.sessionExpired,
|
||||||
color: 'danger',
|
color: 'danger',
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user