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 committed Dec 18, 2024
1 parent 377d330 commit e9c495d
Show file tree
Hide file tree
Showing 5 changed files with 75 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 @@ -2080,6 +2081,7 @@ export type PublicPageParameters = {
theme?: ((PublicPageTheme) | null);
type?: (string) | null;
useGroupSearch?: (boolean) | 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 @@ -760,6 +768,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),
}),
},
DISABLE_ANALYTICS: self
Expand Down
3 changes: 3 additions & 0 deletions server/src/handlers/page_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ pub struct OpenGraphMetadata {
pub struct ButtonTrigger {
selector: String,
mode: String,
remove_triggers: Option<bool>
}

#[derive(Serialize, Deserialize, Debug, Clone, ToSchema, Default)]
Expand Down Expand Up @@ -243,6 +244,8 @@ pub struct PublicPageParameters {
pub creator_linked_in_url: Option<String>,
#[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>,
}

#[utoipa::path(
Expand Down

0 comments on commit e9c495d

Please sign in to comment.