@@ -41,8 +41,8 @@ export abstract class BasePicker {
4141 header : `
4242 <div class="flex justify-between items-center">
4343 <h1 class="text-2xl font-bold">Selected Files and Folders</h1>
44- <button
45- onclick="handleSelectMore() "
44+ <button
45+ id="selectMoreButton "
4646 class="bg-blue-500 text-white px-4 py-2 rounded-lg hover:bg-blue-600 transition-colors"
4747 >
4848 Select Files/Folders
@@ -73,7 +73,7 @@ export abstract class BasePicker {
7373 submitButtonContainer : `
7474 <div id="submitButton" class="flex justify-end mt-6" style="display: none;">
7575 <button
76- onclick="finishSelection() "
76+ id="finishButton "
7777 class="bg-green-500 text-white px-6 py-3 rounded-lg hover:bg-green-600 transition-colors"
7878 >
7979 Finish Selection
@@ -117,7 +117,7 @@ export abstract class BasePicker {
117117 return;
118118 }
119119
120- fileList.innerHTML = selectedFiles.map(file =>
120+ fileList.innerHTML = selectedFiles.map(file =>
121121 \`<div class="group p-4 border rounded-lg flex justify-between items-center hover:bg-gray-50">
122122 <div>
123123 <p class="font-medium text-gray-800">
@@ -128,8 +128,8 @@ export abstract class BasePicker {
128128 </p>
129129 </div>
130130 <button
131- onclick="removeFile(' \${file.id}') "
132- class="p-2 text-gray-500 hover:text-red-500 hover:bg-red-50 rounded-full transition-colors"
131+ data-file-id=" \${file.id}"
132+ class="remove-file-btn p-2 text-gray-500 hover:text-red-500 hover:bg-red-50 rounded-full transition-colors"
133133 aria-label="Remove file"
134134 >
135135 <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
@@ -138,6 +138,14 @@ export abstract class BasePicker {
138138 </button>
139139 </div>\`
140140 ).join('');
141+
142+ // Attach event listeners to remove buttons
143+ document.querySelectorAll('.remove-file-btn').forEach(btn => {
144+ btn.addEventListener('click', (e) => {
145+ const fileId = e.currentTarget.getAttribute('data-file-id');
146+ removeFile(fileId);
147+ });
148+ });
141149
142150 submitButton.style.display = 'flex';
143151 }
@@ -178,6 +186,9 @@ export abstract class BasePicker {
178186 }
179187 }
180188
189+ // Attach event listeners
190+ document.getElementById('finishButton')?.addEventListener('click', finishSelection);
191+
181192 // Initialize file list with pre-selected files if any
182193 if (selectedFiles.length > 0) {
183194 updateFileList();
@@ -211,8 +222,59 @@ export abstract class BasePicker {
211222 <title>${ title } </title>
212223 <meta charset="utf-8">
213224 <meta name="viewport" content="width=device-width, initial-scale=1">
214- <script src="https://cdn.tailwindcss.com"></script>
215- ${ styles }
225+ <style>
226+ * { box-sizing: border-box; margin: 0; padding: 0; }
227+ body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; }
228+ .p-2 { padding: 0.5rem; }
229+ .p-4 { padding: 1rem; }
230+ .p-6 { padding: 1.5rem; }
231+ .px-4 { padding-left: 1rem; padding-right: 1rem; }
232+ .px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
233+ .py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
234+ .py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
235+ .my-4 { margin-top: 1rem; margin-bottom: 1rem; }
236+ .mt-6 { margin-top: 1.5rem; }
237+ .ml-3 { margin-left: 0.75rem; }
238+ .space-y-4 > * + * { margin-top: 1rem; }
239+ .space-y-6 > * + * { margin-top: 1.5rem; }
240+ .flex { display: flex; }
241+ .items-center { align-items: center; }
242+ .justify-between { justify-content: space-between; }
243+ .justify-end { justify-content: flex-end; }
244+ .flex-shrink-0 { flex-shrink: 0; }
245+ .border { border: 1px solid #e5e7eb; }
246+ .border-l-4 { border-left: 4px solid; }
247+ .border-yellow-400 { border-color: #fbbf24; }
248+ .rounded-lg { border-radius: 0.5rem; }
249+ .rounded-full { border-radius: 9999px; }
250+ .bg-blue-500 { background-color: #3b82f6; }
251+ .bg-green-500 { background-color: #10b981; }
252+ .bg-yellow-50 { background-color: #fffbeb; }
253+ .bg-gray-50 { background-color: #f9fafb; }
254+ .bg-red-50 { background-color: #fef2f2; }
255+ .text-white { color: #ffffff; }
256+ .text-2xl { font-size: 1.5rem; line-height: 2rem; }
257+ .text-sm { font-size: 0.875rem; line-height: 1.25rem; }
258+ .text-gray-500 { color: #6b7280; }
259+ .text-gray-800 { color: #1f2937; }
260+ .text-yellow-700 { color: #a16207; }
261+ .text-yellow-400 { color: #fbbf24; }
262+ .text-red-500 { color: #ef4444; }
263+ .font-bold { font-weight: 700; }
264+ .font-medium { font-weight: 500; }
265+ .hover\\:bg-blue-600:hover { background-color: #2563eb; }
266+ .hover\\:bg-green-600:hover { background-color: #059669; }
267+ .hover\\:bg-gray-50:hover { background-color: #f9fafb; }
268+ .hover\\:bg-red-50:hover { background-color: #fef2f2; }
269+ .hover\\:text-red-500:hover { color: #ef4444; }
270+ .transition-colors { transition-property: color, background-color, border-color; transition-duration: 150ms; }
271+ .group:hover .group-hover\\:bg-gray-50 { background-color: #f9fafb; }
272+ button { cursor: pointer; border: none; outline: none; }
273+ button:focus { outline: 2px solid #3b82f6; outline-offset: 2px; }
274+ .h-5 { height: 1.25rem; }
275+ .w-5 { width: 1.25rem; }
276+ ${ styles }
277+ </style>
216278 ${ head }
217279 </head>
218280 <body>
0 commit comments