Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
vernondegoede committed Mar 3, 2024
1 parent 76a3fe4 commit 8da34c3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions copilot-widget/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ <h2>
<div id="opencopilot-root"></div>

<script>
const token = "9Mq2t3kepm1F5Akr";
const apiUrl = "https://api.opencopilot.so/backend";
const socketUrl = "https://api.opencopilot.so";
const token = "NtITS4Z07ZrdctTN";
const apiUrl = "http://localhost:8888/backend";
const socketUrl = "http://localhost:8888";
const sharedConfig = {
initialMessage: "Hey there! How can we help you today?", // optional
initialMessage: "Welcome back! How can I help you today?", // optional
token: token, // required
apiUrl: apiUrl, // required
socketUrl: socketUrl, // required
Expand Down
6 changes: 3 additions & 3 deletions copilot-widget/lib/CopilotWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ import { useEffect, useRef } from "react";
import { useWidgetState } from "./contexts/WidgetState";
import cn from "./utils/cn";
import ChatScreen from "./screens/ChatScreen";
import { IsServer } from "./utils/isServer.ts";
import { isServer } from "./utils/isServer.ts";
import { MessageCircle } from "lucide-react";

function useTrigger(selector?: string, toggle?: () => void) {
const trigger = useRef<HTMLElement | null>(
!selector ? null : IsServer ? null : document.querySelector(selector)
!selector ? null : isServer ? null : document.querySelector(selector)
).current;

useEffect(() => {
if (!selector) {
return;
}

if (trigger && !IsServer) {
if (trigger && !isServer) {
trigger.addEventListener("click", () => toggle?.());
return () => trigger.removeEventListener("click", () => toggle?.());
} else {
Expand Down
2 changes: 1 addition & 1 deletion copilot-widget/lib/utils/isServer.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const IsServer = typeof window === "undefined";
export const isServer = typeof window === "undefined";

0 comments on commit 8da34c3

Please sign in to comment.