Files
boris/node_modules/applesauce-factory/dist/operations/poll-response.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

21 lines
875 B
JavaScript

import { modifyPublicTags } from "./tags.js";
import { addEventTag } from "./tag/common.js";
/** Sets the poll event that this response is for using an 'e' tag */
export function setPollEvent(poll) {
return modifyPublicTags(addEventTag(poll, true));
}
/** Sets multiple response options at once, replacing any existing response tags */
export function setChoices(optionIds) {
return modifyPublicTags((tags) => {
// Remove existing response tags
const filteredTags = tags.filter((tag) => tag[0] !== "response");
// Add new response tags
const responseTags = optionIds.map((id) => ["response", id]);
return [...filteredTags, ...responseTags];
});
}
/** Sets a single response option, replacing any existing response tags (for single choice polls) */
export function setChoice(optionId) {
return setChoices([optionId]);
}