generated from dartungar/obsidian-sample-plugin
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
185 additions
and
40 deletions.
There are no files selected for viewing
This file contains 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
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
src/settings/emotionGroupDeleteModal.ts → ...s/emotionGroup/emotionGroupDeleteModal.ts
This file contains 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
99 changes: 99 additions & 0 deletions
99
src/settings/moodRatingLabel/MoodRatingLabelsEditComponent.svelte
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
<script lang="ts"> | ||
import { EmotionGroup } from "src/entities/IEmotionGroup"; | ||
import MoodTrackerPlugin from "src/main"; | ||
import store from "src/store"; | ||
export let closeModalFunc: () => void; | ||
let plugin: MoodTrackerPlugin; | ||
store.plugin.subscribe((p) => { | ||
plugin = p; | ||
}); | ||
function save() { | ||
plugin.saveSettings(); | ||
closeModalFunc(); | ||
} | ||
</script> | ||
|
||
<div class="edit-mood-labels-modal"> | ||
<div class="labels-aligned"> | ||
<div> | ||
<label for="veryGood">Very Good</label> | ||
<input | ||
id="veryGood" | ||
type="text" | ||
bind:value={plugin.settings.moodRatingLabelDict[5]} | ||
/> | ||
</div> | ||
<div> | ||
<label for="good">Good</label> | ||
<input | ||
id="good" | ||
type="text" | ||
bind:value={plugin.settings.moodRatingLabelDict[4]} | ||
/> | ||
</div> | ||
<div> | ||
<label for="ok">Ok</label> | ||
<input | ||
id="ok" | ||
type="text" | ||
bind:value={plugin.settings.moodRatingLabelDict[3]} | ||
/> | ||
</div> | ||
<div> | ||
<label for="bad">Bad</label> | ||
<input | ||
id="bad" | ||
type="text" | ||
bind:value={plugin.settings.moodRatingLabelDict[2]} | ||
/> | ||
</div> | ||
<div> | ||
<label for="veryBad">Very bad</label> | ||
<input | ||
id="veryBad" | ||
type="text" | ||
bind:value={plugin.settings.moodRatingLabelDict[1]} | ||
/> | ||
</div> | ||
<div style="margin-top: 8px;"> | ||
<label for="size" | ||
>Label size: {plugin.settings.moodRatingLabelSize} rem</label | ||
> | ||
<input | ||
id="size" | ||
type="range" | ||
min="0.5" | ||
max="5" | ||
step="0.5" | ||
bind:value={plugin.settings.moodRatingLabelSize} | ||
/> | ||
</div> | ||
</div> | ||
|
||
<div> | ||
<div>Preview:</div> | ||
<div style="font-size: {plugin.settings.moodRatingLabelSize + 'rem'}"> | ||
{plugin.settings.moodRatingLabelDict[1]} | ||
{plugin.settings.moodRatingLabelDict[2]} | ||
{plugin.settings.moodRatingLabelDict[3]} | ||
{plugin.settings.moodRatingLabelDict[4]} | ||
{plugin.settings.moodRatingLabelDict[5]} | ||
</div> | ||
</div> | ||
|
||
<div> | ||
<button on:click={save}>Save</button> | ||
</div> | ||
</div> | ||
|
||
<style> | ||
.labels-aligned div { | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: space-between; | ||
} | ||
</style> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { App, Modal } from "obsidian"; | ||
import MoodRatingLabelsEditComponent from "./MoodRatingLabelsEditComponent.svelte"; | ||
import MoodTrackerPlugin from "src/main"; | ||
import store from "src/store"; | ||
|
||
|
||
|
||
export class MoodRatingLabelsEditModal extends Modal { | ||
component: MoodRatingLabelsEditComponent; | ||
|
||
constructor(private _plugin: MoodTrackerPlugin, app: App) { | ||
super(app); | ||
} | ||
|
||
onOpen(): void { | ||
store.plugin.set(this._plugin); | ||
|
||
this.titleEl.innerText = "Edit mood rating labels"; | ||
|
||
this.component = new MoodRatingLabelsEditComponent({ | ||
target: this.contentEl, | ||
props: { | ||
closeModalFunc: () => this.close() | ||
} | ||
}); | ||
} | ||
|
||
onClose() { | ||
this.component.$destroy(); | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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