2026-06-23 23:30:54 +00:00
|
|
|
<script lang="ts">
|
|
|
|
|
import PinForm, {type PinFormValues} from "@app/components/PinForm.svelte"
|
|
|
|
|
import {createPin, referenceToPin} from "@app/pinboards"
|
|
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
|
url: string
|
|
|
|
|
address: string
|
2026-07-02 18:36:05 +00:00
|
|
|
reference?: string
|
2026-06-23 23:30:54 +00:00
|
|
|
}
|
|
|
|
|
|
2026-07-02 18:36:05 +00:00
|
|
|
const {url, address, reference}: Props = $props()
|
2026-06-23 23:30:54 +00:00
|
|
|
|
|
|
|
|
const submit = async ({title, topics, value}: PinFormValues) => {
|
|
|
|
|
const params = referenceToPin(value)
|
|
|
|
|
|
|
|
|
|
if (!params) return "Please enter a valid URL or nostr link."
|
|
|
|
|
|
|
|
|
|
return createPin(url, {...params, boards: [address], title, topics})
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
2026-07-02 18:36:05 +00:00
|
|
|
<PinForm
|
|
|
|
|
{url}
|
|
|
|
|
heading="Add Link"
|
|
|
|
|
action="Add link"
|
|
|
|
|
successMessage="Link added!"
|
|
|
|
|
values={{value: reference}}
|
|
|
|
|
{submit} />
|