Skip to content

Commit

Permalink
formatttttt
Browse files Browse the repository at this point in the history
  • Loading branch information
github-tijlxyz committed Mar 23, 2024
1 parent 6134d99 commit b84a0d9
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 58 deletions.
2 changes: 1 addition & 1 deletion src/components/Comment.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<svelte:self
replies={replies.filter((e) => e.getMatchingTags('e').find((v) => v[1] === re.id))}
event={re}
refresh={refresh}
{refresh}
/>
</li>
{/each}
Expand Down
4 changes: 3 additions & 1 deletion src/components/Comments.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
});
}
$: {fetch()}
$: {
fetch();
}
let commentText = '';
async function postComment() {
Expand Down
4 changes: 3 additions & 1 deletion src/components/Recipe/TotalZaps.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
});
}
$: {fetch()}
$: {
fetch();
}
loading = false;
</script>

Expand Down
27 changes: 16 additions & 11 deletions src/routes/login/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
loadUserData();
}
let nsecInput = "";
let nsecError = "";
let nsecInput = '';
let nsecError = '';
async function loginWithSk() {
try {
if (browser && nsecInput) {
Expand All @@ -58,10 +58,10 @@
$userPublickey = newUserPublicKey;
userPublickey.set($userPublickey);
}
goto("/");
goto('/');
}
} catch (error) {
nsecError = "Error! Make sure private key is valid.";
nsecError = 'Error! Make sure private key is valid.';
console.error(error);
}
}
Expand All @@ -72,8 +72,8 @@
nsecModal = false;
}
let seedInput = "";
let seedError = "";
let seedInput = '';
let seedError = '';
async function loginWithSeed() {
try {
if (browser && seedInput) {
Expand All @@ -95,10 +95,10 @@
$userPublickey = newUserPublicKey;
userPublickey.set($userPublickey);
}
goto("/");
goto('/');
}
} catch (error) {
seedError = "Error! Make sure seed is valid.";
seedError = 'Error! Make sure seed is valid.';
console.error(error);
}
}
Expand Down Expand Up @@ -131,7 +131,12 @@

<Modal open={seedModal} cleanup={seedModalCleanup}>
<h2 slot="title">Login with Seed</h2>
<input class="input" type="text" bind:value={seedInput} placeholder="beyond mobile enough risk kite mechanic exact around..." />
<input
class="input"
type="text"
bind:value={seedInput}
placeholder="beyond mobile enough risk kite mechanic exact around..."
/>
<div class="flex">
<span class="flex grow text-danger self-center">{seedError}</span>
<div class="flex gap-2 justify-end">
Expand Down Expand Up @@ -160,7 +165,7 @@
<span class="self-center">Sign in with extension</span>
</button>
<button
on:click={() => nsecModal = true}
on:click={() => (nsecModal = true)}
class="flex w-[320px] h-[52px] gap-2 shadow rounded-xl justify-center text-center font-semibold border box-border border-[#D1D3DC]"
>
<span
Expand All @@ -171,7 +176,7 @@
<span class="self-center">Log in with Private Key</span>
</button>
<button
on:click={() => seedModal = true}
on:click={() => (seedModal = true)}
class="flex w-[320px] h-[52px] gap-2 shadow rounded-xl justify-center text-center font-semibold border box-border border-[#D1D3DC]"
>
<span
Expand Down
35 changes: 10 additions & 25 deletions src/routes/onboarding/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
let disableStepButtons = false;
let name = '';
let picture = "https://zap.cooking/default-pfp.jpg";
let picture = 'https://zap.cooking/default-pfp.jpg';
let about = '';
if ($userPublickey !== '') {
Expand Down Expand Up @@ -159,12 +159,7 @@
your permanent password for the nostr network; It's crucial to store them in a secure location
and avoid sharing them with anyone.
</p>
<input
bind:value={seed}
type="text"
disabled
class="input w-full"
/>
<input bind:value={seed} type="text" disabled class="input w-full" />
<p>
While generating a seed on the web is convenient, it may not be the most secure option.
Consider downloading a native Nostr client for a more robust and secure experience.
Expand All @@ -176,12 +171,7 @@
Your public key, often referred to as npub, can be shared with anyone. With this public key,
others can discover your profile and posts.
</p>
<input
bind:value={npub}
type="text"
disabled
class="input w-full"
/>
<input bind:value={npub} type="text" disabled class="input w-full" />
<p>
Regarding your profile, we need your input to create it. Please provide the following details
for publication.
Expand All @@ -190,7 +180,11 @@
<div class="flex flex-col self-center">
<h2 class="text-white">Picture</h2>
<label for="file-upload" class="cursor-pointer self-center">
<img class="w-[100px] h-[100px] md:w-[200px] md:h-[200px] rounded-full bg-input self-center" src={picture} alt="Profile" />
<img
class="w-[100px] h-[100px] md:w-[200px] md:h-[200px] rounded-full bg-input self-center"
src={picture}
alt="Profile"
/>
<input id="file-upload" bind:this={input} type="file" class="sr-only self-center" />
</label>
</div>
Expand All @@ -207,19 +201,10 @@

<div class="flex mb-4">
<div class="flex-1">
<Button
on:click={backstep}
disabled={disableStepButtons}
primary={false}
>
Back
</Button>
<Button on:click={backstep} disabled={disableStepButtons} primary={false}>Back</Button>
</div>
<div>
<Button
on:click={continuestep}
disabled={disableStepButtons || (step == 2 && name == '')}
>
<Button on:click={continuestep} disabled={disableStepButtons || (step == 2 && name == '')}>
{#if disableStepButtons == true}
loading...
{:else if step == 0}
Expand Down
16 changes: 12 additions & 4 deletions src/routes/settings/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
}
let showPrivkey = false;
const sk = localStorage.getItem("nostrcooking_privateKey");
const sk = localStorage.getItem('nostrcooking_privateKey');
</script>

<svelte:head>
Expand Down Expand Up @@ -133,17 +133,25 @@
<h3>Account Private Key</h3>
<div>
<div>
Your Account's Private Key. <span class="text-danger font-bold">DO NOT SHOW THIS TO ANYONE ELSE!</span>
Your Account's Private Key. <span class="text-danger font-bold"
>DO NOT SHOW THIS TO ANYONE ELSE!</span
>
</div>
<div role="button" tabindex="0" on:keydown={()=> showPrivkey=true} on:click={() => showPrivkey = true} class="input !border-accent-gray !border-2 flex flex-wrap text-wrap break-all">
<div
role="button"
tabindex="0"
on:keydown={() => (showPrivkey = true)}
on:click={() => (showPrivkey = true)}
class="input !border-accent-gray !border-2 flex flex-wrap text-wrap break-all"
>
{#if showPrivkey}
{nip19.npubEncode(sk)}
{:else}
Click to show your private key
{/if}
</div>
{#if showPrivkey}
<button on:click={() => showPrivkey = false}>Click here to hide.</button>
<button on:click={() => (showPrivkey = false)}>Click here to hide.</button>
{/if}
</div>
{/if}
Expand Down
32 changes: 17 additions & 15 deletions src/routes/user/[slug]/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import { ndk, userPublickey } from '$lib/nostr';
import { NDKEvent } from "@nostr-dev-kit/ndk"
import { NDKEvent } from '@nostr-dev-kit/ndk';
import type { NDKFilter, NDKUser, NDKUserProfile } from '@nostr-dev-kit/ndk';
import { nip19 } from 'nostr-tools';
import ZapModal from '../../../components/ZapModal.svelte';
Expand Down Expand Up @@ -71,8 +71,8 @@
loaded = true;
}
profileName = profile && profile.displayName ? profile.displayName : ""
url = profile && profile.image ? profile.image : ""
profileName = profile && profile.displayName ? profile.displayName : '';
url = profile && profile.image ? profile.image : '';
}
async function zapEvt(amount: number, message: string) {
Expand Down Expand Up @@ -144,21 +144,21 @@
});
}
let profileName = ""
let profileName = '';
async function updateProfile() {
const metaEvent = new NDKEvent($ndk);
metaEvent.kind = 0;
metaEvent.tags = [];
// @ts-expect-error typescript is wrong
profile = user.profile
if (!profile) profile = {}
profile = user.profile;
if (!profile) profile = {};
profile.image = url;
profile.displayName = profileName;
console.log(profile)
console.log(profile);
try {
console.log(hexpubkey, profile)
$ndk.cacheAdapter!.saveProfile!(hexpubkey!, profile) // for some reason the caching doesn't happen automatically
console.log(hexpubkey, profile);
$ndk.cacheAdapter!.saveProfile!(hexpubkey!, profile); // for some reason the caching doesn't happen automatically
metaEvent.content = JSON.stringify(profile);
let relays = await metaEvent.publish();
relays.forEach((relay) => {
Expand All @@ -170,7 +170,7 @@
});
});
} catch (error) {
console.error("error while publishing update: ", error)
console.error('error while publishing update: ', error);
}
editModalCleanup();
}
Expand All @@ -188,7 +188,11 @@
<div class="flex flex-col self-center">
<h2 class="text-white">Picture</h2>
<label for="file-upload" class="cursor-pointer self-center">
<img class="w-[100px] h-[100px] md:w-[200px] md:h-[200px] rounded-full bg-input self-center" src={url} alt="Profile" />
<img
class="w-[100px] h-[100px] md:w-[200px] md:h-[200px] rounded-full bg-input self-center"
src={url}
alt="Profile"
/>
<input id="file-upload" bind:this={input} type="file" class="sr-only self-center" />
</label>
</div>
Expand Down Expand Up @@ -238,10 +242,8 @@
<!-- <Button class="flex self-center">Follow</Button> -->
{/if}
{#if hexpubkey === $userPublickey}
<Button
class="flex self-center"
primary="false"
on:click={() => (editModal = true)}>Edit Profile</Button
<Button class="flex self-center" primary="false" on:click={() => (editModal = true)}
>Edit Profile</Button
>
{/if}
</div>
Expand Down

0 comments on commit b84a0d9

Please sign in to comment.