diff --git a/src/App.tsx b/src/App.tsx index e71f51f0..f7645b34 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -106,7 +106,12 @@ const App = () => { > } + element={ + + } /> { }) } }} - className="btn-secondary" + className="btn-secondary-red" > {t('budgets.delete')} diff --git a/src/components/BudgetSwitch.tsx b/src/components/BudgetSwitch.tsx index 1fddfa26..a300a3cb 100644 --- a/src/components/BudgetSwitch.tsx +++ b/src/components/BudgetSwitch.tsx @@ -2,9 +2,13 @@ import { useTranslation } from 'react-i18next' import { Link } from 'react-router-dom' import { useEffect, useState } from 'react' import { Translation, Budget } from '../types' -import { ChevronRightIcon } from '@heroicons/react/20/solid' import { PencilIcon } from '@heroicons/react/24/solid' -import { PlusCircleIcon, PlusIcon } from '@heroicons/react/24/outline' +import { + ArrowsRightLeftIcon, + EyeIcon, + PlusCircleIcon, + PlusIcon, +} from '@heroicons/react/24/outline' import connectBudgetApi from '../lib/api/budgets' import LoadingSpinner from './LoadingSpinner' import { safeName } from '../lib/name-helper' @@ -13,6 +17,7 @@ import FlyoutMenu from './FlyoutMenu' type BudgetSwitchProps = { selectBudget: (budget?: Budget) => void + currentBudget?: Budget } const BudgetSwitch = (props: BudgetSwitchProps) => { @@ -66,54 +71,76 @@ const BudgetSwitch = (props: BudgetSwitchProps) => { ) : (
{budgets.length ? ( -
    - {budgets.map(budget => ( -
  • - { - props.selectBudget(budget) - }} + <> +
      + {budgets.map(budget => ( +
    • -
      -

      - {safeName(budget, 'budget')} -

      +
      +
      +
      +

      + {safeName(budget, 'budget')} +

      +
      + {budget.note && ( +

      + {budget.note} +

      + )} +
      - {budget.note ? ( -

      - {budget.note} -

      - ) : null} -
      - props.selectBudget(budget)} - className="text-sky-600 hover:text-sky-700 dark:text-sky-400" - > - {t('transactions.add')} - - +
      +
      + { + props.selectBudget(budget) + }} + className="relative -mr-px inline-flex w-0 flex-1 items-center justify-center gap-x-3 rounded-bl-lg border border-transparent py-4 text-sm font-semibold text-gray-900 dark:text-gray-100" + > +
      +
      + props.selectBudget(budget)} + className="relative inline-flex w-0 flex-1 items-center justify-center gap-x-3 rounded-br-lg border border-transparent py-4 text-sm font-semibold text-gray-900 dark:text-gray-100" + > +
      - -
    • - ))} -
    +
  • + ))} +
+ ) : ( <>
{t('budgets.emptyList')}
diff --git a/src/components/OwnAccountsList.tsx b/src/components/OwnAccountsList.tsx index 7dcbfa1e..50044178 100644 --- a/src/components/OwnAccountsList.tsx +++ b/src/components/OwnAccountsList.tsx @@ -2,7 +2,6 @@ import { useTranslation } from 'react-i18next' import { Link, useSearchParams } from 'react-router-dom' import { useEffect, useState } from 'react' import { Translation, Budget, Account } from '../types' -import { PencilIcon } from '@heroicons/react/24/solid' import { ArchiveBoxIcon, PlusCircleIcon, @@ -14,7 +13,12 @@ import { safeName } from '../lib/name-helper' import LoadingSpinner from './LoadingSpinner' import AccountListSwitch from './AccountListSwitch' import Error from './Error' -import { ChevronLeftIcon, ChevronRightIcon } from '@heroicons/react/20/solid' +import { + ArrowsRightLeftIcon, + ChevronLeftIcon, + ChevronRightIcon, + PencilIcon, +} from '@heroicons/react/20/solid' type Props = { budget: Budget @@ -111,59 +115,90 @@ const OwnAccountsList = ({ budget }: Props) => {
)} {accounts.length ? ( -
    - {accounts.map(account => ( -
  • - -
    - + <> +
      + {accounts.map(account => ( +
    • +
      +
      +
      +
      +

      + {safeName(account, 'account')} + {account.archived ? ( + + ) : null} +

      + {account.computedData ? ( +
      = 0 + ? 'text-lime-600' + : 'text-red-600' + } md:mt-2 text-lg text-right md:text-left`} + > + + {formatMoney( + account.computedData.balance, + budget.currency, + { signDisplay: 'auto' } + )} + +
      + ) : null} +
      + {!account.onBudget && ( + + {t('accounts.offBudget')} + + )} +
      + +

      + {account.note} +

      +
      -

      - {safeName(account, 'account')} - {account.archived ? ( - - ) : null} -

      - {account.onBudget ? null : ( -
      - {t('accounts.offBudget')} +
      +
      + +
      - )} - {account.note ? ( -

      - {account.note} -

      - ) : null} - {account.computedData ? ( -
      = 0 - ? 'text-lime-600' - : 'text-red-600' - } mt-2 text-lg`} - > - - {formatMoney( - account.computedData.balance, - budget.currency - )} - +
      + +
      - ) : null} - -
    • - ))} -
    +
    +
  • + ))} +
+ ) : ( <>
diff --git a/src/translations/en.json b/src/translations/en.json index ac670fdd..e11a7443 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -12,6 +12,7 @@ "import": "Import", "select": "Select...", "close": "Close", + "open": "Open", "untitled": "Untitled", "version": "Version", "seeAll": "See All", @@ -86,7 +87,8 @@ "initialBalance": "Initial Balance", "initialBalanceDate": "Date of Initial Balance", "onBudgetExplanation": "You can assign money from this account to your envelopes", - "offBudgetExplanation": "Money in this account is tracked, but can not be assigned to envelopes" + "offBudgetExplanation": "Money in this account is tracked, but can not be assigned to envelopes", + "showTransactions": "Show Transactions" }, "transactions": { "transactions": "Transactions", @@ -117,7 +119,7 @@ "unlockBeforeEditingError": "This transaction has been reconciled and needs to be unlocked before updating it.", "create": "Create Transaction", "delete": "Delete Transaction", - "add": "Add transaction", + "add": "Add Transaction", "repeat": "Repeat Transaction", "confirmDelete": "Are you sure you want to delete this transaction?", "amount": "Amount",