[E14][@ant] refactor: канон-тосты по всему marketplace — Notify → SuccessAlert/FailAlert/NotifyAlert

Системно заменён прямой Notify.create на канонические алерты (правый нижний
угол, тёмный фон, единый визуал) во всех 10 страницах marketplace:
positive→SuccessAlert, negative→FailAlert(e) (сам извлекает GraphQL-ошибку),
info/warning→NotifyAlert. Notify убран из quasar-импортов.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
ant
2026-05-30 11:01:02 +00:00
parent ee26bb9d59
commit 54c27599dc
10 changed files with 47 additions and 83 deletions
@@ -1,7 +1,7 @@
<script lang="ts" setup>
import { computed, onMounted, onUnmounted, ref, watch } from 'vue';
import { useRoute } from 'vue-router';
import { Notify } from 'quasar';
import { FailAlert } from 'src/shared/api';
import { OperatorBranchBar, useOperatorBranchStore } from 'src/entities/OperatorBranch';
import { BaseButton, EmptyState } from 'src/shared/ui/base';
import { PageHint } from 'src/shared/ui/domain';
@@ -93,8 +93,7 @@ async function loadAll(): Promise<void> {
issuances.value = i;
returns.value = ret;
} catch (e) {
const message = e instanceof Error ? e.message : String(e);
Notify.create({ type: 'negative', message });
FailAlert(e);
} finally {
loading.value = false;
}
@@ -1,6 +1,7 @@
<script lang="ts" setup>
import { computed, onMounted, ref } from 'vue';
import { Dialog, Notify } from 'quasar';
import { Dialog } from 'quasar';
import { SuccessAlert, FailAlert } from 'src/shared/api';
import { BaseButton, BaseCard, BaseDialog, EmptyState } from 'src/shared/ui/base';
import { PageHint } from 'src/shared/ui/domain';
import {
@@ -60,8 +61,7 @@ async function load(): Promise<void> {
stats.value = st;
allCategories.value = cats;
} catch (e) {
const message = e instanceof Error ? e.message : String(e);
Notify.create({ type: 'negative', message });
FailAlert(e);
} finally {
loading.value = false;
}
@@ -78,12 +78,11 @@ async function confirmAdd(): Promise<void> {
adding.value = true;
try {
await addAvailableCategories(ids);
Notify.create({ type: 'positive', message: `Добавлено категорий: ${ids.length}` });
SuccessAlert(`Добавлено категорий: ${ids.length}`);
addDialogOpen.value = false;
await load();
} catch (e) {
const message = e instanceof Error ? e.message : String(e);
Notify.create({ type: 'negative', message });
FailAlert(e);
} finally {
adding.value = false;
}
@@ -99,11 +98,10 @@ function onRemove(item: MarketplaceAvailableCategoryView): void {
}).onOk(async () => {
try {
await removeAvailableCategories([item.categoryId]);
Notify.create({ type: 'positive', message: 'Категория удалена из whitelist' });
SuccessAlert('Категория удалена из whitelist');
await load();
} catch (e) {
const message = e instanceof Error ? e.message : String(e);
Notify.create({ type: 'negative', message });
FailAlert(e);
}
});
}
@@ -1,6 +1,7 @@
<script lang="ts" setup>
import { computed, onMounted, ref } from 'vue';
import { Dialog, Notify } from 'quasar';
import { Dialog } from 'quasar';
import { SuccessAlert, FailAlert } from 'src/shared/api';
import { Queries } from '@coopenomics/sdk';
import { client } from 'src/shared/api/client';
import { marketplaceUnitShort } from 'src/shared/lib/consts';
@@ -113,8 +114,7 @@ async function loadPage(append: boolean): Promise<void> {
total.value = page.totalCount;
items.value = append ? items.value.concat(page.items) : page.items;
} catch (e) {
const message = e instanceof Error ? e.message : String(e);
Notify.create({ type: 'negative', message });
FailAlert(e);
} finally {
loading.value = false;
}
@@ -140,13 +140,9 @@ function onApprove(offer: MarketplacePendingOfferView): void {
items.value = items.value.filter((o) => o.id !== offer.id);
total.value = Math.max(0, total.value - 1);
detailsOpen.value = false;
Notify.create({
type: 'positive',
message: `Предложение «${offer.product_name}» одобрено`,
});
SuccessAlert(`Предложение «${offer.product_name}» одобрено`);
} catch (e) {
const message = e instanceof Error ? e.message : String(e);
Notify.create({ type: 'negative', message });
FailAlert(e);
} finally {
approving.value.delete(offer.id);
}
@@ -175,13 +171,9 @@ function onReject(offer: MarketplacePendingOfferView): void {
items.value = items.value.filter((o) => o.id !== offer.id);
total.value = Math.max(0, total.value - 1);
detailsOpen.value = false;
Notify.create({
type: 'positive',
message: `Предложение «${offer.product_name}» отклонено`,
});
SuccessAlert(`Предложение «${offer.product_name}» отклонено`);
} catch (e) {
const message = e instanceof Error ? e.message : String(e);
Notify.create({ type: 'negative', message });
FailAlert(e);
} finally {
rejecting.value.delete(offer.id);
}
@@ -352,7 +352,7 @@ q-page.mp-role-offerer.offer-wizard(role='region', aria-label='Создание
<script lang="ts" setup>
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue';
import { Dialog, LocalStorage, Notify } from 'quasar';
import { Dialog, LocalStorage } from 'quasar';
import type { QForm } from 'quasar';
import { useRoute, useRouter } from 'vue-router';
import { VerticalStepper } from 'src/shared/ui/domain/VerticalStepper';
@@ -490,7 +490,7 @@ function onWithdraw(): void {
withdrawing.value = true;
try {
await withdrawOffer(editId.value as string);
Notify.create({ type: 'positive', message: 'Предложение снято с публикации.' });
SuccessAlert('Предложение снято с публикации.');
void router.push({ name: 'marketplace-my-offers' });
} catch (e) {
FailAlert(e, 'Не удалось снять предложение');
@@ -514,10 +514,7 @@ function onTrigger(): void {
triggering.value = true;
try {
await triggerOpenSubscription(editId.value as string);
Notify.create({
type: 'positive',
message: 'Поставка запущена: заказы зафиксированы в партию и приняты.',
});
SuccessAlert('Поставка запущена: заказы зафиксированы в партию и приняты.');
void router.push({ name: 'marketplace-my-offers' });
} catch (e) {
FailAlert(e, 'Не удалось запустить поставку');
@@ -1,7 +1,7 @@
<script lang="ts" setup>
import { computed, onMounted, ref } from 'vue';
import { useRoute } from 'vue-router';
import { Notify } from 'quasar';
import { FailAlert } from 'src/shared/api';
import {
CatalogOfferCard,
type CatalogOffer,
@@ -120,8 +120,7 @@ async function loadPage(append: boolean): Promise<void> {
total.value = page.totalCount;
items.value = append ? items.value.concat(page.items) : page.items;
} catch (e) {
const message = e instanceof Error ? e.message : String(e);
Notify.create({ type: 'negative', message });
FailAlert(e);
} finally {
loading.value = false;
}
@@ -1,6 +1,7 @@
<script lang="ts" setup>
import { computed, onBeforeUnmount, onMounted, ref } from 'vue';
import { Dialog, Loading, Notify } from 'quasar';
import { Dialog, Loading } from 'quasar';
import { SuccessAlert, FailAlert } from 'src/shared/api';
import { OrderCard, toOrderCardModel, type Order as OrderCardModel } from 'src/widgets/Marketplace/OrderCard';
import { BaseButton, EmptyState } from 'src/shared/ui/base';
import { PageHint } from 'src/shared/ui/domain';
@@ -93,8 +94,7 @@ async function load(page: number, append: boolean): Promise<void> {
currentPage.value = result.currentPage;
items.value = append ? items.value.concat(result.items) : result.items;
} catch (e) {
const message = e instanceof Error ? e.message : String(e);
Notify.create({ type: 'negative', message });
FailAlert(e);
} finally {
loading.value = false;
}
@@ -122,14 +122,10 @@ function confirmCancel(order: MarketplaceOrderView): void {
Loading.show({ message: 'Отменяю заказ…' });
try {
const result = await cancelOrder(order.id);
Notify.create({
type: 'positive',
message: `Заказ отменён. Средства разблокированы (tx ${result.tx_hash.slice(0, 8)}).`,
});
SuccessAlert(`Заказ отменён. Средства разблокированы (tx ${result.tx_hash.slice(0, 8)}).`);
await load(1, false);
} catch (e) {
const message = e instanceof Error ? e.message : String(e);
Notify.create({ type: 'negative', message, timeout: 6000 });
FailAlert(e);
} finally {
Loading.hide();
}
@@ -1,6 +1,7 @@
<script lang="ts" setup>
import { computed, onMounted, onUnmounted, ref } from 'vue';
import { Dialog, Notify } from 'quasar';
import { Dialog } from 'quasar';
import { SuccessAlert, FailAlert, NotifyAlert } from 'src/shared/api';
import { useRoute, useRouter } from 'vue-router';
import { BaseButton, EmptyState } from 'src/shared/ui/base';
import { PageHint } from 'src/shared/ui/domain';
@@ -125,8 +126,7 @@ async function load(page: number, append: boolean): Promise<void> {
totalPages.value = result.totalPages;
currentPage.value = result.currentPage;
} catch (e) {
const message = e instanceof Error ? e.message : String(e);
Notify.create({ type: 'negative', message });
FailAlert(e);
} finally {
loading.value = false;
}
@@ -151,15 +151,14 @@ async function onAccept(orderId: string): Promise<void> {
throw new Error('У группового заказа отсутствует идентификатор сводной заявки (cycle_id).');
}
await acceptConsolidatedRequest(order.cycle_id);
Notify.create({ type: 'positive', message: 'Сводная заявка партии принята', timeout: 4000 });
SuccessAlert('Сводная заявка партии принята');
} else {
await acceptIndividualOrder(orderId);
Notify.create({ type: 'positive', message: 'Заказ принят', timeout: 4000 });
SuccessAlert('Заказ принят');
}
await load(1, false);
} catch (e) {
const message = e instanceof Error ? e.message : String(e);
Notify.create({ type: 'negative', message, timeout: 6000 });
FailAlert(e);
} finally {
loading.value = false;
}
@@ -182,15 +181,14 @@ function onDecline(orderId: string): void {
throw new Error('У группового заказа отсутствует идентификатор сводной заявки (cycle_id).');
}
await declineConsolidatedRequest(order.cycle_id, reason.trim());
Notify.create({ type: 'info', message: 'Сводная заявка партии отклонена', timeout: 4000 });
NotifyAlert('Сводная заявка партии отклонена');
} else {
await declineIndividualOrder(orderId, reason.trim());
Notify.create({ type: 'info', message: 'Заказ отклонён', timeout: 4000 });
NotifyAlert('Заказ отклонён');
}
await load(1, false);
} catch (e) {
const message = e instanceof Error ? e.message : String(e);
Notify.create({ type: 'negative', message, timeout: 6000 });
FailAlert(e);
} finally {
loading.value = false;
}
@@ -1,6 +1,6 @@
<script lang="ts" setup>
import { computed, onMounted, onUnmounted, ref } from 'vue';
import { Notify } from 'quasar';
import { SuccessAlert, FailAlert } from 'src/shared/api';
import { useRoute, useRouter } from 'vue-router';
import { useSystemStore } from 'src/entities/System/model';
import { useHeaderActions } from 'src/shared/hooks';
@@ -169,11 +169,10 @@ async function onRepublish(card: OfferCard): Promise<void> {
republishing.value = String(card.id);
try {
await republishOffer(String(card.id));
Notify.create({ type: 'positive', message: 'Предложение возвращено на модерацию.' });
SuccessAlert('Предложение возвращено на модерацию.');
await load(1, false);
} catch (e) {
const message = e instanceof Error ? e.message : String(e);
Notify.create({ type: 'negative', message });
FailAlert(e);
} finally {
republishing.value = null;
}
@@ -187,8 +186,7 @@ async function load(page: number, append: boolean): Promise<void> {
totalPages.value = result.totalPages;
currentPage.value = result.currentPage;
} catch (e) {
const message = e instanceof Error ? e.message : String(e);
Notify.create({ type: 'negative', message });
FailAlert(e);
} finally {
loading.value = false;
}
@@ -1,6 +1,6 @@
<script lang="ts" setup>
import { computed, onMounted, ref } from 'vue';
import { Notify } from 'quasar';
import { SuccessAlert, FailAlert, NotifyAlert } from 'src/shared/api';
import { useRouter } from 'vue-router';
import {
OnboardingCPPGate,
@@ -61,8 +61,7 @@ async function load(): Promise<void> {
try {
state.value = await fetchOnboardingState();
} catch (e) {
const message = e instanceof Error ? e.message : String(e);
Notify.create({ type: 'negative', message });
FailAlert(e);
} finally {
loading.value = false;
}
@@ -99,11 +98,7 @@ async function onAccept(_documentIds: string[]): Promise<void> {
const confirmed =
(!!state.value && !state.value.requires_gate) || (await waitForSignatureSynced());
if (confirmed) {
Notify.create({
type: 'positive',
message: 'Оферта ЦПП «Стол заказов» подписана. Открываем стол заказчика…',
timeout: 1500,
});
SuccessAlert('Оферта ЦПП «Стол заказов» подписана. Открываем стол заказчика…');
// Подпись синхронизирована: backend теперь выдаёт полные orderer-права
// вместо маркера Onboarding:orderer. Перечитываем десктоп (гранты) и
// переустанавливаем маршруты, затем ведём на первую доступную страницу
@@ -122,24 +117,17 @@ async function onAccept(_documentIds: string[]): Promise<void> {
} else {
// Синк не успел за отведённое окно — крайне редко; даём пользователю
// явный сигнал перезагрузить страницу.
Notify.create({
type: 'info',
message: 'Подпись принята блокчейном и синхронизируется. Обновите страницу через несколько секунд.',
});
NotifyAlert('Подпись принята блокчейном и синхронизируется. Обновите страницу через несколько секунд.');
}
} catch (e) {
const message = e instanceof Error ? e.message : String(e);
Notify.create({ type: 'negative', message });
FailAlert(e);
} finally {
loading.value = false;
}
}
function onDecline(): void {
Notify.create({
type: 'warning',
message: 'Без подписи ЦПП Стол заказов недоступен. Вернитесь, когда будете готовы.',
});
NotifyAlert('Без подписи ЦПП Стол заказов недоступен. Вернитесь, когда будете готовы.');
void router.push({ name: 'wallet' });
}
@@ -1,6 +1,6 @@
<script lang="ts" setup>
import { computed, onMounted, onUnmounted, ref } from 'vue';
import { Notify } from 'quasar';
import { FailAlert } from 'src/shared/api';
import {
OrderCard,
orderStatusDisplay,
@@ -146,8 +146,7 @@ async function load(): Promise<void> {
});
items.value = result.items;
} catch (e) {
const message = e instanceof Error ? e.message : String(e);
Notify.create({ type: 'negative', message });
FailAlert(e);
} finally {
loading.value = false;
}