Files
boris/node_modules/applesauce-factory/dist/blueprints/poll.js
Gigi 5d53a827e0 feat: initialize markr nostr bookmark client
- Add project structure with TypeScript, React, and Vite
- Implement nostr authentication using browser extension (NIP-07)
- Add NIP-51 compliant bookmark fetching and display
- Create minimal UI with login and bookmark components
- Integrate applesauce-core and applesauce-react libraries
- Add responsive styling with dark/light mode support
- Include comprehensive README with setup instructions

This is a minimal MVP for a nostr bookmark client that allows users to
view their bookmarks according to NIP-51 specification.
2025-10-02 07:17:07 +02:00

28 lines
1.6 KiB
JavaScript

import { POLL_KIND, POLL_RESPONSE_KIND } from "applesauce-core/helpers";
import { blueprint } from "../event-factory.js";
import { setMetaTags } from "../operations/common.js";
import { setContent } from "../operations/content.js";
import { setZapSplit } from "../operations/zap-split.js";
import { PollResponse, Poll } from "../operations/index.js";
/**
* NIP-88 Poll event (kind 1068) blueprint
* Creates a poll event with question and options
*/
export function PollBlueprint(question, options, opts) {
return blueprint(POLL_KIND, Poll.setQuestion(question), Poll.setOptions(options), opts?.pollType ? Poll.setType(opts.pollType) : undefined, opts?.endsAt ? Poll.setEndsAt(opts.endsAt) : undefined, opts?.relays ? Poll.setRelays(opts.relays) : undefined, setZapSplit(opts), setMetaTags({ ...opts, alt: opts?.alt ?? `Poll: ${question}` }));
}
/**
* NIP-88 Poll Response event (kind 1018) blueprint
* Creates a response to a poll event
*/
export function PollResponseBlueprint(poll, optionIds, opts) {
return blueprint(POLL_RESPONSE_KIND, PollResponse.setPollEvent(poll), PollResponse.setChoices(optionIds), opts?.comment ? setContent(opts.comment) : undefined, setMetaTags({ ...opts, alt: opts?.alt ?? "Poll response" }));
}
/**
* Convenience blueprint for single-choice poll responses
* Creates a response to a poll event with a single option
*/
export function SingleChoicePollResponseBlueprint(poll, optionId, opts) {
return blueprint(POLL_RESPONSE_KIND, PollResponse.setPollEvent(poll), PollResponse.setChoice(optionId), opts?.comment ? setContent(opts.comment) : undefined, setMetaTags({ ...opts, alt: opts?.alt ?? "Poll response" }));
}