Compare commits
5 Commits
feat/commi
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 6610e43200 | |||
|
|
ec62a0591e | ||
| 97b61de092 | |||
|
|
0e0186fdbb | ||
| 02ca34d088 |
16
README.md
16
README.md
@@ -15,13 +15,15 @@ family_budget/
|
|||||||
|
|
||||||
## Tech stack
|
## Tech stack
|
||||||
|
|
||||||
| Layer | Choice | Rationale |
|
|
||||||
|---------- |------------------------|--------------------------------------------------------|
|
| Layer | Choice | Rationale |
|
||||||
| Backend | Express + TypeScript | Simple, well-known, sufficient for a small local app |
|
| ---------- | --------------------- | ---------------------------------------------------- |
|
||||||
| Frontend | React + Vite + TS | Fast dev experience, modern tooling |
|
| Backend | Express + TypeScript | Simple, well-known, sufficient for a small local app |
|
||||||
| Database | PostgreSQL | Deployed on Synology NAS |
|
| Frontend | React + Vite + TS | Fast dev experience, modern tooling |
|
||||||
| Migrations | Knex | Lightweight, SQL-close, supports seeds |
|
| Database | PostgreSQL | Deployed on Synology NAS |
|
||||||
| Shared | Pure TypeScript types | Zero-runtime, imported by both backend and frontend |
|
| Migrations | Knex | Lightweight, SQL-close, supports seeds |
|
||||||
|
| Shared | Pure TypeScript types | Zero-runtime, imported by both backend and frontend |
|
||||||
|
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@family-budget/frontend",
|
"name": "@family-budget/frontend",
|
||||||
"version": "0.8.5",
|
"version": "0.8.6",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export function App() {
|
|||||||
const { user, loading } = useAuth();
|
const { user, loading } = useAuth();
|
||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
return <div className="app-loading">Загрузка...</div>;
|
return <div className="app-state app-state--loading">Загрузка...</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!user) {
|
if (!user) {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ export function AccountsList() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
return <div className="section-loading">Загрузка...</div>;
|
return <div className="state state--loading">Загрузка...</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -72,21 +72,21 @@ export function AccountsList() {
|
|||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
a.alias || (
|
a.alias || (
|
||||||
<span className="text-muted">не задан</span>
|
<span className="muted-text">не задан</span>
|
||||||
)
|
)
|
||||||
)}
|
)}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{editingId === a.id ? (
|
{editingId === a.id ? (
|
||||||
<div className="btn-group">
|
<div className="button-group">
|
||||||
<button
|
<button
|
||||||
className="btn btn-sm btn-primary"
|
className="button button--primary button--small"
|
||||||
onClick={() => handleSave(a.id)}
|
onClick={() => handleSave(a.id)}
|
||||||
>
|
>
|
||||||
Сохранить
|
Сохранить
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
className="btn btn-sm btn-secondary"
|
className="button button--secondary button--small"
|
||||||
onClick={() => setEditingId(null)}
|
onClick={() => setEditingId(null)}
|
||||||
>
|
>
|
||||||
Отмена
|
Отмена
|
||||||
@@ -94,7 +94,7 @@ export function AccountsList() {
|
|||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<button
|
<button
|
||||||
className="btn btn-sm btn-secondary"
|
className="button button--secondary button--small"
|
||||||
onClick={() => handleEdit(a)}
|
onClick={() => handleEdit(a)}
|
||||||
>
|
>
|
||||||
Изменить
|
Изменить
|
||||||
@@ -105,7 +105,7 @@ export function AccountsList() {
|
|||||||
))}
|
))}
|
||||||
{accounts.length === 0 && (
|
{accounts.length === 0 && (
|
||||||
<tr>
|
<tr>
|
||||||
<td colSpan={5} className="td-center text-muted">
|
<td colSpan={5} className="data-table__cell data-table__cell--center muted-text">
|
||||||
Нет счетов. Импортируйте выписку.
|
Нет счетов. Импортируйте выписку.
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export function CategoriesList() {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
return <div className="section-loading">Загрузка...</div>;
|
return <div className="state state--loading">Загрузка...</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -36,9 +36,9 @@ export function CategoriesList() {
|
|||||||
<tbody>
|
<tbody>
|
||||||
{categories.map((c) => (
|
{categories.map((c) => (
|
||||||
<tr key={c.id}>
|
<tr key={c.id}>
|
||||||
<td>{c.name}</td>
|
<td>{c.name}</td>
|
||||||
<td>
|
<td>
|
||||||
<span className={`badge badge-${c.type}`}>
|
<span className={`badge badge--${c.type}`}>
|
||||||
{TYPE_LABELS[c.type] ?? c.type}
|
{TYPE_LABELS[c.type] ?? c.type}
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const COLORS = [
|
const COLORS = [
|
||||||
'#3b82f6', '#ef4444', '#10b981', '#f59e0b', '#8b5cf6',
|
'#2563eb', '#e85d3f', '#0f9f7f', '#d89b17', '#7c5cdb',
|
||||||
'#ec4899', '#06b6d4', '#84cc16', '#f97316', '#6366f1',
|
'#c8558f', '#1495a3', '#79a92f', '#e06d2f', '#4f6fd7',
|
||||||
'#14b8a6', '#e11d48', '#0ea5e9', '#a855f7', '#22c55e',
|
'#1c9a8a', '#d43d5c', '#277bbd', '#9b59b6', '#2f9f63',
|
||||||
];
|
];
|
||||||
|
|
||||||
const rubFormatter = new Intl.NumberFormat('ru-RU', {
|
const rubFormatter = new Intl.NumberFormat('ru-RU', {
|
||||||
@@ -30,7 +30,7 @@ export function CategoryChart({ data }: Props) {
|
|||||||
const chartHeight = isMobile ? 250 : 300;
|
const chartHeight = isMobile ? 250 : 300;
|
||||||
|
|
||||||
if (data.length === 0) {
|
if (data.length === 0) {
|
||||||
return <div className="chart-empty">Нет данных за период</div>;
|
return <div className="state state--empty">Нет данных за период</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const chartData = data.map((item) => ({
|
const chartData = data.map((item) => ({
|
||||||
@@ -41,7 +41,7 @@ export function CategoryChart({ data }: Props) {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="category-chart-wrapper">
|
<div className="category-chart">
|
||||||
<ResponsiveContainer width="100%" height={chartHeight}>
|
<ResponsiveContainer width="100%" height={chartHeight}>
|
||||||
<PieChart>
|
<PieChart>
|
||||||
<Pie
|
<Pie
|
||||||
@@ -58,7 +58,7 @@ export function CategoryChart({ data }: Props) {
|
|||||||
>
|
>
|
||||||
{chartData.map((_, idx) => (
|
{chartData.map((_, idx) => (
|
||||||
<Cell
|
<Cell
|
||||||
key={idx}
|
key={`${idx}-${COLORS[idx % COLORS.length]}`}
|
||||||
fill={COLORS[idx % COLORS.length]}
|
fill={COLORS[idx % COLORS.length]}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
@@ -69,13 +69,13 @@ export function CategoryChart({ data }: Props) {
|
|||||||
</PieChart>
|
</PieChart>
|
||||||
</ResponsiveContainer>
|
</ResponsiveContainer>
|
||||||
|
|
||||||
<table className="category-table">
|
<table className="category-chart__table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Категория</th>
|
<th>Категория</th>
|
||||||
<th>Сумма</th>
|
<th>Сумма</th>
|
||||||
<th className="th-center">Операций</th>
|
<th className="category-chart__cell category-chart__cell--center">Операций</th>
|
||||||
<th className="th-center">Доля</th>
|
<th className="category-chart__cell category-chart__cell--center">Доля</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -83,7 +83,7 @@ export function CategoryChart({ data }: Props) {
|
|||||||
<tr key={item.categoryId}>
|
<tr key={item.categoryId}>
|
||||||
<td>
|
<td>
|
||||||
<span
|
<span
|
||||||
className="color-dot"
|
className="category-chart__dot"
|
||||||
style={{
|
style={{
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
COLORS[idx % COLORS.length],
|
COLORS[idx % COLORS.length],
|
||||||
@@ -92,8 +92,8 @@ export function CategoryChart({ data }: Props) {
|
|||||||
{item.categoryName}
|
{item.categoryName}
|
||||||
</td>
|
</td>
|
||||||
<td>{formatAmount(item.amount)}</td>
|
<td>{formatAmount(item.amount)}</td>
|
||||||
<td className="td-center">{item.txCount}</td>
|
<td className="category-chart__cell category-chart__cell--center">{item.txCount}</td>
|
||||||
<td className="td-center">
|
<td className="category-chart__cell category-chart__cell--center">
|
||||||
{(item.share * 100).toFixed(1)}%
|
{(item.share * 100).toFixed(1)}%
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -31,24 +31,29 @@ export function ClearHistoryModal({ onClose, onDone }: Props) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="modal-overlay" onClick={onClose}>
|
<div
|
||||||
|
className="modal-backdrop"
|
||||||
|
onMouseDown={(e) => {
|
||||||
|
if (e.target === e.currentTarget) onClose();
|
||||||
|
}}
|
||||||
|
>
|
||||||
<div className="modal" onClick={(e) => e.stopPropagation()}>
|
<div className="modal" onClick={(e) => e.stopPropagation()}>
|
||||||
<div className="modal-header">
|
<div className="modal__header">
|
||||||
<h2>Очистить историю операций</h2>
|
<h2>Очистить историю операций</h2>
|
||||||
<button className="btn-close" onClick={onClose}>
|
<button className="modal__close-button" onClick={onClose} aria-label="Закрыть">
|
||||||
×
|
×
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="modal-body">
|
<div className="modal__body">
|
||||||
<p className="clear-history-warn">
|
<p className="danger-note">
|
||||||
Все транзакции будут безвозвратно удалены. Счета и категории
|
Все транзакции будут безвозвратно удалены. Счета и категории
|
||||||
сохранятся.
|
сохранятся.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
{error && <div className="alert alert-error">{error}</div>}
|
{error && <div className="alert alert--error">{error}</div>}
|
||||||
|
|
||||||
<div className="form-group form-group-checkbox clear-history-check">
|
<div className="field field--checkbox danger-note__check">
|
||||||
<label>
|
<label>
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
@@ -59,7 +64,7 @@ export function ClearHistoryModal({ onClose, onDone }: Props) {
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="form-group form-group-checkbox clear-history-check">
|
<div className="field field--checkbox danger-note__check">
|
||||||
<label>
|
<label>
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
@@ -72,15 +77,15 @@ export function ClearHistoryModal({ onClose, onDone }: Props) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="modal-footer">
|
<div className="modal__footer">
|
||||||
<button
|
<button
|
||||||
className="btn btn-danger"
|
className="button button--danger"
|
||||||
onClick={handleConfirm}
|
onClick={handleConfirm}
|
||||||
disabled={!canConfirm || loading}
|
disabled={!canConfirm || loading}
|
||||||
>
|
>
|
||||||
{loading ? 'Удаление…' : 'Удалить всё'}
|
{loading ? 'Удаление…' : 'Удалить всё'}
|
||||||
</button>
|
</button>
|
||||||
<button className="btn btn-secondary" onClick={onClose}>
|
<button className="button button--secondary" onClick={onClose}>
|
||||||
Отмена
|
Отмена
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -34,16 +34,16 @@ export function DataSection() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="data-section">
|
<div className="data-section">
|
||||||
<div className="section-block">
|
<div className="data-section__block">
|
||||||
<h3>История импортов</h3>
|
<h3>История импортов</h3>
|
||||||
<p className="section-desc">
|
<p className="data-section__description">
|
||||||
Список импортов выписок. Можно удалить операции конкретного импорта.
|
Список импортов выписок. Можно удалить операции конкретного импорта.
|
||||||
</p>
|
</p>
|
||||||
{imports.length === 0 ? (
|
{imports.length === 0 ? (
|
||||||
<p className="muted">Импортов пока нет.</p>
|
<p className="muted-text">Импортов пока нет.</p>
|
||||||
) : (
|
) : (
|
||||||
<div className="table-responsive">
|
<div className="table-shell">
|
||||||
<table className="table">
|
<table className="data-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Дата</th>
|
<th>Дата</th>
|
||||||
@@ -67,7 +67,7 @@ export function DataSection() {
|
|||||||
<td>
|
<td>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="btn btn-sm btn-danger"
|
className="button button--danger button--small"
|
||||||
onClick={() => setImpToDelete(imp)}
|
onClick={() => setImpToDelete(imp)}
|
||||||
disabled={imp.importedCount === 0}
|
disabled={imp.importedCount === 0}
|
||||||
>
|
>
|
||||||
@@ -82,15 +82,15 @@ export function DataSection() {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="section-block">
|
<div className="data-section__block">
|
||||||
<h3>Очистка данных</h3>
|
<h3>Очистка данных</h3>
|
||||||
<p className="section-desc">
|
<p className="data-section__description">
|
||||||
Очистить историю операций (все транзакции). Счета, категории и
|
Очистить историю операций (все транзакции). Счета, категории и
|
||||||
правила сохранятся.
|
правила сохранятся.
|
||||||
</p>
|
</p>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="btn btn-danger"
|
className="button button--danger"
|
||||||
onClick={() => setShowClearModal(true)}
|
onClick={() => setShowClearModal(true)}
|
||||||
>
|
>
|
||||||
Очистить историю
|
Очистить историю
|
||||||
|
|||||||
@@ -31,36 +31,41 @@ export function DeleteImportModal({ imp, onClose, onDone }: Props) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="modal-overlay" onClick={onClose}>
|
<div
|
||||||
|
className="modal-backdrop"
|
||||||
|
onMouseDown={(e) => {
|
||||||
|
if (e.target === e.currentTarget) onClose();
|
||||||
|
}}
|
||||||
|
>
|
||||||
<div className="modal" onClick={(e) => e.stopPropagation()}>
|
<div className="modal" onClick={(e) => e.stopPropagation()}>
|
||||||
<div className="modal-header">
|
<div className="modal__header">
|
||||||
<h2>Удалить импорт</h2>
|
<h2>Удалить импорт</h2>
|
||||||
<button className="btn-close" onClick={onClose}>
|
<button className="modal__close-button" onClick={onClose} aria-label="Закрыть">
|
||||||
×
|
×
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="modal-body">
|
<div className="modal__body">
|
||||||
<p className="clear-history-warn">
|
<p className="danger-note">
|
||||||
Будут удалены все операции этого импорта ({imp.importedCount}{' '}
|
Будут удалены все операции этого импорта ({imp.importedCount}{' '}
|
||||||
шт.): {imp.bank} / {accountLabel}
|
шт.): {imp.bank} / {accountLabel}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
{error && <div className="alert alert-error">{error}</div>}
|
{error && <div className="alert alert--error">{error}</div>}
|
||||||
|
|
||||||
<p>Действие необратимо.</p>
|
<p>Действие необратимо.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="modal-footer">
|
<div className="modal__footer">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="btn btn-danger"
|
className="button button--danger"
|
||||||
onClick={handleConfirm}
|
onClick={handleConfirm}
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
>
|
>
|
||||||
{loading ? 'Удаление…' : 'Удалить'}
|
{loading ? 'Удаление…' : 'Удалить'}
|
||||||
</button>
|
</button>
|
||||||
<button type="button" className="btn btn-secondary" onClick={onClose}>
|
<button type="button" className="button button--secondary" onClick={onClose}>
|
||||||
Отмена
|
Отмена
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -82,43 +82,48 @@ export function EditTransactionModal({
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="modal-overlay" onClick={onClose}>
|
<div
|
||||||
|
className="modal-backdrop"
|
||||||
|
onMouseDown={(e) => {
|
||||||
|
if (e.target === e.currentTarget) onClose();
|
||||||
|
}}
|
||||||
|
>
|
||||||
<div className="modal" onClick={(e) => e.stopPropagation()}>
|
<div className="modal" onClick={(e) => e.stopPropagation()}>
|
||||||
<div className="modal-header">
|
<div className="modal__header">
|
||||||
<h2>Редактирование операции</h2>
|
<h2>Редактирование операции</h2>
|
||||||
<button className="btn-close" onClick={onClose}>
|
<button className="modal__close-button" onClick={onClose} aria-label="Закрыть">
|
||||||
×
|
×
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form onSubmit={handleSubmit}>
|
<form onSubmit={handleSubmit}>
|
||||||
<div className="modal-body">
|
<div className="modal__body">
|
||||||
{error && <div className="alert alert-error">{error}</div>}
|
{error && <div className="alert alert--error">{error}</div>}
|
||||||
|
|
||||||
<div className="modal-tx-info">
|
<div className="transaction-preview">
|
||||||
<div className="modal-tx-row">
|
<div className="transaction-preview__row">
|
||||||
<span className="modal-tx-label">Дата</span>
|
<span className="transaction-preview__label">Дата</span>
|
||||||
<span>{formatDateTime(transaction.operationAt)}</span>
|
<span>{formatDateTime(transaction.operationAt)}</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="modal-tx-row">
|
<div className="transaction-preview__row">
|
||||||
<span className="modal-tx-label">Сумма</span>
|
<span className="transaction-preview__label">Сумма</span>
|
||||||
<span>{formatAmount(transaction.amountSigned)}</span>
|
<span>{formatAmount(transaction.amountSigned)}</span>
|
||||||
</div>
|
</div>
|
||||||
{transaction.commission !== 0 && (
|
{transaction.commission !== 0 && (
|
||||||
<div className="modal-tx-row">
|
<div className="transaction-preview__row">
|
||||||
<span className="modal-tx-label">Комиссия</span>
|
<span className="transaction-preview__label">Комиссия</span>
|
||||||
<span>{formatAmount(getCommissionAmountSigned(transaction))}</span>
|
<span>{formatAmount(getCommissionAmountSigned(transaction))}</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className="modal-tx-row">
|
<div className="transaction-preview__row">
|
||||||
<span className="modal-tx-label">Описание</span>
|
<span className="transaction-preview__label">Описание</span>
|
||||||
<span className="modal-tx-description">
|
<span className="transaction-preview__description">
|
||||||
{transaction.description}
|
{transaction.description}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="form-group">
|
<div className="field">
|
||||||
<label htmlFor="edit-category">Категория</label>
|
<label htmlFor="edit-category">Категория</label>
|
||||||
<select
|
<select
|
||||||
id="edit-category"
|
id="edit-category"
|
||||||
@@ -134,7 +139,7 @@ export function EditTransactionModal({
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="form-group">
|
<div className="field">
|
||||||
<label htmlFor="edit-comment">Комментарий</label>
|
<label htmlFor="edit-comment">Комментарий</label>
|
||||||
<textarea
|
<textarea
|
||||||
id="edit-comment"
|
id="edit-comment"
|
||||||
@@ -147,7 +152,7 @@ export function EditTransactionModal({
|
|||||||
|
|
||||||
<div className="form-divider" />
|
<div className="form-divider" />
|
||||||
|
|
||||||
<div className="form-group form-group-checkbox">
|
<div className="field field--checkbox">
|
||||||
<label>
|
<label>
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
@@ -160,7 +165,7 @@ export function EditTransactionModal({
|
|||||||
|
|
||||||
{createRule && (
|
{createRule && (
|
||||||
<>
|
<>
|
||||||
<div className="form-group">
|
<div className="field">
|
||||||
<label htmlFor="edit-pattern">
|
<label htmlFor="edit-pattern">
|
||||||
Шаблон (ключевая строка)
|
Шаблон (ключевая строка)
|
||||||
</label>
|
</label>
|
||||||
@@ -172,7 +177,7 @@ export function EditTransactionModal({
|
|||||||
maxLength={200}
|
maxLength={200}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="form-group form-group-checkbox">
|
<div className="field field--checkbox">
|
||||||
<label>
|
<label>
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
@@ -188,17 +193,17 @@ export function EditTransactionModal({
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="modal-footer">
|
<div className="modal__footer">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="btn btn-secondary"
|
className="button button--secondary"
|
||||||
onClick={onClose}
|
onClick={onClose}
|
||||||
>
|
>
|
||||||
Отмена
|
Отмена
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
className="btn btn-primary"
|
className="button button--primary"
|
||||||
disabled={saving}
|
disabled={saving}
|
||||||
>
|
>
|
||||||
{saving ? 'Сохранение...' : 'Сохранить'}
|
{saving ? 'Сохранение...' : 'Сохранить'}
|
||||||
|
|||||||
@@ -59,17 +59,22 @@ export function ImportModal({ onClose, onDone }: Props) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="modal-overlay" onClick={onClose}>
|
<div
|
||||||
|
className="modal-backdrop"
|
||||||
|
onMouseDown={(e) => {
|
||||||
|
if (e.target === e.currentTarget) onClose();
|
||||||
|
}}
|
||||||
|
>
|
||||||
<div className="modal" onClick={(e) => e.stopPropagation()}>
|
<div className="modal" onClick={(e) => e.stopPropagation()}>
|
||||||
<div className="modal-header">
|
<div className="modal__header">
|
||||||
<h2>Импорт выписки</h2>
|
<h2>Импорт выписки</h2>
|
||||||
<button className="btn-close" onClick={onClose}>
|
<button className="modal__close-button" onClick={onClose} aria-label="Закрыть">
|
||||||
×
|
×
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="modal-body">
|
<div className="modal__body">
|
||||||
{error && <div className="alert alert-error">{error}</div>}
|
{error && <div className="alert alert--error">{error}</div>}
|
||||||
|
|
||||||
{!result && (
|
{!result && (
|
||||||
<div className="import-upload">
|
<div className="import-upload">
|
||||||
@@ -79,19 +84,19 @@ export function ImportModal({ onClose, onDone }: Props) {
|
|||||||
type="file"
|
type="file"
|
||||||
accept=".pdf,.json,application/pdf,application/json"
|
accept=".pdf,.json,application/pdf,application/json"
|
||||||
onChange={handleFileChange}
|
onChange={handleFileChange}
|
||||||
className="file-input"
|
className="import-upload__input"
|
||||||
/>
|
/>
|
||||||
{loading && (
|
{loading && (
|
||||||
<div className="import-loading">Импорт...</div>
|
<div className="import-upload__loading">Импорт...</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{result && (
|
{result && (
|
||||||
<div className="import-result">
|
<div className="import-result">
|
||||||
<div className="import-result-icon" aria-hidden="true">✓</div>
|
<div className="import-result__icon" aria-hidden="true">✓</div>
|
||||||
<h3>Импорт завершён</h3>
|
<h3>Импорт завершён</h3>
|
||||||
<table className="import-stats">
|
<table className="import-result__stats">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Счёт</td>
|
<td>Счёт</td>
|
||||||
@@ -117,9 +122,9 @@ export function ImportModal({ onClose, onDone }: Props) {
|
|||||||
</table>
|
</table>
|
||||||
|
|
||||||
{result.isNewAccount && !aliasSaved && (
|
{result.isNewAccount && !aliasSaved && (
|
||||||
<div className="import-alias">
|
<div className="import-result__alias">
|
||||||
<label>Алиас для нового счёта</label>
|
<label>Алиас для нового счёта</label>
|
||||||
<div className="import-alias-row">
|
<div className="import-result__alias-row">
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Напр.: Текущий, Накопительный"
|
placeholder="Напр.: Текущий, Накопительный"
|
||||||
@@ -128,7 +133,7 @@ export function ImportModal({ onClose, onDone }: Props) {
|
|||||||
maxLength={50}
|
maxLength={50}
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
className="btn btn-sm btn-primary"
|
className="button button--primary button--small"
|
||||||
onClick={handleSaveAlias}
|
onClick={handleSaveAlias}
|
||||||
disabled={!alias.trim()}
|
disabled={!alias.trim()}
|
||||||
>
|
>
|
||||||
@@ -139,7 +144,7 @@ export function ImportModal({ onClose, onDone }: Props) {
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{aliasSaved && (
|
{aliasSaved && (
|
||||||
<div className="import-alias-saved">
|
<div className="import-result__alias-saved">
|
||||||
Алиас сохранён
|
Алиас сохранён
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -147,14 +152,14 @@ export function ImportModal({ onClose, onDone }: Props) {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="modal-footer">
|
<div className="modal__footer">
|
||||||
{result ? (
|
{result ? (
|
||||||
<button className="btn btn-primary" onClick={onDone}>
|
<button className="button button--primary" onClick={onDone}>
|
||||||
Готово
|
Готово
|
||||||
</button>
|
</button>
|
||||||
) : (
|
) : (
|
||||||
<button
|
<button
|
||||||
className="btn btn-secondary"
|
className="button button--secondary"
|
||||||
onClick={onClose}
|
onClick={onClose}
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -17,10 +17,10 @@ export function Layout({ children }: { children: ReactNode }) {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="layout">
|
<div className="app-shell">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="burger-btn"
|
className="menu-button"
|
||||||
aria-label="Открыть меню"
|
aria-label="Открыть меню"
|
||||||
onClick={() => setDrawerOpen(true)}
|
onClick={() => setDrawerOpen(true)}
|
||||||
>
|
>
|
||||||
@@ -33,23 +33,23 @@ export function Layout({ children }: { children: ReactNode }) {
|
|||||||
|
|
||||||
{drawerOpen && (
|
{drawerOpen && (
|
||||||
<div
|
<div
|
||||||
className="sidebar-overlay"
|
className="app-shell__overlay"
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
onClick={closeDrawer}
|
onClick={closeDrawer}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<aside className={`sidebar ${drawerOpen ? 'sidebar-open' : ''}`}>
|
<aside className={`sidebar ${drawerOpen ? 'sidebar--open' : ''}`}>
|
||||||
<div className="sidebar-brand">
|
<div className="sidebar__brand">
|
||||||
<span className="sidebar-brand-icon">₽</span>
|
<span className="sidebar__brand-icon">₽</span>
|
||||||
<span className="sidebar-brand-text">Семейный бюджет</span>
|
<span className="sidebar__brand-text">Семейный бюджет</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<nav className="sidebar-nav">
|
<nav className="sidebar__nav" aria-label="Основная навигация">
|
||||||
<NavLink
|
<NavLink
|
||||||
to="/history"
|
to="/history"
|
||||||
className={({ isActive }) =>
|
className={({ isActive }) =>
|
||||||
`nav-link${isActive ? ' active' : ''}`
|
`sidebar__nav-link${isActive ? ' sidebar__nav-link--active' : ''}`
|
||||||
}
|
}
|
||||||
onClick={closeDrawer}
|
onClick={closeDrawer}
|
||||||
>
|
>
|
||||||
@@ -66,7 +66,7 @@ export function Layout({ children }: { children: ReactNode }) {
|
|||||||
<NavLink
|
<NavLink
|
||||||
to="/analytics"
|
to="/analytics"
|
||||||
className={({ isActive }) =>
|
className={({ isActive }) =>
|
||||||
`nav-link${isActive ? ' active' : ''}`
|
`sidebar__nav-link${isActive ? ' sidebar__nav-link--active' : ''}`
|
||||||
}
|
}
|
||||||
onClick={closeDrawer}
|
onClick={closeDrawer}
|
||||||
>
|
>
|
||||||
@@ -81,7 +81,7 @@ export function Layout({ children }: { children: ReactNode }) {
|
|||||||
<NavLink
|
<NavLink
|
||||||
to="/settings"
|
to="/settings"
|
||||||
className={({ isActive }) =>
|
className={({ isActive }) =>
|
||||||
`nav-link${isActive ? ' active' : ''}`
|
`sidebar__nav-link${isActive ? ' sidebar__nav-link--active' : ''}`
|
||||||
}
|
}
|
||||||
onClick={closeDrawer}
|
onClick={closeDrawer}
|
||||||
>
|
>
|
||||||
@@ -93,23 +93,23 @@ export function Layout({ children }: { children: ReactNode }) {
|
|||||||
</NavLink>
|
</NavLink>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<div className="sidebar-footer">
|
<div className="sidebar__footer">
|
||||||
<div className="sidebar-footer-top">
|
<div className="sidebar__user-row">
|
||||||
<span className="sidebar-user">{user?.login}</span>
|
<span className="sidebar__user">{user?.login}</span>
|
||||||
<button className="btn-logout" onClick={() => logout()}>
|
<button className="sidebar__logout" onClick={() => logout()}>
|
||||||
Выход
|
Выход
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div className="sidebar-footer-bottom">
|
<div className="sidebar__meta">
|
||||||
<span className="sidebar-version">
|
<span className="sidebar__version">
|
||||||
FE {__FE_VERSION__} · BE {beVersion ?? '…'}
|
FE {__FE_VERSION__} · BE {beVersion ?? '…'}
|
||||||
</span>
|
</span>
|
||||||
<span className="sidebar-copyright">© 2025 Семейный бюджет</span>
|
<span className="sidebar__copyright">© 2025 Семейный бюджет</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</aside>
|
</aside>
|
||||||
|
|
||||||
<main className="main-content">{children}</main>
|
<main className="app-shell__main">{children}</main>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,35 +20,38 @@ export function Pagination({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="pagination">
|
<div className="pagination">
|
||||||
<div className="pagination-info">
|
<div className="pagination__info">
|
||||||
{totalItems > 0
|
{totalItems > 0
|
||||||
? `Показано ${from}–${to} из ${totalItems}`
|
? `Показано ${from}–${to} из ${totalItems}`
|
||||||
: 'Нет записей'}
|
: 'Нет записей'}
|
||||||
</div>
|
</div>
|
||||||
<div className="pagination-controls">
|
<div className="pagination__controls">
|
||||||
<select
|
<select
|
||||||
className="pagination-size"
|
className="pagination__size"
|
||||||
value={pageSize}
|
value={pageSize}
|
||||||
onChange={(e) => onPageSizeChange(Number(e.target.value))}
|
onChange={(e) => onPageSizeChange(Number(e.target.value))}
|
||||||
|
aria-label="Количество операций на странице"
|
||||||
>
|
>
|
||||||
<option value={10}>10</option>
|
<option value={10}>10</option>
|
||||||
<option value={50}>50</option>
|
<option value={50}>50</option>
|
||||||
<option value={100}>100</option>
|
<option value={100}>100</option>
|
||||||
</select>
|
</select>
|
||||||
<button
|
<button
|
||||||
className="btn-page"
|
className="icon-button"
|
||||||
disabled={page <= 1}
|
disabled={page <= 1}
|
||||||
onClick={() => onPageChange(page - 1)}
|
onClick={() => onPageChange(page - 1)}
|
||||||
|
aria-label="Предыдущая страница"
|
||||||
>
|
>
|
||||||
←
|
←
|
||||||
</button>
|
</button>
|
||||||
<span className="pagination-current">
|
<span className="pagination__current">
|
||||||
{page} / {totalPages || 1}
|
{page} / {totalPages || 1}
|
||||||
</span>
|
</span>
|
||||||
<button
|
<button
|
||||||
className="btn-page"
|
className="icon-button"
|
||||||
disabled={page >= totalPages}
|
disabled={page >= totalPages}
|
||||||
onClick={() => onPageChange(page + 1)}
|
onClick={() => onPageChange(page + 1)}
|
||||||
|
aria-label="Следующая страница"
|
||||||
>
|
>
|
||||||
→
|
→
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -85,13 +85,13 @@ export function PeriodSelector({ period, onChange }: Props) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="period-selector">
|
<div className="period-picker">
|
||||||
<div className="period-modes">
|
<div className="segmented-control">
|
||||||
{(['week', 'month', 'year', 'custom'] as PeriodMode[]).map(
|
{(['week', 'month', 'year', 'custom'] as PeriodMode[]).map(
|
||||||
(m) => (
|
(m) => (
|
||||||
<button
|
<button
|
||||||
key={m}
|
key={m}
|
||||||
className={`btn-preset ${period.mode === m ? 'active' : ''}`}
|
className={`segmented-control__button ${period.mode === m ? 'segmented-control__button--active' : ''}`}
|
||||||
onClick={() => setMode(m)}
|
onClick={() => setMode(m)}
|
||||||
>
|
>
|
||||||
{MODE_LABELS[m]}
|
{MODE_LABELS[m]}
|
||||||
@@ -100,13 +100,18 @@ export function PeriodSelector({ period, onChange }: Props) {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="period-nav">
|
<div className="period-picker__nav">
|
||||||
{period.mode !== 'custom' && (
|
{period.mode !== 'custom' && (
|
||||||
<button className="btn-page" onClick={() => navigate(-1)}>
|
<button
|
||||||
|
className="icon-button"
|
||||||
|
onClick={() => navigate(-1)}
|
||||||
|
aria-label="Предыдущий период"
|
||||||
|
title="Предыдущий период"
|
||||||
|
>
|
||||||
←
|
←
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
<div className="period-dates">
|
<div className="period-picker__dates">
|
||||||
<input
|
<input
|
||||||
type="date"
|
type="date"
|
||||||
value={period.from}
|
value={period.from}
|
||||||
@@ -114,7 +119,7 @@ export function PeriodSelector({ period, onChange }: Props) {
|
|||||||
onChange({ ...period, mode: 'custom', from: e.target.value })
|
onChange({ ...period, mode: 'custom', from: e.target.value })
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<span className="filter-separator">—</span>
|
<span className="period-picker__separator">—</span>
|
||||||
<input
|
<input
|
||||||
type="date"
|
type="date"
|
||||||
value={period.to}
|
value={period.to}
|
||||||
@@ -124,7 +129,12 @@ export function PeriodSelector({ period, onChange }: Props) {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{period.mode !== 'custom' && (
|
{period.mode !== 'custom' && (
|
||||||
<button className="btn-page" onClick={() => navigate(1)}>
|
<button
|
||||||
|
className="icon-button"
|
||||||
|
onClick={() => navigate(1)}
|
||||||
|
aria-label="Следующий период"
|
||||||
|
title="Следующий период"
|
||||||
|
>
|
||||||
→
|
→
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ export function RulesList() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
return <div className="section-loading">Загрузка...</div>;
|
return <div className="state state--loading">Загрузка...</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -61,10 +61,10 @@ export function RulesList() {
|
|||||||
<tr>
|
<tr>
|
||||||
<th>Шаблон</th>
|
<th>Шаблон</th>
|
||||||
<th>Категория</th>
|
<th>Категория</th>
|
||||||
<th className="th-center">Приоритет</th>
|
<th className="data-table__head-cell data-table__head-cell--center">Приоритет</th>
|
||||||
<th className="th-center">Подтверждение</th>
|
<th className="data-table__head-cell data-table__head-cell--center">Подтверждение</th>
|
||||||
<th>Создано</th>
|
<th>Создано</th>
|
||||||
<th className="th-center">Активно</th>
|
<th className="data-table__head-cell data-table__head-cell--center">Активно</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -72,35 +72,38 @@ export function RulesList() {
|
|||||||
{rules.map((r) => (
|
{rules.map((r) => (
|
||||||
<tr
|
<tr
|
||||||
key={r.id}
|
key={r.id}
|
||||||
className={!r.isActive ? 'row-inactive' : ''}
|
className={!r.isActive ? 'data-table__row--inactive' : ''}
|
||||||
>
|
>
|
||||||
<td>
|
<td>
|
||||||
<code>{r.pattern}</code>
|
<code>{r.pattern}</code>
|
||||||
</td>
|
</td>
|
||||||
<td>{r.categoryName}</td>
|
<td>{r.categoryName}</td>
|
||||||
<td className="td-center">{r.priority}</td>
|
<td className="data-table__cell data-table__cell--center">{r.priority}</td>
|
||||||
<td className="td-center">
|
<td className="data-table__cell data-table__cell--center">
|
||||||
{r.requiresConfirmation ? 'Да' : 'Нет'}
|
{r.requiresConfirmation ? 'Да' : 'Нет'}
|
||||||
</td>
|
</td>
|
||||||
<td className="td-nowrap">
|
<td className="data-table__cell data-table__cell--nowrap">
|
||||||
{formatDate(r.createdAt)}
|
{formatDate(r.createdAt)}
|
||||||
</td>
|
</td>
|
||||||
<td className="td-center">
|
<td className="data-table__cell data-table__cell--center">
|
||||||
<button
|
<button
|
||||||
className={`toggle ${r.isActive ? 'toggle-on' : 'toggle-off'}`}
|
className={`switch-button ${r.isActive ? 'switch-button--on' : 'switch-button--off'}`}
|
||||||
onClick={() => handleToggle(r)}
|
onClick={() => handleToggle(r)}
|
||||||
title={
|
title={
|
||||||
r.isActive ? 'Деактивировать' : 'Активировать'
|
r.isActive ? 'Деактивировать' : 'Активировать'
|
||||||
}
|
}
|
||||||
|
aria-label={
|
||||||
|
r.isActive ? 'Деактивировать правило' : 'Активировать правило'
|
||||||
|
}
|
||||||
>
|
>
|
||||||
{r.isActive ? 'Вкл' : 'Выкл'}
|
{r.isActive ? 'Вкл' : 'Выкл'}
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div className="rules-actions">
|
<div className="rules-list__actions">
|
||||||
{r.isActive && (
|
{r.isActive && (
|
||||||
<button
|
<button
|
||||||
className="btn btn-sm btn-secondary"
|
className="button button--secondary button--small"
|
||||||
onClick={() => handleApply(r.id)}
|
onClick={() => handleApply(r.id)}
|
||||||
disabled={applyingId === r.id}
|
disabled={applyingId === r.id}
|
||||||
>
|
>
|
||||||
@@ -108,7 +111,7 @@ export function RulesList() {
|
|||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
{applyResult?.id === r.id && (
|
{applyResult?.id === r.id && (
|
||||||
<span className="apply-result">
|
<span className="rules-list__result">
|
||||||
Применено: {applyResult.count}
|
Применено: {applyResult.count}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
@@ -118,7 +121,7 @@ export function RulesList() {
|
|||||||
))}
|
))}
|
||||||
{rules.length === 0 && (
|
{rules.length === 0 && (
|
||||||
<tr>
|
<tr>
|
||||||
<td colSpan={7} className="td-center text-muted">
|
<td colSpan={7} className="data-table__cell data-table__cell--center muted-text">
|
||||||
Нет правил
|
Нет правил
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -6,59 +6,61 @@ interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function SummaryCards({ summary }: Props) {
|
export function SummaryCards({ summary }: Props) {
|
||||||
|
const balanceModifier = summary.net >= 0 ? 'positive' : 'negative';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="summary-cards">
|
<div className="summary">
|
||||||
<div className="summary-card summary-card-income">
|
<div className="summary__card summary__card--income">
|
||||||
<div className="summary-label">Доходы</div>
|
<div className="summary__label">Доходы</div>
|
||||||
<div className="summary-value">
|
<div className="summary__value">
|
||||||
{formatAmount(summary.totalIncome)}
|
{formatAmount(summary.totalIncome)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="summary-card summary-card-expense">
|
<div className="summary__card summary__card--expense">
|
||||||
<div className="summary-label">Расходы</div>
|
<div className="summary__label">Расходы</div>
|
||||||
<div className="summary-value">
|
<div className="summary__value">
|
||||||
{formatAmount(summary.totalExpense)}
|
{formatAmount(summary.totalExpense)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
className={`summary-card ${summary.net >= 0 ? 'summary-card-positive' : 'summary-card-negative'}`}
|
className={`summary__card summary__card--${balanceModifier}`}
|
||||||
>
|
>
|
||||||
<div className="summary-label">Баланс</div>
|
<div className="summary__label">Баланс</div>
|
||||||
<div className="summary-value">
|
<div className="summary__value">
|
||||||
{formatAmount(summary.net)}
|
{formatAmount(summary.net)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="summary-card summary-card-investments">
|
<div className="summary__card summary__card--investments">
|
||||||
<div className="summary-label">На инвестиции</div>
|
<div className="summary__label">На инвестиции</div>
|
||||||
<div className="summary-value">
|
<div className="summary__value">
|
||||||
{formatAmount(summary.investmentOutflow)}
|
{formatAmount(summary.investmentOutflow)}
|
||||||
</div>
|
</div>
|
||||||
{summary.investmentIncomeExcluded > 0 && (
|
{summary.investmentIncomeExcluded > 0 && (
|
||||||
<div className="summary-subvalue">
|
<div className="summary__subvalue">
|
||||||
Исключено из доходов: {formatAmount(summary.investmentIncomeExcluded)}
|
Исключено из доходов: {formatAmount(summary.investmentIncomeExcluded)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{summary.topCategories.length > 0 && (
|
{summary.topCategories.length > 0 && (
|
||||||
<div className="summary-card summary-card-top">
|
<div className="summary__card summary__card--top">
|
||||||
<div className="summary-label">Топ расходов</div>
|
<div className="summary__label">Топ расходов</div>
|
||||||
<div className="summary-top-list">
|
<div className="summary__top-list">
|
||||||
{summary.topCategories.map((cat) => (
|
{summary.topCategories.map((cat) => (
|
||||||
<div
|
<div
|
||||||
key={cat.categoryId}
|
key={cat.categoryId}
|
||||||
className="top-category-item"
|
className="summary__top-item"
|
||||||
>
|
>
|
||||||
<span className="top-category-name">
|
<span className="summary__top-name">
|
||||||
{cat.categoryName}
|
{cat.categoryName}
|
||||||
</span>
|
</span>
|
||||||
<span className="top-category-amount">
|
<span className="summary__top-amount">
|
||||||
{formatAmount(cat.amount)}
|
{formatAmount(cat.amount)}
|
||||||
</span>
|
</span>
|
||||||
<span className="top-category-share">
|
<span className="summary__top-share">
|
||||||
{(cat.share * 100).toFixed(0)}%
|
{(cat.share * 100).toFixed(0)}%
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export function TimeseriesChart({ data }: Props) {
|
|||||||
const chartHeight = isMobile ? 250 : 300;
|
const chartHeight = isMobile ? 250 : 300;
|
||||||
|
|
||||||
if (data.length === 0) {
|
if (data.length === 0) {
|
||||||
return <div className="chart-empty">Нет данных за период</div>;
|
return <div className="state state--empty">Нет данных за период</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const chartData = data.map((item) => ({
|
const chartData = data.map((item) => ({
|
||||||
@@ -39,7 +39,7 @@ export function TimeseriesChart({ data }: Props) {
|
|||||||
return (
|
return (
|
||||||
<ResponsiveContainer width="100%" height={chartHeight}>
|
<ResponsiveContainer width="100%" height={chartHeight}>
|
||||||
<BarChart data={chartData}>
|
<BarChart data={chartData}>
|
||||||
<CartesianGrid strokeDasharray="3 3" stroke="#e2e8f0" />
|
<CartesianGrid strokeDasharray="3 3" stroke="#e7ded2" vertical={false} />
|
||||||
<XAxis
|
<XAxis
|
||||||
dataKey="period"
|
dataKey="period"
|
||||||
tickFormatter={(v: string) => {
|
tickFormatter={(v: string) => {
|
||||||
@@ -47,32 +47,42 @@ export function TimeseriesChart({ data }: Props) {
|
|||||||
return `${d.getDate()}.${String(d.getMonth() + 1).padStart(2, '0')}`;
|
return `${d.getDate()}.${String(d.getMonth() + 1).padStart(2, '0')}`;
|
||||||
}}
|
}}
|
||||||
fontSize={12}
|
fontSize={12}
|
||||||
stroke="#64748b"
|
stroke="#7d7164"
|
||||||
|
tickLine={false}
|
||||||
|
axisLine={false}
|
||||||
/>
|
/>
|
||||||
<YAxis
|
<YAxis
|
||||||
tickFormatter={(v: number) =>
|
tickFormatter={(v: number) =>
|
||||||
v >= 1000 ? `${(v / 1000).toFixed(0)}к` : String(v)
|
v >= 1000 ? `${(v / 1000).toFixed(0)}к` : String(v)
|
||||||
}
|
}
|
||||||
fontSize={12}
|
fontSize={12}
|
||||||
stroke="#64748b"
|
stroke="#7d7164"
|
||||||
|
tickLine={false}
|
||||||
|
axisLine={false}
|
||||||
/>
|
/>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
formatter={(value: number) => rubFormatter.format(value)}
|
formatter={(value: number) => rubFormatter.format(value)}
|
||||||
|
cursor={{ fill: 'rgba(129, 93, 58, 0.08)' }}
|
||||||
|
contentStyle={{
|
||||||
|
border: '1px solid #e7ded2',
|
||||||
|
borderRadius: 8,
|
||||||
|
boxShadow: '0 16px 36px rgba(54, 42, 30, 0.14)',
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
<Legend />
|
<Legend />
|
||||||
<Bar
|
<Bar
|
||||||
dataKey="Расходы"
|
dataKey="Расходы"
|
||||||
fill="#ef4444"
|
fill="#e85d3f"
|
||||||
radius={[4, 4, 0, 0]}
|
radius={[4, 4, 0, 0]}
|
||||||
/>
|
/>
|
||||||
<Bar
|
<Bar
|
||||||
dataKey="Доходы"
|
dataKey="Доходы"
|
||||||
fill="#10b981"
|
fill="#0f9f7f"
|
||||||
radius={[4, 4, 0, 0]}
|
radius={[4, 4, 0, 0]}
|
||||||
/>
|
/>
|
||||||
<Bar
|
<Bar
|
||||||
dataKey="Инвестиции"
|
dataKey="Инвестиции"
|
||||||
fill="#f59e0b"
|
fill="#d89b17"
|
||||||
radius={[4, 4, 0, 0]}
|
radius={[4, 4, 0, 0]}
|
||||||
/>
|
/>
|
||||||
</BarChart>
|
</BarChart>
|
||||||
|
|||||||
@@ -115,28 +115,29 @@ export function TransactionFilters({
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="filters-panel">
|
<div className="filters">
|
||||||
<div className="filters-row">
|
<div className="filters__row">
|
||||||
<div className="filter-group">
|
<div className="field field--period">
|
||||||
<label>Период</label>
|
<label>Период</label>
|
||||||
<div className="filter-dates-wrap">
|
<div className="filters__date-control">
|
||||||
{filters.periodMode !== 'custom' && (
|
{filters.periodMode !== 'custom' && (
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="btn-page"
|
className="icon-button"
|
||||||
onClick={() => navigate(-1)}
|
onClick={() => navigate(-1)}
|
||||||
|
aria-label="Предыдущий период"
|
||||||
title="Предыдущий период"
|
title="Предыдущий период"
|
||||||
>
|
>
|
||||||
←
|
←
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
<div className="filter-dates">
|
<div className="filters__dates">
|
||||||
<input
|
<input
|
||||||
type="date"
|
type="date"
|
||||||
value={filters.from}
|
value={filters.from}
|
||||||
onChange={(e) => handleDateChange('from', e.target.value)}
|
onChange={(e) => handleDateChange('from', e.target.value)}
|
||||||
/>
|
/>
|
||||||
<span className="filter-separator">—</span>
|
<span className="filters__separator">—</span>
|
||||||
<input
|
<input
|
||||||
type="date"
|
type="date"
|
||||||
value={filters.to}
|
value={filters.to}
|
||||||
@@ -146,29 +147,30 @@ export function TransactionFilters({
|
|||||||
{filters.periodMode !== 'custom' && (
|
{filters.periodMode !== 'custom' && (
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="btn-page"
|
className="icon-button"
|
||||||
onClick={() => navigate(1)}
|
onClick={() => navigate(1)}
|
||||||
|
aria-label="Следующий период"
|
||||||
title="Следующий период"
|
title="Следующий период"
|
||||||
>
|
>
|
||||||
→
|
→
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="filter-presets">
|
<div className="segmented-control segmented-control--compact">
|
||||||
<button
|
<button
|
||||||
className={`btn-preset ${filters.periodMode === 'week' ? 'active' : ''}`}
|
className={`segmented-control__button ${filters.periodMode === 'week' ? 'segmented-control__button--active' : ''}`}
|
||||||
onClick={() => applyPreset('week')}
|
onClick={() => applyPreset('week')}
|
||||||
>
|
>
|
||||||
Неделя
|
Неделя
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
className={`btn-preset ${filters.periodMode === 'month' ? 'active' : ''}`}
|
className={`segmented-control__button ${filters.periodMode === 'month' ? 'segmented-control__button--active' : ''}`}
|
||||||
onClick={() => applyPreset('month')}
|
onClick={() => applyPreset('month')}
|
||||||
>
|
>
|
||||||
Месяц
|
Месяц
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
className={`btn-preset ${filters.periodMode === 'year' ? 'active' : ''}`}
|
className={`segmented-control__button ${filters.periodMode === 'year' ? 'segmented-control__button--active' : ''}`}
|
||||||
onClick={() => applyPreset('year')}
|
onClick={() => applyPreset('year')}
|
||||||
>
|
>
|
||||||
Год
|
Год
|
||||||
@@ -176,7 +178,7 @@ export function TransactionFilters({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="filter-group">
|
<div className="field">
|
||||||
<label>Счёт</label>
|
<label>Счёт</label>
|
||||||
<select
|
<select
|
||||||
value={filters.accountId}
|
value={filters.accountId}
|
||||||
@@ -191,7 +193,7 @@ export function TransactionFilters({
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="filter-group">
|
<div className="field">
|
||||||
<label>Тип</label>
|
<label>Тип</label>
|
||||||
<select
|
<select
|
||||||
value={filters.direction}
|
value={filters.direction}
|
||||||
@@ -204,7 +206,7 @@ export function TransactionFilters({
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="filter-group">
|
<div className="field">
|
||||||
<label>Категория</label>
|
<label>Категория</label>
|
||||||
<select
|
<select
|
||||||
value={filters.categoryId}
|
value={filters.categoryId}
|
||||||
@@ -220,8 +222,8 @@ export function TransactionFilters({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="filters-row">
|
<div className="filters__row">
|
||||||
<div className="filter-group filter-group-wide">
|
<div className="field field--wide">
|
||||||
<label>Поиск</label>
|
<label>Поиск</label>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
@@ -231,7 +233,7 @@ export function TransactionFilters({
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="filter-group">
|
<div className="field">
|
||||||
<label>Сумма от (₽)</label>
|
<label>Сумма от (₽)</label>
|
||||||
<input
|
<input
|
||||||
type="number"
|
type="number"
|
||||||
@@ -241,7 +243,7 @@ export function TransactionFilters({
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="filter-group">
|
<div className="field">
|
||||||
<label>Сумма до (₽)</label>
|
<label>Сумма до (₽)</label>
|
||||||
<input
|
<input
|
||||||
type="number"
|
type="number"
|
||||||
@@ -251,7 +253,7 @@ export function TransactionFilters({
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="filter-group filter-group-checkbox">
|
<div className="field field--checkbox">
|
||||||
<label>
|
<label>
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
@@ -262,9 +264,9 @@ export function TransactionFilters({
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="filter-group">
|
<div className="field">
|
||||||
<label>Сортировка</label>
|
<label>Сортировка</label>
|
||||||
<div className="filter-sort">
|
<div className="filters__sort">
|
||||||
<select
|
<select
|
||||||
value={filters.sortBy}
|
value={filters.sortBy}
|
||||||
onChange={(e) =>
|
onChange={(e) =>
|
||||||
@@ -275,7 +277,7 @@ export function TransactionFilters({
|
|||||||
<option value="amount">По сумме</option>
|
<option value="amount">По сумме</option>
|
||||||
</select>
|
</select>
|
||||||
<button
|
<button
|
||||||
className="btn-sort-order"
|
className="icon-button"
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
set(
|
set(
|
||||||
'sortOrder',
|
'sortOrder',
|
||||||
@@ -287,6 +289,11 @@ export function TransactionFilters({
|
|||||||
? 'По возрастанию'
|
? 'По возрастанию'
|
||||||
: 'По убыванию'
|
: 'По убыванию'
|
||||||
}
|
}
|
||||||
|
aria-label={
|
||||||
|
filters.sortOrder === 'asc'
|
||||||
|
? 'Сортировать по убыванию'
|
||||||
|
: 'Сортировать по возрастанию'
|
||||||
|
}
|
||||||
>
|
>
|
||||||
{filters.sortOrder === 'asc' ? '↑' : '↓'}
|
{filters.sortOrder === 'asc' ? '↑' : '↓'}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const DIRECTION_CLASSES: Record<string, string> = {
|
const DIRECTION_CLASSES: Record<string, string> = {
|
||||||
income: 'amount-income',
|
income: 'money-amount--income',
|
||||||
expense: 'amount-expense',
|
expense: 'money-amount--expense',
|
||||||
transfer: 'amount-transfer',
|
transfer: 'money-amount--transfer',
|
||||||
};
|
};
|
||||||
|
|
||||||
function getCommissionAmountSigned(tx: Transaction): number {
|
function getCommissionAmountSigned(tx: Transaction): number {
|
||||||
@@ -33,39 +33,39 @@ function TransactionCard({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={`transaction-card ${isUnconfirmed ? 'row-unconfirmed' : ''}`}
|
className={`transaction-card ${isUnconfirmed ? 'transaction-card--unconfirmed' : ''}`}
|
||||||
>
|
>
|
||||||
<div className="transaction-card-header">
|
<div className="transaction-card__header">
|
||||||
<span className="transaction-card-date">
|
<span className="transaction-card__date">
|
||||||
{formatDateTime(tx.operationAt)}
|
{formatDateTime(tx.operationAt)}
|
||||||
</span>
|
</span>
|
||||||
<span className={`transaction-card-amount ${directionClass}`}>
|
<span className={`money-amount transaction-card__amount ${directionClass}`}>
|
||||||
{formatAmount(tx.amountSigned)}
|
{formatAmount(tx.amountSigned)}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
{tx.commission !== 0 && (
|
{tx.commission !== 0 && (
|
||||||
<div className="transaction-card-commission">
|
<div className="transaction-card__commission">
|
||||||
Комиссия: {formatAmount(getCommissionAmountSigned(tx))}
|
Комиссия: {formatAmount(getCommissionAmountSigned(tx))}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className="transaction-card-body">
|
<div className="transaction-card__body">
|
||||||
<span className="description-text">{tx.description}</span>
|
<span className="transaction-card__description">{tx.description}</span>
|
||||||
{tx.comment && (
|
{tx.comment && (
|
||||||
<span className="comment-badge" title={tx.comment}>
|
<span className="comment-indicator" title={tx.comment}>
|
||||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
||||||
<path d="M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z" />
|
<path d="M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z" />
|
||||||
</svg>
|
</svg>
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="transaction-card-footer">
|
<div className="transaction-card__footer">
|
||||||
<span className="transaction-card-meta">
|
<span className="transaction-card__meta">
|
||||||
{tx.accountAlias || '—'} · {tx.categoryName || '—'}
|
{tx.accountAlias || '—'} · {tx.categoryName || '—'}
|
||||||
</span>
|
</span>
|
||||||
<div className="transaction-card-actions">
|
<div className="transaction-card__actions">
|
||||||
{tx.categoryId != null && !tx.isCategoryConfirmed && (
|
{tx.categoryId != null && !tx.isCategoryConfirmed && (
|
||||||
<span
|
<span
|
||||||
className="badge badge-warning"
|
className="badge badge--warning"
|
||||||
title="Категория не подтверждена"
|
title="Категория не подтверждена"
|
||||||
>
|
>
|
||||||
?
|
?
|
||||||
@@ -73,8 +73,9 @@ function TransactionCard({
|
|||||||
)}
|
)}
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="btn-icon btn-icon-touch"
|
className="icon-button icon-button--touch"
|
||||||
onClick={() => onEdit(tx)}
|
onClick={() => onEdit(tx)}
|
||||||
|
aria-label="Редактировать операцию"
|
||||||
title="Редактировать"
|
title="Редактировать"
|
||||||
>
|
>
|
||||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
||||||
@@ -90,16 +91,16 @@ function TransactionCard({
|
|||||||
|
|
||||||
export function TransactionTable({ transactions, loading, onEdit }: Props) {
|
export function TransactionTable({ transactions, loading, onEdit }: Props) {
|
||||||
if (loading) {
|
if (loading) {
|
||||||
return <div className="table-loading">Загрузка операций...</div>;
|
return <div className="state state--loading">Загрузка операций...</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (transactions.length === 0) {
|
if (transactions.length === 0) {
|
||||||
return <div className="table-empty">Операции не найдены</div>;
|
return <div className="state state--empty">Операции не найдены</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="table-wrapper table-desktop">
|
<div className="table-shell table-shell--desktop">
|
||||||
<table className="data-table">
|
<table className="data-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -108,7 +109,7 @@ export function TransactionTable({ transactions, loading, onEdit }: Props) {
|
|||||||
<th>Сумма</th>
|
<th>Сумма</th>
|
||||||
<th>Описание</th>
|
<th>Описание</th>
|
||||||
<th>Категория</th>
|
<th>Категория</th>
|
||||||
<th className="th-center">Статус</th>
|
<th className="data-table__head-cell data-table__head-cell--center">Статус</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -118,43 +119,43 @@ export function TransactionTable({ transactions, loading, onEdit }: Props) {
|
|||||||
key={tx.id}
|
key={tx.id}
|
||||||
className={
|
className={
|
||||||
!tx.isCategoryConfirmed && tx.categoryId
|
!tx.isCategoryConfirmed && tx.categoryId
|
||||||
? 'row-unconfirmed'
|
? 'data-table__row--unconfirmed'
|
||||||
: ''
|
: ''
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<td className="td-nowrap">
|
<td className="data-table__cell data-table__cell--nowrap">
|
||||||
{formatDateTime(tx.operationAt)}
|
{formatDateTime(tx.operationAt)}
|
||||||
</td>
|
</td>
|
||||||
<td className="td-nowrap">{tx.accountAlias || '—'}</td>
|
<td className="data-table__cell data-table__cell--nowrap">{tx.accountAlias || '—'}</td>
|
||||||
<td
|
<td
|
||||||
className={`td-nowrap td-amount ${DIRECTION_CLASSES[tx.direction] ?? ''}`}
|
className={`data-table__cell data-table__cell--nowrap money-amount ${DIRECTION_CLASSES[tx.direction] ?? ''}`}
|
||||||
>
|
>
|
||||||
<div>{formatAmount(tx.amountSigned)}</div>
|
<div>{formatAmount(tx.amountSigned)}</div>
|
||||||
{tx.commission !== 0 && (
|
{tx.commission !== 0 && (
|
||||||
<div className="td-commission">
|
<div className="data-table__subtext">
|
||||||
Комиссия: {formatAmount(getCommissionAmountSigned(tx))}
|
Комиссия: {formatAmount(getCommissionAmountSigned(tx))}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</td>
|
</td>
|
||||||
<td className="td-description">
|
<td className="data-table__cell data-table__cell--description">
|
||||||
<span className="description-text">{tx.description}</span>
|
<span className="data-table__description">{tx.description}</span>
|
||||||
{tx.comment && (
|
{tx.comment && (
|
||||||
<span className="comment-badge" title={tx.comment}>
|
<span className="comment-indicator" title={tx.comment}>
|
||||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
||||||
<path d="M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z" />
|
<path d="M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z" />
|
||||||
</svg>
|
</svg>
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</td>
|
</td>
|
||||||
<td className="td-nowrap">
|
<td className="data-table__cell data-table__cell--nowrap">
|
||||||
{tx.categoryName || (
|
{tx.categoryName || (
|
||||||
<span className="text-muted">—</span>
|
<span className="muted-text">—</span>
|
||||||
)}
|
)}
|
||||||
</td>
|
</td>
|
||||||
<td className="td-center">
|
<td className="data-table__cell data-table__cell--center">
|
||||||
{tx.categoryId != null && !tx.isCategoryConfirmed && (
|
{tx.categoryId != null && !tx.isCategoryConfirmed && (
|
||||||
<span
|
<span
|
||||||
className="badge badge-warning"
|
className="badge badge--warning"
|
||||||
title="Категория не подтверждена"
|
title="Категория не подтверждена"
|
||||||
>
|
>
|
||||||
?
|
?
|
||||||
@@ -163,8 +164,9 @@ export function TransactionTable({ transactions, loading, onEdit }: Props) {
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button
|
<button
|
||||||
className="btn-icon"
|
className="icon-button"
|
||||||
onClick={() => onEdit(tx)}
|
onClick={() => onEdit(tx)}
|
||||||
|
aria-label="Редактировать операцию"
|
||||||
title="Редактировать"
|
title="Редактировать"
|
||||||
>
|
>
|
||||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
||||||
@@ -179,7 +181,7 @@ export function TransactionTable({ transactions, loading, onEdit }: Props) {
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="transaction-cards transaction-mobile">
|
<div className="transaction-list transaction-list--mobile">
|
||||||
{transactions.map((tx) => (
|
{transactions.map((tx) => (
|
||||||
<TransactionCard key={tx.id} tx={tx} onEdit={onEdit} />
|
<TransactionCard key={tx.id} tx={tx} onEdit={onEdit} />
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -88,14 +88,17 @@ export function AnalyticsPage() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="page">
|
<div className="page">
|
||||||
<div className="page-header">
|
<div className="page__header">
|
||||||
<h1>Аналитика</h1>
|
<div>
|
||||||
|
<p className="page__eyebrow">Обзор периода</p>
|
||||||
|
<h1 className="page__title">Аналитика</h1>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="analytics-controls">
|
<div className="analytics-panel">
|
||||||
<PeriodSelector period={period} onChange={setPeriod} />
|
<PeriodSelector period={period} onChange={setPeriod} />
|
||||||
<div className="analytics-filters">
|
<div className="analytics-panel__filters">
|
||||||
<div className="filter-group">
|
<div className="field">
|
||||||
<label>Счёт</label>
|
<label>Счёт</label>
|
||||||
<select
|
<select
|
||||||
value={accountId}
|
value={accountId}
|
||||||
@@ -109,7 +112,7 @@ export function AnalyticsPage() {
|
|||||||
))}
|
))}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div className="filter-group filter-group-checkbox">
|
<div className="field field--checkbox">
|
||||||
<label>
|
<label>
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
@@ -123,11 +126,11 @@ export function AnalyticsPage() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{loading ? (
|
{loading ? (
|
||||||
<div className="section-loading">Загрузка данных...</div>
|
<div className="state state--loading">Загрузка данных...</div>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
{summary && <SummaryCards summary={summary} />}
|
{summary && <SummaryCards summary={summary} />}
|
||||||
<div className="analytics-charts">
|
<div className="analytics-grid">
|
||||||
<div className="chart-card">
|
<div className="chart-card">
|
||||||
<h3>Динамика</h3>
|
<h3>Динамика</h3>
|
||||||
<TimeseriesChart data={timeseries} />
|
<TimeseriesChart data={timeseries} />
|
||||||
|
|||||||
@@ -204,12 +204,20 @@ export function HistoryPage() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="page">
|
<div className="page">
|
||||||
<div className="page-header">
|
<div className="page__header">
|
||||||
<h1>История операций</h1>
|
<div>
|
||||||
|
<p className="page__eyebrow">Операции</p>
|
||||||
|
<h1 className="page__title">История операций</h1>
|
||||||
|
</div>
|
||||||
<button
|
<button
|
||||||
className="btn btn-primary"
|
className="button button--primary"
|
||||||
onClick={() => setShowImport(true)}
|
onClick={() => setShowImport(true)}
|
||||||
>
|
>
|
||||||
|
<svg className="button__icon" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
|
||||||
|
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
|
||||||
|
<polyline points="7,10 12,15 17,10" />
|
||||||
|
<line x1="12" y1="15" x2="12" y2="3" />
|
||||||
|
</svg>
|
||||||
Импорт выписки
|
Импорт выписки
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -20,16 +20,16 @@ export function LoginPage() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="login-page">
|
<div className="login">
|
||||||
<div className="login-card">
|
<div className="login__panel">
|
||||||
<div className="login-header">
|
<div className="login__header">
|
||||||
<span className="login-icon">₽</span>
|
<span className="login__icon">₽</span>
|
||||||
<h1>Семейный бюджет</h1>
|
<h1>Семейный бюджет</h1>
|
||||||
<p>Войдите для продолжения</p>
|
<p>Войдите для продолжения</p>
|
||||||
</div>
|
</div>
|
||||||
<form onSubmit={handleSubmit} className="login-form">
|
<form onSubmit={handleSubmit} className="login__form">
|
||||||
{error && <div className="alert alert-error">{error}</div>}
|
{error && <div className="alert alert--error">{error}</div>}
|
||||||
<div className="form-group">
|
<div className="field">
|
||||||
<label htmlFor="login">Логин</label>
|
<label htmlFor="login">Логин</label>
|
||||||
<input
|
<input
|
||||||
id="login"
|
id="login"
|
||||||
@@ -41,7 +41,7 @@ export function LoginPage() {
|
|||||||
autoFocus
|
autoFocus
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="form-group">
|
<div className="field">
|
||||||
<label htmlFor="password">Пароль</label>
|
<label htmlFor="password">Пароль</label>
|
||||||
<input
|
<input
|
||||||
id="password"
|
id="password"
|
||||||
@@ -54,7 +54,7 @@ export function LoginPage() {
|
|||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
className="btn btn-primary btn-block"
|
className="button button--primary button--block"
|
||||||
disabled={submitting}
|
disabled={submitting}
|
||||||
>
|
>
|
||||||
{submitting ? 'Вход...' : 'Войти'}
|
{submitting ? 'Вход...' : 'Войти'}
|
||||||
|
|||||||
@@ -11,38 +11,41 @@ export function SettingsPage() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="page">
|
<div className="page">
|
||||||
<div className="page-header">
|
<div className="page__header">
|
||||||
<h1>Настройки</h1>
|
<div>
|
||||||
|
<p className="page__eyebrow">Справочники</p>
|
||||||
|
<h1 className="page__title">Настройки</h1>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="tabs">
|
<div className="tabs">
|
||||||
<button
|
<button
|
||||||
className={`tab ${tab === 'accounts' ? 'active' : ''}`}
|
className={`tabs__button ${tab === 'accounts' ? 'tabs__button--active' : ''}`}
|
||||||
onClick={() => setTab('accounts')}
|
onClick={() => setTab('accounts')}
|
||||||
>
|
>
|
||||||
Счета
|
Счета
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
className={`tab ${tab === 'categories' ? 'active' : ''}`}
|
className={`tabs__button ${tab === 'categories' ? 'tabs__button--active' : ''}`}
|
||||||
onClick={() => setTab('categories')}
|
onClick={() => setTab('categories')}
|
||||||
>
|
>
|
||||||
Категории
|
Категории
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
className={`tab ${tab === 'rules' ? 'active' : ''}`}
|
className={`tabs__button ${tab === 'rules' ? 'tabs__button--active' : ''}`}
|
||||||
onClick={() => setTab('rules')}
|
onClick={() => setTab('rules')}
|
||||||
>
|
>
|
||||||
Правила
|
Правила
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
className={`tab ${tab === 'data' ? 'active' : ''}`}
|
className={`tabs__button ${tab === 'data' ? 'tabs__button--active' : ''}`}
|
||||||
onClick={() => setTab('data')}
|
onClick={() => setTab('data')}
|
||||||
>
|
>
|
||||||
Данные
|
Данные
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="tab-content">
|
<div className="tabs__content">
|
||||||
{tab === 'accounts' && <AccountsList />}
|
{tab === 'accounts' && <AccountsList />}
|
||||||
{tab === 'categories' && <CategoriesList />}
|
{tab === 'categories' && <CategoriesList />}
|
||||||
{tab === 'rules' && <RulesList />}
|
{tab === 'rules' && <RulesList />}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
2
package-lock.json
generated
2
package-lock.json
generated
@@ -64,7 +64,7 @@
|
|||||||
},
|
},
|
||||||
"frontend": {
|
"frontend": {
|
||||||
"name": "@family-budget/frontend",
|
"name": "@family-budget/frontend",
|
||||||
"version": "0.1.0",
|
"version": "0.8.6",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@family-budget/shared": "*",
|
"@family-budget/shared": "*",
|
||||||
"react": "^19.0.0",
|
"react": "^19.0.0",
|
||||||
|
|||||||
Reference in New Issue
Block a user