Skip to content

Commit

Permalink
feature: add options to removeTriggers and add zIndex to the PublicPa…
Browse files Browse the repository at this point in the history
…geSettings
  • Loading branch information
cdxker authored and vid277 committed Dec 18, 2024
1 parent bd4662e commit f8fed98
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 2 deletions.
9 changes: 9 additions & 0 deletions clients/ts-sdk/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -6977,6 +6977,10 @@
"mode": {
"type": "string"
},
"removeTriggers": {
"type": "boolean",
"nullable": true
},
"selector": {
"type": "string"
}
Expand Down Expand Up @@ -12447,6 +12451,11 @@
"useGroupSearch": {
"type": "boolean",
"nullable": true
},
"zIndex": {
"type": "integer",
"format": "int32",
"nullable": true
}
}
},
Expand Down
2 changes: 2 additions & 0 deletions clients/ts-sdk/src/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export type BulkDeleteChunkPayload = {

export type ButtonTrigger = {
mode: string;
removeTriggers?: (boolean) | null;
selector: string;
};

Expand Down Expand Up @@ -2081,6 +2082,7 @@ export type PublicPageParameters = {
type?: (string) | null;
useGroupSearch?: (boolean) | null;
videoLink?: (string) | null;
zIndex?: (number) | null;
};

export type PublicPageSearchOptions = {
Expand Down
60 changes: 58 additions & 2 deletions frontends/dashboard/src/pages/dataset/PublicPageSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ const PublicPageControls = () => {
/>
</div>
<MultiStringInput
placeholder={`#search-icon,search`}
placeholder={`#search-icon,search,true`}
value={
extraParams.buttonTriggers?.map((trigger) => {
return `${trigger.selector},${trigger.mode}`;
Expand All @@ -569,10 +569,18 @@ const PublicPageControls = () => {
setExtraParams(
"buttonTriggers",
e.map((trigger) => {
const [selector, mode] = trigger.split(",");
const [selector, mode, replace] = trigger.split(",");
if (replace) {
return {
selector,
mode,
removeTriggers: replace === "true",
};
}
return {
selector,
mode,
removeTriggers: false,
};
}),
);
Expand Down Expand Up @@ -779,6 +787,54 @@ const PublicPageControls = () => {
options={["search", "chat"]}
/>
</div>
<div class="grow">
<div class="flex items-center gap-1">
<label class="block" for="">
Default Search Mode
</label>
<Tooltip
tooltipText="Set the initial search mode"
body={
<FaRegularCircleQuestion class="h-3 w-3 text-black" />
}
/>
</div>
<Select
display={(option) => option}
onSelected={(option) => {
setExtraParams("defaultSearchMode", option);
}}
class="bg-white py-1"
selected={extraParams.defaultSearchMode || "search"}
options={["search", "chat"]}
/>
</div>

<div class="grow">
<div class="flex items-center gap-1">
<label class="block" for="">
Z Index
</label>
<Tooltip
tooltipText="The z-index of the component modal"
body={
<FaRegularCircleQuestion class="h-3 w-3 text-black" />
}
/>
</div>
<input
type="number"
placeholder="1000"
value={extraParams.zIndex || 1000}
onInput={(e) => {
setExtraParams(
"zIndex",
parseInt(e.currentTarget.value),
);
}}
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"
/>
</div>

<div class="grow">
<div class="flex items-center gap-1">
Expand Down
3 changes: 3 additions & 0 deletions server/src/data/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3195,6 +3195,9 @@ impl DatasetConfigurationDTO {
brand_font_family: page_parameters_self
.brand_font_family
.or(page_parameters_curr.brand_font_family),
z_index: page_parameters_self
.z_index
.or(page_parameters_curr.z_index),
video_link: page_parameters_self
.video_link
.or(page_parameters_curr.video_link),
Expand Down
2 changes: 2 additions & 0 deletions server/src/handlers/page_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ pub struct PublicPageParameters {
#[serde(skip_serializing_if = "Option::is_none")]
pub brand_font_family: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub z_index: Option<i32>,
#[serde(skip_serializing_if = "Option::is_none")]
pub video_link: Option<String>,
}

Expand Down

0 comments on commit f8fed98

Please sign in to comment.