Skip to content

Commit

Permalink
Merge pull request #140 from bob2402/product-creator
Browse files Browse the repository at this point in the history
problem: can't see which user proposed a product
  • Loading branch information
gsovereignty authored Sep 19, 2024
2 parents f85f3f1 + 1ccf224 commit 790d646
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
31 changes: 31 additions & 0 deletions src/components/ProductCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
import { currentUser, devmode } from '@/stores/session';
import BadgeMaker from './BadgeMaker.svelte';
import Login from './Login.svelte';
import { Avatar, Name } from '@nostr-dev-kit/ndk-svelte-components';
import { ndk } from '@/ndk';
import * as HoverCard from '$lib/components/ui/hover-card';
import ProfileCard from './ProfileCard.svelte';
export let product: ProductEvent;
export let rocket: Rocket;
Expand Down Expand Up @@ -63,6 +67,33 @@
{#if product.Option().length > 0}(variant: {product.Option()}){/if}</Card.Title
>
<Card.Description>{product.Description()}</Card.Description>
<div class="flex w-full justify-start">
<HoverCard.Root>
<HoverCard.Trigger>
<BadgeMaker>
<div slot="icon">PROPOSED:</div>
<div slot="content">
<div class="flex items-center gap-2">
<Avatar
ndk={$ndk}
pubkey={product.Creator()}
class="h-5 w-5 flex-none rounded-full object-cover"
/>
<Name
npubMaxLength={10}
ndk={$ndk}
pubkey={product.Creator()}
class="inline-block truncate"
/>
</div>
</div>
</BadgeMaker>
</HoverCard.Trigger>
<HoverCard.Content>
<ProfileCard pubkey={product.Creator()} />
</HoverCard.Content>
</HoverCard.Root>
</div>
</Card.Header>

{#if $$slots.default}
Expand Down
7 changes: 6 additions & 1 deletion src/components/ProfileCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,12 @@
<div class="mb-4 flex items-center">
<Avatar ndk={$ndk} {pubkey} class="mr-3 h-12 w-12 rounded-full object-cover" />
<div>
<Name ndk={$ndk} {pubkey} class="text-lg font-semibold text-gray-900 dark:text-white" />
<Name
npubMaxLength={10}
ndk={$ndk}
{pubkey}
class="text-lg font-semibold text-gray-900 dark:text-white"
/>
<button
on:click={copyPubkey}
class="flex cursor-pointer items-center text-sm text-gray-500 transition-colors duration-200 hover:text-blue-500 dark:text-gray-400 dark:hover:text-blue-400"
Expand Down
3 changes: 3 additions & 0 deletions src/lib/event_helpers/rockets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,9 @@ export class Product {
}
return result;
}
Creator(): string {
return this.Event.author.pubkey;
}
ID(): string {
return this.Event.id;
}
Expand Down

0 comments on commit 790d646

Please sign in to comment.