Skip to content

Commit 98742e6

Browse files
committed
feature: add floating action button options to dashboard publicpagesettings
1 parent 50c9c0b commit 98742e6

File tree

8 files changed

+82
-6
lines changed

8 files changed

+82
-6
lines changed

clients/search-component/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ declare module "solid-js" {
7373

7474
#### Props
7575

76-
| Name | Type | Default |
77-
| ---------------------- | ---------------------------------------------------------------------------------------------- | ------------------------------------------ |
76+
| Name | Type | Default |
77+
| ---------------------- | ---------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
7878
| datasetId | string | '' |
7979
| apiKey | string | '' |
8080
| baseUrl | string | "https://api.trieve.ai" |
@@ -98,8 +98,8 @@ declare module "solid-js" {
9898
| brandFontFamily | string | Maven Pro |
9999
| problemLink | string (example: "mailto:[email protected]?subject=") | null |
100100
| responsive | boolean | false |
101-
| floatingButtonPosition | "top-left", "top-right", "bottom-left", or "bottom-right" | "bottom-right"
102-
| showFloatingButton | boolean | true
101+
| floatingButtonPosition | "top-left", "top-right", "bottom-left", or "bottom-right" | "bottom-right" |
102+
| showFloatingButton | boolean | false |
103103

104104
### Search Results
105105

clients/ts-sdk/openapi.json

+8
Original file line numberDiff line numberDiff line change
@@ -12324,6 +12324,10 @@
1232412324
},
1232512325
"nullable": true
1232612326
},
12327+
"floatingButtonPosition": {
12328+
"type": "string",
12329+
"nullable": true
12330+
},
1232712331
"forBrandName": {
1232812332
"type": "string",
1232912333
"nullable": true
@@ -12376,6 +12380,10 @@
1237612380
],
1237712381
"nullable": true
1237812382
},
12383+
"showFloatingButton": {
12384+
"type": "boolean",
12385+
"nullable": true
12386+
},
1237912387
"singleProductOptions": {
1238012388
"allOf": [
1238112389
{

clients/ts-sdk/src/types.gen.ts

+2
Original file line numberDiff line numberDiff line change
@@ -2055,6 +2055,7 @@ export type PublicPageParameters = {
20552055
defaultCurrency?: (string) | null;
20562056
defaultSearchMode?: (string) | null;
20572057
defaultSearchQueries?: Array<(string)> | null;
2058+
floatingButtonPosition?: (string) | null;
20582059
forBrandName?: (string) | null;
20592060
headingPrefix?: (string) | null;
20602061
heroPattern?: ((HeroPattern) | null);
@@ -2065,6 +2066,7 @@ export type PublicPageParameters = {
20652066
problemLink?: (string) | null;
20662067
responsive?: (boolean) | null;
20672068
searchOptions?: ((PublicPageSearchOptions) | null);
2069+
showFloatingButton?: (boolean) | null;
20682070
singleProductOptions?: ((SingleProductOptions) | null);
20692071
suggestedQueries?: (boolean) | null;
20702072
tabMessages?: Array<PublicPageTabMessage> | null;

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

+50
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,56 @@ const PublicPageControls = () => {
755755
</div>
756756
</div>
757757

758+
<div class="grid grid-cols-2 gap-4">
759+
<div class="flex gap-2">
760+
<div class="flex items-center gap-1">
761+
<label class="block" for="">
762+
Show Floating Chat Button
763+
</label>
764+
<Tooltip
765+
tooltipText="Show a floating chat button on the page"
766+
body={
767+
<FaRegularCircleQuestion class="h-3 w-3 text-black" />
768+
}
769+
/>
770+
</div>
771+
<input
772+
type="checkbox"
773+
checked={extraParams.showFloatingButton || false}
774+
onChange={(e) => {
775+
setExtraParams(
776+
"showFloatingButton",
777+
e.currentTarget.checked,
778+
);
779+
}}
780+
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"
781+
/>
782+
</div>
783+
<div class="grow">
784+
<div class="flex items-center gap-1">
785+
<label class="block" for="">
786+
Floating Chat Button Position
787+
</label>
788+
<Tooltip
789+
tooltipText="Either top-right, bottom-right, top-left, or bottom-left"
790+
body={
791+
<FaRegularCircleQuestion class="h-3 w-3 text-black" />
792+
}
793+
/>
794+
</div>
795+
<input
796+
value={extraParams.floatingButtonPosition || "bottom-right"}
797+
onChange={(e) => {
798+
setExtraParams(
799+
"floatingButtonPosition",
800+
e.currentTarget.value,
801+
);
802+
}}
803+
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"
804+
/>
805+
</div>
806+
</div>
807+
758808
<div class="grid grid-cols-2 gap-4">
759809
<div class="flex gap-2">
760810
<div class="flex items-center gap-1">

server/src/data/models.rs

+6
Original file line numberDiff line numberDiff line change
@@ -3147,6 +3147,12 @@ impl DatasetConfigurationDTO {
31473147
currency_position: page_parameters_self
31483148
.currency_position
31493149
.or(page_parameters_curr.currency_position),
3150+
floating_button_position: page_parameters_self
3151+
.floating_button_position
3152+
.or(page_parameters_curr.floating_button_position),
3153+
show_floating_button: page_parameters_self
3154+
.show_floating_button
3155+
.or(page_parameters_curr.show_floating_button),
31503156
debounce_ms: page_parameters_self
31513157
.debounce_ms
31523158
.or(page_parameters_curr.debounce_ms),

server/src/handlers/page_handler.rs

+4
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,10 @@ pub struct PublicPageParameters {
213213
#[serde(skip_serializing_if = "Option::is_none")]
214214
pub currency_position: Option<String>,
215215
#[serde(skip_serializing_if = "Option::is_none")]
216+
pub floating_button_position: Option<String>,
217+
#[serde(skip_serializing_if = "Option::is_none")]
218+
pub show_floating_button: Option<bool>,
219+
#[serde(skip_serializing_if = "Option::is_none")]
216220
pub debounce_ms: Option<i32>,
217221
#[serde(skip_serializing_if = "Option::is_none")]
218222
pub hero_pattern: Option<HeroPattern>,

server/src/public/page.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<link rel="stylesheet" href="/static/output.css" />
55
<link
66
rel="stylesheet"
7-
href="https://unpkg.com/[email protected].25/dist/index.css"
7+
href="https://unpkg.com/[email protected].26/dist/index.css"
88
/>
99
<link
1010
rel="apple-touch-icon"
@@ -267,7 +267,7 @@
267267
</style>
268268

269269
<script type="module">
270-
import {renderToDiv} from 'https://unpkg.com/[email protected].25/dist/vanilla/index.js';
270+
import {renderToDiv} from 'https://unpkg.com/[email protected].26/dist/vanilla/index.js';
271271
const root = document.getElementById('root');
272272
renderToDiv(root, {
273273
... {{params | tojson}}

server/src/public/search-component-code.html

+6
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@
7979
{% if params.currencyPosition -%}
8080
currencyPosition: "{{ params.currencyPosition }}",
8181
{% endif -%}
82+
{% if params.showFloatingButton -%}
83+
showFloatingButton: "{{ params.showFloatingButton }}",
84+
{% endif -%}
85+
{% if params.floatingButtongPosition -%}
86+
floatingButtongPosition: "{{ params.floatingButtongPosition }}",
87+
{% endif -%}
8288
{% if params.debounceMs -%}
8389
debounceMs: {{ params.debounceMs }},
8490
{% endif -%}

0 commit comments

Comments
 (0)