Skip to content

Commit 3d35fd6

Browse files
cdxkerskeptrunedev
authored andcommitted
feature: set defualt values in search UI
1 parent 44b1067 commit 3d35fd6

File tree

1 file changed

+21
-26
lines changed

1 file changed

+21
-26
lines changed

frontends/dashboard/src/pages/dataset/PublicPageSettings.tsx

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createSignal, useContext } from "solid-js";
1+
import { useContext } from "solid-js";
22
import { createToast } from "../../components/ShowToasts";
33
import { ApiRoutes } from "../../components/Routes";
44
import { DatasetContext } from "../../contexts/DatasetContext";
@@ -105,7 +105,7 @@ export const PublicPageSettings = () => {
105105
</label>
106106
<input
107107
placeholder="https://cdn.trieve.ai/favicon.ico"
108-
value={""}
108+
value={extra_params.brandLogoImgSrcUrl || ""}
109109
onInput={(e) => {
110110
setExtraParams("brandLogoImgSrcUrl", e.currentTarget.value);
111111
}}
@@ -117,8 +117,8 @@ export const PublicPageSettings = () => {
117117
Brand Name
118118
</label>
119119
<input
120-
placeholder="https://example.com/openapi.json"
121-
value={""}
120+
placeholder="Trieve"
121+
value={extra_params.brandName || ""}
122122
onInput={(e) => {
123123
setExtraParams("brandName", e.currentTarget.value);
124124
}}
@@ -131,9 +131,9 @@ export const PublicPageSettings = () => {
131131
</label>
132132
<input
133133
placeholder="light"
134-
value={""}
134+
value={extra_params.theme || ""}
135135
onInput={(e) => {
136-
setExtraParams("theme", e.currentTarget.value);
136+
setExtraParams("theme", e.currentTarget.value === "dark" ? "dark" : "light");
137137
}}
138138
class="block w-full rounded border border-neutral-300 px-3 py-1.5 shadow-sm placeholder:text-neutral-400 focus:outline-magenta-500 sm:text-sm sm:leading-6"
139139
/>
@@ -144,7 +144,7 @@ export const PublicPageSettings = () => {
144144
</label>
145145
<input
146146
placeholder="#CB53EB"
147-
value={""}
147+
value={extra_params.accentColor || ""}
148148
onInput={(e) => {
149149
setExtraParams("accentColor", e.currentTarget.value);
150150
}}
@@ -160,8 +160,8 @@ export const PublicPageSettings = () => {
160160
Problem Link
161161
</label>
162162
<input
163-
placeholder="https://example.com/openapi.json"
164-
value={""}
163+
placeholder="mailto:[email protected]"
164+
value={extra_params.problemLink || ""}
165165
onInput={(e) => {
166166
setExtraParams("problemLink", e.currentTarget.value);
167167
}}
@@ -175,11 +175,10 @@ export const PublicPageSettings = () => {
175175
Responsive View
176176
</label>
177177
<input
178-
placeholder="Search..."
179-
value={""}
178+
checked={extra_params.responsive || false}
180179
type="checkbox"
181180
onInput={(e) => {
182-
setExtraParams("responsive", e.currentTarget.value);
181+
setExtraParams("responsive", e.currentTarget.value === "true");
183182
}}
184183
class="block w-4 rounded border border-neutral-300 px-3 py-1.5 shadow-sm placeholder:text-neutral-400 focus:outline-magenta-500 sm:text-sm sm:leading-6"
185184
/>
@@ -189,11 +188,10 @@ export const PublicPageSettings = () => {
189188
Analytics
190189
</label>
191190
<input
192-
placeholder="Search..."
193-
value={""}
191+
checked={extra_params.analytics || true}
194192
type="checkbox"
195-
onInput={(e) => {
196-
setExtraParams("analytics", e.currentTarget.value);
193+
onChange={(e) => {
194+
setExtraParams("analytics", e.currentTarget.checked);
197195
}}
198196
class="block w-4 rounded border border-neutral-300 px-3 py-1.5 shadow-sm placeholder:text-neutral-400 focus:outline-magenta-500 sm:text-sm sm:leading-6"
199197
/>
@@ -204,10 +202,10 @@ export const PublicPageSettings = () => {
204202
</label>
205203
<input
206204
placeholder="Search..."
207-
value={""}
205+
checked={extra_params.suggestedQueries || true}
208206
type="checkbox"
209-
onInput={(e) => {
210-
setExtraParams("suggestedQueries", e.currentTarget.value);
207+
onChange={(e) => {
208+
setExtraParams("suggestedQueries", e.currentTarget.checked);
211209
}}
212210
class="block w-4 rounded border border-neutral-300 px-3 py-1.5 shadow-sm placeholder:text-neutral-400 focus:outline-magenta-500 sm:text-sm sm:leading-6"
213211
/>
@@ -218,10 +216,10 @@ export const PublicPageSettings = () => {
218216
</label>
219217
<input
220218
placeholder="Search..."
221-
value={""}
219+
checked={extra_params.chat || true}
222220
type="checkbox"
223-
onInput={(e) => {
224-
setExtraParams("chat", e.currentTarget.value);
221+
onChange={(e) => {
222+
setExtraParams("chat", e.currentTarget.checked);
225223
}}
226224
class="block w-4 rounded border border-neutral-300 px-3 py-1.5 shadow-sm placeholder:text-neutral-400 focus:outline-magenta-500 sm:text-sm sm:leading-6"
227225
/>
@@ -239,7 +237,7 @@ export const PublicPageSettings = () => {
239237
value={() => {
240238
return extra_params?.searchOptions || {}
241239
}}
242-
onError={(error) => { }}
240+
onError={(_) => { }}
243241
/>
244242
</div>
245243
<div class="p-2 space-y-1.5">
@@ -287,6 +285,3 @@ export const PublicPageSettings = () => {
287285
</div>
288286
);
289287
};
290-
function useDatasetServerConfig() {
291-
throw new Error("Function not implemented.");
292-
}

0 commit comments

Comments
 (0)