File size: 5,853 Bytes
b4531e8
 
 
e7b0a32
a519169
b4531e8
 
 
 
 
 
 
 
 
c703ea3
e7b0a32
b4531e8
c703ea3
 
 
 
 
 
 
 
 
0d548ea
213c234
b4531e8
 
c703ea3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b4531e8
 
c703ea3
 
 
 
 
 
 
 
d871370
 
c703ea3
 
 
9c2da23
 
c703ea3
 
 
 
9c2da23
c703ea3
 
 
 
c8a8763
c703ea3
 
 
 
 
782d90b
c703ea3
 
b4531e8
 
c703ea3
 
 
 
 
 
 
 
b4531e8
 
 
c703ea3
e7b0a32
f12c994
 
 
 
c703ea3
b4531e8
c703ea3
 
 
 
b4531e8
 
c703ea3
 
 
 
 
 
5761465
c703ea3
 
f444918
 
c703ea3
 
 
 
5761465
 
 
 
 
 
c703ea3
 
f444918
5761465
c703ea3
f444918
c703ea3
 
 
f444918
 
 
c703ea3
 
5761465
 
c703ea3
5761465
f444918
 
c703ea3
 
 
 
 
 
c8a8763
 
c703ea3
 
 
 
c8a8763
c703ea3
c8a8763
c703ea3
 
c8a8763
 
c703ea3
 
 
c8a8763
 
c703ea3
 
 
 
c8a8763
c703ea3
c8a8763
 
c703ea3
c8a8763
 
c703ea3
b4531e8
 
c703ea3
 
 
c8a8763
b4531e8
c703ea3
b4531e8
 
c703ea3
782d90b
c703ea3
 
74f8c2c
 
c703ea3
 
 
 
74f8c2c
 
c703ea3
74f8c2c
 
c703ea3
 
74f8c2c
 
c703ea3
 
 
 
74f8c2c
 
c703ea3
 
 
 
d871370
 
c703ea3
d871370
c703ea3
 
d871370
 
c703ea3
9c2da23
 
c703ea3
 
9c2da23
 
c703ea3
 
 
 
 
 
9c2da23
d871370
 
c703ea3
 
 
 
 
d871370
 
c703ea3
 
 
 
 
 
d871370
c703ea3
 
9c2da23
 
c703ea3
 
b4531e8
 
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
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
<script lang="ts">
  import type { PicletInstance } from '$lib/db/schema';
  import { deletePicletInstance } from '$lib/db/piclets';
  import { uiStore } from '$lib/stores/ui';
  import { TYPE_DATA } from '$lib/types/picletTypes';
  
  interface Props {
    instance: PicletInstance;
    onClose: () => void;
    onDeleted?: () => void;
  }
  
  let { instance, onClose, onDeleted }: Props = $props();
  
  const typeColor = $derived(TYPE_DATA[instance.primaryType]?.color || '#007bff');
  
  async function handleDelete() {
    if (confirm(`Are you sure you want to delete ${instance.typeId}?`)) {
      try {
        await deletePicletInstance(instance.id!);
        onDeleted?.();
        onClose();
      } catch (error) {
        console.error('Failed to delete piclet:', error);
        alert('Failed to delete piclet');
      }
    }
  }
</script>

<div class="piclet-detail-overlay" onclick={onClose}>
  <div class="piclet-detail" onclick={(e) => e.stopPropagation()}>
    <!-- Header -->
    <div class="header" style="--type-color: {typeColor}">
      <button class="close-button" onclick={onClose}>×</button>
      <div class="tier-badge tier-{instance.tier}">{instance.tier}</div>
    </div>
    
    <!-- Main Content -->
    <div class="content">
      <!-- Image Section -->
      <div class="image-section">
        <img 
          src={instance.imageData || instance.imageUrl} 
          alt={instance.typeId}
          class="piclet-image"
        />
      </div>
      
      <!-- Info Section -->
      <div class="info-section">
        <h2 class="name">{instance.typeId}</h2>
        
        <div class="types">
          <span class="type primary" style="background-color: {typeColor}">
            {instance.primaryType}
          </span>
        </div>
        
        <div class="description">
          <h3>Description</h3>
          <p>{instance.description}</p>
        </div>
        
        <div class="metadata">
          <div class="meta-item">
            <strong>Caught:</strong> 
            {instance.caught ? 'Yes' : 'No'}
          </div>
          {#if instance.caughtAt}
            <div class="meta-item">
              <strong>Caught on:</strong> 
              {new Date(instance.caughtAt).toLocaleDateString()}
            </div>
          {/if}
          {#if instance.isInRoster}
            <div class="meta-item">
              <strong>Status:</strong> 
              <span class="roster-badge">In Battle Roster</span>
            </div>
          {/if}
        </div>
      </div>
    </div>
    
    <!-- Actions -->
    <div class="actions">
      <button class="delete-button" onclick={handleDelete}>
        🗑️ Delete
      </button>
    </div>
  </div>
</div>

<style>
  .piclet-detail-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
  }
  
  .piclet-detail {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  
  .header {
    background: var(--type-color, #007bff);
    color: white;
    padding: 1rem;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  .close-button {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
  }
  
  .close-button:hover {
    background: rgba(255, 255, 255, 0.2);
  }
  
  .tier-badge {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
  }
  
  .tier-low { background: #6c757d; }
  .tier-medium { background: #28a745; }
  .tier-high { background: #fd7e14; }
  .tier-legendary { background: #dc3545; }
  
  .content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
  }
  
  .image-section {
    text-align: center;
    margin-bottom: 1.5rem;
  }
  
  .piclet-image {
    width: 150px;
    height: 150px;
    object-fit: contain;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.05);
  }
  
  .info-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }
  
  .name {
    margin: 0;
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
    color: var(--type-color, #007bff);
  }
  
  .types {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
  }
  
  .type {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    color: white;
  }
  
  .type.secondary {
    background: #6c757d;
  }
  
  .description h3 {
    margin: 0 0 0.5rem 0;
    color: #333;
    font-size: 1.1rem;
  }
  
  .description p {
    margin: 0;
    line-height: 1.5;
    color: #666;
  }
  
  .metadata {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
  }
  
  .roster-badge {
    background: #28a745;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
  }
  
  .actions {
    padding: 1rem 1.5rem;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: center;
  }
  
  .delete-button {
    background: #dc3545;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
  }
  
  .delete-button:hover {
    background: #c82333;
  }
</style>