Skip to content
Snippets Groups Projects
Unverified Commit fef8ac60 authored by Jed Fox's avatar Jed Fox
Browse files

Fix /schedule/discover behavior when it’s a page

parent 6b320a40
No related branches found
No related tags found
No related merge requests found
......@@ -26,13 +26,14 @@ import useSelected, {
} from 'loot-design/src/components/useSelected';
import { colors } from 'loot-design/src/style';
import { Page } from '../Page';
import { Page, usePageType } from '../Page';
import DisplayId from '../util/DisplayId';
import { ScheduleAmountCell } from './SchedulesTable';
let ROW_HEIGHT = 43;
function DiscoverSchedulesTable({ schedules, loading }) {
let pageType = usePageType();
let selectedItems = useSelectedItems();
let dispatchSelected = useSelectedDispatch();
......@@ -100,9 +101,12 @@ function DiscoverSchedulesTable({ schedules, loading }) {
</TableHeader>
<Table
rowHeight={ROW_HEIGHT}
backgroundColor="transparent"
version="v2"
style={{ flex: 1, backgroundColor: 'transparent' }}
backgroundColor={pageType.type === 'modal' ? 'transparent' : undefined}
style={{
flex: 1,
backgroundColor: pageType.type === 'modal' ? 'transparent' : undefined
}}
items={schedules}
loading={loading}
isSelected={id => selectedItems.has(id)}
......@@ -114,7 +118,7 @@ function DiscoverSchedulesTable({ schedules, loading }) {
}
export default function DiscoverSchedules() {
let location = useLocation();
let pageType = usePageType();
let history = useHistory();
let [schedules, setSchedules] = useState();
let [creating, setCreating] = useState(false);
......@@ -174,11 +178,7 @@ export default function DiscoverSchedules() {
on all transactions for a schedule to be the same payee.
</P>
<P>
You can always do this later
{Platform.isBrowser
? ' from the "Find schedules" item in the sidebar menu'
: ' from the "Tools > Find schedules" menu item'}
.
You can always do this later from More Tools &rarr; Find Schedules.
</P>
<SelectedProvider instance={selectedInst}>
......@@ -192,9 +192,11 @@ export default function DiscoverSchedules() {
direction="row"
align="center"
justify="flex-end"
style={{ paddingTop: 20 }}
style={{
paddingTop: 20,
paddingBottom: pageType.type === 'modal' ? 0 : 20
}}
>
<Button onClick={() => history.goBack()}>Do nothing</Button>
<ButtonWithLoading
primary
loading={creating}
......
......@@ -451,7 +451,7 @@ function Tools() {
history.push('/rules');
break;
case 'find-schedules':
history.push('/schedule/discover', { locationPtr: history.location });
history.push('/schedule/discover');
break;
case 'repair-splits':
history.push('/tools/fix-splits', { locationPtr: history.location });
......@@ -472,9 +472,12 @@ function Tools() {
onClick={onToggle}
style={{ pointerEvents: isOpen ? 'none' : 'auto' }}
forceHover={isOpen}
forceActive={['/payees', '/rules', '/tools'].some(route =>
location.pathname.startsWith(route)
)}
forceActive={[
'/payees',
'/rules',
'/tools',
'/schedule/discover'
].some(route => location.pathname.startsWith(route))}
button={
<ChevronRight
width={12}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment