feat(search): sender picker, date presets, has:link filter
- Add SelectSenderButton: clickable people picker for the From filter replacing the text-only from:@user syntax - Add date preset shortcuts in DateRangeButton (Today, Last week, Last month, Last year) for one-click range selection - Add Has link chip backed by Matrix contains_url API filter; toggle removes cleanly with X badge - Wire containsUrl through URL params, useMessageSearch hook, and SearchFilters props UNTESTED — verify at chat.lotusguild.org post-deploy. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -70,10 +70,11 @@ export type MessageSearchParams = {
|
||||
senders?: string[];
|
||||
fromTs?: number;
|
||||
toTs?: number;
|
||||
containsUrl?: boolean;
|
||||
};
|
||||
export const useMessageSearch = (params: MessageSearchParams) => {
|
||||
const mx = useMatrixClient();
|
||||
const { term, order, rooms, senders, fromTs, toTs } = params;
|
||||
const { term, order, rooms, senders, fromTs, toTs, containsUrl } = params;
|
||||
|
||||
const searchMessages = useCallback(
|
||||
async (nextBatch?: string) => {
|
||||
@@ -96,9 +97,10 @@ export const useMessageSearch = (params: MessageSearchParams) => {
|
||||
limit,
|
||||
rooms,
|
||||
senders,
|
||||
// from_ts / to_ts are valid Matrix spec fields not yet in SDK types
|
||||
// from_ts / to_ts and contains_url are valid Matrix spec fields not yet in SDK types
|
||||
...(fromTs !== undefined && { from_ts: fromTs }),
|
||||
...(toTs !== undefined && { to_ts: toTs }),
|
||||
...(containsUrl !== undefined && { contains_url: containsUrl }),
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} as any,
|
||||
include_state: false,
|
||||
@@ -114,7 +116,7 @@ export const useMessageSearch = (params: MessageSearchParams) => {
|
||||
});
|
||||
return parseSearchResult(r);
|
||||
},
|
||||
[mx, term, order, rooms, senders, fromTs, toTs],
|
||||
[mx, term, order, rooms, senders, fromTs, toTs, containsUrl],
|
||||
);
|
||||
|
||||
return searchMessages;
|
||||
|
||||
Reference in New Issue
Block a user