This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
BOARD_ID = '' | |
AUTH_TOKEN = '' | |
URL = 'https://api.miro.com/v1/boards/{board_id}/widgets'.format(board_id=BOARD_ID) | |
FRAME_ID = '' | |
headers = { | |
'Accept': 'application/json', | |
'Content-Type': 'application/json', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function updateWidgets(widgetIds) { | |
const widgetObjects = await Promise.all(widgetsIds.map(async (widgetId) => { | |
const widgets = await miro.board.widgets.get({ id: widgetId }) | |
if (widgets.length > 0) { | |
return widgets[0] | |
} | |
return null | |
})) | |
const widgets = widgetObjects.filter(x => x !== null) | |
widgets.forEach((widget) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useEffect, useState } from 'react' | |
function App() { | |
const [selection, setSelection] = useState([]) | |
const [isLoading, setIsLoading] = useState(true) | |
async function setInitialSelection() { | |
const selection = await miro.board.selection.get() | |
setSelection(selection) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Connections have this shape | |
// { | |
// key: "connection-1", | |
// x: 0, | |
// y: 0, | |
// commands: [ | |
// { | |
// command: "M", | |
// x: 180, | |
// y: 280 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Steps have this shape | |
// export const steps = [ | |
// { | |
// key: "step-1", | |
// x: 100, | |
// y: 100, | |
// width: 100, | |
// height: 200 | |
// }, | |
// ]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useContext, useState } from "react"; | |
import { Rect, Stage, Layer } from "react-konva"; | |
import AppContext, { AppConsumer, AppProvider } from "./AppContext"; | |
import { MapContent } from "./MapContent"; | |
export function Map() { | |
const { isInSelectMode } = useContext(AppContext); | |
const [selection, setSelection] = useState(null); | |
function handleMouseDown(e) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useContext } from "react"; | |
import { Stage } from "react-konva"; | |
import AppContext, { AppConsumer, AppProvider } from "./AppContext"; | |
import { MapContent } from "./MapContent"; | |
export function Map() { | |
const { isInSelectMode } = useContext(AppContext); | |
return ( | |
<AppConsumer> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useEffect, useState } from "react"; | |
import { AppProvider } from "./AppContext"; | |
import { Map } from "./Map"; | |
export default function App() { | |
const [isInSelectMode, setIsInSelectMode] = useState(false); | |
const [selectedEntities, setSelectedEntities] = useState([]); | |
function handleKeyDown(e) { | |
if (!isInSelectMode && e.keyCode === 16) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createContext } from 'react'; | |
const ViewBoxContext = createContext({ | |
xPos: 75, | |
setXPos: () => null, | |
yPos: 75, | |
setYPos: () => null, | |
scale: 1, | |
setScale: () => null, | |
scaleDelta: 0, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function TypeOne({ title, subtitle }) { | |
return ( | |
<h1>{title}</h1> | |
<p>{subtitle}</p> | |
) | |
} | |
function TypeTwo({ image, content }) { | |
return ( | |
<div> |