mirror of
https://github.com/dergigi/boris.git
synced 2026-01-06 00:14:48 +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.
26 lines
1.3 KiB
JavaScript
26 lines
1.3 KiB
JavaScript
import { DATE_BASED_CALENDAR_EVENT_KIND, TIME_BASED_CALENDAR_EVENT_KIND } from "applesauce-core/helpers/calendar-event";
|
|
import { Calendar } from "applesauce-factory/operations";
|
|
import { kinds } from "nostr-tools";
|
|
/** Adds a calendar event to a calendar */
|
|
export function AddEventToCalendar(calendar, event) {
|
|
if (calendar.kind !== kinds.Calendar)
|
|
throw new Error("Calendar is not a calendar event");
|
|
if (event.kind !== DATE_BASED_CALENDAR_EVENT_KIND && event.kind !== TIME_BASED_CALENDAR_EVENT_KIND)
|
|
throw new Error("Event is not a calendar event");
|
|
return async function* ({ factory }) {
|
|
const draft = await factory.modify(calendar, Calendar.addEvent(event));
|
|
return await factory.sign(draft);
|
|
};
|
|
}
|
|
/** Removes a calendar event from a calendar */
|
|
export function RemoveEventFromCalendar(calendar, event) {
|
|
if (calendar.kind !== kinds.Calendar)
|
|
throw new Error("Calendar is not a calendar event");
|
|
if (event.kind !== DATE_BASED_CALENDAR_EVENT_KIND && event.kind !== TIME_BASED_CALENDAR_EVENT_KIND)
|
|
throw new Error("Event is not a calendar event");
|
|
return async function* ({ factory }) {
|
|
const draft = await factory.modify(calendar, Calendar.removeEvent(event));
|
|
return await factory.sign(draft);
|
|
};
|
|
}
|