Skip to content

Commit

Permalink
Merge pull request #26 from saadiqbal-dev/main
Browse files Browse the repository at this point in the history
URL fixed for canvas when no user logged in
  • Loading branch information
elliotBraem authored Apr 17, 2024
2 parents f783744 + 72a4955 commit 3ec2a01
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 22 deletions.
39 changes: 18 additions & 21 deletions src/components/custom/tldraw/Canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,32 +102,29 @@ const Test = () => {

useEffect(() => {
const updatePage = setTimeout(() => {
let newLocation;
if (accountId) {
newLocation = {
pathname:
location.pathname === "/everything.near"
const newLocation = {
pathname:
location.pathname === "/" || location.pathname === "/null"
? location.pathname === "/"
? `/${accountId}`
: location.pathname,
search: `?page=${currentPage.name
.toLowerCase()
.split(" ")
.join("-")}&v=${viewportPageBounds.x.toFixed(
2
)},${viewportPageBounds.y.toFixed(2)},${viewportPageBounds.w},${
viewportPageBounds.h
}`,
};
} else {
newLocation = {
pathname: "/everything.near",
};
}
: "/every.near"
: location.pathname,

search: `page=${currentPage.name
.toLowerCase()
.split(" ")
.join("-")}&v=${viewportPageBounds.x.toFixed(
2
)},${viewportPageBounds.y.toFixed(2)},${viewportPageBounds.w},${
viewportPageBounds.h
}`,
};

history.push(newLocation);
}, 1000);

return () => clearTimeout(updatePage);
}, [accountId, location.pathname, currentPage, viewportPageBounds, history]);
}, [currentPage, viewportPageBounds]);

return <></>;
};
Expand Down
6 changes: 5 additions & 1 deletion src/pages/ViewPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ export default function ViewPage(props) {
<Widget
key={src}
src={src}
props={{ path: path, page: page, viewport: viewport }}
props={{
path: path ?? "every.near",
page: page,
viewport: viewport,
}}
config={{
redirectMap: redirectMapStore.redirectMap,
}}
Expand Down

0 comments on commit 3ec2a01

Please sign in to comment.