mirror of
https://github.com/minimo-io/appticles.git
synced 2025-06-23 16:05:29 +00:00
Starting with form
This commit is contained in:
parent
15a3de3a3d
commit
d40206c74d
@ -5,7 +5,6 @@ Let promote some reciprocity here! 😹
|
||||
|
||||
## ToDo
|
||||
|
||||
- Add % value for progress.
|
||||
- Add forms
|
||||
- Query for userdata, at least for no-followers
|
||||
- Remove SvelteKit (just Vite + Svelte).
|
||||
|
@ -1,4 +1,5 @@
|
||||
export const relays = [
|
||||
"wss://cache2.primal.net/v1",
|
||||
"wss://relay.hodl.ar",
|
||||
"wss://relay.current.fyi",
|
||||
"wss://nostr.wine",
|
||||
@ -14,7 +15,8 @@ export const relays = [
|
||||
"wss://nostr.bitcoiner.social",
|
||||
"wss://nostr.mutinywallet.com",
|
||||
"wss://relay.current.fyi",
|
||||
"wss://relay.plebstr.com",
|
||||
// "wss://relay.plebstr.com",
|
||||
|
||||
// "wss://nostr-pub.wellorder.net",
|
||||
// "wss://brb.io",
|
||||
// "wss://eden.nostr.land",
|
||||
|
@ -4,9 +4,11 @@
|
||||
import { fetchUserProfile } from "$lib/fetchs";
|
||||
import { relays } from "$lib/data/relays";
|
||||
|
||||
let npubToQuery = "npub1wujhdsytm3w6g0mpsqh8v7ezx83jcm64dlkwuqgm5v8lv0pds55ssudkw0";
|
||||
let userName;
|
||||
let userThumb;
|
||||
// let npubToQuery = "npub1wujhdsytm3w6g0mpsqh8v7ezx83jcm64dlkwuqgm5v8lv0pds55ssudkw0";
|
||||
let npubToQuery = "";
|
||||
let querying = false;
|
||||
let userName = "";
|
||||
let userThumb = "";
|
||||
let followsCount;
|
||||
|
||||
let followBackCount = 0;
|
||||
@ -14,11 +16,11 @@
|
||||
let unknownFollowBack = 0;
|
||||
let totalCountOfContactsChecked = 0;
|
||||
|
||||
$: progress = ((totalCountOfContactsChecked / followsCount) * 100).toFixed();
|
||||
|
||||
let originalFollow = [];
|
||||
let notFollowersBack = [];
|
||||
|
||||
function updateNpub() {}
|
||||
|
||||
async function bootstrap() {
|
||||
try {
|
||||
const ndk = new NDK({
|
||||
@ -89,14 +91,37 @@
|
||||
}
|
||||
}
|
||||
|
||||
bootstrap();
|
||||
//bootstrap();
|
||||
</script>
|
||||
|
||||
<h1>Who does not follows you on Nostr</h1>
|
||||
{#if !userThumb}
|
||||
|
||||
<form class="npub-form">
|
||||
<input type="text" bind:value={npubToQuery} placeholder={npubToQuery} />
|
||||
<input
|
||||
type="button"
|
||||
on:click={async () => {
|
||||
querying = true;
|
||||
userName = "";
|
||||
userThumb = "";
|
||||
originalFollow = [];
|
||||
notFollowersBack = [];
|
||||
followBackCount = 0;
|
||||
notFollowBackCount = 0;
|
||||
unknownFollowBack = 0;
|
||||
totalCountOfContactsChecked = 0;
|
||||
bootstrap();
|
||||
}}
|
||||
value="Analyze"
|
||||
/>
|
||||
</form>
|
||||
|
||||
{#if !querying}
|
||||
{npubToQuery}
|
||||
{/if}
|
||||
|
||||
<hr />
|
||||
|
||||
{#if userThumb}
|
||||
<div class="user-box">
|
||||
<img src={userThumb} width="50" style="border-radius:100%;" alt="user-thumb" />
|
||||
@ -108,9 +133,16 @@
|
||||
<span title="Actually Counted">{notFollowBackCount}</span>
|
||||
/ <span title="Actualy counted">{notFollowersBack.length}</span>
|
||||
<br />
|
||||
<p>
|
||||
Progress = {totalCountOfContactsChecked} of {followBackCount + notFollowBackCount + unknownFollowBack}
|
||||
</p>
|
||||
{#if progress < 100}
|
||||
<p>
|
||||
Progress =
|
||||
<strong>{progress}%</strong> - {totalCountOfContactsChecked} of {followBackCount +
|
||||
notFollowBackCount +
|
||||
unknownFollowBack}
|
||||
</p>
|
||||
{:else}
|
||||
<p><strong>Completed!</strong></p>
|
||||
{/if}
|
||||
<hr />
|
||||
<br />
|
||||
Results ({originalFollow.length})
|
||||
@ -140,6 +172,15 @@
|
||||
{/each}
|
||||
</ul> -->
|
||||
</div>
|
||||
{:else if !querying}
|
||||
<p>Let's find out who does not follow you back in Nostr!</p>
|
||||
{:else}
|
||||
<div class="loader">Loading data...</div>
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
.npub-form input[type="text"] {
|
||||
padding: 5px;
|
||||
width: 50%;
|
||||
}
|
||||
</style>
|
||||
|
Loading…
x
Reference in New Issue
Block a user