Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

styling: mobile chat modal fixes #2964

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion clients/search-component/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ declare module "solid-js" {
| problemLink | string (example: "mailto:[email protected]?subject=") | null |
| responsive | boolean | false |
| floatingButtonPosition | "top-left", "top-right", "bottom-left", or "bottom-right" | "bottom-right" |
| showFloatingButton | boolean | false |
| showFloatingButton | boolean | false |
| buttonTriggers | { selector: "query-selector", mode: "chat" | "search" }[] | [] |

### Search Results

Expand Down
2 changes: 1 addition & 1 deletion clients/search-component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"import": "./dist/vanilla/index.js"
}
},
"version": "0.2.27",
"version": "0.2.28",
"license": "MIT",
"homepage": "https://github.com/devflowinc/trieve/tree/main/clients/search-component",
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const AIInitialMessage = () => {
I'm an AI assistant with access to documentation, help articles, and
other content.
</p>
<p>
<p className="brand-paragraph">
Ask me anything about{" "}
<span
style={{
Expand Down
6 changes: 5 additions & 1 deletion clients/search-component/src/TrieveModal/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -498,8 +498,12 @@ body {
}
}

.brand-paragraph {
@apply leading-8;
}

.brand-name {
@apply text-white px-1.5 py-1 rounded-md font-[500] whitespace-nowrap leading-8;
@apply text-white px-1.5 py-1 rounded-md font-[500] whitespace-nowrap text-ellipsis;
}
}
}
Expand Down
22 changes: 22 additions & 0 deletions clients/ts-sdk/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -6967,6 +6967,21 @@
}
}
},
"ButtonTrigger": {
"type": "object",
"required": [
"selector",
"mode"
],
"properties": {
"mode": {
"type": "string"
},
"selector": {
"type": "string"
}
}
},
"CTRAnalytics": {
"oneOf": [
{
Expand Down Expand Up @@ -12276,6 +12291,13 @@
"type": "string",
"nullable": true
},
"buttonTriggers": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ButtonTrigger"
},
"nullable": true
},
"chat": {
"type": "boolean",
"nullable": true
Expand Down
2 changes: 1 addition & 1 deletion clients/ts-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"files": [
"dist"
],
"version": "0.0.44",
"version": "0.0.45",
"license": "MIT",
"scripts": {
"lint": "eslint 'src/**/*.ts'",
Expand Down
6 changes: 6 additions & 0 deletions clients/ts-sdk/src/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ export type BulkDeleteChunkPayload = {
filter: ChunkFilter;
};

export type ButtonTrigger = {
mode: string;
selector: string;
};

export type CTRAnalytics = {
filter?: ((SearchAnalyticsFilter) | null);
type: 'search_ctr_metrics';
Expand Down Expand Up @@ -2045,6 +2050,7 @@ export type PublicPageParameters = {
brandFontFamily?: (string) | null;
brandLogoImgSrcUrl?: (string) | null;
brandName?: (string) | null;
buttonTriggers?: Array<ButtonTrigger> | null;
chat?: (boolean) | null;
creatorLinkedInUrl?: (string) | null;
creatorName?: (string) | null;
Expand Down
35 changes: 34 additions & 1 deletion frontends/dashboard/src/pages/dataset/PublicPageSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,40 @@ const PublicPageControls = () => {
inputClass="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 />
<div class="grow">
<div class="flex items-center gap-1">
<label class="block" for="">
Button Triggers
</label>
<Tooltip
tooltipText="UI elements that can trigger the search component to open. Each field has a selector and mode (search/chat) separated by commas."
body={<FaRegularCircleQuestion class="h-3 w-3 text-black" />}
/>
</div>
<MultiStringInput
placeholder={`#search-icon,search`}
value={
extraParams.buttonTriggers?.map((trigger) => {
return `${trigger.selector},${trigger.mode}`;
}) ?? []
}
onChange={(e) => {
setExtraParams(
"buttonTriggers",
e.map((trigger) => {
const [selector, mode] = trigger.split(",");
return {
selector,
mode,
};
}),
);
}}
addLabel="Add Trigger"
addClass="text-sm"
inputClass="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">
<label class="block">Placeholder Text</label>
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 @@ -3153,6 +3153,9 @@ impl DatasetConfigurationDTO {
show_floating_button: page_parameters_self
.show_floating_button
.or(page_parameters_curr.show_floating_button),
button_triggers: page_parameters_self
.button_triggers
.or(page_parameters_curr.button_triggers),
debounce_ms: page_parameters_self
.debounce_ms
.or(page_parameters_curr.debounce_ms),
Expand Down
9 changes: 9 additions & 0 deletions server/src/handlers/page_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@ pub struct OpenGraphMetadata {
description: Option<String>,
}

#[derive(Serialize, Deserialize, Debug, Clone, ToSchema, Default)]
#[serde(rename_all = "camelCase")]
pub struct ButtonTrigger {
selector: String,
mode: String,
}

#[derive(Serialize, Deserialize, Debug, Clone, ToSchema, Default)]
#[serde(rename_all = "camelCase")]
pub struct SingleProductOptions {
Expand Down Expand Up @@ -217,6 +224,8 @@ pub struct PublicPageParameters {
#[serde(skip_serializing_if = "Option::is_none")]
pub show_floating_button: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub button_triggers: Option<Vec<ButtonTrigger>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub debounce_ms: Option<i32>,
#[serde(skip_serializing_if = "Option::is_none")]
pub hero_pattern: Option<HeroPattern>,
Expand Down
1 change: 1 addition & 0 deletions server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ impl Modify for SecurityAddon {
operators::crawl_operator::Metadata,
operators::crawl_operator::Sitemap,
handlers::stripe_handler::CreateSetupCheckoutSessionResPayload,
handlers::page_handler::ButtonTrigger,
handlers::page_handler::PublicPageSearchOptions,
handlers::page_handler::OpenGraphMetadata,
handlers::page_handler::SingleProductOptions,
Expand Down
4 changes: 2 additions & 2 deletions server/src/public/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<link rel="stylesheet" href="/static/output.css" />
<link
rel="stylesheet"
href="https://unpkg.com/[email protected].27/dist/index.css"
href="https://unpkg.com/[email protected].28/dist/index.css"
/>
<link
rel="apple-touch-icon"
Expand Down Expand Up @@ -274,7 +274,7 @@
</style>

<script type="module">
import {renderToDiv} from 'https://unpkg.com/[email protected].27/dist/vanilla/index.js';
import {renderToDiv} from 'https://unpkg.com/[email protected].28/dist/vanilla/index.js';
const root = document.getElementById('root');
renderToDiv(root, {
... {{params | tojson}}
Expand Down
4 changes: 2 additions & 2 deletions server/src/public/product.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ <h3 class="text-sm font-medium text-gray-900 mt-4">

<section
aria-labelledby="related-heading"
class="border-t border-gray-200 px-4 mt-4 sm:px-0"
class="border-t border-gray-200 mt-4"
>
<div class="recs-section">
<h2
Expand All @@ -72,7 +72,7 @@ <h4 class="text-sm text-gray-500 mt-2 w-fit">
</h4>

<div
class="recs mt-6 flex flex-nowrap overflow-x-auto gap-x-4 sm:gap-x-6 xl:gap-x-8 py-2 mx-4 sm:mx-6 lg:mx-8"
class="recs mt-6 flex flex-nowrap overflow-x-auto gap-x-4 sm:gap-x-6 xl:gap-x-8 py-2 mr-4 sm:mr-6 lg:mr-8"
>
{% for i in range(5) %}
<div class="w-64 flex-shrink-0">
Expand Down
11 changes: 6 additions & 5 deletions server/src/public/search-component-code.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<code class="language-javascript">
&lt;link
rel="stylesheet"
href="https://unpkg.com/[email protected].15/dist/index.css"
href="https://unpkg.com/[email protected].27/dist/index.css"
/&gt;

&lt;script type="module"&gt;
import {renderToDiv} from 'https://unpkg.com/[email protected].15/dist/vanilla/index.js';
import {renderToDiv} from 'https://unpkg.com/[email protected].27/dist/vanilla/index.js';
window.addEventListener('load', () => {
const root = document.getElementById('root');
renderToDiv(root,
Expand All @@ -29,7 +29,7 @@
analytics: {{ params.analytics }},
{% endif -%}
{% if params.tags -%}
tags: {{ params.tags }},
tags: {{ params.tags | tojson }},
{% endif -%}
{% if params.responsive -%}
responsive: {{ params.responsive }},
Expand Down Expand Up @@ -85,13 +85,14 @@
{% if params.floatingButtongPosition -%}
floatingButtongPosition: "{{ params.floatingButtongPosition }}",
{% endif -%}
{% if params.buttonTriggers -%}
buttonTriggers: {{ params.buttonTriggers }},
{% endif -%}
{% if params.debounceMs -%}
debounceMs: {{ params.debounceMs }},
{% endif -%}

)
});
&lt;/script&gt;

</code>
</pre>
20 changes: 6 additions & 14 deletions server/static/output.css
Original file line number Diff line number Diff line change
Expand Up @@ -571,11 +571,6 @@ video {
margin-bottom: -1rem;
}

.mx-4 {
margin-left: 1rem;
margin-right: 1rem;
}

.mx-auto {
margin-left: auto;
margin-right: auto;
Expand All @@ -585,6 +580,10 @@ video {
margin-top: -0.5rem;
}

.mr-4 {
margin-right: 1rem;
}

.mt-0\.5 {
margin-top: 0.125rem;
}
Expand Down Expand Up @@ -930,8 +929,7 @@ video {
}

@media (min-width: 640px) {
.sm\:mx-6 {
margin-left: 1.5rem;
.sm\:mr-6 {
margin-right: 1.5rem;
}

Expand Down Expand Up @@ -964,11 +962,6 @@ video {
column-gap: 1.5rem;
}

.sm\:px-0 {
padding-left: 0px;
padding-right: 0px;
}

.sm\:px-6 {
padding-left: 1.5rem;
padding-right: 1.5rem;
Expand All @@ -990,8 +983,7 @@ video {
}

@media (min-width: 1024px) {
.lg\:mx-8 {
margin-left: 2rem;
.lg\:mr-8 {
margin-right: 2rem;
}

Expand Down
Loading