mirror of
https://github.com/lumina-rocks/lumina.git
synced 2026-04-09 23:16:47 +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>
93 lines
2.5 KiB
TypeScript
93 lines
2.5 KiB
TypeScript
import { useRef } from "react";
|
|
import { useNostrEvents } from "nostr-react";
|
|
import NoteCard from '@/components/NoteCard';
|
|
import CommentsCompontent from "@/components/CommentsComponent";
|
|
import KIND20Card from "./KIND20Card";
|
|
import { getImageUrl } from "@/utils/utils";
|
|
|
|
// Function to extract video URL from imeta tags
|
|
const getVideoUrl = (tags: string[][]): string | null => {
|
|
for (const tag of tags) {
|
|
if (tag[0] === 'imeta') {
|
|
for (let i = 1; i < tag.length; i++) {
|
|
if (tag[i].startsWith('url ')) {
|
|
return tag[i].substring(4);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return null;
|
|
};
|
|
|
|
interface NotePageComponentProps {
|
|
id: string;
|
|
}
|
|
|
|
const NotePageComponent: React.FC<NotePageComponentProps> = ({ id }) => {
|
|
const now = useRef(new Date()); // Make sure current time isn't re-rendered
|
|
|
|
const { events } = useNostrEvents({
|
|
filter: {
|
|
ids: [id],
|
|
limit: 1,
|
|
},
|
|
});
|
|
|
|
// filter out all events that also have another e tag with another id
|
|
const filteredEvents = events.filter((event) => {
|
|
return event.tags.filter((tag) => {
|
|
return tag[0] === '#e' && tag[1] !== id;
|
|
}).length === 0;
|
|
});
|
|
|
|
return (
|
|
<>
|
|
{filteredEvents.map((event) => (
|
|
<div key={event.id} className="py-6">
|
|
{event.kind === 1 && (
|
|
<NoteCard
|
|
key={event.id}
|
|
pubkey={event.pubkey}
|
|
text={event.content}
|
|
eventId={event.id}
|
|
tags={event.tags}
|
|
event={event}
|
|
showViewNoteCardButton={false}
|
|
/>
|
|
)}
|
|
{event.kind === 20 && (
|
|
<KIND20Card
|
|
key={event.id}
|
|
pubkey={event.pubkey}
|
|
text={event.content}
|
|
image={getImageUrl(event.tags)}
|
|
eventId={event.id}
|
|
tags={event.tags}
|
|
event={event}
|
|
showViewNoteCardButton={false}
|
|
/>
|
|
)}
|
|
{(event.kind === 21 || event.kind === 22) && (
|
|
<NoteCard
|
|
key={event.id}
|
|
pubkey={event.pubkey}
|
|
text={(() => {
|
|
const videoUrl = getVideoUrl(event.tags);
|
|
return videoUrl ? `${event.content}\n${videoUrl}` : event.content;
|
|
})()}
|
|
eventId={event.id}
|
|
tags={event.tags}
|
|
event={event}
|
|
showViewNoteCardButton={false}
|
|
/>
|
|
)}
|
|
<div className="py-6 px-6">
|
|
<CommentsCompontent pubkey={event.pubkey} event={event} />
|
|
</div>
|
|
</div>
|
|
))}
|
|
</>
|
|
);
|
|
}
|
|
|
|
export default NotePageComponent; |