Run a giveaway from a bsky post. Choose from those who interacted with it

Limit & Status text

Changed files
+18 -2
+18 -2
Index.html
··· 91 91 url.searchParams.append('target', target); 92 92 url.searchParams.append('collection', collection); 93 93 url.searchParams.append('path', path); 94 + url.searchParams.append('limit', '100'); 94 95 if (cursor) { 95 96 url.searchParams.append('cursor', cursor); 96 97 } ··· 120 121 winners: [], 121 122 participants: 0, 122 123 showResults: false, 124 + statusText: '', 123 125 124 126 // Initialize component with query parameters 125 127 init() { ··· 221 223 console.log(`Fetching ${collection} data...`); 222 224 let cursor = null; 223 225 let pageCount = 1; 224 - 226 + let displayTypeText = '' 227 + let displayTotal = 0; 228 + if (collection === likesCollection) { 229 + displayTypeText = 'likes' 230 + }else if (collection === repostsCollection) { 231 + displayTypeText = 'reposts' 232 + } 233 + else { 234 + displayTypeText = 'both' 235 + } 225 236 do { 226 237 console.log(`Fetching ${collection} data, page ${pageCount}${cursor ? ' with cursor' : ''}...`); 227 238 const response = await callConstellationEndpoint(atUri, collection, path, cursor); 228 239 console.log(`${collection} response (page ${pageCount}):`, response); 229 240 230 241 if (response && response.linking_dids) { 242 + displayTotal += response.linking_dids.length; 243 + this.statusText = `${displayTotal}/${response.total} ${displayTypeText} fetched.`; 244 + 231 245 let dids = response.linking_dids.map(x => ({ 232 246 collection: collection, 233 247 did: x ··· 350 364 351 365 </fieldset> 352 366 <span x-show="error" x-text="error" class="text-red-500 text-lg font-bold"></span> 367 + <span x-show="statusText && loading" x-text="statusText" class="text-gray-500 text-lg font-bold"></span> 368 + <span x-show="statusText && loading" class="text-gray-500 text-sm font-bold">Posts with lots of likes and reposts can take a while. It will show an error if it fails.</span> 353 369 <button type="submit" class="btn btn-neutral mt-4" x-bind:disabled="loading"> 354 370 <span x-show="!loading">I choose you!</span> 355 371 <span x-show="loading" class="loading loading-spinner"></span> ··· 377 393 <!-- URL Parameters Documentation --> 378 394 <div class="mt-6 p-4 bg-base-200 rounded-lg text-sm"> 379 395 <h3 class="text-lg font-bold mb-2">🔗 URL Parameters</h3> 380 - <p class="mb-2">You can create links that automatically run giveaways with these GET query parameters:</p> 396 + <p class="mb-2">You can create links that automatically run the giveaway when the page is loaded with these GET query parameters:</p> 381 397 <ul class="list-disc pl-5 mb-2"> 382 398 <li><code>post_url</code>: URL of the Bluesky post</li> 383 399 <li><code>winner_count</code>: Number of winners (default: 1)</li>