diff --git a/src/module/sheets/skillSheet.mjs b/src/module/sheets/skillSheet.mjs index 6f72b3c3..b08807af 100644 --- a/src/module/sheets/skillSheet.mjs +++ b/src/module/sheets/skillSheet.mjs @@ -1,35 +1,64 @@ -export class SkillSheet extends foundry.appv1.sheets.ItemSheet { - /**@override */ - static get defaultOptions() { - return foundry.utils.mergeObject(super.defaultOptions, { - classes: ['dsa41', 'sheet', 'item', 'skill'], - width: 520, - height: 480, +const {DocumentSheetV2, HandlebarsApplicationMixin} = foundry.applications.api + +export class SkillSheet extends HandlebarsApplicationMixin(DocumentSheetV2) { + + /** @inheritDoc */ + static DEFAULT_OPTIONS = { + position: {width: 520, height: 480}, + classes: ['dsa41', 'sheet', 'item', 'skill'], + tag: 'form', + form: { + submitOnChange: true, + closeOnSubmit: false, + handler: SkillSheet.#onSubmitForm + } + } + + // MIGRATE to tabs + + static TABS = { + sheet: { tabs: [ - { - navSelector: '.sheet-tabs', - contentSelector: '.sheet-body', - initial: 'meta', - }, + {id: 'meta', group: 'sheet', label: 'Meta'}, + {id: 'description', group: 'sheet', label: 'Beschreibung'}, ], - }); + initial: 'meta' + } + } + + /** @inheritDoc */ + static PARTS = { + form: { + template: `systems/DSA_4-1/templates/item/skill/main-sheet.hbs` + }, + meta: { + template: `systems/DSA_4-1/templates/item/skill/tab-meta.hbs` + }, + description: { + template: `systems/DSA_4-1/templates/item/skill/tab-description.hbs` + } + } + + /** + * Handle form submission + * @this {MyClass} + * @param {SubmitEvent} event + * @param {HTMLFormElement} form + * @param {FormDataExtended} formData + */ + static async #onSubmitForm(event, form, formData) { + event.preventDefault() + + await this.document.update(formData.object) // Note: formData.object } /** @override */ - get template() { - return `systems/DSA_4-1/templates/item/item-skill-sheet.hbs`; - } + async _prepareContext(options) { - /** @override */ - getData() { - // Retrieve the data structure from the base sheet. You can inspect or log - // the context variable to see the structure, but some key properties for - // sheets are the actor object, the data object, whether or not it's - // editable, the items array, and the effects array. - const context = super.getData(); + const context = await super._prepareContext(options) // Use a safe clone of the actor data for further operations. - const skillData = context.data; + const skillData = context.document; // Add the actor's data to context.data for easier access, as well as flags. context.system = skillData.system; @@ -48,18 +77,9 @@ export class SkillSheet extends foundry.appv1.sheets.ItemSheet { context.isCombat = context.system.gruppe === "Kampf" context.isTalent = context.system.gruppe !== "Kampf" context.isLanguage = context.system.gruppe === "Sprachen" || context.system.gruppe === "Schriften" - context.hasRequirement = context.system.voraussetzung.talent != null + context.hasRequirement = context.system.voraussetzung?.talent != null ?? false return context; } - activateListeners(html) { - super.activateListeners(html); - - // Everything below here is only needed if the sheet is editable - if (!this.isEditable) { - - } - } - } \ No newline at end of file diff --git a/src/style/_richtext-editor.scss b/src/style/_richtext-editor.scss new file mode 100644 index 00000000..4a2f4c21 --- /dev/null +++ b/src/style/_richtext-editor.scss @@ -0,0 +1,3 @@ +.editor.prosemirror.active, .editor.prosemirror.inactive { + flex: 1; +} diff --git a/src/style/_talent-sheet.scss b/src/style/_skill-sheet.scss similarity index 91% rename from src/style/_talent-sheet.scss rename to src/style/_skill-sheet.scss index 0cfc8857..211e3949 100644 --- a/src/style/_talent-sheet.scss +++ b/src/style/_skill-sheet.scss @@ -1,6 +1,6 @@ .sheet.item.skill { - .tab.meta.active { + .meta-details { display: grid; grid-template-areas: @@ -8,9 +8,7 @@ "taw statistics ebe" "language language language" "attack attack attack"; - - gap: 8px; - margin: 8px; + height: unset; .category { grid-area: category; @@ -48,4 +46,8 @@ } + .description-details { + + } + } diff --git a/src/style/_tabs.scss b/src/style/_tabs.scss index 7f872530..a0a5676a 100644 --- a/src/style/_tabs.scss +++ b/src/style/_tabs.scss @@ -10,7 +10,7 @@ display: flow; border-top: unset; border-bottom: unset; - margin-bottom: 9px; + margin-bottom: 0; a.item[data-tab] { @@ -25,7 +25,6 @@ background: assets.$tab-background; position: relative; z-index: 2; - } } @@ -46,3 +45,60 @@ } } + +// Tabs v2 + +.sheet-tabs { + + position: relative; + display: flow; + border-top: unset; + border-bottom: unset; + margin-bottom: 0; + + a[data-action="tab"] { + + background-color: colours.$tab-inactive-background-color; + display: inline-block; + height: 32px; + line-height: 32px; + vertical-align: middle; + padding: 0 16px; + + span { + + } + + &.active { + + border-left: numbers.$tab-border-width solid colours.$tab-border-color; + border-top: numbers.$tab-border-width solid colours.$tab-border-color; + border-right: numbers.$tab-border-width solid colours.$tab-border-color; + border-bottom: 0; + top: numbers.$tab-border-width*2; + background: assets.$tab-background; + position: relative; + z-index: 2; + + span { + + } + + } + + } +} + +section.tab { + border: numbers.$tab-border-width solid colours.$tab-border-color; + background: assets.$tab-pane-background; + flex: 1; + + & > div { + display: flex; + flex-direction: column; + height: 100%; + gap: 8px; + padding: 8px; + } +} \ No newline at end of file diff --git a/src/style/styles.scss b/src/style/styles.scss index e30542c1..ea91cf78 100644 --- a/src/style/styles.scss +++ b/src/style/styles.scss @@ -11,6 +11,7 @@ @use "_player-action"; @use "_modify-liturgy"; @use "_liturgy-banner"; -@use "_talent-sheet"; +@use "_skill-sheet"; @use "_active-effect-sheet"; @use "_advantage-sheet"; +@use "_richtext-editor"; \ No newline at end of file diff --git a/src/templates/item/item-skill-sheet.hbs b/src/templates/item/item-skill-sheet.hbs deleted file mode 100644 index 72ad0f8a..00000000 --- a/src/templates/item/item-skill-sheet.hbs +++ /dev/null @@ -1,97 +0,0 @@ -
diff --git a/src/templates/item/skill/main-sheet.hbs b/src/templates/item/skill/main-sheet.hbs new file mode 100644 index 00000000..21d661ee --- /dev/null +++ b/src/templates/item/skill/main-sheet.hbs @@ -0,0 +1,14 @@ +