53 lines
1.9 KiB
TypeScript
53 lines
1.9 KiB
TypeScript
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
|
|
import { Stack, Text } from "@mantine/core";
|
|
import { fn } from "storybook/test";
|
|
|
|
import { InvestmentRefreshState } from "./InvestmentRefreshState.view";
|
|
|
|
const meta = {
|
|
args: { labelScope: "portfolio", refreshError: false, refreshing: false, retry: fn() },
|
|
argTypes: {
|
|
refreshError: { control: "boolean" },
|
|
refreshing: { control: "boolean" },
|
|
retry: { control: false },
|
|
},
|
|
component: InvestmentRefreshState,
|
|
parameters: {
|
|
docs: {
|
|
description: {
|
|
component:
|
|
"Обновление уже показанных данных портфеля. Синтетические суммы остаются видимыми вместе с InvestmentRefreshState при refetch и его ошибке. Суммы синтетические; это presentation Client Cached Snapshot, без QueryClient и запроса API. Retry регистрирует локальное действие в Actions и не доказывает восстановление API.",
|
|
},
|
|
},
|
|
},
|
|
render: arguments_ => (
|
|
<Stack>
|
|
<Text>125 000,50 ₽ · 320 USD</Text>
|
|
|
|
<InvestmentRefreshState {...arguments_} />
|
|
</Stack>
|
|
),
|
|
tags: ["autodocs"],
|
|
title: "Product/InvestmentRefreshState",
|
|
} satisfies Meta<typeof InvestmentRefreshState>;
|
|
|
|
export default meta;
|
|
|
|
type Story = StoryObj<typeof meta>;
|
|
|
|
export const Idle: Story = { name: "Сохранённые данные" };
|
|
export const Refreshing: Story = {
|
|
args: { refreshing: true },
|
|
name: "Фоновое обновление",
|
|
};
|
|
export const RefreshError: Story = {
|
|
args: { labelScope: "portfolio", refreshError: true },
|
|
name: "Ошибка обновления с retry",
|
|
};
|
|
|
|
export const SourceFailure: Story = {
|
|
args: { labelScope: "portfolio", refreshError: true, sourceError: true },
|
|
name: "Ошибка синхронизации сохраняет суммы",
|
|
};
|