[Glitch] Collections: Handle URLs in search

Port d229157f193e1394718151c5048e2e2857dee46d to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Echo 2026-05-27 15:13:38 +02:00 committed by Claire
parent 5c3dee40c5
commit 46a819e764
2 changed files with 7 additions and 0 deletions

View File

@ -1,4 +1,5 @@
import type { ApiAccountJSON } from './accounts'; import type { ApiAccountJSON } from './accounts';
import type { ApiCollectionJSON } from './collections';
import type { ApiStatusJSON } from './statuses'; import type { ApiStatusJSON } from './statuses';
import type { ApiHashtagJSON } from './tags'; import type { ApiHashtagJSON } from './tags';
@ -8,4 +9,5 @@ export interface ApiSearchResultsJSON {
accounts: ApiAccountJSON[]; accounts: ApiAccountJSON[];
statuses: ApiStatusJSON[]; statuses: ApiStatusJSON[];
hashtags: ApiHashtagJSON[]; hashtags: ApiHashtagJSON[];
collections: ApiCollectionJSON[];
} }

View File

@ -19,6 +19,7 @@ import { useHistory } from 'react-router-dom';
import { isFulfilled } from '@reduxjs/toolkit'; import { isFulfilled } from '@reduxjs/toolkit';
import { getCollectionPath } from '@/flavours/glitch/features/collections/utils';
import CancelIcon from '@/material-icons/400-24px/cancel-fill.svg?react'; import CancelIcon from '@/material-icons/400-24px/cancel-fill.svg?react';
import CloseIcon from '@/material-icons/400-24px/close.svg?react'; import CloseIcon from '@/material-icons/400-24px/close.svg?react';
import SearchIcon from '@/material-icons/400-24px/search.svg?react'; import SearchIcon from '@/material-icons/400-24px/search.svg?react';
@ -337,6 +338,10 @@ export const Search: React.FC<{
history.push( history.push(
`/@${result.payload.statuses[0].account.acct}/${result.payload.statuses[0].id}`, `/@${result.payload.statuses[0].account.acct}/${result.payload.statuses[0].id}`,
); );
} else if (result.payload.collections[0]) {
history.push(
getCollectionPath(result.payload.collections[0].id),
);
} }
} }