Skip to content

Commit

Permalink
Merge pull request #677 from ben/vue-theme-domain
Browse files Browse the repository at this point in the history
Vue theme/domain sheet
  • Loading branch information
ben authored Mar 12, 2023
2 parents a8f7ed7 + 0080b76 commit 167882c
Show file tree
Hide file tree
Showing 11 changed files with 96 additions and 131 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Next Release

- Replace the delve theme/domain sheet with a vue implementation ([#677](https://github.com/ben/foundry-ironsworn/pull/677))

## 1.20.29

- Update move-sheet aesthetics to reduce the use of color a bit ([#672](https://github.com/ben/foundry-ironsworn/pull/672))
Expand Down
10 changes: 4 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { runDataMigrations } from './module/helpers/migrations'
import { IronswornSettings } from './module/helpers/settings'
import { AssetSheetV2 } from './module/item/asset/assetsheet-v2'
import { BondsetSheetV2 } from './module/item/bondset/bondsetsheet-v2'
import { DelveThemeOrDomainSheet } from './module/item/delve-theme-domain/delvethemeordomainsheet'
import { ThemeDomainSheet } from './module/item/delve-theme-domain/theme-domain-sheet'
import { IronswornItem } from './module/item/item'
import { SFMoveSheet } from './module/item/move/sfmovesheet'
import { ProgressSheetV2 } from './module/item/progress/progresssheet-v2'
Expand Down Expand Up @@ -129,12 +129,10 @@ Hooks.once('init', async () => {
types: ['sfmove'],
label: 'IRONSWORN.ITEM.TypeMove',
})
Items.registerSheet('ironsworn', DelveThemeOrDomainSheet, {

Items.registerSheet('ironsworn', ThemeDomainSheet, {
types: ['delve-theme', 'delve-domain'],
label:
game.i18n.localize('IRONSWORN.ITEM.TypeDelveTheme') +
' / ' +
game.i18n.localize('IRONSWORN.ITEM.TypeDelveDomain'),
label: 'IRONSWORN.ITEM.TypeDelveThemeOrDomain',
makeDefault: true,
})

Expand Down
41 changes: 0 additions & 41 deletions src/module/item/delve-theme-domain/delvethemeordomainsheet.ts

This file was deleted.

11 changes: 11 additions & 0 deletions src/module/item/delve-theme-domain/theme-domain-sheet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { VueItemSheet } from '../../vue/vueitemsheet'
import delveThemeDomainSheet from '../../vue/delve-theme-domain-sheet.vue'

export class ThemeDomainSheet extends VueItemSheet {
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
height: 650,
rootComponent: delveThemeDomainSheet,
} as any)
}
}
1 change: 0 additions & 1 deletion src/module/vue/components/site/site-moves.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
.wrapper {
margin: 0;
border-radius: var(--ironsworn-border-radius-lg);
background-color: var(--ironsworn-color-midtone-30);
height: max-content;
}
Expand Down
75 changes: 75 additions & 0 deletions src/module/vue/delve-theme-domain-sheet.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<template>
<div class="flexcol" :class="$style.sheetStyles">
<SheetHeaderBasic class="nogrow" :document="data.item" />

<input
class="nogrow"
type="text"
v-model="typedSystem.summary"
:placeholder="$t('IRONSWORN.Summary')"
@blur="save"
/>
<MceEditor v-model="typedSystem.description" style="flex-basis: 8rem" />

<h3 class="nogrow">{{ $t('IRONSWORN.DELVESITE.Features') }}</h3>
<table>
<tbody>
<tr v-for="feature in typedSystem.features">
<td>{{ formattedRange(feature.range) }}</td>
<td>
<input type="text" v-model="feature.text" @blur="save" />
</td>
</tr>
</tbody>
</table>

<h3 class="nogrow">{{ $t('IRONSWORN.DELVESITE.Dangers') }}</h3>
<table>
<tbody>
<tr v-for="danger in typedSystem.dangers">
<td>{{ formattedRange(danger.range) }}</td>
<td>
<input type="text" v-model="danger.text" @blur="save" />
</td>
</tr>
</tbody>
</table>
</div>
</template>

<style lang="less" module>
.sheetStyles {
gap: var(--ironsworn-spacer-md);
h3 {
margin: var(--ironsworn-spacer-lg) 0 0 0;
}
}
</style>

<script setup lang="ts">
import { inject, provide, computed } from 'vue'
import { DelveThemeDataPropertiesData } from '../item/itemtypes'
import MceEditor from './components/mce-editor.vue'
import { $ItemKey, ItemKey } from './provisions'
import SheetHeaderBasic from './sheet-header-basic.vue'
const $item = inject($ItemKey)
const props = defineProps<{ data: { item: any } }>()
provide(ItemKey, computed(() => props.data.item) as any)
const typedSystem = props.data.item.system as DelveThemeDataPropertiesData
function formattedRange(range: [number, number]): string {
if (range[0] === range[1]) return `${range[0]}`
return `${range[0]}–${range[1]}`
}
function save() {
const { summary, description, features, dangers } = typedSystem
$item?.update({
system: { summary, description, features, dangers },
})
}
</script>
1 change: 1 addition & 0 deletions system/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,7 @@
"TypeBondset": "Bondset",
"TypeDelveDomain": "Site domain",
"TypeDelveTheme": "Site theme",
"TypeDelveThemeOrDomain": "Site theme/domain",
"TypeMove": "Move",
"TypeProgressTrack": "Progress track"
},
Expand Down
1 change: 1 addition & 0 deletions system/lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,7 @@
"TypeBondset": "Forger un lien",
"TypeDelveDomain": "Domaine du site",
"TypeDelveTheme": "Thème du site",
"TypeDelveThemeOrDomain": "Thème/domaine du site",
"TypeMove": "Action",
"TypeProgressTrack": "Jauge de progrès"
},
Expand Down
3 changes: 2 additions & 1 deletion system/lang/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,8 @@
"TypeBond": "Więź",
"TypeProgressTrack": "Tor postępu",
"TypeDelveDomain": "Domena",
"TypeDelveTheme": "Motyw"
"TypeDelveTheme": "Motyw",
"TypeDelveThemeOrDomain": "Motyw/domena"
},
"ITEMS": {
"SubtypeConnection": "Połączenia",
Expand Down
41 changes: 0 additions & 41 deletions system/templates/item/delve-domain.hbs

This file was deleted.

41 changes: 0 additions & 41 deletions system/templates/item/delve-theme.hbs

This file was deleted.

0 comments on commit 167882c

Please sign in to comment.