feat: add manual bank card screens

Add cards, operations, refunds, categories and monthly summaries with Mantine date controls.

Derive banking types from runtime OpenAPI. Cover recovery and session isolation.
This commit is contained in:
2026-09-12 18:34:41 +03:00
parent 427ca23a43
commit ff4e88edbe
50 changed files with 7795 additions and 10 deletions
@@ -0,0 +1,102 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { BankSummaryView } from "./BankSummary.view";
const money = (value: string) => ({ currency: "RUB", value });
const meta = {
title: "Product/BankCards/Summary",
component: BankSummaryView,
tags: ["autodocs"],
parameters: {
docs: {
description: {
component:
"Месячные расходы ручного учёта. Вымышленные суммы, без API и сохранения. Возвраты учитываются отдельно; отрицательный итог не превращается в процентную диаграмму.",
},
},
},
args: {
loading: false,
error: false,
fetching: false,
retry: () => {},
data: {
month: "2026-09",
cardId: null,
expenses: money("8500"),
refunds: money("1000"),
net: money("7500"),
categories: [
{
categoryId: "food",
categoryName: "Продукты",
expenses: money("8500"),
refunds: money("1000"),
net: money("7500"),
},
],
},
},
} satisfies Meta<typeof BankSummaryView>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Loaded: Story = { name: "Расходы и возвраты" };
export const RefundMonth: Story = {
name: "Возврат покупки прошлого месяца",
args: {
data: {
month: "2026-09",
cardId: null,
expenses: money("0"),
refunds: money("600"),
net: money("-600"),
categories: [
{
categoryId: "shopping",
categoryName:
"Покупки с длинным пользовательским названием категории",
expenses: money("0"),
refunds: money("600"),
net: money("-600"),
},
],
},
},
};
export const Empty: Story = {
name: "Известные нули",
args: {
data: {
month: "2026-09",
cardId: null,
expenses: money("0"),
refunds: money("0"),
net: money("0"),
categories: [],
},
},
};
export const Loading: Story = {
name: "Начальная загрузка",
args: { data: undefined, loading: true },
};
export const Failed: Story = {
name: "Ошибка без данных",
args: { data: undefined, error: true },
};
export const CachedError: Story = {
name: "Сохранённые суммы при ошибке обновления",
args: { error: true },
};
export const LongAmounts: Story = {
name: "Точный итог длиннее предела отдельного ввода",
args: {
data: {
month: "2026-09",
cardId: null,
expenses: money("184467440737095516.14"),
refunds: money("0"),
net: money("184467440737095516.14"),
categories: [],
},
},
};