From 31ca3ed94f5f06c73262e14fb46c834f1a30e1f9 Mon Sep 17 00:00:00 2001 From: Zithith Date: Sat, 14 Dec 2024 18:48:02 +0000 Subject: [PATCH 1/2] feat(inline actor tabs): Added setting to inline tabs for actor sheets --- src/lang/en.json | 4 ++ src/style/sheets/actor/module.scss | 55 ++++++++++--------- src/system/applications/actor/base.ts | 12 ++-- src/system/hooks/sheets.ts | 10 ++++ src/system/settings.ts | 2 + .../actors/adversary/parts/sheet-content.hbs | 1 + .../actors/character/parts/sheet-content.hbs | 1 + 7 files changed, 53 insertions(+), 32 deletions(-) diff --git a/src/lang/en.json b/src/lang/en.json index 247f8ce9..8e351656 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -1099,6 +1099,10 @@ } }, "SETTINGS": { + "actorSheetInlineTabs": { + "name": "Horizontal Inline Tabs for Actor Sheets", + "hint": "If enabled, actor sheets will use horizontal tabs within the bounds of the sheet, as per foundry default sheets. This setting is meant as a work-around solution for the Pop-Out! module, for those who want to use it." + }, "itemSheetSideTabs": { "name": "Vertical Side Tabs for Item Sheets", "hint": "If enabled, item sheets use vertical tabs down the right-hand side, similar to the character sheet, instead of the default in-line horizontal ones." diff --git a/src/style/sheets/actor/module.scss b/src/style/sheets/actor/module.scss index 1a9ed5e7..3fe01533 100644 --- a/src/style/sheets/actor/module.scss +++ b/src/style/sheets/actor/module.scss @@ -2,10 +2,37 @@ @import './adversary.scss'; .sheet.actor { - overflow: visible; - .window-content { + &.side-tabs { overflow: visible; + + .window-content { + overflow: visible; + } + + nav { + border: none; + flex-direction: column; + position: absolute; + left: 100%; + top: 15%; + + > a { + background: rgba(11, 10, 19, 0.9); + width: 2.88867rem; + height: 2.5rem; + display: flex; + align-items: center; + justify-content: center; + border: 1px solid #302831; + border-top-right-radius: 0.3rem; + border-bottom-right-radius: 0.3rem; + + &.active { + background-color: rgb(45 41 77 / 90%); + } + } + } } > .window-header { @@ -33,30 +60,6 @@ } } - nav { - border: none; - flex-direction: column; - position: absolute; - left: 100%; - top: 15%; - - > a { - background: rgba(11, 10, 19, 0.9); - width: 2.88867rem; - height: 2.5rem; - display: flex; - align-items: center; - justify-content: center; - border: 1px solid #302831; - border-top-right-radius: 0.3rem; - border-bottom-right-radius: 0.3rem; - - &.active { - background-color: rgb(45 41 77 / 90%); - } - } - } - .sheet-header { margin-bottom: 1rem; diff --git a/src/system/applications/actor/base.ts b/src/system/applications/actor/base.ts index 0a0bedd6..6bf445cf 100644 --- a/src/system/applications/actor/base.ts +++ b/src/system/applications/actor/base.ts @@ -65,12 +65,12 @@ export class BaseActorSheet< ); /* eslint-enable @typescript-eslint/unbound-method */ - static PARTS = foundry.utils.mergeObject(super.PARTS, { - navigation: { - template: - 'systems/cosmere-rpg/templates/actors/parts/navigation.hbs', - }, - }); + // static PARTS = foundry.utils.mergeObject(super.PARTS, { + // navigation: { + // template: + // 'systems/cosmere-rpg/templates/actors/parts/navigation.hbs', + // }, + // }); static TABS = foundry.utils.mergeObject(super.TABS, { [BaseSheetTab.Actions]: { diff --git a/src/system/hooks/sheets.ts b/src/system/hooks/sheets.ts index f8059c11..8f859849 100644 --- a/src/system/hooks/sheets.ts +++ b/src/system/hooks/sheets.ts @@ -1,4 +1,5 @@ import { BaseItemSheet } from '../applications/item/base'; +import { BaseActorSheet } from '../applications/actor/base'; import { getSystemSetting, SETTINGS } from '../settings'; Hooks.on( @@ -9,3 +10,12 @@ Hooks.on( } }, ); + +Hooks.on( + 'renderActorSheetV2', + (actorSheet: BaseActorSheet, node: HTMLFormElement) => { + if (!getSystemSetting(SETTINGS.ACTOR_SHEET_INLINE_TABS)) { + node.classList.add('side-tabs'); + } + }, +); diff --git a/src/system/settings.ts b/src/system/settings.ts index cf1f69ef..7a2a9861 100644 --- a/src/system/settings.ts +++ b/src/system/settings.ts @@ -8,6 +8,7 @@ import { setTheme } from './utils/templates'; export const SETTINGS = { INTERNAL_FIRST_CREATION: 'firstTimeWorldCreation', INTERNAL_LATEST_VERSION: 'latestVersion', + ACTOR_SHEET_INLINE_TABS: 'actorSheetInlineTabs', ITEM_SHEET_SIDE_TABS: 'itemSheetSideTabs', ROLL_SKIP_DIALOG_DEFAULT: 'skipRollDialogByDefault', CHAT_ENABLE_OVERLAY_BUTTONS: 'enableOverlayButtons', @@ -47,6 +48,7 @@ export function registerSystemSettings() { // SHEET SETTINGS const sheetOptions = [ + { name: SETTINGS.ACTOR_SHEET_INLINE_TABS, default: false }, { name: SETTINGS.ITEM_SHEET_SIDE_TABS, default: false }, ]; diff --git a/src/templates/actors/adversary/parts/sheet-content.hbs b/src/templates/actors/adversary/parts/sheet-content.hbs index 1e3e275b..4617b441 100644 --- a/src/templates/actors/adversary/parts/sheet-content.hbs +++ b/src/templates/actors/adversary/parts/sheet-content.hbs @@ -49,6 +49,7 @@
{{app-adversary-header}} {{app-actor-attributes}} + {{>tabs tabs=tabs ignoreLabel=true}}
{{> adv-actions-tab}} {{> adv-equipment-tab}} diff --git a/src/templates/actors/character/parts/sheet-content.hbs b/src/templates/actors/character/parts/sheet-content.hbs index 6d3302b1..d14df531 100644 --- a/src/templates/actors/character/parts/sheet-content.hbs +++ b/src/templates/actors/character/parts/sheet-content.hbs @@ -9,6 +9,7 @@
{{app-actor-attributes}} + {{>tabs tabs=tabs ignoreLabel=true}}
{{> char-details-tab}} {{> char-actions-tab}} From 7b05e46ade5e328140c09e037315064214cf1842 Mon Sep 17 00:00:00 2001 From: Zithith Date: Sat, 14 Dec 2024 20:14:22 +0000 Subject: [PATCH 2/2] chore: clean up redundant navigation parts --- src/system/applications/actor/base.ts | 9 --------- src/templates/actors/parts/navigation.hbs | 1 - 2 files changed, 10 deletions(-) delete mode 100644 src/templates/actors/parts/navigation.hbs diff --git a/src/system/applications/actor/base.ts b/src/system/applications/actor/base.ts index 6bf445cf..9c78ad4c 100644 --- a/src/system/applications/actor/base.ts +++ b/src/system/applications/actor/base.ts @@ -16,8 +16,6 @@ import { import { TabsApplicationMixin, DragDropApplicationMixin, - // ComponentHandlebarsApplicationMixin, - // ComponentHandlebarsRenderOptions, } from '@system/applications/mixins'; // Components @@ -65,13 +63,6 @@ export class BaseActorSheet< ); /* eslint-enable @typescript-eslint/unbound-method */ - // static PARTS = foundry.utils.mergeObject(super.PARTS, { - // navigation: { - // template: - // 'systems/cosmere-rpg/templates/actors/parts/navigation.hbs', - // }, - // }); - static TABS = foundry.utils.mergeObject(super.TABS, { [BaseSheetTab.Actions]: { label: 'COSMERE.Actor.Sheet.Tabs.Actions', diff --git a/src/templates/actors/parts/navigation.hbs b/src/templates/actors/parts/navigation.hbs deleted file mode 100644 index f6fddc48..00000000 --- a/src/templates/actors/parts/navigation.hbs +++ /dev/null @@ -1 +0,0 @@ -{{>tabs tabs=tabs ignoreLabel=true}} \ No newline at end of file