From cf26aa504e7352cbc181eea585b6596f0afc5097 Mon Sep 17 00:00:00 2001
From: Ren Amamiya <123083837+reyamir@users.noreply.github.com>
Date: Tue, 25 Apr 2023 12:07:12 +0700
Subject: [PATCH] clean up and fix build error
---
package.json | 1 -
pnpm-lock.yaml | 12 ------------
src/components/channels/channelListItem.tsx | 7 ++++---
src/components/channels/channelProfile.tsx | 19 +++++++++++++------
src/components/channels/messages/index.tsx | 4 ++--
src/components/chats/messageList.tsx | 4 ++--
src/components/navigation.tsx | 3 +--
7 files changed, 22 insertions(+), 28 deletions(-)
diff --git a/package.json b/package.json
index 77581cf4..d1a09fdc 100644
--- a/package.json
+++ b/package.json
@@ -28,7 +28,6 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.43.9",
- "react-loading-skeleton": "^3.2.1",
"react-string-replace": "^1.1.0",
"react-virtuoso": "^4.3.1",
"react-youtube": "^10.1.0",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 960ecfd8..6afafb6c 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -43,9 +43,6 @@ dependencies:
react-hook-form:
specifier: ^7.43.9
version: 7.43.9(react@18.2.0)
- react-loading-skeleton:
- specifier: ^3.2.1
- version: 3.2.1(react@18.2.0)
react-string-replace:
specifier: ^1.1.0
version: 1.1.0
@@ -3543,15 +3540,6 @@ packages:
resolution:
{ integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== }
- /react-loading-skeleton@3.2.1(react@18.2.0):
- resolution:
- { integrity: sha512-e1KwEOuBa1REXWoseELIJXlsqWTCHL5IQnqhVhI33WmnuTK7LK1DXl4mmcOLsWVcwqXeOATU9VFJEjz2ytZSng== }
- peerDependencies:
- react: '>=16.8.0'
- dependencies:
- react: 18.2.0
- dev: false
-
/react-string-replace@1.1.0:
resolution:
{ integrity: sha512-N6RalSDFGbOHs0IJi1H611WbZsvk3ZT47Jl2JEXFbiS3kTwsdCYij70Keo/tWtLy7sfhDsYm7CwNM/WmjXIaMw== }
diff --git a/src/components/channels/channelListItem.tsx b/src/components/channels/channelListItem.tsx
index 4d5b9808..24aa3631 100644
--- a/src/components/channels/channelListItem.tsx
+++ b/src/components/channels/channelListItem.tsx
@@ -1,7 +1,8 @@
+import { DEFAULT_AVATAR } from '@stores/constants';
+
import { useChannelMetadata } from '@utils/hooks/useChannelMetadata';
import { usePageContext } from '@utils/hooks/usePageContext';
-import Skeleton from 'react-loading-skeleton';
import { twMerge } from 'tailwind-merge';
export const ChannelListItem = ({ data }: { data: any }) => {
@@ -20,10 +21,10 @@ export const ChannelListItem = ({ data }: { data: any }) => {
)}
>
-
} alt={data.event_id} className="h-5 w-5 rounded object-contain" />
+
-
{channel?.name || }
+ {channel?.name}
);
diff --git a/src/components/channels/channelProfile.tsx b/src/components/channels/channelProfile.tsx
index 3eec8a4c..6a8b88d9 100644
--- a/src/components/channels/channelProfile.tsx
+++ b/src/components/channels/channelProfile.tsx
@@ -1,32 +1,39 @@
+import { DEFAULT_AVATAR } from '@stores/constants';
+
import { useChannelMetadata } from '@utils/hooks/useChannelMetadata';
import { Copy } from 'iconoir-react';
import { nip19 } from 'nostr-tools';
-import Skeleton from 'react-loading-skeleton';
export const ChannelProfile = ({ id, pubkey }: { id: string; pubkey: string }) => {
const metadata = useChannelMetadata(id, pubkey);
- const noteID = nip19.noteEncode(id);
+ const noteID = id ? nip19.noteEncode(id) : null;
const copyNoteID = async () => {
const { writeText } = await import('@tauri-apps/api/clipboard');
- await writeText(noteID);
+ if (noteID) {
+ await writeText(noteID);
+ }
};
return (
-
} alt={id} className="h-8 w-8 rounded bg-zinc-900 object-contain" />
+
-
{metadata?.name || }
+ {metadata?.name}
- {metadata?.about || noteID.substring(0, 24) + '...' || }
+ {metadata?.about || (noteID && noteID.substring(0, 24) + '...')}
diff --git a/src/components/channels/messages/index.tsx b/src/components/channels/messages/index.tsx
index a7e84a97..2a060e69 100644
--- a/src/components/channels/messages/index.tsx
+++ b/src/components/channels/messages/index.tsx
@@ -1,10 +1,10 @@
import { ChannelMessageItem } from '@components/channels/messages/item';
+import { Placeholder } from '@components/note/placeholder';
import { sortedChannelMessagesAtom } from '@stores/channel';
import { useAtomValue } from 'jotai';
import { useCallback, useRef } from 'react';
-import Skeleton from 'react-loading-skeleton';
import { Virtuoso } from 'react-virtuoso';
export default function ChannelMessages() {
@@ -45,5 +45,5 @@ export default function ChannelMessages() {
}
const COMPONENTS = {
- EmptyPlaceholder: () => ,
+ EmptyPlaceholder: () => ,
};
diff --git a/src/components/chats/messageList.tsx b/src/components/chats/messageList.tsx
index dae03147..8cab0338 100644
--- a/src/components/chats/messageList.tsx
+++ b/src/components/chats/messageList.tsx
@@ -1,11 +1,11 @@
import { AccountContext } from '@components/accountProvider';
import { MessageListItem } from '@components/chats/messageListItem';
+import { Placeholder } from '@components/note/placeholder';
import { sortedChatMessagesAtom } from '@stores/chat';
import { useAtomValue } from 'jotai';
import { useCallback, useContext, useRef } from 'react';
-import Skeleton from 'react-loading-skeleton';
import { Virtuoso } from 'react-virtuoso';
export default function MessageList() {
@@ -50,5 +50,5 @@ export default function MessageList() {
}
const COMPONENTS = {
- EmptyPlaceholder: () => ,
+ EmptyPlaceholder: () => ,
};
diff --git a/src/components/navigation.tsx b/src/components/navigation.tsx
index 43c2fb66..5235c3ed 100644
--- a/src/components/navigation.tsx
+++ b/src/components/navigation.tsx
@@ -5,7 +5,6 @@ import ChatList from '@components/chats/chatList';
import { Disclosure } from '@headlessui/react';
import { Bonfire, NavArrowUp, PeopleTag } from 'iconoir-react';
import { Suspense } from 'react';
-import Skeleton from 'react-loading-skeleton';
export default function Navigation() {
return (
@@ -60,7 +59,7 @@ export default function Navigation() {
Channels
- }>
+ Loading...}>