Skip to content

Commit 18608ec

Browse files
committed
feat(mobile): render search definition
1 parent ab6da26 commit 18608ec

File tree

5 files changed

+129
-62
lines changed

5 files changed

+129
-62
lines changed

apps/client/src/layouts/mobile_layout.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import CloseZenModeButton from "../widgets/close_zen_button.js";
2424
import NoteWrapperWidget from "../widgets/note_wrapper.js";
2525
import MobileDetailMenu from "../widgets/mobile_widgets/mobile_detail_menu.js";
2626
import NoteList from "../widgets/collections/NoteList.jsx";
27+
import StandaloneRibbonAdapter from "../widgets/ribbon/components/StandaloneRibbonAdapter.jsx";
28+
import SearchDefinitionTab from "../widgets/ribbon/SearchDefinitionTab.jsx";
2729

2830
const MOBILE_CSS = `
2931
<style>
@@ -155,6 +157,7 @@ export default class MobileLayout {
155157
.contentSized()
156158
.child(new NoteDetailWidget())
157159
.child(<NoteList media="screen" />)
160+
.child(<StandaloneRibbonAdapter component={SearchDefinitionTab} />)
158161
.child(<FilePropertiesWrapper />)
159162
)
160163
.child(<MobileEditorToolbar />)

apps/client/src/widgets/ribbon/SearchDefinitionOptions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ function SearchOption({ note, title, titleIcon, children, help, attributeName, a
115115
additionalAttributesToDelete?: { type: "label" | "relation", name: string }[]
116116
}) {
117117
return (
118-
<tr>
118+
<tr className={attributeName}>
119119
<td className="title-column">
120120
{titleIcon && <><Icon icon={titleIcon} />{" "}</>}
121121
{title}
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
.search-setting-table {
2+
margin-top: 0;
3+
margin-bottom: 7px;
4+
width: 100%;
5+
border-collapse: separate;
6+
border-spacing: 10px;
7+
}
8+
9+
.search-setting-table div {
10+
white-space: nowrap;
11+
}
12+
13+
.search-setting-table .title-column {
14+
/* minimal width so that table remains static sized and most space remains for middle column with settings */
15+
width: 50px;
16+
white-space: nowrap;
17+
}
18+
19+
.search-setting-table .button-column {
20+
/* minimal width so that table remains static sized and most space remains for middle column with settings */
21+
width: 50px;
22+
white-space: nowrap;
23+
text-align: end;
24+
vertical-align: middle;
25+
}
26+
27+
.search-setting-table .button-column .dropdown {
28+
display: inline-block !important;
29+
}
30+
31+
.search-setting-table .button-column .dropdown-menu {
32+
white-space: normal;
33+
}
34+
35+
.search-setting-table .button-column > * {
36+
vertical-align: middle;
37+
}
38+
39+
.attribute-list hr {
40+
height: 1px;
41+
border-color: var(--main-border-color);
42+
position: relative;
43+
top: 4px;
44+
margin-top: 5px;
45+
margin-bottom: 0;
46+
}
47+
48+
.search-definition-widget input:invalid {
49+
border: 3px solid red;
50+
}
51+
52+
.add-search-option button {
53+
margin: 3px;
54+
}
55+
56+
.dropdown-header {
57+
background-color: var(--accented-background-color);
58+
}
59+
60+
@media (max-width: 720px) {
61+
.search-setting-table {
62+
display: block;
63+
}
64+
65+
.search-setting-table tr {
66+
margin: 0.5em 0;
67+
}
68+
69+
.search-setting-table tr,
70+
.search-setting-table td {
71+
display: block;
72+
}
73+
74+
.search-setting-table tbody {
75+
display: block;
76+
padding: 0.5em;
77+
}
78+
79+
.search-setting-table tbody:first-of-type {
80+
display: block;
81+
overflow: auto;
82+
}
83+
84+
.search-setting-table .add-search-option {
85+
display: flex;
86+
}
87+
88+
.search-setting-table .add-search-option button {
89+
font-size: 0.75em;
90+
}
91+
92+
.search-options tr {
93+
display: flex;
94+
}
95+
96+
.search-setting-table .title-column {
97+
width: unset;
98+
margin-right: 0.5em;
99+
min-width: 20%;
100+
flex-shrink: 0;
101+
}
102+
103+
.search-setting-table .button-column {
104+
flex-grow: 1;
105+
justify-content: end;
106+
}
107+
108+
.search-setting-table tr.orderBy td:nth-of-type(2) {
109+
display: flex;
110+
flex-direction: column;
111+
overflow: hidden;
112+
gap: 0.5em;
113+
}
114+
115+
.search-setting-table tr.searchString td:nth-of-type(2) {
116+
flex-grow: 1;
117+
}
118+
119+
.search-setting-table tr.searchString .button-column {
120+
flex-grow: 0;
121+
flex-shrink: 0;
122+
width: 64px;
123+
}
124+
}

apps/client/src/widgets/ribbon/SearchDefinitionTab.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import bulk_action, { ACTION_GROUPS } from "../../services/bulk_action";
2020
import { FormListHeader, FormListItem } from "../react/FormList";
2121
import RenameNoteBulkAction from "../bulk_actions/note/rename_note";
2222
import { getErrorMessage } from "../../services/utils";
23+
import "./SearchDefinitionTab.css";
2324

2425
export default function SearchDefinitionTab({ note, ntxId }: TabContext) {
2526
const parentComponent = useContext(ParentComponent);

apps/client/src/widgets/ribbon/style.css

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -376,67 +376,6 @@ body[dir=rtl] .attribute-list-editor {
376376
}
377377
/* #endregion */
378378

379-
/* #region Search definition */
380-
.search-setting-table {
381-
margin-top: 0;
382-
margin-bottom: 7px;
383-
width: 100%;
384-
border-collapse: separate;
385-
border-spacing: 10px;
386-
}
387-
388-
.search-setting-table div {
389-
white-space: nowrap;
390-
}
391-
392-
.search-setting-table .title-column {
393-
/* minimal width so that table remains static sized and most space remains for middle column with settings */
394-
width: 50px;
395-
white-space: nowrap;
396-
}
397-
398-
.search-setting-table .button-column {
399-
/* minimal width so that table remains static sized and most space remains for middle column with settings */
400-
width: 50px;
401-
white-space: nowrap;
402-
text-align: end;
403-
vertical-align: middle;
404-
}
405-
406-
.search-setting-table .button-column .dropdown {
407-
display: inline-block !important;
408-
}
409-
410-
.search-setting-table .button-column .dropdown-menu {
411-
white-space: normal;
412-
}
413-
414-
.search-setting-table .button-column > * {
415-
vertical-align: middle;
416-
}
417-
418-
.attribute-list hr {
419-
height: 1px;
420-
border-color: var(--main-border-color);
421-
position: relative;
422-
top: 4px;
423-
margin-top: 5px;
424-
margin-bottom: 0;
425-
}
426-
427-
.search-definition-widget input:invalid {
428-
border: 3px solid red;
429-
}
430-
431-
.add-search-option button {
432-
margin: 3px;
433-
}
434-
435-
.dropdown-header {
436-
background-color: var(--accented-background-color);
437-
}
438-
/* #endregion */
439-
440379
/* #region Note actions */
441380
.note-actions {
442381
width: 35px;

0 commit comments

Comments
 (0)