mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 04:40:32 +00:00
WIP feature/breadcrumb/fix_localize
This commit is contained in:
@@ -8,7 +8,7 @@ export default function AuthenticationWrapper({
|
||||
isAuthenticated = false,
|
||||
...rest
|
||||
}) {
|
||||
const to = { pathname: '/dashboard/homepage' };
|
||||
const to = { pathname: '/homepage' };
|
||||
|
||||
return (
|
||||
<Route path='/auth'>
|
||||
|
||||
26
client/src/components/Breadcrumbs.js
Normal file
26
client/src/components/Breadcrumbs.js
Normal file
@@ -0,0 +1,26 @@
|
||||
import React from 'react';
|
||||
import { NavLink } from 'react-router-dom';
|
||||
import routes from 'routes/dashboard';
|
||||
import withBreadcrumbs from 'react-router-breadcrumbs-hoc';
|
||||
|
||||
const PureBreadcrumbs = ({ breadcrumbs }) => (
|
||||
<div>
|
||||
{breadcrumbs.map(({ breadcrumb, path, match }) => (
|
||||
<span key={path}>
|
||||
<NavLink to={match.url}>{breadcrumb}</NavLink>
|
||||
<span>/</span>
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
|
||||
// <div>
|
||||
// {breadcrumbs.map(({ breadcrumb, match }, index) => (
|
||||
// <div key={match.url}>
|
||||
// <Link to={match.url || ""}>{breadcrumb}</Link>
|
||||
// {index < breadcrumbs.length - 1 && ">"}
|
||||
// </div>
|
||||
// ))}
|
||||
// </div>
|
||||
);
|
||||
|
||||
export default withBreadcrumbs(routes)(PureBreadcrumbs);
|
||||
@@ -11,13 +11,13 @@ export default function Dashboard() {
|
||||
return (
|
||||
<div className='dashboard'>
|
||||
<Switch>
|
||||
<Route path='/dashboard/preferences'>
|
||||
<Route path='/preferences'>
|
||||
<Sidebar />
|
||||
<PreferencesSidebar />
|
||||
<PreferencesContent />
|
||||
</Route>
|
||||
|
||||
<Route path='/dashboard'>
|
||||
<Route path='/'>
|
||||
<Sidebar />
|
||||
<DashboardContent />
|
||||
</Route>
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import React from 'react';
|
||||
import { Route, Switch } from 'react-router-dom';
|
||||
import routes from 'routes/dashboard'
|
||||
import Breadcrumbs from 'components/Breadcrumbs';
|
||||
|
||||
export default function DashboardContentRoute() {
|
||||
|
||||
return (
|
||||
<Route pathname="/dashboard">
|
||||
<Route pathname="/">
|
||||
<Breadcrumbs/>
|
||||
<Switch>
|
||||
{ routes.map((route, index) => (
|
||||
<Route
|
||||
|
||||
@@ -24,7 +24,7 @@ function DashboardTopbar({
|
||||
const history = useHistory();
|
||||
|
||||
const handlerClickEditView = () => {
|
||||
history.push(`/dashboard/custom_views/${editViewId}/edit`);
|
||||
history.push(`/custom_views/${editViewId}/edit`);
|
||||
};
|
||||
|
||||
const maybleRenderPageSubtitle = pageSubtitle && <h3>{pageSubtitle}</h3>;
|
||||
@@ -48,7 +48,7 @@ function DashboardTopbar({
|
||||
role='img'
|
||||
focusable='false'
|
||||
>
|
||||
<title>Menu</title>
|
||||
<title><T id={'menu'}/></title>
|
||||
<path
|
||||
stroke='currentColor'
|
||||
stroke-linecap='round'
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
Popover
|
||||
} from '@blueprintjs/core';
|
||||
import t from 'store/types';
|
||||
import { FormattedMessage as T, useIntl } from 'react-intl';
|
||||
|
||||
function DashboardTopbarUser({ logout }) {
|
||||
const history = useHistory();
|
||||
@@ -20,12 +21,12 @@ function DashboardTopbarUser({ logout }) {
|
||||
|
||||
const userAvatarDropMenu = useMemo(() => (
|
||||
<Menu>
|
||||
<MenuItem icon="graph" text="Graph" />
|
||||
<MenuItem icon="map" text="Map" />
|
||||
<MenuItem icon="th" text="Table" shouldDismissPopover={false} />
|
||||
<MenuItem icon="zoom-to-fit" text="Nucleus" disabled={true} />
|
||||
<MenuItem icon="graph" text={<T id={'menu'}/>} />
|
||||
<MenuItem icon="map" text={<T id={'graph'}/>} />
|
||||
<MenuItem icon="th" text={<T id={'table'}/>} shouldDismissPopover={false} />
|
||||
<MenuItem icon="zoom-to-fit" text={<T id={'nucleus'}/>} disabled={true} />
|
||||
<MenuDivider />
|
||||
<MenuItem icon="cog" text="Logout" onClick={onClickLogout} />
|
||||
<MenuItem icon="cog" text={<T id={'logout'}/>} onClick={onClickLogout} />
|
||||
</Menu>
|
||||
), [onClickLogout]);
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ export default function ExpenseForm({
|
||||
submitExpense(values)
|
||||
.then(response => {
|
||||
AppToaster.show({
|
||||
message: 'the_expense_has_been_submit'
|
||||
message: formatMessage({id:'the_expense_has_been_successfully_created'})
|
||||
});
|
||||
})
|
||||
.catch(error => {});
|
||||
@@ -108,11 +108,11 @@ export default function ExpenseForm({
|
||||
|
||||
const paymentAccountLabel = state.selectedPaymentAccount
|
||||
? state.selectedPaymentAccount.name
|
||||
: 'Select Payment Account';
|
||||
: <T id={'select_payment_account'}/>;
|
||||
|
||||
const expenseAccountLabel = state.selectedExpenseAccount
|
||||
? state.selectedExpenseAccount.name
|
||||
: 'Select Expense Account';
|
||||
: <T id={'select_expense_account'}/>;
|
||||
|
||||
const handleClose = () => {};
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ export default function ExpensesActionsBar({
|
||||
<AnchorButton
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon='plus' />}
|
||||
href='/dashboard/expenses/new'
|
||||
href='/expenses/new'
|
||||
text={<T id={'new_expense'}/>}
|
||||
onClick={onClickNewAccount}
|
||||
/>
|
||||
|
||||
@@ -17,7 +17,7 @@ function AccountsViewsTabs({ views }) {
|
||||
const {path} = useRouteMatch();
|
||||
|
||||
const handleClickNewView = () => {
|
||||
history.push('/dashboard/custom_views/new');
|
||||
history.push('/custom_views/new');
|
||||
};
|
||||
|
||||
const tabs = views.map((view) => {
|
||||
|
||||
@@ -19,9 +19,11 @@ export default function FilterDropdown({
|
||||
fields,
|
||||
onFilterChange,
|
||||
}) {
|
||||
const {formatMessage} =useIntl();
|
||||
|
||||
const conditionalsItems = useMemo(() => [
|
||||
{ value: 'and', label: 'AND' },
|
||||
{ value: 'or', label: 'OR' },
|
||||
{ value: 'and', label:formatMessage({id:'and'}) },
|
||||
{ value: 'or', label: formatMessage({id:'or'}) },
|
||||
], []);
|
||||
|
||||
const resourceFields = useMemo(() => [
|
||||
@@ -29,11 +31,11 @@ export default function FilterDropdown({
|
||||
], [fields]);
|
||||
|
||||
const compatatorsItems = useMemo(() => [
|
||||
{value: '', label: 'Select a compatator'},
|
||||
{value: 'equals', label: 'Equals'},
|
||||
{value: 'not_equal', label: 'Not Equal'},
|
||||
{value: 'contain', label: 'Contain'},
|
||||
{value: 'not_contain', label: 'Not Contain'},
|
||||
{value: '', label:formatMessage({id:'select_a_comparator'})},
|
||||
{value: 'equals', label: formatMessage({id:'equals'})},
|
||||
{value: 'not_equal', label: formatMessage({id:'not_equal'})},
|
||||
{value: 'contain', label: formatMessage({id:'contain'})},
|
||||
{value: 'not_contain', label: formatMessage({id:'not_contain'})},
|
||||
], []);
|
||||
|
||||
const defaultFilterCondition = useMemo(() => ({
|
||||
|
||||
@@ -2,6 +2,7 @@ import React, { useMemo, useCallback } from 'react';
|
||||
import moment from 'moment';
|
||||
import classnames from 'classnames';
|
||||
import LoadingIndicator from 'components/LoadingIndicator';
|
||||
import { FormattedMessage as T, useIntl } from 'react-intl';
|
||||
|
||||
export default function FinancialSheet({
|
||||
companyName,
|
||||
@@ -18,42 +19,44 @@ export default function FinancialSheet({
|
||||
const formattedFromDate = moment(fromDate).format('DD MMMM YYYY');
|
||||
const formattedToDate = moment(toDate).format('DD MMMM YYYY');
|
||||
const nameModifer = name ? `financial-sheet--${name}` : '';
|
||||
|
||||
const methodsLabels = useMemo(() => ({
|
||||
'cash': 'Cash',
|
||||
'accural': 'Accural',
|
||||
}), []);
|
||||
const { formatMessage } = useIntl();
|
||||
const methodsLabels = useMemo(
|
||||
() => ({
|
||||
cash: formatMessage({id:'cash'}),
|
||||
accrual: formatMessage({id:'accrual'}),
|
||||
}),
|
||||
[]
|
||||
);
|
||||
const getBasisLabel = useCallback((b) => methodsLabels[b], [methodsLabels]);
|
||||
const basisLabel = useMemo(() => getBasisLabel(basis), [getBasisLabel, basis]);
|
||||
const basisLabel = useMemo(() => getBasisLabel(basis), [
|
||||
getBasisLabel,
|
||||
basis,
|
||||
]);
|
||||
|
||||
return (
|
||||
<div className={classnames('financial-sheet', nameModifer, className)}>
|
||||
<LoadingIndicator loading={loading} spinnerSize={34} />
|
||||
|
||||
<div className={classnames('financial-sheet__inner', {
|
||||
'is-loading': loading,
|
||||
})}>
|
||||
<h1 class="financial-sheet__title">
|
||||
{ companyName }
|
||||
</h1>
|
||||
<h6 class="financial-sheet__sheet-type">{ sheetType }</h6>
|
||||
<div class="financial-sheet__date">
|
||||
From { formattedFromDate } | To { formattedToDate }
|
||||
<div
|
||||
className={classnames('financial-sheet__inner', {
|
||||
'is-loading': loading,
|
||||
})}
|
||||
>
|
||||
<h1 class='financial-sheet__title'>{companyName}</h1>
|
||||
<h6 class='financial-sheet__sheet-type'>{sheetType}</h6>
|
||||
<div class='financial-sheet__date'>
|
||||
<T id={'from'}/> {formattedFromDate} | <T id={'to'}/> {formattedToDate}
|
||||
</div>
|
||||
|
||||
<div class="financial-sheet__table">
|
||||
{ children }
|
||||
</div>
|
||||
<div class="financial-sheet__accounting-basis">
|
||||
{ accountingBasis }
|
||||
</div>
|
||||
<div class='financial-sheet__table'>{children}</div>
|
||||
<div class='financial-sheet__accounting-basis'>{accountingBasis}</div>
|
||||
|
||||
{ (basisLabel) && (
|
||||
<div class="financial-sheet__basis">
|
||||
Accounting Basis: { basisLabel }
|
||||
{basisLabel && (
|
||||
<div class='financial-sheet__basis'>
|
||||
<T id={'accounting_basis'}/> {basisLabel}
|
||||
</div>
|
||||
)}
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,11 +4,11 @@ import preferencesRoutes from 'routes/preferences'
|
||||
|
||||
|
||||
export default function DashboardContentRoute() {
|
||||
const defaultTab = '/dashboard/preferences/general';
|
||||
const defaultTab = '/preferences/general';
|
||||
|
||||
return (
|
||||
<Route pathname="/dashboard/preferences">
|
||||
<Redirect from='/dashboard/preferences' to={defaultTab} />
|
||||
<Route pathname="/preferences">
|
||||
<Redirect from='/preferences' to={defaultTab} />
|
||||
|
||||
<Switch>
|
||||
{ preferencesRoutes.map((route, index) => (
|
||||
|
||||
@@ -11,16 +11,16 @@ export default function PreferencesTopbar() {
|
||||
<h2>Accounts</h2>
|
||||
|
||||
<div class="preferences__topbar-actions">
|
||||
<Route pathname="/dashboard/preferences">
|
||||
<Route pathname="/preferences">
|
||||
<Switch>
|
||||
<Route
|
||||
exact
|
||||
path={'/dashboard/preferences/users'}
|
||||
path={'/preferences/users'}
|
||||
component={UsersActions} />
|
||||
|
||||
<Route
|
||||
exact
|
||||
path={'/dashboard/preferences/currencies'}
|
||||
path={'/preferences/currencies'}
|
||||
component={CurrenciesActions} />
|
||||
</Switch>
|
||||
</Route>
|
||||
|
||||
@@ -17,7 +17,7 @@ function PrivateRoute({
|
||||
<BodyClassName className={''}>
|
||||
<Route
|
||||
{...rest}
|
||||
path="/dashboard"
|
||||
path="/"
|
||||
render={_props =>
|
||||
isAuthenticated ? (<Component {..._props} />) :
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user