nostrmarket/static/components/nostr-keys-dialog.js
Ben Weeks a21b5289c1 feat: add merchant profile edit, keys dialog, and publish to Nostr
- Add PATCH endpoint for updating merchant profile config
- Add website field to MerchantProfile model
- Fix to_nostr_event to include all profile fields (display_name, banner, website, nip05, lud16)
- Always publish merchant profile (kind 0) when publishing to Nostr
- Extract edit-profile-dialog and nostr-keys-dialog into separate components
- Fix profile avatar alignment to match original design
- Simplify keys dialog to show only npub QR code (no nsec QR)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 12:42:03 +00:00

56 lines
1.2 KiB
JavaScript

window.app.component('nostr-keys-dialog', {
name: 'nostr-keys-dialog',
template: '#nostr-keys-dialog',
delimiters: ['${', '}'],
props: ['public-key', 'private-key', 'model-value'],
emits: ['update:model-value'],
data: function () {
return {
showNsec: false
}
},
computed: {
show: {
get() {
return this.modelValue
},
set(value) {
this.$emit('update:model-value', value)
}
},
npub: function () {
if (!this.publicKey) return ''
try {
return window.NostrTools.nip19.npubEncode(this.publicKey)
} catch (e) {
return this.publicKey
}
},
nsec: function () {
if (!this.privateKey) return ''
try {
return window.NostrTools.nip19.nsecEncode(this.privateKey)
} catch (e) {
return this.privateKey
}
}
},
methods: {
copyText: function (text, message) {
var notify = this.$q.notify
Quasar.copyToClipboard(text).then(function () {
notify({
message: message || 'Copied to clipboard!',
position: 'bottom'
})
})
}
},
watch: {
modelValue(newVal) {
if (!newVal) {
this.showNsec = false
}
}
}
})