mirror of
https://github.com/dergigi/boris.git
synced 2026-01-07 00:44:52 +01:00
- 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.
21 lines
875 B
JavaScript
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]);
|
|
}
|