Skip to content

Commit

Permalink
initial canvas
Browse files Browse the repository at this point in the history
  • Loading branch information
elliotBraem committed Nov 27, 2023
1 parent 23c7e72 commit febc79a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 36 deletions.
4 changes: 2 additions & 2 deletions apps/canvas/widget/feed/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,14 @@ return (
<Container>
<div className="d-flex justify-content-between align-items-center mb-3">
<h3>every {type}</h3>
{/* <div>
<div>
<button className="classic me-2">
<i className="bi bi-upload" />
</button>
<button className="classic">
<i className="bi bi-gear" />
</button>
</div> */}
</div>
</div>
<Widget
src="/*__@appAccount__*//widget/ItemFeed"
Expand Down
44 changes: 10 additions & 34 deletions apps/canvas/widget/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
* This should be primary view
*/

const path = props.path || "everycanvas.near";
const path = props.path || context.accountId || "everycanvas.near";

const parts = path.split("/");

if (parts.length === 1) {
path = `${path}/thing/canvas`;
path = `${path}/canvas/main`;
}

const creatorId = parts[0];
Expand All @@ -22,50 +22,26 @@ const hyperfile = JSON.parse(Social.get(path, "final") || "null");
let data; // what is an empty snapshot?

if (hyperfile.adapter) {
const { get } =
VM.require(hyperfile.adapter) || (() => {});
const { get } = VM.require(hyperfile.adapter) || (() => {});
if (get) {
data = get(hyperfile.reference) || null;
} else {
return <p>{`Loading or adapter not found : ${hyperfile.adapter}`}</p>;
}
} else {
return (
<Container key={path}>
<Canvas persistance={path} autoFocus={true} />
</Container>
);
}

// // button to select and load a specific canvas.
// // what is the multiples example?

if (!data) {
return <p>{`Loading or canvas not found : ${hyperfile.adapter}`}</p>;
}

// this can come from user or app settings
const plugins = [
{
"hyperfile": {
src: "everycanvas.near/widget/create.hyperfile",
description: "able to create hyperfiles",
layout: "sharezone",
authors: ["hack.near", "flowscience.near", "efiz.near"]
}
},
{
"magic": {
src: "everycanvas.near/widget/magic",
description: "use open ai",
layout: "action",
isModalOpen: true,
authors: ["petersalomonsen.near"]
}
}
]

return (
<Container key={path}>
<Canvas
initialSnapshot={data}
persistance={path}
autoFocus={true}
plugins={plugins}
/>
<Canvas initialSnapshot={data} persistance={path} autoFocus={true} />
</Container>
);

0 comments on commit febc79a

Please sign in to comment.