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

Fix Mendable Floating Button Logo #1568

Closed
karl-cardenas-coding opened this issue Sep 19, 2023 · 4 comments
Closed

Fix Mendable Floating Button Logo #1568

karl-cardenas-coding opened this issue Sep 19, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@karl-cardenas-coding
Copy link
Contributor

The Mendable floating button does not display the specified assets.

@karl-cardenas-coding karl-cardenas-coding added the bug Something isn't working label Sep 19, 2023
@nagesh161007
Copy link
Contributor

Hi @karl-cardenas-coding, I've created a solution for this issue, but I can't push my changes since I don't have write permissions for this repository. I'm no longer part of the Spectrocloud organization on GitHub. Should I fork this repository and create pull request. Meanwhile I am posting changes for Mendable AI widget here. Moved icon and botIcon outside floatingButton in config and removed imports and directly used image urls


import { useEffect } from "react";
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
import useBaseUrl from "@docusaurus/useBaseUrl";

export const MENDABLE_SCRIPT_URL =
  "https://unpkg.com/@mendable/search@0.0.155/dist/umd/mendable-bundle.min.js";

export default function MendableAIWidget() {
  const {
    siteConfig: { customFields },
  } = useDocusaurusContext();

  const logoUrl = useBaseUrl("/spectrocloud-logo.png");
  const botUrl = useBaseUrl("/spectrocloud-logo-black.svg");

  useEffect(() => {
    const script = document.createElement("script");
    script.src = MENDABLE_SCRIPT_URL;
    script.defer = true;

    setTimeout(() => {
      document.body.appendChild(script);
    }, 500);

    script.onload = () => {
      if (window.Mendable) {
        window.Mendable.initialize({
          anon_key: customFields?.mendableKey,
          type: "floatingButton",
          dialogPlaceholder: "What is Palette?",
          cmdShortcutKey: "l",
          icon: logoUrl,
          botIcon: botUrl,
          floatingButtonStyle: {
            color: "#FFFFFF",
            backgroundColor: "#3E4FB5",
          },
          isPinnable: true,
          style: { accentColor: "#3E4FB5" },
        });
      }
    };

    return () => {
      document.body.removeChild(script);
    };
  }, []);

  return null;
}


@karl-cardenas-coding
Copy link
Contributor Author

Hi @nagesh161007 , ahhh that's right. Hm, yeah let's try the fork route. I can approve the CI workflow for the fork.

@nagesh161007
Copy link
Contributor

Hi @karl-cardenas-coding , I am not sure why Github CI/CD actions were failing for my PR. I think that environment variables are not getting loaded properly for PR from fork.

@karl-cardenas-coding
Copy link
Contributor Author

@nagesh161007 That's exactly why. GitHub automatically removes CI variables in forked CI actions. A different workflow is needed to allow fork runs to start

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants