Prev/Next for visible grandchildren?

My portfolio is organized as follows:
Work > Client > Project

The Work page template displays all Projects like such:

$projects = page('work')->grandchildren()->visible()->sortBy('client', 'asc', 'year', 'desc');

When viewing a Project, I’d like to have a Prev/Next project link that works in the same order as the Projects are displayed above on the Work page.

Using $page->hasNextVisible / $page->hasPrevVisible() results in only Projects of the same Client.

Thanks in advance.

That’s possible with a custom methods, see my getPrev()/getNext() methods in this gist: https://gist.github.com/texnixe/637b4096032a722370696d5d750b9918

Note that you need to pass your pages collection as argument:

$nextPage = $page->getNext($projects);