orderDescending not needed with SortedMap
This commit is contained in:
parent
cdd814cf73
commit
1fd37a42d2
@ -1,6 +1,7 @@
|
|||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { useInView } from "react-intersection-observer";
|
import { useInView } from "react-intersection-observer";
|
||||||
import { FormattedMessage } from "react-intl";
|
import { FormattedMessage } from "react-intl";
|
||||||
|
|
||||||
import usePageDimensions from "@/Hooks/usePageDimensions";
|
import usePageDimensions from "@/Hooks/usePageDimensions";
|
||||||
import { debounce } from "@/Utils";
|
import { debounce } from "@/Utils";
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ import { useContext } from "react";
|
|||||||
|
|
||||||
import { useArticles } from "@/Feed/ArticlesFeed";
|
import { useArticles } from "@/Feed/ArticlesFeed";
|
||||||
import { DeckContext } from "@/Pages/DeckLayout";
|
import { DeckContext } from "@/Pages/DeckLayout";
|
||||||
import { orderDescending } from "@/Utils";
|
|
||||||
|
|
||||||
import Note from "../Event/EventComponent";
|
import Note from "../Event/EventComponent";
|
||||||
|
|
||||||
@ -16,7 +15,7 @@ export default function Articles() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{orderDescending(data).map(a => (
|
{data.map(a => (
|
||||||
<Note
|
<Note
|
||||||
data={a}
|
data={a}
|
||||||
key={a.id}
|
key={a.id}
|
||||||
|
@ -9,7 +9,6 @@ import PageSpinner from "@/Components/PageSpinner";
|
|||||||
import { useNotificationsView } from "@/Feed/WorkerRelayView";
|
import { useNotificationsView } from "@/Feed/WorkerRelayView";
|
||||||
import useLogin from "@/Hooks/useLogin";
|
import useLogin from "@/Hooks/useLogin";
|
||||||
import useModeration from "@/Hooks/useModeration";
|
import useModeration from "@/Hooks/useModeration";
|
||||||
import { orderDescending } from "@/Utils";
|
|
||||||
import { markNotificationsRead } from "@/Utils/Login";
|
import { markNotificationsRead } from "@/Utils/Login";
|
||||||
|
|
||||||
import { getNotificationContext } from "./getNotificationContext";
|
import { getNotificationContext } from "./getNotificationContext";
|
||||||
@ -33,7 +32,7 @@ export default function NotificationsPage({ onClick }: { onClick?: (link: NostrL
|
|||||||
};
|
};
|
||||||
|
|
||||||
const myNotifications = useMemo(() => {
|
const myNotifications = useMemo(() => {
|
||||||
return orderDescending([...notifications]).filter(
|
return notifications.filter(
|
||||||
a => !isMuted(a.pubkey) && a.tags.some(b => b[0] === "p" && b[1] === login.publicKey),
|
a => !isMuted(a.pubkey) && a.tags.some(b => b[0] === "p" && b[1] === login.publicKey),
|
||||||
);
|
);
|
||||||
}, [notifications, login.publicKey]);
|
}, [notifications, login.publicKey]);
|
||||||
|
@ -289,10 +289,6 @@ export const delay = (t: number) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export function orderDescending<T>(arr: Array<T & { created_at: number }>) {
|
|
||||||
return arr.sort((a, b) => (b.created_at > a.created_at ? 1 : -1));
|
|
||||||
}
|
|
||||||
|
|
||||||
export function orderAscending<T>(arr: Array<T & { created_at: number }>) {
|
export function orderAscending<T>(arr: Array<T & { created_at: number }>) {
|
||||||
return arr.sort((a, b) => (b.created_at > a.created_at ? -1 : 1));
|
return arr.sort((a, b) => (b.created_at > a.created_at ? -1 : 1));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user