Skip to content

Commit

Permalink
applied settings, added to sheet
Browse files Browse the repository at this point in the history
  • Loading branch information
dskvr committed Apr 18, 2024
1 parent 436a554 commit a8896bc
Show file tree
Hide file tree
Showing 25 changed files with 538 additions and 286 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"bits-ui": "0.21.1",
"clsx": "2.1.0",
"cmdk-sv": "0.0.16",
"deepmerge": "4.3.1",
"embla-carousel-svelte": "8.0.0",
"formsnap": "1.0.0",
"jsonpack": "1.1.5",
Expand Down Expand Up @@ -77,4 +78,4 @@
"typescript": "5.4.3",
"vite-plugin-dynamic-import": "1.5.0"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export const defaultOptions = {
blockHeading: "geo",
showMonitors: "always"
}

export const optionsConfig = {
blockHeading: {
label: "Block Heading",
type: "text",
default: defaultOptions.blockHeading
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,14 @@
import type NDK from '@nostr-dev-kit/ndk';
import UserAvatar from "$lib/components/partials/avatar.svelte";
import Badge from '$lib/components/ui/badge/badge.svelte';
import Badge from '$lib/components/ui/badge/badge.svelte';
import Block from '$lib/components/wrappers/block.svelte';
const mrp_context: Writable<MyRelayPage> = getContext(MY_RELAY_PAGE);
const MRP: Writable<MyRelayPage> = getContext(MY_RELAY_PAGE);
const MAX_LENGTH = 72
let authed: boolean;
let followsRetrieved: boolean = false;
let followsOnRelay: NDKUser[] | undefined;
let ndk: NDK | undefinned
mrp_context.subscribe(async (_mrp) => {
ndk = _mrp?.nostr.$
authed = _mrp?.nostr?.authed
followsOnRelay = _mrp?.userFollowsOnRelay
});
$: authed = $MRP?.nostr?.authed
$: followsOnRelay = $MRP?.userFollowsOnRelay > 500? "500+": $MRP.userFollowsOnRelay
$: followsTruncated = (): [NDKUser[], number] => {
if(!followsOnRelay) return [followsOnRelay, 0]
Expand All @@ -31,26 +24,26 @@
return [followsOnRelay.slice(0, MAX_LENGTH) as NDKUser[], difference]
}
</script>


{#if authed && typeof followsOnRelay !== 'undefined' && followsOnRelay.length}
<div class="mrp-block duration-200">
<h3 class="mrp-block-title">
<Block>
<svelte:fragment slot="title">
you follow <Badge class="text-lg">{followsOnRelay?.length}</Badge> people who hang out here
</h3>
{#each followsTruncated()[0] as follow}
<span class="mr-1 inline-block">
<UserAvatar photo={follow?.profile?.image} name={follow?.profile?.name} />
</span>
{/each}
{#if followsTruncated()[1] > 0}
<Badge class="ml-0 h-10 w-10 py-0 px-0 text-center shrink-0 overflow-hidden rounded-full inline-block">
<span class="text-lg mt-1 inline-block">+{followsTruncated()[1]}</span>
</Badge>
{/if}
</div>
</svelte:fragment>
<svelte:fragment slot="content">
{#each followsTruncated()[0] as follow}
<span class="mr-1 inline-block">
<UserAvatar photo={follow?.profile?.image} name={follow?.profile?.name} />
</span>
{/each}
{#if followsTruncated()[1] > 0}
<Badge class="ml-0 h-10 w-10 py-0 px-0 text-center shrink-0 overflow-hidden rounded-full inline-block">
<span class="text-lg mt-1 inline-block">+{followsTruncated()[1]}</span>
</Badge>
{/if}
</svelte:fragment>
</Block>
{/if}


22 changes: 18 additions & 4 deletions src/lib/components/blocks/unique/map/map.options.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const defaultOptions = {
blockHeading: "geo",
showMonitors: true
showMonitors: "always"
}

export const optionsConfig = {
Expand All @@ -10,8 +10,22 @@ export const optionsConfig = {
default: defaultOptions.blockHeading
},
showMonitors: {
label: "Enable Monitors",
type: "checkbox",
default: defaultOptions.showMonitors
label: "Monitor Visibility",
type: "radio",
default: defaultOptions.showMonitors,
values: [
{
label: "Always",
value: "always"
},
{
label: "On hover",
value: "onhover"
},
{
label: "Never",
value: "never"
}
]
}
}
Loading

0 comments on commit a8896bc

Please sign in to comment.