From 417df1796d00e57f663c19cb8d0d5ef502b984ce Mon Sep 17 00:00:00 2001 From: Ren Amamiya <123083837+reyamir@users.noreply.github.com> Date: Sat, 6 May 2023 16:09:16 +0700 Subject: [PATCH] add skeleton state --- package.json | 1 + pnpm-lock.yaml | 12 ++++++ src/app/daily/pages/index.page.tsx | 12 ++++-- src/app/note/components/parent.tsx | 43 +++++-------------- src/app/note/components/placeholder.tsx | 25 ----------- src/app/note/components/quote.tsx | 24 ++++++----- src/app/note/components/rootNote.tsx | 36 ++++------------ src/app/note/components/user/default.tsx | 54 +++++++++--------------- src/app/note/components/user/mention.tsx | 12 +----- src/app/note/components/user/reply.tsx | 47 ++++++++------------- src/app/note/components/user/repost.tsx | 51 ++++++++-------------- src/renderer/_default.page.client.tsx | 1 + 12 files changed, 111 insertions(+), 207 deletions(-) delete mode 100644 src/app/note/components/placeholder.tsx diff --git a/package.json b/package.json index 3a440297..e7d5c79f 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "react-hook-form": "^7.43.9", + "react-loading-skeleton": "^3.3.1", "react-markdown": "^8.0.7", "react-virtuoso": "^4.3.5", "remark-gfm": "^3.0.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index cb88f2a8..1fc853fc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -43,6 +43,9 @@ dependencies: react-hook-form: specifier: ^7.43.9 version: 7.43.9(react@18.2.0) + react-loading-skeleton: + specifier: ^3.3.1 + version: 3.3.1(react@18.2.0) react-markdown: specifier: ^8.0.7 version: 8.0.7(@types/react@18.2.5)(react@18.2.0) @@ -3944,6 +3947,15 @@ packages: { integrity: sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w== } dev: false + /react-loading-skeleton@3.3.1(react@18.2.0): + resolution: + { integrity: sha512-NilqqwMh2v9omN7LteiDloEVpFyMIa0VGqF+ukqp0ncVlYu1sKYbYGX9JEl+GtOT9TKsh04zCHAbavnQ2USldA== } + peerDependencies: + react: '>=16.8.0' + dependencies: + react: 18.2.0 + dev: false + /react-markdown@8.0.7(@types/react@18.2.5)(react@18.2.0): resolution: { integrity: sha512-bvWbzG4MtOU62XqBx3Xx+zB2raaFFsq4mYiAzfjXJMEz2sixgeAfraA3tvzULF02ZdOMUOKTBFFaZJDDrq+BJQ== } diff --git a/src/app/daily/pages/index.page.tsx b/src/app/daily/pages/index.page.tsx index 1f5f9248..18a38919 100644 --- a/src/app/daily/pages/index.page.tsx +++ b/src/app/daily/pages/index.page.tsx @@ -1,11 +1,11 @@ import NoteBase from '@lume/app/note/components/base'; -import { Placeholder } from '@lume/app/note/components/placeholder'; import { NoteQuoteRepost } from '@lume/app/note/components/quoteRepost'; import { getNotes } from '@lume/utils/storage'; import { useInfiniteQuery } from '@tanstack/react-query'; import { useVirtualizer } from '@tanstack/react-virtual'; import { useEffect, useRef } from 'react'; +import Skeleton from 'react-loading-skeleton'; const ITEM_PER_PAGE = 10; const TIME = Math.floor(Date.now() / 1000); @@ -49,7 +49,7 @@ export function Page() {