update display
Browse files
src/lib/components/Pages/Pictuary.svelte
CHANGED
@@ -200,7 +200,7 @@
|
|
200 |
<RosterSlot
|
201 |
{position}
|
202 |
piclet={rosterMap().get(position)}
|
203 |
-
size={
|
204 |
onDrop={handleRosterDrop}
|
205 |
onPicletClick={(piclet) => handleRosterClick(position)}
|
206 |
onEmptyClick={handleRosterClick}
|
@@ -224,8 +224,7 @@
|
|
224 |
{#each storagePiclets.slice(0, 10) as piclet}
|
225 |
<DraggablePicletCard
|
226 |
instance={piclet}
|
227 |
-
size={
|
228 |
-
showDetails={true}
|
229 |
onClick={() => handleStorageClick(piclet)}
|
230 |
onDragStart={handleDragStart}
|
231 |
onDragEnd={handleDragEnd}
|
|
|
200 |
<RosterSlot
|
201 |
{position}
|
202 |
piclet={rosterMap().get(position)}
|
203 |
+
size={110}
|
204 |
onDrop={handleRosterDrop}
|
205 |
onPicletClick={(piclet) => handleRosterClick(position)}
|
206 |
onEmptyClick={handleRosterClick}
|
|
|
224 |
{#each storagePiclets.slice(0, 10) as piclet}
|
225 |
<DraggablePicletCard
|
226 |
instance={piclet}
|
227 |
+
size={110}
|
|
|
228 |
onClick={() => handleStorageClick(piclet)}
|
229 |
onDragStart={handleDragStart}
|
230 |
onDragEnd={handleDragEnd}
|
src/lib/components/Piclets/DraggablePicletCard.svelte
CHANGED
@@ -5,13 +5,12 @@
|
|
5 |
interface Props {
|
6 |
instance: PicletInstance;
|
7 |
size?: number;
|
8 |
-
showDetails?: boolean;
|
9 |
onDragStart?: (instance: PicletInstance) => void;
|
10 |
onDragEnd?: () => void;
|
11 |
onClick?: () => void;
|
12 |
}
|
13 |
|
14 |
-
let { instance, size = 100,
|
15 |
|
16 |
let isDragging = $state(false);
|
17 |
|
@@ -53,7 +52,7 @@
|
|
53 |
role="button"
|
54 |
tabindex="0"
|
55 |
>
|
56 |
-
<PicletCard {instance} {size} {
|
57 |
</div>
|
58 |
|
59 |
<style>
|
|
|
5 |
interface Props {
|
6 |
instance: PicletInstance;
|
7 |
size?: number;
|
|
|
8 |
onDragStart?: (instance: PicletInstance) => void;
|
9 |
onDragEnd?: () => void;
|
10 |
onClick?: () => void;
|
11 |
}
|
12 |
|
13 |
+
let { instance, size = 100, onDragStart, onDragEnd, onClick }: Props = $props();
|
14 |
|
15 |
let isDragging = $state(false);
|
16 |
|
|
|
52 |
role="button"
|
53 |
tabindex="0"
|
54 |
>
|
55 |
+
<PicletCard {instance} {size} {onClick} />
|
56 |
</div>
|
57 |
|
58 |
<style>
|
src/lib/components/Piclets/PicletCard.svelte
CHANGED
@@ -1,16 +1,14 @@
|
|
1 |
<script lang="ts">
|
2 |
import type { PicletInstance } from '$lib/db/schema';
|
3 |
import { TYPE_DATA } from '$lib/types/picletTypes';
|
4 |
-
import TypeBadge from '$lib/components/UI/TypeBadge.svelte';
|
5 |
|
6 |
interface Props {
|
7 |
instance: PicletInstance;
|
8 |
size?: number;
|
9 |
-
showDetails?: boolean;
|
10 |
onClick?: () => void;
|
11 |
}
|
12 |
|
13 |
-
let { instance, size = 100,
|
14 |
|
15 |
const hpPercentage = $derived(instance.currentHp / instance.maxHp);
|
16 |
const hpColor = $derived(
|
@@ -20,35 +18,31 @@
|
|
20 |
);
|
21 |
|
22 |
const typeColor = $derived(TYPE_DATA[instance.primaryType].color);
|
|
|
23 |
</script>
|
24 |
|
25 |
<button
|
26 |
class="piclet-card"
|
27 |
-
style="width: {size}px; height: {size +
|
28 |
onclick={onClick}
|
29 |
type="button"
|
30 |
>
|
31 |
-
<div class="image-container"
|
32 |
<img
|
33 |
src={instance.imageData || instance.imageUrl}
|
34 |
alt={instance.nickname || 'Piclet'}
|
35 |
class="piclet-image"
|
36 |
-
style="width: {size * 0.
|
37 |
/>
|
38 |
<div class="level-badge">
|
39 |
Lv.{instance.level}
|
40 |
</div>
|
41 |
-
<div class="type-badge-container">
|
42 |
-
<TypeBadge type={instance.primaryType} size="small" />
|
43 |
-
{#if instance.secondaryType}
|
44 |
-
<TypeBadge type={instance.secondaryType} size="small" />
|
45 |
-
{/if}
|
46 |
-
</div>
|
47 |
</div>
|
48 |
|
49 |
-
|
50 |
-
<
|
51 |
-
|
|
|
52 |
<div class="hp-bar">
|
53 |
<div
|
54 |
class="hp-fill"
|
@@ -56,14 +50,14 @@
|
|
56 |
></div>
|
57 |
</div>
|
58 |
</div>
|
59 |
-
|
60 |
</button>
|
61 |
|
62 |
<style>
|
63 |
.piclet-card {
|
64 |
display: flex;
|
65 |
flex-direction: column;
|
66 |
-
background:
|
67 |
border-radius: 12px;
|
68 |
border: 2px solid;
|
69 |
border-color: var(--type-color, #007bff);
|
@@ -86,6 +80,7 @@
|
|
86 |
justify-content: center;
|
87 |
border-radius: 10px 10px 0 0;
|
88 |
overflow: hidden;
|
|
|
89 |
}
|
90 |
|
91 |
.piclet-image {
|
@@ -103,37 +98,44 @@
|
|
103 |
font-weight: bold;
|
104 |
}
|
105 |
|
106 |
-
.type-badge-container {
|
107 |
-
position: absolute;
|
108 |
-
bottom: 4px;
|
109 |
-
left: 4px;
|
110 |
-
display: flex;
|
111 |
-
gap: 2px;
|
112 |
-
}
|
113 |
-
|
114 |
.details-section {
|
115 |
-
height:
|
116 |
-
padding:
|
117 |
display: flex;
|
118 |
flex-direction: column;
|
119 |
justify-content: center;
|
|
|
|
|
120 |
}
|
121 |
|
122 |
.nickname {
|
123 |
-
margin: 0;
|
124 |
-
font-size:
|
125 |
font-weight: 600;
|
126 |
text-align: center;
|
127 |
overflow: hidden;
|
128 |
text-overflow: ellipsis;
|
129 |
white-space: nowrap;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
}
|
131 |
|
132 |
.hp-bar {
|
133 |
height: 3px;
|
134 |
background: #f0f0f0;
|
135 |
border-radius: 1.5px;
|
136 |
-
margin-top: 2px;
|
137 |
overflow: hidden;
|
138 |
}
|
139 |
|
|
|
1 |
<script lang="ts">
|
2 |
import type { PicletInstance } from '$lib/db/schema';
|
3 |
import { TYPE_DATA } from '$lib/types/picletTypes';
|
|
|
4 |
|
5 |
interface Props {
|
6 |
instance: PicletInstance;
|
7 |
size?: number;
|
|
|
8 |
onClick?: () => void;
|
9 |
}
|
10 |
|
11 |
+
let { instance, size = 100, onClick }: Props = $props();
|
12 |
|
13 |
const hpPercentage = $derived(instance.currentHp / instance.maxHp);
|
14 |
const hpColor = $derived(
|
|
|
18 |
);
|
19 |
|
20 |
const typeColor = $derived(TYPE_DATA[instance.primaryType].color);
|
21 |
+
const softTypeColor = $derived(`${typeColor}20`); // Add 20% opacity for soft background
|
22 |
</script>
|
23 |
|
24 |
<button
|
25 |
class="piclet-card"
|
26 |
+
style="width: {size}px; height: {size + 40}px; --type-color: {typeColor}; --soft-type-color: {softTypeColor};"
|
27 |
onclick={onClick}
|
28 |
type="button"
|
29 |
>
|
30 |
+
<div class="image-container">
|
31 |
<img
|
32 |
src={instance.imageData || instance.imageUrl}
|
33 |
alt={instance.nickname || 'Piclet'}
|
34 |
class="piclet-image"
|
35 |
+
style="width: {size * 0.8}px; height: {size * 0.8}px;"
|
36 |
/>
|
37 |
<div class="level-badge">
|
38 |
Lv.{instance.level}
|
39 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
</div>
|
41 |
|
42 |
+
<div class="details-section">
|
43 |
+
<p class="nickname">{instance.nickname || 'Unknown'}</p>
|
44 |
+
<div class="hp-section">
|
45 |
+
<span class="hp-text">HP: {instance.currentHp}/{instance.maxHp}</span>
|
46 |
<div class="hp-bar">
|
47 |
<div
|
48 |
class="hp-fill"
|
|
|
50 |
></div>
|
51 |
</div>
|
52 |
</div>
|
53 |
+
</div>
|
54 |
</button>
|
55 |
|
56 |
<style>
|
57 |
.piclet-card {
|
58 |
display: flex;
|
59 |
flex-direction: column;
|
60 |
+
background: var(--soft-type-color, #f0f0f0);
|
61 |
border-radius: 12px;
|
62 |
border: 2px solid;
|
63 |
border-color: var(--type-color, #007bff);
|
|
|
80 |
justify-content: center;
|
81 |
border-radius: 10px 10px 0 0;
|
82 |
overflow: hidden;
|
83 |
+
background: rgba(255, 255, 255, 0.7);
|
84 |
}
|
85 |
|
86 |
.piclet-image {
|
|
|
98 |
font-weight: bold;
|
99 |
}
|
100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
.details-section {
|
102 |
+
height: 50px;
|
103 |
+
padding: 6px 8px;
|
104 |
display: flex;
|
105 |
flex-direction: column;
|
106 |
justify-content: center;
|
107 |
+
background: rgba(255, 255, 255, 0.9);
|
108 |
+
border-radius: 0 0 10px 10px;
|
109 |
}
|
110 |
|
111 |
.nickname {
|
112 |
+
margin: 0 0 2px 0;
|
113 |
+
font-size: 10px;
|
114 |
font-weight: 600;
|
115 |
text-align: center;
|
116 |
overflow: hidden;
|
117 |
text-overflow: ellipsis;
|
118 |
white-space: nowrap;
|
119 |
+
color: #333;
|
120 |
+
}
|
121 |
+
|
122 |
+
.hp-section {
|
123 |
+
display: flex;
|
124 |
+
flex-direction: column;
|
125 |
+
gap: 1px;
|
126 |
+
}
|
127 |
+
|
128 |
+
.hp-text {
|
129 |
+
font-size: 8px;
|
130 |
+
font-weight: 500;
|
131 |
+
text-align: center;
|
132 |
+
color: #666;
|
133 |
}
|
134 |
|
135 |
.hp-bar {
|
136 |
height: 3px;
|
137 |
background: #f0f0f0;
|
138 |
border-radius: 1.5px;
|
|
|
139 |
overflow: hidden;
|
140 |
}
|
141 |
|
src/lib/components/Piclets/RosterSlot.svelte
CHANGED
@@ -79,7 +79,6 @@
|
|
79 |
<DraggablePicletCard
|
80 |
instance={piclet}
|
81 |
{size}
|
82 |
-
showDetails={false}
|
83 |
onClick={handleClick}
|
84 |
{onDragStart}
|
85 |
{onDragEnd}
|
|
|
79 |
<DraggablePicletCard
|
80 |
instance={piclet}
|
81 |
{size}
|
|
|
82 |
onClick={handleClick}
|
83 |
{onDragStart}
|
84 |
{onDragEnd}
|
src/lib/components/UI/TypeBadge.svelte
DELETED
@@ -1,125 +0,0 @@
|
|
1 |
-
<script lang="ts">
|
2 |
-
import type { PicletType } from '$lib/types/picletTypes';
|
3 |
-
import { TYPE_DATA, PicletType as PicletTypeEnum } from '$lib/types/picletTypes';
|
4 |
-
|
5 |
-
interface Props {
|
6 |
-
type: PicletType | string | undefined;
|
7 |
-
size?: 'small' | 'medium' | 'large';
|
8 |
-
showIcon?: boolean;
|
9 |
-
showLabel?: boolean;
|
10 |
-
}
|
11 |
-
|
12 |
-
let { type, size = 'medium', showIcon = true, showLabel = false }: Props = $props();
|
13 |
-
|
14 |
-
// Safely get type info with fallback for invalid types
|
15 |
-
const typeInfo = $derived(() => {
|
16 |
-
// Handle undefined or null
|
17 |
-
if (!type) {
|
18 |
-
return TYPE_DATA[PicletTypeEnum.BEAST]; // Default fallback
|
19 |
-
}
|
20 |
-
|
21 |
-
// Check if type exists in TYPE_DATA
|
22 |
-
const typeData = TYPE_DATA[type as PicletType];
|
23 |
-
if (typeData) {
|
24 |
-
return typeData;
|
25 |
-
}
|
26 |
-
|
27 |
-
// Handle legacy string types by mapping them
|
28 |
-
const legacyTypeMap: Record<string, PicletType> = {
|
29 |
-
'normal': PicletTypeEnum.BEAST,
|
30 |
-
'fire': PicletTypeEnum.BEAST,
|
31 |
-
'water': PicletTypeEnum.AQUATIC,
|
32 |
-
'electric': PicletTypeEnum.MACHINA,
|
33 |
-
'grass': PicletTypeEnum.FLORA,
|
34 |
-
'ice': PicletTypeEnum.MINERAL,
|
35 |
-
'fighting': PicletTypeEnum.BEAST,
|
36 |
-
'poison': PicletTypeEnum.FLORA,
|
37 |
-
'ground': PicletTypeEnum.MINERAL,
|
38 |
-
'flying': PicletTypeEnum.BEAST,
|
39 |
-
'psychic': PicletTypeEnum.SPACE,
|
40 |
-
'bug': PicletTypeEnum.BUG,
|
41 |
-
'rock': PicletTypeEnum.MINERAL,
|
42 |
-
'ghost': PicletTypeEnum.SPACE,
|
43 |
-
'dragon': PicletTypeEnum.BEAST,
|
44 |
-
'dark': PicletTypeEnum.SPACE,
|
45 |
-
'steel': PicletTypeEnum.MACHINA,
|
46 |
-
'fairy': PicletTypeEnum.CULTURE
|
47 |
-
};
|
48 |
-
|
49 |
-
const mappedType = legacyTypeMap[type as string];
|
50 |
-
if (mappedType) {
|
51 |
-
return TYPE_DATA[mappedType];
|
52 |
-
}
|
53 |
-
|
54 |
-
// Final fallback
|
55 |
-
return TYPE_DATA[PicletTypeEnum.BEAST];
|
56 |
-
});
|
57 |
-
|
58 |
-
const sizeClass = $derived(`size-${size}`);
|
59 |
-
</script>
|
60 |
-
|
61 |
-
<div class="type-badge {sizeClass}" style="--type-color: {typeInfo().color}">
|
62 |
-
{#if showIcon}
|
63 |
-
<span class="type-icon">{typeInfo().icon}</span>
|
64 |
-
{/if}
|
65 |
-
{#if showLabel}
|
66 |
-
<span class="type-label">{typeInfo().name}</span>
|
67 |
-
{/if}
|
68 |
-
</div>
|
69 |
-
|
70 |
-
<style>
|
71 |
-
.type-badge {
|
72 |
-
display: inline-flex;
|
73 |
-
align-items: center;
|
74 |
-
gap: 2px;
|
75 |
-
background-color: var(--type-color);
|
76 |
-
color: white;
|
77 |
-
border-radius: 12px;
|
78 |
-
font-weight: 600;
|
79 |
-
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
|
80 |
-
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
|
81 |
-
border: 1px solid color-mix(in srgb, var(--type-color) 80%, black);
|
82 |
-
}
|
83 |
-
|
84 |
-
.size-small {
|
85 |
-
padding: 2px 4px;
|
86 |
-
font-size: 10px;
|
87 |
-
border-radius: 8px;
|
88 |
-
}
|
89 |
-
|
90 |
-
.size-medium {
|
91 |
-
padding: 3px 6px;
|
92 |
-
font-size: 11px;
|
93 |
-
border-radius: 10px;
|
94 |
-
}
|
95 |
-
|
96 |
-
.size-large {
|
97 |
-
padding: 4px 8px;
|
98 |
-
font-size: 12px;
|
99 |
-
border-radius: 12px;
|
100 |
-
}
|
101 |
-
|
102 |
-
.type-icon {
|
103 |
-
line-height: 1;
|
104 |
-
filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.5));
|
105 |
-
}
|
106 |
-
|
107 |
-
.type-label {
|
108 |
-
line-height: 1;
|
109 |
-
font-weight: 700;
|
110 |
-
text-transform: uppercase;
|
111 |
-
letter-spacing: 0.5px;
|
112 |
-
}
|
113 |
-
|
114 |
-
.size-small .type-icon {
|
115 |
-
font-size: 8px;
|
116 |
-
}
|
117 |
-
|
118 |
-
.size-medium .type-icon {
|
119 |
-
font-size: 10px;
|
120 |
-
}
|
121 |
-
|
122 |
-
.size-large .type-icon {
|
123 |
-
font-size: 12px;
|
124 |
-
}
|
125 |
-
</style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|