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

Disclaimer updated so text and background colors can be configured. #276

Merged
merged 1 commit into from
Nov 23, 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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ You can also customize chatbot with different configuration
disclaimer: {
title: 'Disclaimer',
message: 'By using this chatbot, you agree to the <a target="_blank" href="https://flowiseai.com/terms">Terms & Condition</a>',
textColor: 'black',
buttonColor: '#3b82f6',
buttonText: 'Start Chatting',
buttonTextColor: 'white',
blurredBackgroundColor: 'rgba(0, 0, 0, 0.4)', //The color of the blurred background that overlays the chat interface
backgroundColor: 'white',
},
chatWindow: {
showTitle: true,
Expand Down
2 changes: 1 addition & 1 deletion dist/components/Bot.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions dist/features/bubble/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,12 @@ export type autoWindowOpenTheme = {
export type DisclaimerPopUpTheme = {
title?: string;
message?: string;
textColor?: string;
buttonColor?: string;
buttonTextColor?: string;
buttonText?: string;
blurredBackgroundColor?: string;
backgroundColor?: string;
};
export type DateTimeToggleTheme = {
date?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion dist/features/bubble/types.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions dist/features/popup/components/DisclaimerPopup.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ export type DisclaimerPopupProps = {
title?: string;
message?: string;
buttonText?: string;
blurredBackgroundColor?: string;
backgroundColor?: string;
buttonColor?: string;
textColor?: string;
buttonTextColor?: string;
};
export declare const DisclaimerPopup: (props: DisclaimerPopupProps) => import("solid-js").JSX.Element;
//# sourceMappingURL=DisclaimerPopup.d.ts.map
2 changes: 1 addition & 1 deletion dist/features/popup/components/DisclaimerPopup.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions dist/web.js

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions src/components/Bot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1629,7 +1629,12 @@ export const Bot = (botProps: BotProps & { class?: string }) => {
onAccept={handleDisclaimerAccept}
title={props.disclaimer?.title}
message={props.disclaimer?.message}
textColor={props.disclaimer?.textColor}
buttonColor={props.disclaimer?.buttonColor}
buttonText={props.disclaimer?.buttonText}
buttonTextColor={props.disclaimer?.buttonTextColor}
blurredBackgroundColor={props.disclaimer?.blurredBackgroundColor}
backgroundColor={props.disclaimer?.backgroundColor}
/>
)}
</>
Expand Down
5 changes: 5 additions & 0 deletions src/features/bubble/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,12 @@ export type autoWindowOpenTheme = {
export type DisclaimerPopUpTheme = {
title?: string;
message?: string;
textColor?: string;
buttonColor?: string;
buttonTextColor?: string;
buttonText?: string;
blurredBackgroundColor?: string;
backgroundColor?: string;
};

export type DateTimeToggleTheme = {
Expand Down
40 changes: 32 additions & 8 deletions src/features/popup/components/DisclaimerPopup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,53 @@ export type DisclaimerPopupProps = {
title?: string;
message?: string;
buttonText?: string;
blurredBackgroundColor?: string;
backgroundColor?: string;
buttonColor?: string;
textColor?: string;
buttonTextColor?: string;
};

export const DisclaimerPopup = (props: DisclaimerPopupProps) => {
const [popupProps] = splitProps(props, ['onAccept', 'isOpen', 'title', 'message', 'buttonText']);
const [popupProps] = splitProps(props, [
'onAccept',
'isOpen',
'title',
'message',
'textColor',
'buttonColor',
'buttonText',
'buttonTextColor',
'blurredBackgroundColor',
'backgroundColor',
]);

const handleAccept = () => {
props.onAccept?.();
popupProps.onAccept?.();
};

return (
<Show when={popupProps.isOpen}>
<div class="fixed inset-0 rounded-lg flex items-center justify-center bg-black bg-opacity-40 backdrop-blur-sm z-50">
<div class="bg-white p-10 rounded-lg shadow-lg max-w-md w-full text-center mx-4 font-sans">
<h2 class="text-2xl font-semibold mb-4 flex justify-center items-center">{popupProps.title ?? 'Disclaimer'}</h2>
<div
class="fixed inset-0 rounded-lg flex items-center justify-center backdrop-blur-sm z-50"
style={{ background: popupProps.blurredBackgroundColor || 'rgba(0, 0, 0, 0.4)' }}
>
<div class="p-10 rounded-lg shadow-lg max-w-md w-full text-center mx-4 font-sans"
style={{ background: popupProps.backgroundColor || 'white', color: popupProps.textColor || 'black' }}>
<h2 class="text-2xl font-semibold mb-4 flex justify-center items-center">
{popupProps.title ?? 'Disclaimer'}
</h2>

<p
class="text-gray-700 text-base mb-6"
innerHTML={popupProps.message ?? 'By using this chatbot, you acknowledge and accept these terms.'}
style={{ color: popupProps.textColor || 'black' }}
innerHTML={popupProps.message ?? 'By using this chatbot, you agree to the <a target="_blank" href="https://flowiseai.com/terms">Terms & Condition</a>.'}
/>

<div class="flex justify-center">
<button
class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-6 rounded focus:outline-none focus:shadow-outline"
class="font-bold py-2 px-6 rounded focus:outline-none focus:shadow-outline"
style={{ background: popupProps.buttonColor || '#3b82f6', color: popupProps.buttonTextColor || 'white' }}
onClick={handleAccept}
>
{popupProps.buttonText ?? 'Start Chatting'}
Expand All @@ -38,4 +62,4 @@ export const DisclaimerPopup = (props: DisclaimerPopupProps) => {
</div>
</Show>
);
};
};