|
1 | 1 | <template>
|
2 |
| - <EditableColumn> |
3 |
| - <template #viewer> |
4 |
| - <p v-if="site"> |
5 |
| - <Icon |
6 |
| - :name="site.systemBadge+'-logo'" |
7 |
| - small |
8 |
| - /> |
9 |
| - {{ site.name }} |
10 |
| - </p> |
11 |
| - <p v-if="character"> |
12 |
| - {{ character.name }} |
13 |
| - </p> |
14 |
| - </template> |
15 |
| - <template #editor> |
16 |
| - <Icon |
17 |
| - :name="site.systemBadge+'-logo'" |
18 |
| - medium |
19 |
| - /> |
20 |
| - <MaterialSelect |
21 |
| - v-model="siteid" |
22 |
| - :opts="siteOpts" |
23 |
| - :label="$t('character.stats.game')" |
24 |
| - /> |
25 |
| - <Textfield |
26 |
| - v-model="charname" |
27 |
| - :label="$t('character.stats.name')" |
28 |
| - blur |
29 |
| - /> |
30 |
| - </template> |
31 |
| - </EditableColumn> |
| 2 | + <Column class="CharacterMetaForm"> |
| 3 | + <Textfield |
| 4 | + v-model="name" |
| 5 | + :label="$t('character.meta.name')" |
| 6 | + /> |
| 7 | + </Column> |
32 | 8 | </template>
|
33 | 9 |
|
34 | 10 | <script lang="ts">
|
35 | 11 | import { computed, defineComponent } from 'vue'
|
36 |
| -import MaterialSelect from '../material/MaterialSelect.vue' |
37 |
| -import { useSites } from '@/state/sites' |
38 |
| -import { useCharacters } from '@/state/characters' |
| 12 | +import { Character, useCharacters } from '@/state/characters' |
| 13 | +import Column from '../layout/Column.vue' |
39 | 14 | import Textfield from '../form/Textfield.vue'
|
40 |
| -import { useSite } from '@/state/site' |
41 |
| -import Icon from '../material/Icon.vue' |
42 |
| -import EditableColumn from '../layout/EditableColumn.vue' |
43 |
| -import { logDebug } from '@/utils/eventLogger' |
44 | 15 |
|
45 | 16 | export default defineComponent({
|
46 | 17 | name: 'CharacterMetaForm',
|
47 |
| - components: { MaterialSelect, Textfield, Icon, EditableColumn }, |
| 18 | + components: { Column, Textfield }, |
48 | 19 | props: {
|
49 |
| - characterid: { |
| 20 | + characterId: { |
50 | 21 | type: String,
|
51 | 22 | required: true
|
52 | 23 | }
|
53 | 24 | },
|
54 | 25 | setup (props) {
|
55 | 26 | const { characters } = useCharacters()
|
56 |
| - const character = computed(() => characters.value.get(props.characterid)) |
57 |
| - const { userSites } = useSites() |
58 |
| - const { site } = useSite() |
59 |
| - const siteOpts = computed(() => { |
60 |
| - return userSites.value.filter((s) => (s.usePlayers)).map((s) => ({ key: s.id, value: s.name })) |
61 |
| - }) |
| 27 | + const character = computed(() => (characters.value.get(props.characterId) || new Character())) |
62 | 28 |
|
63 |
| - const charname = computed({ |
64 |
| - get: () => (character?.value?.name ?? ''), |
65 |
| - set: (n: string) => { |
66 |
| - logDebug('CharacterMetaForm.charname.set', n) |
| 29 | + const name = computed({ |
| 30 | + get: () => { |
| 31 | + return character.value.name |
| 32 | + }, |
| 33 | + set: (value) => { |
| 34 | + character.value.name = value |
67 | 35 | }
|
68 | 36 | })
|
69 |
| - return { siteOpts, site, charname, character } |
| 37 | +
|
| 38 | + return { character, name } |
70 | 39 | }
|
71 | 40 | })
|
72 | 41 | </script>
|
0 commit comments