Deploy deepseek 2
This commit is contained in:
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