Skip to content

A local-first personal finance app

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

Jed Foxfef8ac608d2a
diff --git a/packages/desktop-client/src/components/schedules/DiscoverSchedules.js b/packages/desktop-client/src/components/schedules/DiscoverSchedules.js
index f9fff59daf..cd161bbda7 100644
--- a/packages/desktop-client/src/components/schedules/DiscoverSchedules.js
+++ b/packages/desktop-client/src/components/schedules/DiscoverSchedules.js
@@ -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}
diff --git a/packages/loot-design/src/components/sidebar.js b/packages/loot-design/src/components/sidebar.js
index 627e819853..833c8944f8 100644
--- a/packages/loot-design/src/components/sidebar.js
+++ b/packages/loot-design/src/components/sidebar.js
@@ -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}