mirror of
https://github.com/lumina-rocks/lumina.git
synced 2026-04-10 23:47:05 +02:00
* add URL option to image upload * Full NIP-68 and NIP-71 implementation * changed deprecated note ids to nevent ids, with backward-compatability * interim state reels implementation * Fixed uploading from URL and added a Cancel button to the upload modal. Couldn't get rid of the errors. * Added ability to upload kinds 20, 21, 22, along with source tags (e, a, or u). Includes validation check. * added thumbnail support * included kind 21 and kind 22 in the feeds and searches * Implement inboxes/outboxes * implemented thumbnails in the profile feed * enhanced reels feed with #reels * interim implementation of pins * added pins * fixed the pins * tidied up the reels * fixed the uploader * Fixed build * update reels feed with the one from Lumina main * fixed the reels interactions * Added audio controls * Interim reelfeed state * feed working again * full fead --------- Co-authored-by: Silberengel <silberengel7@proton.com>
100 lines
3.3 KiB
TypeScript
100 lines
3.3 KiB
TypeScript
import { Button } from "@/components/ui/button";
|
|
import {
|
|
Drawer,
|
|
DrawerClose,
|
|
DrawerContent,
|
|
DrawerDescription,
|
|
DrawerFooter,
|
|
DrawerHeader,
|
|
DrawerTitle,
|
|
DrawerTrigger,
|
|
} from "@/components/ui/drawer"
|
|
import { Textarea } from "./ui/textarea";
|
|
import { Share1Icon } from "@radix-ui/react-icons";
|
|
import { Input } from "./ui/input";
|
|
import React, { useRef } from 'react';
|
|
import { useToast } from "./ui/use-toast";
|
|
import { Event as NostrEvent, nip19 } from "nostr-tools";
|
|
|
|
interface ViewCopyButtonProps {
|
|
event: NostrEvent;
|
|
}
|
|
|
|
export default function ViewCopyButton({ event }: ViewCopyButtonProps) {
|
|
const jsonEvent = JSON.stringify(event, null, 2);
|
|
const inputRef = useRef(null);
|
|
const inputRefID = useRef(null);
|
|
const { toast } = useToast()
|
|
|
|
const handleCopyLink = async () => {
|
|
try {
|
|
await navigator.clipboard.writeText(window.location.href);
|
|
toast({
|
|
description: 'URL copied to clipboard',
|
|
title: 'Copied'
|
|
});
|
|
} catch (err) {
|
|
toast({
|
|
description: 'Error copying URL to clipboard',
|
|
title: 'Error',
|
|
variant: 'destructive'
|
|
});
|
|
}
|
|
};
|
|
|
|
const handleCopyNoteId = async () => {
|
|
try {
|
|
// Create nevent with relay hints
|
|
const nevent = nip19.neventEncode({
|
|
id: event.id,
|
|
relays: []
|
|
});
|
|
await navigator.clipboard.writeText(nevent);
|
|
toast({
|
|
description: 'Event ID copied to clipboard',
|
|
title: 'Copied'
|
|
});
|
|
} catch (err) {
|
|
toast({
|
|
description: 'Error copying Event ID to clipboard',
|
|
title: 'Error',
|
|
variant: 'destructive'
|
|
});
|
|
}
|
|
};
|
|
|
|
return (
|
|
<Drawer>
|
|
<DrawerTrigger asChild>
|
|
<Button variant="outline"><Share1Icon /></Button>
|
|
</DrawerTrigger>
|
|
<DrawerContent>
|
|
<DrawerHeader>
|
|
<DrawerTitle>Share this Note</DrawerTitle>
|
|
<DrawerDescription>Share this Note with others.</DrawerDescription>
|
|
</DrawerHeader>
|
|
<div className="px-2">
|
|
{/* <h1>URL</h1> */}
|
|
<div className="flex items-center mb-4">
|
|
<Input ref={inputRef} value={window.location.href} disabled className="mr-2" />
|
|
<Button variant="outline" onClick={handleCopyLink}>Copy Link</Button>
|
|
</div>
|
|
<div className="flex items-center mb-4">
|
|
<Input ref={inputRefID} value={nip19.neventEncode({
|
|
id: event.id,
|
|
relays: []
|
|
})} disabled className="mr-2" />
|
|
<Button variant="outline" onClick={handleCopyNoteId}>Copy Event ID</Button>
|
|
</div>
|
|
</div>
|
|
<DrawerFooter>
|
|
<DrawerClose asChild>
|
|
<div>
|
|
<Button variant="outline">Close</Button>
|
|
</div>
|
|
</DrawerClose>
|
|
</DrawerFooter>
|
|
</DrawerContent>
|
|
</Drawer>
|
|
);
|
|
} |