add trending stuff to right column

This commit is contained in:
Martti Malmi
2023-11-22 14:06:42 +02:00
parent f9d0318f36
commit f9e7bc8558
9 changed files with 68 additions and 40 deletions

View File

@ -6,14 +6,14 @@ import PageSpinner from "@/Element/PageSpinner";
import NostrBandApi from "@/External/NostrBand";
import { ErrorOrOffline } from "./ErrorOrOffline";
export default function TrendingUsers({ title }: { title?: ReactNode }) {
export default function TrendingUsers({ title, count = 5 }: { title?: ReactNode; count?: number }) {
const [userList, setUserList] = useState<HexKey[]>();
const [error, setError] = useState<Error>();
async function loadTrendingUsers() {
const api = new NostrBandApi();
const users = await api.trendingProfiles();
const keys = users.profiles.map(a => a.pubkey);
const keys = users.profiles.map(a => a.pubkey).slice(0, count); // Limit the user list to the count
setUserList(keys);
}