Deploy deepseek 2
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<script setup>
|
||||
import { computed, onBeforeUnmount, onMounted, ref } from 'vue';
|
||||
import { SetupHandle, SetSize, ResetPosition, ClearWindow, Top } from '@/services/Windows';
|
||||
import { SetupHandle, SetSize, ResetPosition, ClearWindow, CreateWindow, GetFirstWindowId, Top } from '@/services/Windows';
|
||||
import WindowHandle from './partials/WindowHandle.vue';
|
||||
import Server, { getBaseUrl } from '~/services/Server';
|
||||
import { emitter } from '~/services/Emitter';
|
||||
@@ -100,6 +100,11 @@ function normalizeActor(actor) {
|
||||
name: item.name ?? '', quantity: Number(item.quantity ?? 1), weight: Number(item.weight ?? 0),
|
||||
icon: item.icon ?? ''
|
||||
})),
|
||||
// Les capacitats del món: una filera per element, amb la seva icona. El text lliure
|
||||
// de sota continua sent el que el món no té com a element.
|
||||
features: (actor?.features ?? []).map((feature) => ({
|
||||
name: feature.name ?? '', description: feature.description ?? '', icon: feature.icon ?? ''
|
||||
})),
|
||||
traits: actor?.traits ?? '',
|
||||
spells: actor?.spells ?? '',
|
||||
image: actor?.image ?? ''
|
||||
@@ -233,6 +238,14 @@ function removeInventoryItem(index) {
|
||||
form.value.inventory.splice(index, 1);
|
||||
}
|
||||
|
||||
// Una capacitat s'obre com un objecte: la seva icona, el seu nom i la seva descripció en una
|
||||
// finestra pròpia. N'hi ha una de sola, i obrir-ne una altra substitueix la que hi ha.
|
||||
function openTrait(feature) {
|
||||
const existing = GetFirstWindowId('trait_sheet');
|
||||
if (existing !== undefined) ClearWindow({ id: existing });
|
||||
CreateWindow('trait_sheet', { feature });
|
||||
}
|
||||
|
||||
async function saveSheet() {
|
||||
if (!form.value.name.trim() || saving.value) return;
|
||||
saving.value = true;
|
||||
@@ -519,8 +532,20 @@ async function saveSheet() {
|
||||
<main v-show="activeTab === 'traits'" class="sheet-tab-body">
|
||||
<section class="sheet-panel traits-panel">
|
||||
<h2>{{ $t('campaigns.character-sheet.traits') }}</h2>
|
||||
<!-- Una capacitat per filera, amb la icona a l'esquerra com l'inventari;
|
||||
clicar-la obre la seva descripció. -->
|
||||
<div v-if="form.features.length" class="trait-list">
|
||||
<button v-for="(trait, index) in form.features" :key="index" class="trait-row" type="button" @click="openTrait(trait)">
|
||||
<span class="trait-icon-cell">
|
||||
<img v-if="trait.icon" :src="resolveImage(trait.icon)" alt="">
|
||||
<span v-else class="item-icon-blank" aria-hidden="true" />
|
||||
</span>
|
||||
<span class="trait-name">{{ trait.name }}</span>
|
||||
</button>
|
||||
</div>
|
||||
<textarea v-if="editing" v-model="form.traits" rows="12" :placeholder="$t('campaigns.character-sheet.traits-placeholder')" />
|
||||
<p v-else class="sheet-copy">{{ form.traits || $t('campaigns.character-sheet.empty-traits') }}</p>
|
||||
<p v-else-if="form.traits" class="sheet-copy">{{ form.traits }}</p>
|
||||
<p v-else-if="!form.features.length" class="sheet-copy">{{ $t('campaigns.character-sheet.empty-traits') }}</p>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
@@ -636,8 +661,18 @@ async function saveSheet() {
|
||||
.sheet-copy { min-height: 74px; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.45; opacity: .85; }
|
||||
input, textarea { box-sizing: border-box; max-width: 100%; padding: 6px 7px; border: 1px solid var(--color-border); border-radius: 6px; background: var(--color-background-soft); color: var(--color-text); font: inherit; }
|
||||
input:focus, textarea:focus { outline: none; border-color: var(--color-link); }
|
||||
input[type='number'] { appearance: textfield; -moz-appearance: textfield; }
|
||||
input[type='number']::-webkit-inner-spin-button, input[type='number']::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
|
||||
textarea { resize: vertical; width: 100%; min-height: 88px; font-size: 12px; }
|
||||
.traits-panel, .spells-panel { min-height: 175px; }
|
||||
/* Les capacitats de la pestanya de trets: la icona del món a l'esquerra i el nom a la dreta,
|
||||
com una filera de l'inventari. */
|
||||
.trait-list { display: flex; flex-direction: column; gap: 5px; margin-bottom: 11px; }
|
||||
.trait-row { display: flex; align-items: center; gap: 8px; width: 100%; padding: 5px 7px; border: 1px solid var(--color-border); border-radius: 7px; background: var(--color-background-soft); color: var(--color-text); font: inherit; text-align: left; cursor: pointer; }
|
||||
.trait-row:hover { border-color: var(--color-link); }
|
||||
.trait-icon-cell { width: 26px; flex: 0 0 26px; display: grid; place-items: center; }
|
||||
.trait-icon-cell img { display: block; width: 26px; height: 26px; object-fit: contain; border-radius: 5px; }
|
||||
.trait-name { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 13px; }
|
||||
.panel-title-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
|
||||
.panel-title-row h2 { flex: 1; }
|
||||
.weight-summary { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 1px 0 7px; font-size: 12px; }
|
||||
|
||||
57
frontend/app/components/windows/TraitWindow.vue
Normal file
57
frontend/app/components/windows/TraitWindow.vue
Normal file
@@ -0,0 +1,57 @@
|
||||
<script setup>
|
||||
import { computed, onBeforeUnmount, onMounted, ref } from 'vue';
|
||||
import { SetupHandle, SetSize, ResetPosition, ClearWindow, Top } from '@/services/Windows';
|
||||
import WindowHandle from './partials/WindowHandle.vue';
|
||||
import { getBaseUrl } from '~/services/Server';
|
||||
|
||||
// A feature of the character sheet, opened from the traits tab (see CharacterSheetWindow.vue).
|
||||
// The icon, the name and the description come from the Foundry feature item the campaign synced.
|
||||
const props = defineProps(['data']);
|
||||
const id = props.data.id;
|
||||
const feature = props.data.feature ?? {};
|
||||
const handle = ref(null);
|
||||
const wrapper = ref(null);
|
||||
|
||||
onMounted(() => {
|
||||
Top(wrapper);
|
||||
SetupHandle(id, handle);
|
||||
SetSize(id, { width: 420, height: 500 });
|
||||
ResetPosition(id, 'center');
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => ClearWindow({ type: 'trait_sheet' }));
|
||||
|
||||
const imageUrl = computed(() => {
|
||||
if (!feature.icon) return '';
|
||||
return /^(https?:|data:|\/\/)/i.test(feature.icon)
|
||||
? feature.icon
|
||||
: `${getBaseUrl()}/public/${feature.icon}`;
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="window-wrapper trait-window" :id="'window-wrapper-' + id" ref="wrapper">
|
||||
<WindowHandle :window="id" ref="handle" />
|
||||
<div class="trait-body">
|
||||
<header class="trait-hero">
|
||||
<span class="trait-mark" :class="{ empty: !imageUrl }">
|
||||
<img v-if="imageUrl" :src="imageUrl" alt="">
|
||||
<span v-else aria-hidden="true">{{ String(feature.name ?? '').slice(0, 1).toUpperCase() }}</span>
|
||||
</span>
|
||||
<h1>{{ feature.name }}</h1>
|
||||
</header>
|
||||
<p v-if="feature.description" class="trait-description">{{ feature.description }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.trait-window { display: flex; align-items: center; flex-direction: column; }
|
||||
.trait-body { flex: 1; min-height: 0; align-self: stretch; box-sizing: border-box; margin: 10px; padding: 8px; overflow-y: auto; }
|
||||
.trait-hero { display: flex; align-items: center; gap: 12px; padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid var(--color-border); }
|
||||
.trait-mark { width: 52px; height: 52px; flex: 0 0 52px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--color-border); border-radius: 9px; background: var(--color-background-soft); color: var(--color-link); font: 24px MrEavesRemake; }
|
||||
.trait-mark.empty { border-style: dashed; }
|
||||
.trait-mark img { width: 100%; height: 100%; object-fit: contain; }
|
||||
.trait-hero h1 { margin: 0; font: 22px MrEavesRemake; overflow-wrap: anywhere; }
|
||||
.trait-description { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.5; opacity: .9; }
|
||||
</style>
|
||||
Reference in New Issue
Block a user