Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline Tabs for Actor sheets - Pop-Out! workaround #195

Open
wants to merge 2 commits into
base: release-0.2.2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
55 changes: 29 additions & 26 deletions src/style/sheets/actor/module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;

Expand Down
9 changes: 0 additions & 9 deletions src/system/applications/actor/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import {
import {
TabsApplicationMixin,
DragDropApplicationMixin,
// ComponentHandlebarsApplicationMixin,
// ComponentHandlebarsRenderOptions,
} from '@system/applications/mixins';

// Components
Expand Down Expand Up @@ -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',
Expand Down
10 changes: 10 additions & 0 deletions src/system/hooks/sheets.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { BaseItemSheet } from '../applications/item/base';
import { BaseActorSheet } from '../applications/actor/base';
import { getSystemSetting, SETTINGS } from '../settings';

Hooks.on(
Expand All @@ -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');
}
},
);
2 changes: 2 additions & 0 deletions src/system/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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 },
];

Expand Down
1 change: 1 addition & 0 deletions src/templates/actors/adversary/parts/sheet-content.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<section class="col-main">
{{app-adversary-header}}
{{app-actor-attributes}}
{{>tabs tabs=tabs ignoreLabel=true}}
<div class="tab-body">
{{> adv-actions-tab}}
{{> adv-equipment-tab}}
Expand Down
1 change: 1 addition & 0 deletions src/templates/actors/character/parts/sheet-content.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
</section>
<section class="col-main">
{{app-actor-attributes}}
{{>tabs tabs=tabs ignoreLabel=true}}
<div class="tab-body">
{{> char-details-tab}}
{{> char-actions-tab}}
Expand Down
1 change: 0 additions & 1 deletion src/templates/actors/parts/navigation.hbs

This file was deleted.

Loading