File size: 5,152 Bytes
7428b13
 
82b6f62
6530b95
7428b13
 
 
 
82b6f62
e8aa797
6530b95
 
 
 
 
ea83c78
7428b13
 
afa3e65
366ca7a
 
 
 
 
 
 
 
afa3e65
 
366ca7a
 
 
 
 
 
ea83c78
366ca7a
 
b1c7f35
366ca7a
 
ea83c78
366ca7a
 
ea83c78
 
afa3e65
366ca7a
 
 
 
 
 
 
 
 
 
 
 
 
 
7428b13
 
afa3e65
 
7428b13
 
 
afa3e65
 
 
 
 
 
 
 
 
 
7428b13
 
afa3e65
 
 
 
7428b13
 
afa3e65
 
 
366ca7a
afa3e65
366ca7a
 
 
6530b95
 
366ca7a
 
 
 
 
 
 
6530b95
 
366ca7a
 
 
 
 
7428b13
 
366ca7a
 
 
 
 
 
 
 
7428b13
366ca7a
6530b95
366ca7a
 
7428b13
 
 
 
afa3e65
7428b13
366ca7a
 
 
 
 
7428b13
 
366ca7a
afa3e65
366ca7a
 
 
7428b13
 
b1c7f35
 
 
 
366ca7a
 
ea83c78
 
b1c7f35
ea83c78
 
 
 
366ca7a
ea83c78
 
 
366ca7a
 
b1c7f35
ea83c78
 
afa3e65
 
366ca7a
7428b13
366ca7a
7428b13
b1c7f35
366ca7a
7428b13
 
afa3e65
7428b13
 
 
 
afa3e65
 
366ca7a
afa3e65
366ca7a
afa3e65
b1c7f35
366ca7a
afa3e65
 
 
 
 
82b6f62
e8aa797
 
afa3e65
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7428b13
 
 
 
afa3e65
 
366ca7a
 
 
 
 
 
7428b13
 
 
afa3e65
 
 
366ca7a
 
 
 
b1c7f35
366ca7a
7428b13
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<script lang="ts">
  import type { PicletInstance } from '$lib/db/schema';
  import { getXpProgress, getXpTowardsNextLevel } from '$lib/services/levelingService';
  import { TYPE_DATA } from '$lib/types/picletTypes';
  
  export let piclet: PicletInstance;
  export let hpPercentage: number;
  export let isPlayer: boolean;
  $: xpTowardsNext = isPlayer ? getXpTowardsNextLevel(piclet.xp, piclet.level, piclet.tier) : { current: 0, needed: 0, percentage: 0 };
  
  // Type-based styling
  $: typeData = TYPE_DATA[piclet.primaryType];
  $: typeColor = typeData.color;
  $: typeLogoPath = `/classes/${piclet.primaryType}.png`;
  
  $: hpColor = hpPercentage > 0.5 ? '#34c759' : hpPercentage > 0.25 ? '#ffcc00' : '#ff3b30';
</script>

<div class="piclet-info-wrapper {isPlayer ? 'player-info-wrapper' : 'enemy-info-wrapper'}">
  <div class="piclet-info">
    <!-- Type Logo (Foreground) -->
    <div class="type-logo-container">
      <img 
        src={typeLogoPath} 
        alt={piclet.primaryType}
        class="type-logo"
      />
    </div>
    
    <!-- Content Area -->
    <div class="content-area">
      <!-- Name and Level Row -->
      <div class="header-row">
        <div class="piclet-name">{piclet.nickname}</div>
        <div class="level-text">Lv.{piclet.level}</div>
      </div>
      
      <!-- HP Section -->
      <div class="stat-row">
        <div class="stat-label">HP</div>
        <div class="hp-bar">
          <div 
            class="hp-fill" 
            style="width: {hpPercentage * 100}%; background-color: {hpColor}"
          ></div>
        </div>
      </div>
      
      <!-- XP Section (Player only) -->
      {#if isPlayer}
        <div class="stat-row">
          <div class="stat-label">XP</div>
          <div class="xp-bar">
            <div 
              class="xp-fill" 
              style="width: {xpTowardsNext.percentage}%"
            ></div>
          </div>
        </div>
      {/if}
    </div>
  </div>
  
  <!-- Triangle Pointer -->
  <div class="triangle-pointer {isPlayer ? 'player-pointer' : 'enemy-pointer'}"></div>
</div>

<style>
  .piclet-info-wrapper {
    position: absolute;
    display: flex;
    align-items: center;
  }
  
  .player-info-wrapper {
    right: 16px;
    bottom: 20px;
    flex-direction: row-reverse;
  }
  
  .enemy-info-wrapper {
    left: 16px;
    top: 20px;
    flex-direction: row;
  }
  
  .piclet-info {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    padding: 10px;
    min-width: 160px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
  }
  
  /* Type Logo Container */
  .type-logo-container {
    flex-shrink: 0;
    margin-top: 2px;
  }
  
  .type-logo {
    width: 35px;
    height: 35px;
    object-fit: contain;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }
  
  /* Content Area */
  .content-area {
    flex: 1;
    min-width: 0; /* Allows flex item to shrink below content size */
  }
  
  /* Header Row */
  .header-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 6px;
    gap: 8px;
  }
  
  .piclet-name {
    font-weight: 600;
    font-size: 14px;
    color: #1a1a1a;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  
  .level-text {
    font-size: 11px;
    font-weight: 600;
    color: #666;
    flex-shrink: 0;
  }
  
  /* Stat Rows */
  .stat-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 3px;
  }
  
  .stat-row:last-child {
    margin-bottom: 0;
  }
  
  .stat-label {
    font-size: 9px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    width: 16px;
    flex-shrink: 0;
  }
  
  /* HP Bar */
  .hp-bar {
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    flex: 1;
    min-width: 80px;
  }
  
  .hp-fill {
    height: 100%;
    transition: width 0.5s ease, background-color 0.3s ease;
  }
  
  /* XP Bar */
  .xp-bar {
    height: 5px;
    background: #e0e0e0;
    border-radius: 2.5px;
    overflow: hidden;
    flex: 1;
    min-width: 80px;
  }
  
  .xp-fill {
    height: 100%;
    background: #2196f3;
    transition: width 1.2s ease-out;
  }
  
  
  /* Triangle Pointer */
  .triangle-pointer {
    width: 0;
    height: 0;
    border-style: solid;
  }
  
  .player-pointer {
    border-width: 8px 16px 8px 0;
    border-color: transparent rgba(255, 255, 255, 0.9) transparent transparent;
    margin-right: -1px;
  }
  
  .enemy-pointer {
    border-width: 8px 0 8px 16px;
    border-color: transparent transparent transparent rgba(255, 255, 255, 0.9);
    margin-left: -1px;
  }
  
  @media (max-width: 768px) {
    .piclet-info {
      min-width: 140px;
      padding: 8px;
      gap: 8px;
    }
    
    .type-logo {
      width: 28px;
      height: 28px;
    }
    
    .piclet-name {
      font-size: 12px;
    }
    
    .level-text {
      font-size: 10px;
    }
    
    .hp-bar, .xp-bar {
      min-width: 60px;
    }
  }
</style>