👋
diff --git a/src/shared/notes/replies/replyMediaUploader.tsx b/src/shared/notes/replies/replyMediaUploader.tsx
new file mode 100644
index 00000000..ff956a30
--- /dev/null
+++ b/src/shared/notes/replies/replyMediaUploader.tsx
@@ -0,0 +1,79 @@
+import { message, open } from '@tauri-apps/plugin-dialog';
+import { readBinaryFile } from '@tauri-apps/plugin-fs';
+import { useState } from 'react';
+
+import { MediaIcon } from '@shared/icons';
+
+export function ReplyMediaUploader({ setValue }) {
+ const [loading, setLoading] = useState(false);
+
+ const uploadToNostrBuild = async () => {
+ try {
+ // start loading
+ setLoading(true);
+
+ const selected = await open({
+ multiple: false,
+ filters: [
+ {
+ name: 'Media',
+ extensions: [
+ 'png',
+ 'jpeg',
+ 'jpg',
+ 'gif',
+ 'mp4',
+ 'mp3',
+ 'webm',
+ 'mkv',
+ 'avi',
+ 'mov',
+ ],
+ },
+ ],
+ });
+
+ if (!selected) {
+ setLoading(false);
+ return;
+ }
+
+ const file = await readBinaryFile(selected.path);
+ const blob = new Blob([file]);
+
+ const data = new FormData();
+ data.append('fileToUpload', blob);
+ data.append('submit', 'Upload Image');
+
+ const res = await fetch('https://nostr.build/api/v2/upload/files', {
+ method: 'POST',
+ body: data,
+ });
+
+ if (res.ok) {
+ const json = await res.json();
+ const content = json.data[0];
+
+ setValue((prev) => prev + ' ' + content.url);
+
+ // stop loading
+ setLoading(false);
+ }
+ } catch (e) {
+ // stop loading
+ setLoading(false);
+ await message(`Upload failed, error: ${e}`, { title: 'Lume', type: 'error' });
+ }
+ };
+
+ return (
+
+ );
+}
diff --git a/src/shared/notification/notifyNote.tsx b/src/shared/notification/notifyNote.tsx
index 3f968ca6..9ec26ea5 100644
--- a/src/shared/notification/notifyNote.tsx
+++ b/src/shared/notification/notifyNote.tsx
@@ -1,33 +1,38 @@
import { NDKEvent, NDKKind } from '@nostr-dev-kit/ndk';
+import { useStorage } from '@libs/storage/provider';
+
import {
ArticleNote,
FileNote,
- NoteActions,
NoteSkeleton,
TextNote,
UnknownNote,
} from '@shared/notes';
import { User } from '@shared/user';
+import { WidgetKinds, useWidgets } from '@stores/widgets';
+
import { formatCreatedAt } from '@utils/createdAt';
import { useEvent } from '@utils/hooks/useEvent';
-export function NotifyNote({
- id,
- user,
- content,
- kind,
- time,
-}: {
- id: string;
- user: string;
- content: string;
- kind: NDKKind | number;
- time: number;
-}) {
- const createdAt = formatCreatedAt(time, false);
- const { status, data } = useEvent(id);
+export function NotifyNote({ event }: { event: NDKEvent }) {
+ const createdAt = formatCreatedAt(event.created_at, false);
+ const rootEventId = event.tags.find((el) => el[0] === 'e')?.[1];
+
+ const { db } = useStorage();
+ const { status, data } = useEvent(rootEventId);
+
+ const setWidget = useWidgets((state) => state.setWidget);
+
+ const openThread = (event, thread: string) => {
+ const selection = window.getSelection();
+ if (selection.toString().length === 0) {
+ setWidget(db, { kind: WidgetKinds.local.thread, title: 'Thread', content: thread });
+ } else {
+ event.stopPropagation();
+ }
+ };
const renderKind = (event: NDKEvent) => {
switch (event.kind) {
@@ -47,7 +52,7 @@ export function NotifyNote({
case NDKKind.Text:
return 'replied';
case NDKKind.Reaction:
- return `reacted ${content}`;
+ return `reacted ${event.content}`;
case NDKKind.Repost:
return 'reposted';
case NDKKind.Zap:
@@ -68,28 +73,29 @@ export function NotifyNote({
}
return (
-
-
-
-
-
- {renderText(kind)}
-
-
-
- {createdAt}
-
-
-
-
-
-
-
-
- {renderKind(data)}
-
+
+
+
+
+
+
+
+ {renderText(event.kind)}
+
+
{createdAt}
+ {event.kind === 1 ?
: null}
+
+
openThread(e, data.id)}
+ onKeyDown={(e) => openThread(e, data.id)}
+ role="button"
+ tabIndex={0}
+ className="cursor-default rounded-lg border border-neutral-300 bg-neutral-200 p-3 dark:border-neutral-700 dark:bg-neutral-800"
+ >
+
+
{renderKind(data)}
diff --git a/src/shared/user.tsx b/src/shared/user.tsx
index da963d08..38ed83ea 100644
--- a/src/shared/user.tsx
+++ b/src/shared/user.tsx
@@ -115,13 +115,13 @@ export const User = memo(function User({
loading="lazy"
decoding="async"
style={{ contentVisibility: 'auto' }}
- className="h-8 w-8 rounded-lg"
+ className="h-8 w-8 rounded-md"
/>
@@ -416,10 +416,10 @@ export const User = memo(function User({
-
+
@@ -467,13 +467,13 @@ export const User = memo(function User({
View profile
Message
diff --git a/src/shared/widgets/global/articles.tsx b/src/shared/widgets/global/articles.tsx
index 84987c2a..7d202cd6 100644
--- a/src/shared/widgets/global/articles.tsx
+++ b/src/shared/widgets/global/articles.tsx
@@ -67,9 +67,9 @@ export function GlobalArticlesWidget({ params }: { params: Widget }) {
) : (
-
+
{data.map((item) => renderItem(item))}
-
+
)}
diff --git a/src/shared/widgets/global/files.tsx b/src/shared/widgets/global/files.tsx
index 88ab1815..05011ea2 100644
--- a/src/shared/widgets/global/files.tsx
+++ b/src/shared/widgets/global/files.tsx
@@ -69,9 +69,9 @@ export function GlobalFilesWidget({ params }: { params: Widget }) {
) : (
-
+
{data.map((item) => renderItem(item))}
-
+
)}
diff --git a/src/shared/widgets/global/hashtag.tsx b/src/shared/widgets/global/hashtag.tsx
index 3831f587..13c31ce5 100644
--- a/src/shared/widgets/global/hashtag.tsx
+++ b/src/shared/widgets/global/hashtag.tsx
@@ -99,7 +99,7 @@ export function GlobalHashtagWidget({ params }: { params: Widget }) {