Added "Show Task Description" Setting
This commit is contained in:
parent
d10a2ca747
commit
6384c98181
8 changed files with 41 additions and 9 deletions
|
|
@ -5,6 +5,7 @@ import { HabiticaSyncView, VIEW_TYPE} from "./view"
|
|||
interface HabiticaSyncSettings {
|
||||
userID: string
|
||||
apiToken: string
|
||||
showTaskDescription: boolean
|
||||
}
|
||||
const DEFAULT_SETTINGS: Partial<HabiticaSyncSettings> = {
|
||||
userID: "",
|
||||
|
|
|
|||
|
|
@ -38,5 +38,18 @@ export class HabiticaSyncSettingsTab extends PluginSettingTab {
|
|||
await this.plugin.saveSettings();
|
||||
})
|
||||
);
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName("Show Task Descriptions")
|
||||
.setDesc("Updates require pane re-opening")
|
||||
.addToggle(cb => {
|
||||
cb
|
||||
.setValue(this.plugin.settings.showTaskDescription)
|
||||
.onChange(async (isEnable) => {
|
||||
this.plugin.settings.showTaskDescription = isEnable;
|
||||
await this.plugin.saveSettings();
|
||||
})
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -195,7 +195,7 @@ class App extends React.Component<any, any> {
|
|||
return (<div className="plugin-root">
|
||||
{content}
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
|
||||
<Taskview data={this.state.tasks} handleChangeTodos={this.handleChangeTodos} handleChangeDailys={this.handleChangeDailys} handleChangeHabits={this.handleChangeHabits} handleChangeRewards={this.handleChangeRewards}/>
|
||||
<Taskview data={this.state.tasks} handleChangeTodos={this.handleChangeTodos} settings = {this.props.plugin.settings} handleChangeDailys={this.handleChangeDailys} handleChangeHabits={this.handleChangeHabits} handleChangeRewards={this.handleChangeRewards}/>
|
||||
<div></div>
|
||||
<Statsview user_data={this.state.user_data} />
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -9,8 +9,12 @@ export default function Index(props: any){
|
|||
else {
|
||||
const incompleteDailies = props.dailys.map((daily: any) => {
|
||||
if(!daily.completed)
|
||||
if (props.settings.showTaskDescription) {
|
||||
return <DailyItem key={daily.id} id={daily.id} daily_text={daily.text} daily_notes={daily.notes} onChange={props.onChange} completed={daily.completed}/>
|
||||
})
|
||||
} else {
|
||||
return <DailyItem key={daily.id} id={daily.id} daily_text={daily.text} onChange={props.onChange} completed={daily.completed}/>
|
||||
}
|
||||
})
|
||||
const completedDailies = 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}/>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,11 @@ export default function Index(props: any){
|
|||
}
|
||||
else {
|
||||
const allHabits = props.habits.map((habit: any) => {
|
||||
if (props.settings.showTaskDescription) {
|
||||
return <HabitItem key={habit.id} id={habit.id} habit_text={habit.text} habit_notes={habit.notes} upCount={habit.counterUp} downCount={habit.counterDown} onChange={props.onChange}/>
|
||||
} else {
|
||||
return <HabitItem key={habit.id} id={habit.id} habit_text={habit.text} upCount={habit.counterUp} downCount={habit.counterDown} onChange={props.onChange}/>
|
||||
}
|
||||
})
|
||||
const display = <div id="classDisplay">
|
||||
<ul>{allHabits}</ul>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,11 @@ export default function Index(props: any){
|
|||
}
|
||||
else {
|
||||
const allRewards = props.rewards.map((reward: any) => {
|
||||
return <RewardItem key={reward.id} id={reward.id} reward_text={reward.text} reward_notes={reward.notes} reward_value={reward.value} onChange={props.onChange}/>
|
||||
if (props.settings.showTaskDescription) {
|
||||
return <RewardItem key={reward.id} id={reward.id} reward_text={reward.text} reward_notes={reward.notes} reward_value={reward.value} onChange={props.onChange}/>
|
||||
} else {
|
||||
return <RewardItem key={reward.id} id={reward.id} reward_text={reward.text} reward_value={reward.value} onChange={props.onChange}/>
|
||||
}
|
||||
})
|
||||
const display = <div id="classDisplay">
|
||||
<ul>{allRewards}</ul>
|
||||
|
|
|
|||
|
|
@ -8,8 +8,14 @@ export default function Index(props: any){
|
|||
}
|
||||
else {
|
||||
const incompleteTodos = props.todos.map((todo: any) => {
|
||||
if(!todo.completed)
|
||||
return <TodoItem key={todo.id} id={todo.id} todo_text={todo.text} todo_notes={todo.notes} onChange={props.onChange} completed={todo.completed}/>
|
||||
if(!todo.completed) {
|
||||
if (props.settings.showTaskDescription) {
|
||||
return <TodoItem key={todo.id} id={todo.id} todo_text={todo.text} todo_notes={todo.notes} onChange={props.onChange} completed={todo.completed}/>
|
||||
} else {
|
||||
return <TodoItem key={todo.id} id={todo.id} todo_text={todo.text} onChange={props.onChange} completed={todo.completed}/>
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
const completedTodos = props.todos.map((todo: any) => {
|
||||
if(todo.completed)
|
||||
|
|
|
|||
|
|
@ -24,16 +24,16 @@ export default function Index(props: any){
|
|||
</Tab>
|
||||
</TabList>
|
||||
<TabPanel>
|
||||
<Dailiesview dailys={props.data.dailys} onChange={props.handleChangeDailys} />
|
||||
<Dailiesview dailys={props.data.dailys} settings = {props.settings} onChange={props.handleChangeDailys} />
|
||||
</TabPanel>
|
||||
<TabPanel>
|
||||
<Habitsview habits={props.data.habits} onChange={props.handleChangeHabits}/>
|
||||
<Habitsview habits={props.data.habits} settings = {props.settings} onChange={props.handleChangeHabits}/>
|
||||
</TabPanel>
|
||||
<TabPanel>
|
||||
<Todoview todos={props.data.todos} onChange={props.handleChangeTodos} />
|
||||
<Todoview todos={props.data.todos} settings = {props.settings} onChange={props.handleChangeTodos} />
|
||||
</TabPanel>
|
||||
<TabPanel>
|
||||
<Rewardview rewards={props.data.rewards} onChange={props.handleChangeRewards} />
|
||||
<Rewardview rewards={props.data.rewards} settings = {props.settings} onChange={props.handleChangeRewards} />
|
||||
</TabPanel>
|
||||
</Tabs>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue