chore(client/search): fix improper nesting

This commit is contained in:
Elian Doran 2025-09-23 20:33:43 +03:00
parent aeb9bfc1fd
commit fae66e555e
No known key found for this signature in database

View File

@ -33,7 +33,7 @@ export default function SearchDefinitionTab({ note, ntxId }: TabContext) {
const activeOptions: SearchOption[] = []; const activeOptions: SearchOption[] = [];
for (const searchOption of SEARCH_OPTIONS) { for (const searchOption of SEARCH_OPTIONS) {
const attr = note.getAttribute(searchOption.attributeType, searchOption.attributeName); const attr = note.getAttribute(searchOption.attributeType, searchOption.attributeName);
if (attr) { if (attr) {
activeOptions.push(searchOption); activeOptions.push(searchOption);
} else { } else {
@ -75,24 +75,26 @@ export default function SearchDefinitionTab({ note, ntxId }: TabContext) {
return ( return (
<div className="search-definition-widget"> <div className="search-definition-widget">
<div className="search-settings"> <div className="search-settings">
{note && {note &&
<table className="search-setting-table"> <table className="search-setting-table">
<tr> <tbody>
<td className="title-column">{t("search_definition.add_search_option")}</td> <tr>
<td colSpan={2} className="add-search-option"> <td className="title-column">{t("search_definition.add_search_option")}</td>
{searchOptions?.availableOptions.map(({ icon, label, tooltip, attributeName, attributeType, defaultValue }) => ( <td colSpan={2} className="add-search-option">
<Button {searchOptions?.availableOptions.map(({ icon, label, tooltip, attributeName, attributeType, defaultValue }) => (
size="small" <Button
icon={icon} size="small"
text={label} icon={icon}
title={tooltip} text={label}
onClick={() => attributes.setAttribute(note, attributeType, attributeName, defaultValue ?? "")} title={tooltip}
/> onClick={() => attributes.setAttribute(note, attributeType, attributeName, defaultValue ?? "")}
))} />
))}
<AddBulkActionButton note={note} /> <AddBulkActionButton note={note} />
</td> </td>
</tr> </tr>
</tbody>
<tbody className="search-options"> <tbody className="search-options">
{searchOptions?.activeOptions.map(({ attributeType, attributeName, component, additionalAttributesToDelete, defaultValue }) => { {searchOptions?.activeOptions.map(({ attributeType, attributeName, component, additionalAttributesToDelete, defaultValue }) => {
const Component = component; const Component = component;
@ -125,7 +127,7 @@ export default function SearchDefinitionTab({ note, ntxId }: TabContext) {
onClick={async () => { onClick={async () => {
await server.post(`search-and-execute-note/${note.noteId}`); await server.post(`search-and-execute-note/${note.noteId}`);
refreshResults(); refreshResults();
toast.showMessage(t("search_definition.actions_executed"), 3000); toast.showMessage(t("search_definition.actions_executed"), 3000);
}} }}
/> />
@ -196,9 +198,9 @@ function AddBulkActionButton({ note }: { note: FNote }) {
{actions.map(({ actionName, actionTitle }) => ( {actions.map(({ actionName, actionTitle }) => (
<FormListItem onClick={() => bulk_action.addAction(note.noteId, actionName)}>{actionTitle}</FormListItem> <FormListItem onClick={() => bulk_action.addAction(note.noteId, actionName)}>{actionTitle}</FormListItem>
))} ))}
</> </>
))} ))}
</Dropdown> </Dropdown>
) )
} }