Adding Prettier

* Added prettier with automatic useage on pre-commit to avoid style breakage
* Ran Prettier on the project
This commit is contained in:
WBHarry 2025-05-23 18:57:50 +02:00 committed by GitHub
parent 820c2df1f4
commit b24cdcc9ed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
136 changed files with 13929 additions and 12206 deletions

View file

@ -1,8 +1,8 @@
import DaggerheartSheet from '../sheets/daggerheart-sheet.mjs';
const {ApplicationV2} = foundry.applications.api;
const { ApplicationV2 } = foundry.applications.api;
export default class DaggerheartActionConfig extends DaggerheartSheet(ApplicationV2) {
constructor(action){
constructor(action) {
super({});
this.action = action;
@ -10,40 +10,47 @@ export default class DaggerheartActionConfig extends DaggerheartSheet(Applicatio
}
// get title(){
// return `Action - ${this.action.name}`;
// return `Action - ${this.action.name}`;
// }
static DEFAULT_OPTIONS = {
tag: 'form',
id: "daggerheart-action",
classes: ["daggerheart", "views", "action"],
id: 'daggerheart-action',
classes: ['daggerheart', 'views', 'action'],
position: { width: 600, height: 'auto' },
actions: {
toggleSection: this.toggleSection,
toggleSection: this.toggleSection
},
form: {
handler: this.updateForm,
closeOnSubmit: true,
},
closeOnSubmit: true
}
};
static PARTS = {
form: {
id: "action",
template: "systems/daggerheart/templates/views/action.hbs"
id: 'action',
template: 'systems/daggerheart/templates/views/action.hbs'
}
}
};
_getTabs() {
const tabs = {
effects: { active: true, cssClass: '', group: 'primary', id: 'effects', icon: null, label: 'Effects' },
useage: { active: false, cssClass: '', group: 'primary', id: 'useage', icon: null, label: 'Useage' },
conditions: { active: false, cssClass: '', group: 'primary', id: 'conditions', icon: null, label: 'Conditions' },
}
conditions: {
active: false,
cssClass: '',
group: 'primary',
id: 'conditions',
icon: null,
label: 'Conditions'
}
};
for ( const v of Object.values(tabs) ) {
for (const v of Object.values(tabs)) {
v.active = this.tabGroups[v.group] ? this.tabGroups[v.group] === v.id : v.active;
v.cssClass = v.active ? "active" : "";
v.cssClass = v.active ? 'active' : '';
}
return tabs;
@ -61,14 +68,14 @@ export default class DaggerheartActionConfig extends DaggerheartSheet(Applicatio
this.openSection = button.dataset.section === this.openSection ? null : button.dataset.section;
this.render(true);
}
static async updateForm(event, _, formData) {
const data = foundry.utils.expandObject(foundry.utils.mergeObject(this.action.toObject(), formData.object));
const newActions = this.action.parent.actions.map(x => x.toObject());
if(!newActions.findSplice(x => x.id === data.id, data)){
if (!newActions.findSplice(x => x.id === data.id, data)) {
newActions.push(data);
}
await this.action.parent.parent.update({ "system.actions": newActions });
await this.action.parent.parent.update({ 'system.actions': newActions });
}
}
}