Skip to content

Commit

Permalink
Share Canvas Option in Top Zone
Browse files Browse the repository at this point in the history
  • Loading branch information
saadiqbal-dev committed Apr 21, 2024
1 parent 6e80696 commit bc81237
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
23 changes: 22 additions & 1 deletion apps/canvas/widget/tldraw/TopZone.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,15 @@ const parts = path.split("/");
const creatorId = parts[0];
const thingId = parts[2];

const Button = styled.button`
background: transparent;
width: 24px;
height: 24px;
border: none;
`;

return (
<div className="styled-top-bar">
<div className="styled-top-bar d-flex align-items-center">
<Widget
src="mob.near/widget/N.ProfileLine"
props={{
Expand All @@ -15,5 +22,19 @@ return (
}}
/>
{"/" + thingId}
<OverlayTrigger
placement="auto"
overlay={<Tooltip>{"Copy to clipboard"}</Tooltip>}
>
<Button
onClick={() =>
clipboard.writeText(
`https://draw.everything.dev/${context.accountId}${props.location.search}`
)
}
>
<i className="bi bi-share"></i>
</Button>
</OverlayTrigger>
</div>
);
4 changes: 3 additions & 1 deletion src/components/custom/tldraw/TopZone.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import { Widget } from "near-social-vm";
import React from "react";
import { useBosLoaderStore } from "../../../stores/bos-loader";
import { useLocation } from "react-router-dom";

function TopZone({ path }) {
const redirectMapStore = useBosLoaderStore();
const location = useLocation();

return (
<>
<Widget
key={`${path}-topzone`}
src="everycanvas.near/widget/tldraw.TopZone"
props={{ path: path }}
props={{ path: path, location: location }}
config={{
redirectMap: redirectMapStore.redirectMap,
}}
Expand Down

0 comments on commit bc81237

Please sign in to comment.