Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

navigateToLeftMenuItem #239

Open
mdbraber opened this issue Jan 19, 2023 · 5 comments
Open

navigateToLeftMenuItem #239

mdbraber opened this issue Jan 19, 2023 · 5 comments

Comments

@mdbraber
Copy link
Contributor

mdbraber commented Jan 19, 2023

I wanted a function that could navigate directly to a specific top section, favorite or project - see the code below. I've used the updated withLeftMenuItems from #232. The itemId can be today, upcoming or any itemId that Todoist creates for projects or filters. This way you can easily navigate to projects with the same name (and code doesn't have to be updated if projects get renamed).

  function navigateToLeftMenuItem(itemId) {
      return () => {
          withLeftMenuItems(['top','favorites','projects'], (menuItems, current) => {
              for (const menuItem of menuItems) {
                  if(menuItem.href.indexOf(itemId) > 0) {
                      click(menuItem);
                  }
              }
          });
      }
  }

You can make keybinding as follows:

    ['command+1', navigateToLeftMenuItem('377156504')],
    ['command+2', navigateToLeftMenuItem('today')],
    ['command+3', navigateToLeftMenuItem('upcoming')],
@mgsloan
Copy link
Owner

mgsloan commented Jan 24, 2023

Cool, thanks! I've added this code to version 173

@mgsloan mgsloan closed this as completed Jan 24, 2023
@mdbraber
Copy link
Contributor Author

Thanks @mgsloan - I think we also then need the updated code from #232 which also fixes the navigation issues mentioned there (issue is closed officially - maybe reopen if it needs work?)

@mgsloan
Copy link
Owner

mgsloan commented Jan 24, 2023

Welcome! Yeah, was going to try to include that in this release but didn't get around to it. Will write more on that issue

@mdbraber
Copy link
Contributor Author

mdbraber commented Jan 24, 2023

No problem. Just mentioning that the withLeftMenuLinks code is from my updated function so not from < v173. So if that code fron #232 is not integrated in v173 it might need some (temporary updating). Check the sections part of the code.

@mgsloan mgsloan reopened this Jan 24, 2023
@mgsloan
Copy link
Owner

mgsloan commented Jan 24, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants