40 lines
926 B
TypeScript
40 lines
926 B
TypeScript
|
|
import * as React from 'react';
|
||
|
|
import {createRoot} from 'react-dom/client';
|
||
|
|
|
||
|
|
import '../src/assets/style.css';
|
||
|
|
import { findExistingAxe } from '.';
|
||
|
|
|
||
|
|
const App: React.FC = () => {
|
||
|
|
const addAxe = async () => {
|
||
|
|
var axe = await findExistingAxe()
|
||
|
|
if (!axe) {
|
||
|
|
axe = await miro.board.createImage({
|
||
|
|
url: 'https://www.svgrepo.com/show/395800/axe.svg',
|
||
|
|
width: 200,
|
||
|
|
title: 'todo-tree-axe'
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
await miro.board.viewport.zoomTo(axe);
|
||
|
|
};
|
||
|
|
|
||
|
|
return (
|
||
|
|
<div className="grid wrapper">
|
||
|
|
<div className="cs1 ce12">
|
||
|
|
<h1>TODO Tree Chopper 🪓</h1>
|
||
|
|
</div>
|
||
|
|
<div className="cs1 ce12">
|
||
|
|
<button className="button button-primary" onClick={addAxe}>
|
||
|
|
Create Axe
|
||
|
|
</button>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
);
|
||
|
|
};
|
||
|
|
|
||
|
|
const container = document.getElementById('root');
|
||
|
|
if (container) {
|
||
|
|
const root = createRoot(container);
|
||
|
|
root.render(<App />);
|
||
|
|
}
|