wip: rework widget

This commit is contained in:
2023-11-09 18:02:25 +07:00
parent cb9006abb2
commit 0cdf199cb5
31 changed files with 155 additions and 509 deletions

View File

@@ -4,7 +4,10 @@ import { VList } from 'virtua';
import { LoaderIcon } from '@shared/icons';
import { TitleBar } from '@shared/titleBar';
import { WidgetWrapper } from '@shared/widgets';
import { NostrBandUserProfile, type Profile } from '@shared/widgets/nostrBandUserProfile';
import {
NostrBandUserProfile,
type Profile,
} from '@shared/widgets/other/nostrBandUserProfile';
import { Widget } from '@utils/types';

View File

@@ -13,9 +13,9 @@ interface Response {
notes: Array<{ event: NDKEvent }>;
}
export function TrendingNotesWidget({ params }: { params: Widget }) {
export function TrendingNotesWidget({ widget }: { widget: Widget }) {
const { status, data } = useQuery({
queryKey: ['trending-notes-widget'],
queryKey: ['widget-' + widget.id],
queryFn: async () => {
const res = await fetch('https://api.nostr.band/v0/trending/notes');
if (!res.ok) {
@@ -33,7 +33,7 @@ export function TrendingNotesWidget({ params }: { params: Widget }) {
return (
<WidgetWrapper>
<TitleBar id={params.id} title="Trending Notes" />
<TitleBar id={widget.id} title="Trending Notes" />
<VList className="flex-1">
{status === 'pending' ? (
<div className="flex h-full w-full items-center justify-center ">