Skip to content

Revert "feat: Update ai chat button styles" #626

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

Merged
merged 1 commit into from
May 6, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ document.addEventListener("DOMContentLoaded", () => {
document.head.appendChild(inkeepScript);

// Configure and initialize the widget
const addInkeepWidget = ({ openChange }) => {
return Inkeep.ChatButton({
const addInkeepWidget = () => {
const inkeepWidget = Inkeep.ChatButton({
baseSettings: {
env: "production",
apiKey: "40582708b8a0305555fa91c049bb0dfa4e192337819bd03c", // required - replace with your own API key
Expand Down Expand Up @@ -44,6 +44,15 @@ document.addEventListener("DOMContentLoaded", () => {
},
],
},
onEvent: (event) => {
// analytics.track(event.eventName, event.properties);
if (
event.eventName === "modal_opened" &&
event.properties?.componentType === "ChatButton"
) {
window.dataLayer?.push({ event: "click_AiBot_floatBtn" });
}
},
},
aiChatSettings: {
aiAssistantName: "BNB Chain AI",
Expand All @@ -62,27 +71,10 @@ document.addEventListener("DOMContentLoaded", () => {
"Where can I find funding or grants?",
],
},
modalSettings: {
onOpenChange: openChange
}
});
};

inkeepScript.addEventListener("load", () => {
const widget = addInkeepWidget({
openChange(isOpen) {
widget.update?.({ modalSettings: { isOpen } });
}
});

const aiBotWrapper = document.querySelector('.ai-bot-wrapper');
if (aiBotWrapper) {
aiBotWrapper.addEventListener('click', () => {
widget.update?.({ modalSettings: { isOpen: true } });
window.dataLayer?.push({ event: "click_AiBot_floatBtn" });
});
} else {
console.warn('.ai-bot-wrapper element not found. Ensure it is rendered correctly.');
}
addInkeepWidget(); // initialize the widget
});
});
65 changes: 0 additions & 65 deletions docs/assets/style/components/ai-bot-button.css

This file was deleted.

3 changes: 1 addition & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -658,12 +658,11 @@ extra_css:
- assets/style/components/footer-nav.css
- assets/style/components/footer.css
- https://unpkg.com/katex@0.16.10/dist/katex.min.css
- assets/style/components/ai-bot-button.css

extra_javascript:
- assets/js/mathjax.js
- assets/js/custom.js
- assets/js/inkeep-custom-button.js
- assets/js/inkeep-button.js
- https://unpkg.com/mathjax@3.2.2/es5/tex-mml-chtml.js
- https://unpkg.com/katex@0.16.10/dist/katex.min.js
- https://unpkg.com/katex@0.16.10/dist/contrib/auto-render.min.js
Expand Down
8 changes: 0 additions & 8 deletions overrides/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,4 @@
© 2024 Bnbchain.org. All rights reserved.
</div>
</div>
<div class="ai-bot-wrapper">
<button type="button" class="ask-ai-button" aria-label="Toggle AI Chat">
Ask AI
<span>
<svg data-theme="dark" viewBox="0 0 24 25" focusable="false" aria-hidden="true"><path d="M10.5 6.58644L10.9459 7.82537C11.1908 8.5045 11.5824 9.12128 12.0929 9.63177C12.6034 10.1423 13.2202 10.5339 13.8993 10.7788L15.1383 11.2247C15.2501 11.2648 15.2501 11.4232 15.1383 11.4634L13.8992 11.9093C13.2201 12.1542 12.6033 12.5459 12.0929 13.0563C11.5824 13.5668 11.1908 14.1836 10.9459 14.8627L10.5 16.1016C10.4597 16.2135 10.3015 16.2135 10.2611 16.1016L9.81524 14.8627C9.57032 14.1836 9.17867 13.5669 8.66818 13.0564C8.1577 12.546 7.54093 12.1543 6.86182 11.9095L5.62306 11.4636C5.51106 11.4234 5.51106 11.265 5.62306 11.2248L6.86182 10.779C7.54095 10.5341 8.15773 10.1424 8.66821 9.63195C9.1787 9.12146 9.57034 8.50468 9.81524 7.82555L10.2611 6.58662C10.2699 6.56193 10.286 6.54056 10.3074 6.52545C10.3288 6.51034 10.3544 6.50222 10.3806 6.50222C10.4068 6.50222 10.4323 6.51034 10.4537 6.52545C10.4751 6.54056 10.4913 6.56193 10.5 6.58662V6.58644ZM16.0771 3.60937L16.3034 4.23657C16.5548 4.93239 17.1027 5.48102 17.7992 5.73239L18.4264 5.9587C18.439 5.96307 18.4499 5.97124 18.4576 5.98207C18.4653 5.9929 18.4694 6.00586 18.4694 6.01915C18.4694 6.03244 18.4653 6.0454 18.4576 6.05623C18.4499 6.06706 18.439 6.07523 18.4264 6.07959L17.7991 6.3059C17.4552 6.43009 17.1429 6.6285 16.8844 6.88703C16.6258 7.14555 16.4274 7.45785 16.3032 7.80173L16.0769 8.42875C16.0726 8.4413 16.0644 8.45218 16.0536 8.45988C16.0427 8.46758 16.0298 8.47171 16.0165 8.47171C16.0032 8.47171 15.9902 8.46758 15.9794 8.45988C15.9686 8.45218 15.9604 8.4413 15.956 8.42875L15.7297 7.80173C15.6055 7.45785 15.4071 7.14555 15.1486 6.88703C14.8901 6.6285 14.5778 6.43009 14.2339 6.3059L13.6069 6.07959C13.5943 6.07523 13.5835 6.06706 13.5758 6.05623C13.5681 6.0454 13.5639 6.03244 13.5639 6.01915C13.5639 6.00586 13.5681 5.9929 13.5758 5.98207C13.5835 5.97124 13.5943 5.96307 13.6069 5.9587L14.2339 5.73239C14.9297 5.48084 15.4784 4.93293 15.7297 4.23639L15.956 3.60937C15.9604 3.59682 15.9686 3.58594 15.9794 3.57824C15.9902 3.57054 16.0032 3.56641 16.0165 3.56641C16.0298 3.56641 16.0427 3.57054 16.0536 3.57824C16.0644 3.58594 16.0726 3.59682 16.0769 3.60937H16.0771ZM16.0771 14.2607L16.3034 14.8878C16.5548 15.5836 17.1027 16.1322 17.7992 16.3836L18.4264 16.6101C18.439 16.6144 18.4499 16.6226 18.4576 16.6334C18.4653 16.6443 18.4694 16.6572 18.4694 16.6705C18.4694 16.6838 18.4653 16.6968 18.4576 16.7076C18.4499 16.7184 18.439 16.7266 18.4264 16.731L17.7991 16.9571C17.4552 17.0813 17.1429 17.2797 16.8844 17.5382C16.6258 17.7968 16.4274 18.1091 16.3032 18.4529L16.0769 19.0799C16.0726 19.0925 16.0644 19.1034 16.0536 19.1111C16.0427 19.1188 16.0298 19.1229 16.0165 19.1229C16.0032 19.1229 15.9902 19.1188 15.9794 19.1111C15.9686 19.1034 15.9604 19.0925 15.956 19.0799L15.7297 18.4529C15.6055 18.1091 15.4071 17.7968 15.1486 17.5382C14.8901 17.2797 14.5778 17.0813 14.2339 16.9571L13.6071 16.7308C13.5945 16.7264 13.5836 16.7183 13.5759 16.7074C13.5682 16.6966 13.5641 16.6836 13.5641 16.6703C13.5641 16.6571 13.5682 16.6441 13.5759 16.6333C13.5836 16.6224 13.5945 16.6143 13.6071 16.6099L14.2341 16.3836C14.9299 16.1322 15.4785 15.5843 15.7299 14.8878L15.9562 14.2607C15.9606 14.2482 15.9688 14.2373 15.9796 14.2296C15.9904 14.2219 16.0034 14.2178 16.0167 14.2178C16.03 14.2178 16.0429 14.2219 16.0537 14.2296C16.0646 14.2373 16.0727 14.2482 16.0771 14.2607Z" fill="currentColor"></path></svg>
</span>
</button>
</div>
{% endblock %}