Refractoring: Removed unnecessary component Reactview
This commit is contained in:
parent
30dd6590ec
commit
0cd5fde19c
5 changed files with 9 additions and 21 deletions
12
main.js
12
main.js
File diff suppressed because one or more lines are too long
|
|
@ -8,7 +8,7 @@
|
||||||
"build": "rollup --config rollup.config.js --environment BUILD:production"
|
"build": "rollup --config rollup.config.js --environment BUILD:production"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"author": "Leonard and Ran",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@rollup/plugin-commonjs": "^18.0.0",
|
"@rollup/plugin-commonjs": "^18.0.0",
|
||||||
|
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
import * as React from "react";
|
|
||||||
import App from "./view/App";
|
|
||||||
|
|
||||||
export default function ReactView(props: any){
|
|
||||||
return(
|
|
||||||
<App username={props.userID} apiToken={props.tokenAPI} plugin={props.plugin}/>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { ItemView,WorkspaceLeaf } from "obsidian";
|
import { ItemView,WorkspaceLeaf } from "obsidian";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import * as ReactDOM from "react-dom";
|
import * as ReactDOM from "react-dom";
|
||||||
import ReactView from "./ReactView";
|
import App from "./view/App"
|
||||||
import HabiticaSync from "./main";
|
import HabiticaSync from "./main";
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -27,7 +27,7 @@ export class HabiticaSyncView extends ItemView {
|
||||||
|
|
||||||
async onOpen() {
|
async onOpen() {
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<ReactView userID = {this.plugin.settings.userID} tokenAPI = {this.plugin.settings.apiToken} plugin={this.plugin}/>,
|
<App plugin={this.plugin}/>,
|
||||||
this.containerEl.children[1]
|
this.containerEl.children[1]
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,8 @@ let credentials = ""
|
||||||
class App extends React.Component<any,any> {
|
class App extends React.Component<any,any> {
|
||||||
constructor(props: any) {
|
constructor(props: any) {
|
||||||
super(props)
|
super(props)
|
||||||
username = this.props.username
|
username = this.props.plugin.settings.userID
|
||||||
credentials = this.props.apiToken
|
credentials = this.props.plugin.settings.apiToken
|
||||||
this.state = {
|
this.state = {
|
||||||
isLoaded: false,
|
isLoaded: false,
|
||||||
user_data: {
|
user_data: {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue