feat: add for you column
This commit is contained in:
@@ -57,16 +57,12 @@ export function HomeRoute({ colKey }: { colKey: string }) {
|
||||
};
|
||||
}
|
||||
},
|
||||
select: (data) => data?.pages.flatMap((page) => page),
|
||||
staleTime: 120 * 1000,
|
||||
refetchOnWindowFocus: false,
|
||||
refetchOnMount: false,
|
||||
});
|
||||
|
||||
const allEvents = useMemo(
|
||||
() => (data ? data.pages.flatMap((page) => page) : []),
|
||||
[data],
|
||||
);
|
||||
|
||||
const renderItem = (event: NDKEvent) => {
|
||||
switch (event.kind) {
|
||||
case NDKKind.Text:
|
||||
@@ -110,7 +106,7 @@ export function HomeRoute({ colKey }: { colKey: string }) {
|
||||
<LoaderIcon className="size-5 animate-spin" />
|
||||
</div>
|
||||
) : (
|
||||
allEvents.map((item) => renderItem(item))
|
||||
data.map((item) => renderItem(item))
|
||||
)}
|
||||
<div className="flex items-center justify-center h-16">
|
||||
{hasNextPage ? (
|
||||
|
||||
@@ -13,7 +13,7 @@ export function Timeline({ column }: { column: IColumn }) {
|
||||
const queryClient = useQueryClient();
|
||||
const since = useRef(Math.floor(Date.now() / 1000));
|
||||
|
||||
const refreshTimeline = async (events: NDKEvent[]) => {
|
||||
const refresh = async (events: NDKEvent[]) => {
|
||||
const uniqEvents = new Set(events);
|
||||
await queryClient.setQueryData(
|
||||
[colKey],
|
||||
@@ -40,7 +40,7 @@ export function Timeline({ column }: { column: IColumn }) {
|
||||
: ark.account.contacts,
|
||||
since: since.current,
|
||||
}}
|
||||
onClick={refreshTimeline}
|
||||
onClick={refresh}
|
||||
/>
|
||||
<Column.Content>
|
||||
<Column.Route path="/" element={<HomeRoute colKey={colKey} />} />
|
||||
|
||||
Reference in New Issue
Block a user