Skip to content

Commit

Permalink
Add temporary logging
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonyec committed Sep 18, 2024
1 parent 7d7927d commit a2060c5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion plugins/hubspot/src/pages/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Logo } from "../components/Logo"
import { ChartIcon, FormsIcon, PersonIcon, MessageIcon, LightningIcon, WidgetsIcon } from "../components/Icons"
import { framer } from "framer-plugin"
import cx from "classnames"
import { BASE_PATH } from "../router"

const MenuOption = ({
icon,
Expand All @@ -22,7 +23,7 @@ const MenuOption = ({
return (
<button
className={cx("h-[110px] w-full tile col items-center justify-center rounded-md", className)}
onClick={() => (onClick ? onClick() : navigate(to))}
onClick={() => (onClick ? onClick() : navigate(`${BASE_PATH}${to}`))}
>
{icon}
<p className="font-semibold text-tertiary">{title}</p>
Expand Down
5 changes: 3 additions & 2 deletions plugins/hubspot/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useLocation } from "wouter"
import auth from "../auth"
import { Button } from "../components/Button"
import { Logo } from "../components/Logo"
import { BASE_PATH } from "../router"

export function AuthenticatePage() {
const [, navigate] = useLocation()
Expand All @@ -15,7 +16,7 @@ export function AuthenticatePage() {
const isAuth = await auth.isAuthenticated()

if (isAuth) {
navigate("/menu")
navigate(`${BASE_PATH}/menu`)
}
}

Expand Down Expand Up @@ -53,7 +54,7 @@ export function AuthenticatePage() {
// Poll the auth server and wait for tokens
await pollForTokens(authorization.readKey)

navigate("/menu")
navigate(`${BASE_PATH}/menu`)
} catch (e) {
framer.notify(e instanceof Error ? e.message : "An unknown error occurred.", { variant: "error" })
} finally {
Expand Down
5 changes: 4 additions & 1 deletion plugins/hubspot/src/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { WidgetsPage } from "./pages/Widgets"
import { PageErrorBoundaryFallback } from "./components/PageErrorBoundaryFallback"
import { isLocal } from "./auth"

const BASE_PATH = isLocal() ? "" : "/hubspot"
export const BASE_PATH = isLocal() ? "" : "/hubspot"

interface PluginRoute {
path: string
Expand Down Expand Up @@ -108,9 +108,12 @@ function useRoutes(routes: PluginRoute[]) {

const addToMatch = (route: PluginRoute, parentPath = "") => {
const fullPath = BASE_PATH + parentPath + route.path
console.log({ fullPath })

// eslint-disable-next-line react-hooks/rules-of-hooks
const match = useRoute(fullPath)
matches.push({ match, route: { ...route, path: fullPath } })
console.log({ match, matches })

if (route.children) {
for (const child of route.children) {
Expand Down

0 comments on commit a2060c5

Please sign in to comment.