added padding bottom
This commit is contained in:
parent
69d96cdefc
commit
ee9edc466e
@ -51,7 +51,7 @@ export default function LandingPage() {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="overflow-hidden">
|
<div className="overflow-hidden pb-20">
|
||||||
<div className="mx-auto max-w-7xl px-6 pb-32 pt-16 sm:pt-40 lg:px-8 lg:pt-16">
|
<div className="mx-auto max-w-7xl px-6 pb-32 pt-16 sm:pt-40 lg:px-8 lg:pt-16">
|
||||||
<div className="mx-auto max-w-2xl gap-x-14 lg:mx-0 lg:flex lg:max-w-none lg:items-center">
|
<div className="mx-auto max-w-2xl gap-x-14 lg:mx-0 lg:flex lg:max-w-none lg:items-center">
|
||||||
<div className="w-full max-w-xl lg:shrink-0 xl:max-w-2xl">
|
<div className="w-full max-w-xl lg:shrink-0 xl:max-w-2xl">
|
||||||
|
@ -9,7 +9,7 @@ import { useNDK } from "@/app/_providers/ndk";
|
|||||||
import { RiArrowRightLine, RiLockLine } from "react-icons/ri";
|
import { RiArrowRightLine, RiLockLine } from "react-icons/ri";
|
||||||
import { HiOutlineLockOpen } from "react-icons/hi";
|
import { HiOutlineLockOpen } from "react-icons/hi";
|
||||||
import { decryptMessage } from "@/lib/nostr";
|
import { decryptMessage } from "@/lib/nostr";
|
||||||
import { NDKUser } from "@nostr-dev-kit/ndk";
|
import { NDKFilter, NDKUser } from "@nostr-dev-kit/ndk";
|
||||||
import { log } from "@/lib/utils";
|
import { log } from "@/lib/utils";
|
||||||
import { EventSchema } from "@/types";
|
import { EventSchema } from "@/types";
|
||||||
import KindCard from "@/components/KindCard";
|
import KindCard from "@/components/KindCard";
|
||||||
@ -24,9 +24,10 @@ import {
|
|||||||
import useCurrentUser from "@/lib/hooks/useCurrentUser";
|
import useCurrentUser from "@/lib/hooks/useCurrentUser";
|
||||||
import { unlockEvent } from "@/lib/actions/create";
|
import { unlockEvent } from "@/lib/actions/create";
|
||||||
import { type KindCardProps } from "./";
|
import { type KindCardProps } from "./";
|
||||||
|
import { getTagValues } from "@/lib/nostr/utils";
|
||||||
|
|
||||||
export default function Kind3745(props: KindCardProps) {
|
export default function Kind3745(props: KindCardProps) {
|
||||||
const { pubkey, content, id } = props;
|
const { pubkey, content, id, tags } = props;
|
||||||
const { currentUser } = useCurrentUser();
|
const { currentUser } = useCurrentUser();
|
||||||
const [error, setError] = useState("");
|
const [error, setError] = useState("");
|
||||||
const [passphrase, setPassphrase] = useState("");
|
const [passphrase, setPassphrase] = useState("");
|
||||||
@ -44,11 +45,16 @@ export default function Kind3745(props: KindCardProps) {
|
|||||||
log("func", `handleFetchEvent()`);
|
log("func", `handleFetchEvent()`);
|
||||||
setFetchingEvent(true);
|
setFetchingEvent(true);
|
||||||
try {
|
try {
|
||||||
const directMessageEvent = await ndk.fetchEvent({
|
const delegate = getTagValues("delegate", tags);
|
||||||
|
const filter: NDKFilter = {
|
||||||
kinds: [4],
|
kinds: [4],
|
||||||
["#e"]: [id],
|
["#e"]: [id],
|
||||||
["#p"]: [currentUser.pubkey],
|
["#p"]: [currentUser.pubkey],
|
||||||
});
|
};
|
||||||
|
if (delegate) {
|
||||||
|
filter.authors = [delegate];
|
||||||
|
}
|
||||||
|
const directMessageEvent = await ndk.fetchEvent(filter);
|
||||||
if (directMessageEvent) {
|
if (directMessageEvent) {
|
||||||
log("info", "direct msg decryption");
|
log("info", "direct msg decryption");
|
||||||
if (!signer) return;
|
if (!signer) return;
|
||||||
|
71
components/ui/calendar.tsx
Normal file
71
components/ui/calendar.tsx
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
"use client"
|
||||||
|
|
||||||
|
import * as React from "react"
|
||||||
|
import { ChevronLeftIcon, ChevronRightIcon } from "@radix-ui/react-icons"
|
||||||
|
import { DayPicker } from "react-day-picker"
|
||||||
|
|
||||||
|
import { cn } from "@/lib/utils"
|
||||||
|
import { buttonVariants } from "@/components/ui/button"
|
||||||
|
|
||||||
|
export type CalendarProps = React.ComponentProps<typeof DayPicker>
|
||||||
|
|
||||||
|
function Calendar({
|
||||||
|
className,
|
||||||
|
classNames,
|
||||||
|
showOutsideDays = true,
|
||||||
|
...props
|
||||||
|
}: CalendarProps) {
|
||||||
|
return (
|
||||||
|
<DayPicker
|
||||||
|
showOutsideDays={showOutsideDays}
|
||||||
|
className={cn("p-3", className)}
|
||||||
|
classNames={{
|
||||||
|
months: "flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",
|
||||||
|
month: "space-y-4",
|
||||||
|
caption: "flex justify-center pt-1 relative items-center",
|
||||||
|
caption_label: "text-sm font-medium",
|
||||||
|
nav: "space-x-1 flex items-center",
|
||||||
|
nav_button: cn(
|
||||||
|
buttonVariants({ variant: "outline" }),
|
||||||
|
"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"
|
||||||
|
),
|
||||||
|
nav_button_previous: "absolute left-1",
|
||||||
|
nav_button_next: "absolute right-1",
|
||||||
|
table: "w-full border-collapse space-y-1",
|
||||||
|
head_row: "flex",
|
||||||
|
head_cell:
|
||||||
|
"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",
|
||||||
|
row: "flex w-full mt-2",
|
||||||
|
cell: cn(
|
||||||
|
"relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent",
|
||||||
|
props.mode === "range"
|
||||||
|
? "[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md"
|
||||||
|
: "[&:has([aria-selected])]:rounded-md"
|
||||||
|
),
|
||||||
|
day: cn(
|
||||||
|
buttonVariants({ variant: "ghost" }),
|
||||||
|
"h-8 w-8 p-0 font-normal aria-selected:opacity-100"
|
||||||
|
),
|
||||||
|
day_range_start: "day-range-start",
|
||||||
|
day_range_end: "day-range-end",
|
||||||
|
day_selected:
|
||||||
|
"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",
|
||||||
|
day_today: "bg-accent text-accent-foreground",
|
||||||
|
day_outside: "text-muted-foreground opacity-50",
|
||||||
|
day_disabled: "text-muted-foreground opacity-50",
|
||||||
|
day_range_middle:
|
||||||
|
"aria-selected:bg-accent aria-selected:text-accent-foreground",
|
||||||
|
day_hidden: "invisible",
|
||||||
|
...classNames,
|
||||||
|
}}
|
||||||
|
components={{
|
||||||
|
IconLeft: ({ ...props }) => <ChevronLeftIcon className="h-4 w-4" />,
|
||||||
|
IconRight: ({ ...props }) => <ChevronRightIcon className="h-4 w-4" />,
|
||||||
|
}}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Calendar.displayName = "Calendar"
|
||||||
|
|
||||||
|
export { Calendar }
|
@ -309,3 +309,91 @@ export async function follow(
|
|||||||
const newContacts = await createEvent(ndk, newEvent);
|
const newContacts = await createEvent(ndk, newEvent);
|
||||||
return newContacts;
|
return newContacts;
|
||||||
}
|
}
|
||||||
|
export async function createCalendarEvent(
|
||||||
|
ndk: NDK,
|
||||||
|
event: {
|
||||||
|
content: string;
|
||||||
|
kind: number;
|
||||||
|
tags: string[][];
|
||||||
|
},
|
||||||
|
isPrivate?: boolean,
|
||||||
|
list?: NDKList,
|
||||||
|
delegateSigner?: NDKPrivateKeySigner,
|
||||||
|
) {
|
||||||
|
log("func", "createEventHandler");
|
||||||
|
const pubkey = await window.nostr?.getPublicKey();
|
||||||
|
if (!pubkey || !window.nostr) {
|
||||||
|
throw new Error("No public key provided!");
|
||||||
|
}
|
||||||
|
const eventToPublish = new NDKEvent(ndk, {
|
||||||
|
...event,
|
||||||
|
tags: [...event.tags, ["client", "flockstr"]],
|
||||||
|
pubkey,
|
||||||
|
created_at: unixTimeNowInSeconds(),
|
||||||
|
} as NostrEvent);
|
||||||
|
|
||||||
|
await eventToPublish.sign();
|
||||||
|
|
||||||
|
let publishedEvent: NDKEvent | null = null;
|
||||||
|
// Check if is private event
|
||||||
|
if (isPrivate) {
|
||||||
|
log("info", "isPrivate");
|
||||||
|
const rawEventString = JSON.stringify(eventToPublish.rawEvent());
|
||||||
|
const passphrase = generateRandomString();
|
||||||
|
const encryptedRawEventString = await encryptMessage(
|
||||||
|
rawEventString,
|
||||||
|
passphrase,
|
||||||
|
);
|
||||||
|
const newEvent = new NDKEvent(ndk, {
|
||||||
|
content: encryptedRawEventString,
|
||||||
|
kind: 3745,
|
||||||
|
tags: [
|
||||||
|
["kind", event.kind.toString()],
|
||||||
|
["client", "flockstr"],
|
||||||
|
],
|
||||||
|
pubkey,
|
||||||
|
} as NostrEvent);
|
||||||
|
await newEvent.sign();
|
||||||
|
await newEvent.publish();
|
||||||
|
|
||||||
|
const messenger = delegateSigner ?? ndk.signer!;
|
||||||
|
const user = await messenger.user();
|
||||||
|
log("info", "Signer", user.toString());
|
||||||
|
|
||||||
|
if (list) {
|
||||||
|
// Send DMs to subscribers
|
||||||
|
const subscribers = getTagsValues("p", list.tags);
|
||||||
|
for (const subscriber of subscribers) {
|
||||||
|
const messageEvent = new NDKEvent(ndk, {
|
||||||
|
content: passphrase,
|
||||||
|
kind: 4,
|
||||||
|
tags: [
|
||||||
|
["p", subscriber],
|
||||||
|
["e", newEvent.id],
|
||||||
|
["client", "flockstr"],
|
||||||
|
],
|
||||||
|
pubkey: user.pubkey,
|
||||||
|
} as NostrEvent);
|
||||||
|
await messageEvent.encrypt(
|
||||||
|
new NDKUser({ hexpubkey: subscriber }),
|
||||||
|
messenger,
|
||||||
|
);
|
||||||
|
await messageEvent.sign(messenger);
|
||||||
|
await messageEvent.publish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
publishedEvent = newEvent;
|
||||||
|
} else {
|
||||||
|
await eventToPublish.publish();
|
||||||
|
publishedEvent = eventToPublish;
|
||||||
|
}
|
||||||
|
if (list) {
|
||||||
|
const tag = publishedEvent.tagReference();
|
||||||
|
if (!tag) return;
|
||||||
|
// Add event to list
|
||||||
|
await list.addItem(tag, undefined, false);
|
||||||
|
await list.sign();
|
||||||
|
await list.publish();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
"cmdk": "^0.2.0",
|
"cmdk": "^0.2.0",
|
||||||
"crypto": "^1.0.1",
|
"crypto": "^1.0.1",
|
||||||
"crypto-js": "^4.1.1",
|
"crypto-js": "^4.1.1",
|
||||||
|
"date-fns": "^2.30.0",
|
||||||
"dayjs": "^1.11.10",
|
"dayjs": "^1.11.10",
|
||||||
"dexie": "^3.2.4",
|
"dexie": "^3.2.4",
|
||||||
"dexie-react-hooks": "^1.1.6",
|
"dexie-react-hooks": "^1.1.6",
|
||||||
@ -49,6 +50,7 @@
|
|||||||
"nostr-tools": "^1.16.0",
|
"nostr-tools": "^1.16.0",
|
||||||
"ramda": "^0.29.1",
|
"ramda": "^0.29.1",
|
||||||
"react": "^18",
|
"react": "^18",
|
||||||
|
"react-day-picker": "^8.9.1",
|
||||||
"react-dom": "^18",
|
"react-dom": "^18",
|
||||||
"react-hook-form": "^7.47.0",
|
"react-hook-form": "^7.47.0",
|
||||||
"react-icons": "^4.11.0",
|
"react-icons": "^4.11.0",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user