mirror of
https://github.com/luminous-devs/lume.git
synced 2024-09-30 00:41:00 +00:00
minor fixes
This commit is contained in:
parent
c5ba98e37a
commit
de6624ff78
@ -1,7 +1,12 @@
|
|||||||
import { useRouteError } from 'react-router-dom';
|
import { useRouteError } from 'react-router-dom';
|
||||||
|
|
||||||
|
interface IRouteError {
|
||||||
|
statusText: string;
|
||||||
|
message: string;
|
||||||
|
}
|
||||||
|
|
||||||
export function ErrorScreen() {
|
export function ErrorScreen() {
|
||||||
const error: any = useRouteError();
|
const error = useRouteError() as IRouteError;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex h-full w-full items-center justify-center">
|
<div className="flex h-full w-full items-center justify-center">
|
||||||
|
@ -12,7 +12,7 @@ const ITEM_PER_PAGE = 10;
|
|||||||
|
|
||||||
export function FeedBlock({ params }: { params: any }) {
|
export function FeedBlock({ params }: { params: any }) {
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
const { status, data, fetchNextPage, hasNextPage, isFetchingNextPage }: any =
|
const { status, data, fetchNextPage, hasNextPage, isFetchingNextPage } =
|
||||||
useInfiniteQuery({
|
useInfiniteQuery({
|
||||||
queryKey: ['newsfeed', params.content],
|
queryKey: ['newsfeed', params.content],
|
||||||
queryFn: async ({ pageParam = 0 }) => {
|
queryFn: async ({ pageParam = 0 }) => {
|
||||||
@ -60,7 +60,7 @@ export function FeedBlock({ params }: { params: any }) {
|
|||||||
if (!note) return;
|
if (!note) return;
|
||||||
return (
|
return (
|
||||||
<div key={index} data-index={index} ref={rowVirtualizer.measureElement}>
|
<div key={index} data-index={index} ref={rowVirtualizer.measureElement}>
|
||||||
<Note event={note} block={params.id} />
|
<Note event={note} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -14,15 +14,16 @@ import { useNote } from '@stores/note';
|
|||||||
|
|
||||||
const ITEM_PER_PAGE = 10;
|
const ITEM_PER_PAGE = 10;
|
||||||
|
|
||||||
export function FollowingBlock({ block }: { block: number }) {
|
export function FollowingBlock() {
|
||||||
// subscribe for live update
|
// subscribe for live update
|
||||||
useNewsfeed();
|
useNewsfeed();
|
||||||
|
// notify user that new note is arrive
|
||||||
const [hasNewNote, toggleHasNewNote] = useNote((state) => [
|
const [hasNewNote, toggleHasNewNote] = useNote((state) => [
|
||||||
state.hasNewNote,
|
state.hasNewNote,
|
||||||
state.toggleHasNewNote,
|
state.toggleHasNewNote,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const { status, data, fetchNextPage, hasNextPage, isFetchingNextPage, refetch }: any =
|
const { status, data, fetchNextPage, hasNextPage, isFetchingNextPage, refetch } =
|
||||||
useInfiniteQuery({
|
useInfiniteQuery({
|
||||||
queryKey: ['newsfeed-circle'],
|
queryKey: ['newsfeed-circle'],
|
||||||
queryFn: async ({ pageParam = 0 }) => {
|
queryFn: async ({ pageParam = 0 }) => {
|
||||||
@ -68,8 +69,12 @@ export function FollowingBlock({ block }: { block: number }) {
|
|||||||
const note = notes[index];
|
const note = notes[index];
|
||||||
if (!note) return;
|
if (!note) return;
|
||||||
return (
|
return (
|
||||||
<div key={index} data-index={index} ref={rowVirtualizer.measureElement}>
|
<div
|
||||||
<Note event={note} block={block} />
|
key={note.event_id || note.id}
|
||||||
|
data-index={index}
|
||||||
|
ref={rowVirtualizer.measureElement}
|
||||||
|
>
|
||||||
|
<Note event={note} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -30,7 +30,7 @@ export function SpaceScreen() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="scrollbar-hide flex h-full w-full flex-nowrap overflow-x-auto overflow-y-hidden">
|
<div className="scrollbar-hide flex h-full w-full flex-nowrap overflow-x-auto overflow-y-hidden">
|
||||||
<FollowingBlock block={1} />
|
<FollowingBlock />
|
||||||
{status === 'loading' ? (
|
{status === 'loading' ? (
|
||||||
<div className="flex w-[350px] shrink-0 flex-col border-r border-zinc-900">
|
<div className="flex w-[350px] shrink-0 flex-col border-r border-zinc-900">
|
||||||
<div
|
<div
|
||||||
@ -43,7 +43,7 @@ export function SpaceScreen() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
blocks.map((block: any) => {
|
blocks.map((block: { kind: number; id: string }) => {
|
||||||
switch (block.kind) {
|
switch (block.kind) {
|
||||||
case 0:
|
case 0:
|
||||||
return <ImageBlock key={block.id} params={block} />;
|
return <ImageBlock key={block.id} params={block} />;
|
||||||
|
Loading…
Reference in New Issue
Block a user