fix note search, rm sort:popular
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
import { useEffect, useMemo, useState } from "react";
|
import { useEffect, useMemo, useState } from "react";
|
||||||
import { FormattedMessage, useIntl } from "react-intl";
|
import { useIntl } from "react-intl";
|
||||||
import { useNavigate, useParams } from "react-router-dom";
|
import { useNavigate, useParams } from "react-router-dom";
|
||||||
|
|
||||||
import Timeline from "@/Components/Feed/Timeline";
|
import Timeline from "@/Components/Feed/Timeline";
|
||||||
@ -25,7 +25,6 @@ const SearchPage = () => {
|
|||||||
const { formatMessage } = useIntl();
|
const { formatMessage } = useIntl();
|
||||||
const [search, setSearch] = useState<string>(params.keyword ?? "");
|
const [search, setSearch] = useState<string>(params.keyword ?? "");
|
||||||
const [keyword, setKeyword] = useState<string>(params.keyword ?? "");
|
const [keyword, setKeyword] = useState<string>(params.keyword ?? "");
|
||||||
const [sortPopular, setSortPopular] = useState<boolean>(true);
|
|
||||||
// tabs
|
// tabs
|
||||||
const SearchTab = [
|
const SearchTab = [
|
||||||
{ text: formatMessage({ defaultMessage: "Notes", id: "7+Domh" }), value: NOTES },
|
{ text: formatMessage({ defaultMessage: "Notes", id: "7+Domh" }), value: NOTES },
|
||||||
@ -56,10 +55,10 @@ const SearchPage = () => {
|
|||||||
const subject = useMemo(
|
const subject = useMemo(
|
||||||
() => ({
|
() => ({
|
||||||
type: "post_keyword",
|
type: "post_keyword",
|
||||||
items: [keyword + (sortPopular ? " sort:popular" : "")],
|
items: [keyword],
|
||||||
discriminator: keyword,
|
discriminator: keyword,
|
||||||
}),
|
}),
|
||||||
[keyword, sortPopular],
|
[keyword],
|
||||||
);
|
);
|
||||||
|
|
||||||
function tabContent() {
|
function tabContent() {
|
||||||
@ -71,29 +70,7 @@ const SearchPage = () => {
|
|||||||
return <TrendingNotes />;
|
return <TrendingNotes />;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return <Timeline key={keyword} subject={subject} postsOnly={false} method={"LIMIT_UNTIL"} loadMore={false} />;
|
||||||
<>
|
|
||||||
{sortOptions()}
|
|
||||||
<Timeline key={keyword} subject={subject} postsOnly={false} method={"LIMIT_UNTIL"} loadMore={false} />
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function sortOptions() {
|
|
||||||
if (tab.value != PROFILES) return null;
|
|
||||||
return (
|
|
||||||
<div className="flex items-center justify-end g8">
|
|
||||||
<FormattedMessage defaultMessage="Sort" id="RwFaYs" description="Label for sorting options for people search" />
|
|
||||||
<select onChange={e => setSortPopular(e.target.value == "true")} value={sortPopular ? "true" : "false"}>
|
|
||||||
<option value={"true"}>
|
|
||||||
<FormattedMessage defaultMessage="Popular" id="mTJFgF" description="Sort order name" />
|
|
||||||
</option>
|
|
||||||
<option value={"false"}>
|
|
||||||
<FormattedMessage defaultMessage="Recent" id="RjpoYG" description="Sort order name" />
|
|
||||||
</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -856,20 +856,12 @@
|
|||||||
"RhDAoS": {
|
"RhDAoS": {
|
||||||
"defaultMessage": "Are you sure you want to delete {id}"
|
"defaultMessage": "Are you sure you want to delete {id}"
|
||||||
},
|
},
|
||||||
"RjpoYG": {
|
|
||||||
"defaultMessage": "Recent",
|
|
||||||
"description": "Sort order name"
|
|
||||||
},
|
|
||||||
"RoOyAh": {
|
"RoOyAh": {
|
||||||
"defaultMessage": "Relays"
|
"defaultMessage": "Relays"
|
||||||
},
|
},
|
||||||
"Rs4kCE": {
|
"Rs4kCE": {
|
||||||
"defaultMessage": "Bookmark"
|
"defaultMessage": "Bookmark"
|
||||||
},
|
},
|
||||||
"RwFaYs": {
|
|
||||||
"defaultMessage": "Sort",
|
|
||||||
"description": "Label for sorting options for people search"
|
|
||||||
},
|
|
||||||
"SLZGPn": {
|
"SLZGPn": {
|
||||||
"defaultMessage": "Enter a pin to encrypt your private key, you must enter this pin every time you open {site}."
|
"defaultMessage": "Enter a pin to encrypt your private key, you must enter this pin every time you open {site}."
|
||||||
},
|
},
|
||||||
@ -1458,10 +1450,6 @@
|
|||||||
"mKhgP9": {
|
"mKhgP9": {
|
||||||
"defaultMessage": "{n,plural,=0{} =1{zapped} other{zapped}}"
|
"defaultMessage": "{n,plural,=0{} =1{zapped} other{zapped}}"
|
||||||
},
|
},
|
||||||
"mTJFgF": {
|
|
||||||
"defaultMessage": "Popular",
|
|
||||||
"description": "Sort order name"
|
|
||||||
},
|
|
||||||
"mfe8RW": {
|
"mfe8RW": {
|
||||||
"defaultMessage": "Option: {n}"
|
"defaultMessage": "Option: {n}"
|
||||||
},
|
},
|
||||||
|
@ -282,10 +282,8 @@
|
|||||||
"RahCRH": "Expired",
|
"RahCRH": "Expired",
|
||||||
"RfhLwC": "By: {author}",
|
"RfhLwC": "By: {author}",
|
||||||
"RhDAoS": "Are you sure you want to delete {id}",
|
"RhDAoS": "Are you sure you want to delete {id}",
|
||||||
"RjpoYG": "Recent",
|
|
||||||
"RoOyAh": "Relays",
|
"RoOyAh": "Relays",
|
||||||
"Rs4kCE": "Bookmark",
|
"Rs4kCE": "Bookmark",
|
||||||
"RwFaYs": "Sort",
|
|
||||||
"SLZGPn": "Enter a pin to encrypt your private key, you must enter this pin every time you open {site}.",
|
"SLZGPn": "Enter a pin to encrypt your private key, you must enter this pin every time you open {site}.",
|
||||||
"SMO+on": "Send zap to {name}",
|
"SMO+on": "Send zap to {name}",
|
||||||
"SOqbe9": "Update Lightning Address",
|
"SOqbe9": "Update Lightning Address",
|
||||||
@ -481,7 +479,6 @@
|
|||||||
"mKAr6h": "Follow all",
|
"mKAr6h": "Follow all",
|
||||||
"mKh2HS": "File upload service",
|
"mKh2HS": "File upload service",
|
||||||
"mKhgP9": "{n,plural,=0{} =1{zapped} other{zapped}}",
|
"mKhgP9": "{n,plural,=0{} =1{zapped} other{zapped}}",
|
||||||
"mTJFgF": "Popular",
|
|
||||||
"mfe8RW": "Option: {n}",
|
"mfe8RW": "Option: {n}",
|
||||||
"n1Whvj": "Switch",
|
"n1Whvj": "Switch",
|
||||||
"nDejmx": "Unblock",
|
"nDejmx": "Unblock",
|
||||||
|
@ -1,11 +1,4 @@
|
|||||||
import {
|
import { EventMetadata, NostrEvent, OkResponse, ReqCommand, WorkerMessage, WorkerMessageCommand } from "./types";
|
||||||
EventMetadata,
|
|
||||||
NostrEvent,
|
|
||||||
OkResponse,
|
|
||||||
ReqCommand,
|
|
||||||
WorkerMessage,
|
|
||||||
WorkerMessageCommand,
|
|
||||||
} from "./types";
|
|
||||||
import { v4 as uuid } from "uuid";
|
import { v4 as uuid } from "uuid";
|
||||||
|
|
||||||
export class WorkerRelayInterface {
|
export class WorkerRelayInterface {
|
||||||
|
Reference in New Issue
Block a user