@dandori/ui
TypeScript icon, indicating that this package has built-in type declarations

0.0.25 • Public • Published

dandori/ui

This repository is responsible for viewing your tasks which are generated by @dandori/core .

Installation

npm install @dandori/core @dandori/ui
yarn add @dandori/core @dandori/ui
pnpm add @dandori/core @dandori/ui

Usage

import generateDandoriTasks from '@dandori/core';
import { generateDandoriMiroCards } from "@dandori/ui";

const text = `
Today's My Tasks
* Send Email to John
* Send Email to Mary
* Report to Boss after sending emails
`;

const tasks = await generateDandoriTasks(text);
await generateDandoriMiroCards(tasks, {
  boardId: '1234567890',
});

Requirements

  • Please see @dandori/core before using @dandori/ui.
  • @dandori/ui depends on external APIs. You need to set EXTERNALAPP_API_KEY environment variables like MIRO_API_KEY .
  • @dandori/ui supports to load .env file. Please create .env file and set environment variables.

Supported External APIs

API

generateDandoriMiroCards

async function generateDandoriMiroCards(
  tasks: DandoriTask[],
  options?: GenerateDandoriMiroCardsOptions,
): Promise<void> {}

generateDandoriMiroCards creates miro cards from generateDandoriTasks result.

miro output example

Parameters

tasks

The tasks which are generated by generateDandoriTasks of @dandori/core.

options
interface GenerateDandoriMiroCardsOptions {
  boardId?: string;
  isAppCard?: boolean;
  apiKey?: string;
}
  • boardId

The existing board id of miro.

You can get the board id from the miro url of the board.

For example, if the url is https://miro.com/app/board/1234567890/, the board id is 1234567890.

If not set, the new board is created.

  • isAppCard

default is false

If you set true , the cards are created as App cards.

  • apiKey

The api key of miro. You can also set MIRO_API_KEY environment variable instead of this option.

generateDandoriNotionPages

async function generateDandoriNotionPages(
  tasks: DandoriTask[],
  options?: GenerateDandoriNotionPagesOptions,
): Promise<void> {}

generateDandoriNotionTasks creates notion pages from generateDandoriTasks result.

notion output example

Parameters

tasks

The tasks which are generated by generateDandoriTasks of @dandori/core.

options
interface GenerateDandoriNotionPagesOptions {
  databaseId: string;
  databasePropertiesMap?: DatabasePropertiesMap;
  apiKey?: string;
}
  • databaseId

The existing database id of notion.

You can get the database id from the notion url of the database.

For example, if the url is https://www.notion.so/myworkspace/1234567890?v=123, the database id is 1234567890.

  • databasePropertiesMap

default is { name: 'title' }

The map which key is defined by dandori and value is your notion database properties.

You can set the key like belows.

const databasePropertiesMap = {
  name: "",
  deadline: "",
  description: "",
  status: "",
  "status.todo": "",
  "status.doing": "",
  "status.done": "",
};
import generateDandoriTasks from '@dandori/core';
import { generateDandoriNotionPages } from "@dandori/ui";

const text = `
Today's My Tasks
* Send Email to John
* Send Email to Mary
* Report to Boss after sending emails
`;

const databasePropertiesMap = {
  status: "Status",
  "status.todo": "ToDo",
  "status.doing": "Doing",
  "status.done": "Done 🙌",
};

const tasks = await generateDandoriTasks(text);
await generateDandoriNotionPages(tasks, {
  databaseId: '1234567890',
  databasePropertiesMap,
});

This is an example. In this case, the output is like belows.

notion output example

For more details about database properties, please see Notion API.

  • apiKey

The api key of notion. You can also set NOTION_API_KEY environment variable instead of this option.

generateDandoriTrelloCards

async function generateDandoriTrelloCards(
  tasks: DandoriTask[],
  options?: GenerateDandoriTrelloCardsOptions,
): Promise<void> {}

generateDandoriTrelloCards creates trello cards from generateDandoriTasks result.

trello output example

Parameters

tasks

The tasks which are generated by generateDandoriTasks of @dandori/core.

options
interface GenerateDandoriTrelloCardsOptions {
  boardId: string;
  trelloListPropertiesMap?: TrelloListPropertiesMap;
  apiKey?: string;
  apiToken?: string;
}
  • boardId

The existing board id of trello.

You can get the board id from your trello url.

For example, if the url is https://trello.com/b/ABCDE/boardTitle, the board id is ABCDE.

  • trelloListPropertiesMap

The map which key is defined by dandori and value is your trello list properties.

You can set the key like belows.

const trelloListPropertiesMap = {
  "status.todo": "",
  "status.doing": "",
  "status.done": "",
};
import generateDandoriTasks from '@dandori/core';
import { generateDandoriTrelloCards } from "@dandori/ui";

const text = `
Today's My Tasks
* Send Email to John
* Send Email to Mary
* Report to Boss after sending emails
`;

const trelloListPropertiesMap = {
  "status.todo": "Todo",
  "status.doing": "Doing",
  "status.done": "Done",
};

const tasks = await generateDandoriTasks(text);
await generateDandoriNotionPages(tasks, {
  boardId: 'ABCDE',
  trelloListPropertiesMap,
});

This is an example. In this case, the output is like belows.

notion output example

For more details about database properties, please see Notion API.

  • apiKey

The api key of trello. You can also set TRELLO_API_KEY environment variable instead of this option.

  • apiToken

The api token of trello which you can get through OAuth. You can also set TRELLO_API_TOKEN environment variable instead of this option.

Readme

Keywords

none

Package Sidebar

Install

npm i @dandori/ui

Weekly Downloads

3

Version

0.0.25

License

MIT

Unpacked Size

3.91 MB

Total Files

29

Last publish

Collaborators

  • hiroki0525