Compare commits
11 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a3e378f219 | ||
|
|
c63f039b11 | ||
|
|
3c7d2099bd | ||
|
|
44893508dc | ||
|
|
64d045bbc5 | ||
|
|
fc6506525c | ||
|
|
b80d2f8dc1 | ||
|
|
67463a648d | ||
|
|
b2c93a4747 | ||
|
|
eadd8d9f8c | ||
|
|
e7b4572d2e |
9 changed files with 99 additions and 79 deletions
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "obsidian-habitica-integration",
|
||||
"name": "Habitica Sync",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.2",
|
||||
"minAppVersion": "0.9.12",
|
||||
"description": "This plugin helps integrate Habitica user tasks and stats into Obsidian",
|
||||
"author": "Leoh and Ran",
|
||||
|
|
|
|||
69
package.json
69
package.json
|
|
@ -4,47 +4,48 @@
|
|||
"description": "This plugin allows for Habitica integration into Obsidian",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
"dev": "rollup --config rollup.config.js -w",
|
||||
"build": "rollup --config rollup.config.js --environment BUILD:production",
|
||||
"dev": "rollup --config rollup.config.mjs -w",
|
||||
"build": "rollup --config rollup.config.mjs --environment BUILD:production",
|
||||
"dev2": "obsidian-plugin dev src/main.ts"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "Leonard and Ran",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-commonjs": "^18.0.0",
|
||||
"@rollup/plugin-json": "^4.1.0",
|
||||
"@rollup/plugin-node-resolve": "^11.2.1",
|
||||
"@rollup/plugin-typescript": "^8.2.1",
|
||||
"@types/markdown-it": "^12.2.3",
|
||||
"@types/markdown-it-emoji": "^2.0.2",
|
||||
"@types/node": "^14.14.37",
|
||||
"@types/node-emoji": "^1.8.1",
|
||||
"@types/react": "^17.0.27",
|
||||
"@types/react-dom": "^17.0.9",
|
||||
"@types/react-tabs": "^2.3.3",
|
||||
"@types/twemoji": "^12.1.2",
|
||||
"css-loader": "^6.4.0",
|
||||
"extract-text-webpack-plugin": "^2.1.2",
|
||||
"obsidian": "^0.12.0",
|
||||
"obsidian-plugin-cli": "^0.4.3",
|
||||
"rollup": "^2.32.1",
|
||||
"style-loader": "^3.3.0",
|
||||
"tslib": "^2.2.0",
|
||||
"typescript": "^4.2.4"
|
||||
"@rollup/plugin-commonjs": "^25.0.7",
|
||||
"@rollup/plugin-json": "^6.1.0",
|
||||
"@rollup/plugin-node-resolve": "^15.2.3",
|
||||
"@rollup/plugin-typescript": "^11.1.6",
|
||||
"@types/markdown-it": "^13.0.7",
|
||||
"@types/markdown-it-emoji": "^2.0.4",
|
||||
"@types/node": "^20.11.0",
|
||||
"@types/node-emoji": "^1.8.2",
|
||||
"@types/react": "^18.2.47",
|
||||
"@types/react-dom": "^18.2.18",
|
||||
"@types/react-tabs": "^5.0.4",
|
||||
"@types/twemoji": "^13.1.1",
|
||||
"css-loader": "^6.9.0",
|
||||
"mini-css-extract-plugin": "^2.7.7",
|
||||
"obsidian": "^1.4.11",
|
||||
"obsidian-plugin-cli": "^0.0.5",
|
||||
"rollup": "^4.9.4",
|
||||
"style-loader": "^3.3.4",
|
||||
"tslib": "^2.6.2",
|
||||
"typescript": "^5.3.3",
|
||||
"webpack": "^5.89.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"markdown-it": "^12.3.2",
|
||||
"markdown-it-emoji": "^2.0.0",
|
||||
"moment": "^2.29.1",
|
||||
"node": "^16.10.0",
|
||||
"node-emoji": "^1.11.0",
|
||||
"node-fetch": "^3.0.0",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-emoji-render": "^1.2.4",
|
||||
"react-markdown": "^7.1.0",
|
||||
"react-tabs": "^3.2.2",
|
||||
"twemoji": "^13.1.0"
|
||||
"markdown-it": "^14.0.0",
|
||||
"markdown-it-emoji": "^2.0.2",
|
||||
"moment": "^2.30.1",
|
||||
"node": "^21.2.0",
|
||||
"node-emoji": "^2.1.3",
|
||||
"node-fetch": "^3.3.2",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-emoji-render": "^2.0.1",
|
||||
"react-markdown": "^9.0.1",
|
||||
"react-tabs": "^6.0.2",
|
||||
"twemoji": "^14.0.2"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,32 +1,32 @@
|
|||
import typescript from '@rollup/plugin-typescript';
|
||||
import {nodeResolve} from '@rollup/plugin-node-resolve';
|
||||
import commonjs from '@rollup/plugin-commonjs';
|
||||
import json from '@rollup/plugin-json';
|
||||
|
||||
const isProd = (process.env.BUILD === 'production');
|
||||
|
||||
const banner =
|
||||
`/*
|
||||
THIS IS A GENERATED/BUNDLED FILE BY ROLLUP
|
||||
if you want to view the source visit the plugins github repository
|
||||
*/
|
||||
`;
|
||||
|
||||
export default {
|
||||
input: 'src/main.ts',
|
||||
output: {
|
||||
dir: '.',
|
||||
sourcemap: 'inline',
|
||||
sourcemapExcludeSources: isProd,
|
||||
format: 'cjs',
|
||||
exports: 'default',
|
||||
banner,
|
||||
},
|
||||
external: ['obsidian'],
|
||||
plugins: [
|
||||
typescript(),
|
||||
nodeResolve({browser: true}),
|
||||
commonjs(),
|
||||
json(),
|
||||
]
|
||||
import typescript from '@rollup/plugin-typescript';
|
||||
import {nodeResolve} from '@rollup/plugin-node-resolve';
|
||||
import commonjs from '@rollup/plugin-commonjs';
|
||||
import json from '@rollup/plugin-json';
|
||||
|
||||
const isProd = (process.env.BUILD === 'production');
|
||||
|
||||
const banner =
|
||||
`/*
|
||||
THIS IS A GENERATED/BUNDLED FILE BY ROLLUP
|
||||
if you want to view the source visit the plugins github repository
|
||||
*/
|
||||
`;
|
||||
|
||||
export default {
|
||||
input: 'src/main.ts',
|
||||
output: {
|
||||
dir: '.',
|
||||
sourcemap: 'inline',
|
||||
sourcemapExcludeSources: isProd,
|
||||
format: 'cjs',
|
||||
exports: 'default',
|
||||
banner,
|
||||
},
|
||||
external: ['obsidian'],
|
||||
plugins: [
|
||||
typescript(),
|
||||
nodeResolve({browser: true}),
|
||||
commonjs(),
|
||||
json(),
|
||||
]
|
||||
};
|
||||
10
src/main.ts
10
src/main.ts
|
|
@ -39,7 +39,7 @@ export default class HabiticaSync extends Plugin {
|
|||
this.activateView();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
async loadSettings() {
|
||||
this.settings = Object.assign(DEFAULT_SETTINGS, await this.loadData())
|
||||
|
|
@ -50,22 +50,22 @@ export default class HabiticaSync extends Plugin {
|
|||
|
||||
async onunload() {
|
||||
await this.view.onClose();
|
||||
|
||||
|
||||
this.app.workspace
|
||||
.getLeavesOfType(VIEW_TYPE)
|
||||
.forEach((leaf) => leaf.detach());
|
||||
}
|
||||
async activateView() {
|
||||
this.app.workspace.detachLeavesOfType(VIEW_TYPE);
|
||||
|
||||
|
||||
await this.app.workspace.getRightLeaf(false).setViewState({
|
||||
type: VIEW_TYPE,
|
||||
active: true,
|
||||
});
|
||||
|
||||
|
||||
this.app.workspace.revealLeaf(
|
||||
this.app.workspace.getLeavesOfType(VIEW_TYPE)[0]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ class App extends React.Component<any, any> {
|
|||
this.state.tasks.rewards.forEach((element: any) => {
|
||||
if (element.id == event.target.id) {
|
||||
if (element.id == target_id) {
|
||||
this.sendReward(target_id, "down", "Cost!")
|
||||
this.sendReward(target_id, "down", "Redeemed!")
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -62,12 +62,30 @@ export default function Index(props: any){
|
|||
}
|
||||
})
|
||||
|
||||
const allDailies = props.dailys.map((daily: any) => {
|
||||
// if(daily.completed)
|
||||
// return <DailyItem key={daily.id} id={daily.id} daily_text={daily.text} daily_notes={daily.notes} onChange={props.onChange} completed={daily.completed}/>
|
||||
let daily_notes = '';
|
||||
let daily_subtasks = '';
|
||||
if (props.settings.showTaskDescription) {
|
||||
daily_notes = daily.notes;
|
||||
}
|
||||
|
||||
if (props.settings.showSubTasks) {
|
||||
daily_subtasks = daily.checklist;
|
||||
}
|
||||
return <DailyItem key={daily.id} id={daily.id} daily_text={daily.text}
|
||||
daily_notes={daily_notes} daily_subtasks={daily_subtasks}
|
||||
onChange={props.onChange} completed={daily.completed} onChangeChecklistItem={props.onChangeChecklistItem}/>
|
||||
})
|
||||
|
||||
const display = <div id="classDisplay">
|
||||
<Tabs>
|
||||
<TabList>
|
||||
<Tab>Active</Tab>
|
||||
<Tab>Completed</Tab>
|
||||
<Tab>Not Due</Tab>
|
||||
<Tab>All</Tab>
|
||||
</TabList>
|
||||
<TabPanel>
|
||||
<ul>{incompleteDailies}</ul>
|
||||
|
|
@ -78,6 +96,9 @@ export default function Index(props: any){
|
|||
<TabPanel>
|
||||
<ul>{notDueDailies}</ul>
|
||||
</TabPanel>
|
||||
<TabPanel>
|
||||
<ul>{allDailies}</ul>
|
||||
</TabPanel>
|
||||
</Tabs>
|
||||
</div>
|
||||
return(display);
|
||||
|
|
|
|||
|
|
@ -36,10 +36,10 @@ export default function Index(props: any){
|
|||
<Tab>Completed</Tab>
|
||||
</TabList>
|
||||
<TabPanel>
|
||||
<ul>{incompleteTodos}</ul>
|
||||
<ul className="todolist-indent">{incompleteTodos}</ul>
|
||||
</TabPanel>
|
||||
<TabPanel>
|
||||
<ul>{completedTodos}</ul>
|
||||
<ul className="todolist-indent">{completedTodos}</ul>
|
||||
</TabPanel>
|
||||
</Tabs>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,10 +1,6 @@
|
|||
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@1,300&display=swap');
|
||||
@import url('https://fonts.googleapis.com/css2?family=Open Sans:ital,wght@0,400;1,100&family=Roboto&display=swap');
|
||||
|
||||
* {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.add-task-input {
|
||||
display: flex;
|
||||
}
|
||||
|
|
@ -45,6 +41,7 @@
|
|||
font-family: Roboto, sans-serif;
|
||||
font-weight: bold;
|
||||
font-size: 16px;
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
.description {
|
||||
|
|
@ -323,4 +320,4 @@ button {
|
|||
.description>ul {
|
||||
list-style-type: disc;
|
||||
margin-left: 10% !important;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
"moduleResolution": "node",
|
||||
"importHelpers": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"esModuleInterop": true,
|
||||
"lib": [
|
||||
"dom",
|
||||
"es5",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue