Skip to content

Commit

Permalink
Merge pull request #23 from saertna/selection-modal-booster-crafting
Browse files Browse the repository at this point in the history
bring boosters to craft into game
  • Loading branch information
saertna authored Oct 21, 2023
2 parents 3d42362 + dc19ee2 commit 956cbcd
Show file tree
Hide file tree
Showing 11 changed files with 1,949 additions and 271 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Hello, fellow learners and knowledge seekers! 📚 If you're as passionate about
Note: On some machines the .obsidian folder may be hidden. On MacOS you should be able to press Command+Shift+Dot to show the folder in Finder.
3. Reload Obsidian
4. If prompted about Safe Mode, you can disable safe mode and enable the plugin.
5. plugin `dataview` has to be installed an in dataview settings enable `Enable JavaScript Queries` and `Enable Inline JavaScript Queries` to display counting in profile.
6. in Obsidian hit `CTRL+P` and run command `Initialize gamification ratings`

**Embark on a Motivational Journey!**

Expand Down
858 changes: 760 additions & 98 deletions main.js

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"id": "obsidian-gamified-pkm",
"name": "Gamificate your PKM",
"version": "0.0.6",
"version": "0.0.7",
"minAppVersion": "0.15.0",
"description": "This plugin gamifies your personal knowledge management (PKM) to bring fun and drive into your PKM",
"author": "Andreas Trebing",
"authorUrl": "",
"fundingUrl": "https://ko-fi.com/andreastrebing",
"isDesktopOnly": false
"isDesktopOnly": false,
"styles": ["styles.css"]
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "obsidian-gamified-pkm",
"version": "0.0.6",
"version": "0.0.7",
"description": "This plugin gamifies your personal knowledge management (PKM) to bring fun and drive into your PKM",
"main": "main.js",
"scripts": {
Expand Down
51 changes: 51 additions & 0 deletions src/ModalBooster.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { App, Modal } from 'obsidian';
import gamification from 'main';
import { MultiSelectModal } from 'MultiSelectModal';

export class ModalBooster extends Modal {
private readonly displayText: string;
private readonly gamificationInstance: gamification;

constructor(app: App, displayText: string, gamificationInstance: gamification) {
super(app);
this.displayText = displayText;
this.gamificationInstance = gamificationInstance;
}

onOpen() {
const { contentEl } = this;
contentEl.setText(this.displayText);

const multiSelectModal = new MultiSelectModal(this.app, [], 'Craft Booster Item', this.gamificationInstance); // Create the modal instance


// Add a button to open the multi-select modal
const button = document.createElement('button');
button.innerText = 'Open Crafting Table';
button.onclick = () => {
multiSelectModal.setUseBooster(false); // Set the flag for crafting table
multiSelectModal.open();
};


multiSelectModal.readBoostersStock();
multiSelectModal.readIngrementStock();


const button2 = document.createElement('button');
button2.innerText = 'Open Booster Board';
button2.onclick = () => {
multiSelectModal.setUseBooster(true);
multiSelectModal.open();
};

contentEl.appendChild(button);
contentEl.appendChild(button2);
}

onClose() {
const { contentEl } = this;
contentEl.empty();
}

}
20 changes: 20 additions & 0 deletions src/ModalInformationbox.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { App, Modal } from 'obsidian';

export class ModalInformationbox extends Modal {
private readonly displayText: string; // Store the text to be displayed

constructor(app: App, displayText: string) {
super(app);
this.displayText = displayText; // Store the passed text
}

onOpen() {
const { contentEl } = this;
contentEl.setText(this.displayText); // Use the stored text
}

onClose() {
const { contentEl } = this;
contentEl.empty();
}
}
Loading

0 comments on commit 956cbcd

Please sign in to comment.