1
0
mirror of https://github.com/flarum/core.git synced 2025-08-08 01:16:52 +02:00

feat: search UI/UX revamp (#3941)

* feat: first iteration

* chore: tweak

* feat: second iteration

* chore: incorrect code organization

* feat: gambit input suggestions

* feat: gambit keyboard navigation

* chore: bugs

* feat: negative gambits

* feat: improve gambit highlighting

* refactor: localize gambits

* feat: negative and positive gambit buttons

* fix: permissions

* chore: wat

* per: lazy load search modal

* fix: extensibility and bug fixes

* fix: bugs

* feat: reusable autocomplete dropdown

* chore: format

* fix: tag filter
This commit is contained in:
Sami Mazouz
2024-01-09 22:51:01 +01:00
committed by GitHub
parent fb1703cd9b
commit 3a34136e36
79 changed files with 2158 additions and 754 deletions

View File

@@ -1,23 +1,12 @@
import IGambit from 'flarum/common/query/IGambit';
import { BooleanGambit } from 'flarum/common/query/IGambit';
import app from 'flarum/common/app';
export default class StickyGambit implements IGambit {
pattern(): string {
return 'is:sticky';
}
toFilter(_matches: string[], negate: boolean): Record<string, any> {
const key = (negate ? '-' : '') + 'sticky';
return {
[key]: true,
};
export default class StickyGambit extends BooleanGambit {
key(): string {
return app.translator.trans('flarum-sticky.lib.gambits.discussions.sticky.key', {}, true);
}
filterKey(): string {
return 'sticky';
}
fromFilter(value: string, negate: boolean): string {
return `${negate ? '-' : ''}is:sticky`;
}
}

View File

@@ -32,6 +32,15 @@ flarum-sticky:
# REUSED TRANSLATIONS - These keys should not be used directly in code!
##
# Translations in this namespace are used by the forum and admin interfaces.
lib:
# These translations are used by gambits. Gambit keys must be in snake_case, no spaces.
gambits:
discussions:
sticky:
key: sticky
# Translations in this namespace are referenced by two or more unique keys.
ref:
sticky: Sticky