From 3bda11600e678bef04197c7e078a81798b59e02e Mon Sep 17 00:00:00 2001 From: Jed Fox <git@jedfox.com> Date: Mon, 2 Jan 2023 10:27:50 -0500 Subject: [PATCH] =?UTF-8?q?move=20=E2=80=9CFind=20schedules=E2=80=9D=20to?= =?UTF-8?q?=20a=20button=20on=20the=20Schedules=20page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/schedules/index.js | 14 +++++++++++++- packages/loot-design/src/components/sidebar.js | 13 +++---------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/packages/desktop-client/src/components/schedules/index.js b/packages/desktop-client/src/components/schedules/index.js index 96fdf05b6..415d7c727 100644 --- a/packages/desktop-client/src/components/schedules/index.js +++ b/packages/desktop-client/src/components/schedules/index.js @@ -27,6 +27,10 @@ export default function Schedules() { history.push(`/schedule/edit`, { locationPtr: history.location }); } + function onDiscover() { + history.push(`/schedule/discover`, { locationPtr: history.location }); + } + async function onAction(name, id) { switch (name) { case 'post-transaction': @@ -70,7 +74,15 @@ export default function Schedules() { /> </View> - <View style={{ alignItems: 'flex-end', margin: '20px 0', flexShrink: 0 }}> + <View + style={{ + flexDirection: 'row', + justifyContent: 'space-between', + margin: '20px 0', + flexShrink: 0 + }} + > + <Button onClick={onDiscover}>Find schedules…</Button> <Button primary onClick={onAdd}> Add new schedule </Button> diff --git a/packages/loot-design/src/components/sidebar.js b/packages/loot-design/src/components/sidebar.js index a5f0218c0..c8acde374 100644 --- a/packages/loot-design/src/components/sidebar.js +++ b/packages/loot-design/src/components/sidebar.js @@ -439,7 +439,6 @@ function Tools() { let items = [ { name: 'payees', text: 'Payees' }, { name: 'rules', text: 'Rules' }, - { name: 'find-schedules', text: 'Find schedules' }, { name: 'repair-splits', text: 'Repair split transactions' } ]; @@ -452,9 +451,6 @@ function Tools() { case 'rules': history.push('/rules'); break; - case 'find-schedules': - history.push('/schedule/discover'); - break; case 'repair-splits': history.push('/tools/fix-splits', { locationPtr: history.location }); break; @@ -474,12 +470,9 @@ function Tools() { onClick={onToggle} style={{ pointerEvents: isOpen ? 'none' : 'auto' }} forceHover={isOpen} - forceActive={[ - '/payees', - '/rules', - '/tools', - '/schedule/discover' - ].some(route => location.pathname.startsWith(route))} + forceActive={['/payees', '/rules', '/tools'].some(route => + location.pathname.startsWith(route) + )} button={ <ChevronRight width={12} -- GitLab