mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
feat: back redirection
This commit is contained in:
parent
a2825208b8
commit
f0397ef2b5
@ -17,7 +17,17 @@ const Breadcrumbs = ({ children }: BreadcrumbsProps) => {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="grid h-8 w-8 flex-shrink-0 cursor-pointer place-items-center rounded border border-brand-base text-center text-sm hover:bg-brand-surface-1"
|
className="grid h-8 w-8 flex-shrink-0 cursor-pointer place-items-center rounded border border-brand-base text-center text-sm hover:bg-brand-surface-1"
|
||||||
onClick={() => router.back()}
|
onClick={() => {
|
||||||
|
const lastTenUrls = JSON.parse(localStorage.getItem("lastTenUrls") || "[]");
|
||||||
|
if (lastTenUrls.length > 0) {
|
||||||
|
const url = lastTenUrls[1];
|
||||||
|
lastTenUrls.splice(0, 2);
|
||||||
|
localStorage.setItem("lastTenUrls", JSON.stringify(lastTenUrls));
|
||||||
|
router.push(url);
|
||||||
|
} else {
|
||||||
|
router.push("/");
|
||||||
|
}
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<ArrowLeftIcon className="h-3 w-3" />
|
<ArrowLeftIcon className="h-3 w-3" />
|
||||||
</button>
|
</button>
|
||||||
|
@ -31,6 +31,12 @@ NProgress.configure({ showSpinner: false });
|
|||||||
Router.events.on("routeChangeStart", NProgress.start);
|
Router.events.on("routeChangeStart", NProgress.start);
|
||||||
Router.events.on("routeChangeError", NProgress.done);
|
Router.events.on("routeChangeError", NProgress.done);
|
||||||
Router.events.on("routeChangeComplete", NProgress.done);
|
Router.events.on("routeChangeComplete", NProgress.done);
|
||||||
|
Router.events.on("routeChangeComplete", () => {
|
||||||
|
const urls = JSON.parse(localStorage.getItem("lastTenUrls") || "[]");
|
||||||
|
urls.unshift(Router.asPath);
|
||||||
|
const trimmedUrls = urls.slice(0, 10);
|
||||||
|
localStorage.setItem("lastTenUrls", JSON.stringify(trimmedUrls));
|
||||||
|
});
|
||||||
|
|
||||||
function MyApp({ Component, pageProps }: AppProps) {
|
function MyApp({ Component, pageProps }: AppProps) {
|
||||||
return (
|
return (
|
||||||
|
Loading…
Reference in New Issue
Block a user