Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add search box to splash screen #3835

Merged
merged 8 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 12 additions & 4 deletions specifyweb/frontend/js_src/lib/components/HomePage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,20 @@ export function WelcomeView(): JSX.Element {
const [mode] = userPreferences.use('welcomePage', 'general', 'mode');
const formId = useId('express-search')('form');

const [displaySearchBar] = userPreferences.use(
'welcomePage',
'general',
'addSearchBar'
);

return (
<div className="flex h-full flex-col">
<div className="flex justify-end gap-2 pt-4 pr-4">
<SearchForm formId={formId} />
<Submit.Gray form={formId}>{commonText.search()}</Submit.Gray>
</div>
{displaySearchBar && (
<div className="flex justify-end gap-2 pt-4 pr-4">
<SearchForm formId={formId} />
<Submit.Gray form={formId}>{commonText.search()}</Submit.Gray>
</div>
)}
<div
className={`
mx-auto flex w-full max-w-[1000px] flex-1 flex-col justify-center gap-4 p-4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,14 @@ export const userPreferenceDefinitions = {
general: {
title: preferencesText.general(),
items: {
addSearchBar: defineItem<boolean>({
title: preferencesText.addSearchBarHomePage(),
description: preferencesText.addSearchBarHomePage(),
CarolineDenis marked this conversation as resolved.
Show resolved Hide resolved
requiresReload: false,
visible: true,
defaultValue: true,
type: 'java.lang.Boolean',
}),
mode: defineItem<WelcomePageMode>({
title: preferencesText.content(),
description: (
Expand Down
5 changes: 4 additions & 1 deletion specifyweb/frontend/js_src/lib/localization/preferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1819,7 +1819,7 @@ export const preferencesText = createDictionary({
},
detailedView: {
'en-us': 'Detailed view',
},
},
attachmentPreviewMode: {
'en-us': 'Attachment preview mode',
'de-ch': 'Anhang-Vorschaumodus',
Expand All @@ -1844,4 +1844,7 @@ export const preferencesText = createDictionary({
'ru-ru': 'Миниатюра',
'uk-ua': 'Мініатюра',
},
addSearchBarHomePage: {
'en-us': 'Add Search Bar on home page',
},
} as const);