-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a2278e2
commit 65c3efe
Showing
12 changed files
with
208 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,28 @@ | ||
import { QueryErrorResetBoundary } from "@tanstack/react-query"; | ||
import { useEffect, useRef } from "react"; | ||
import { ErrorBoundary } from "react-error-boundary"; | ||
import { useResizeObserver } from "usehooks-ts"; | ||
import { routes } from "./routes"; | ||
import { useNavigationStore } from "./stores/navigationStore"; | ||
import { PluginContainer } from "./components/PluginContainer"; | ||
import { framer } from "framer-plugin"; | ||
|
||
function usePluginResizeObserver(ref: React.RefObject<HTMLDivElement>) { | ||
const { width = 260, height = 95 } = useResizeObserver({ | ||
ref, | ||
box: "content-box", | ||
}); | ||
|
||
useEffect(() => { | ||
framer.showUI({ | ||
title: "Semrush", | ||
width, | ||
height, | ||
}); | ||
}, [width, height]); | ||
|
||
return { width, height }; | ||
} | ||
import { Router } from "./pages/router"; | ||
|
||
export function App() { | ||
const pathname = useNavigationStore((state) => state.pathname); | ||
const ref = useRef(null); | ||
usePluginResizeObserver(ref); | ||
|
||
const { | ||
title, | ||
element: Page, | ||
displayAsSmall, | ||
} = routes[pathname] || routes["/"]; | ||
|
||
return ( | ||
<PluginContainer ref={ref} title={title} isSmall={displayAsSmall}> | ||
<QueryErrorResetBoundary> | ||
{({ reset }) => ( | ||
<ErrorBoundary | ||
onReset={reset} | ||
fallbackRender={({ resetErrorBoundary, error }) => ( | ||
<div className="col-lg justify-center items-center w-full"> | ||
<p className="text-framer-red">{error.message}</p> | ||
<button | ||
className="bg-transparent hover:bg-transparent active:bg-transparent text-blue-600 outline-none" | ||
onClick={() => resetErrorBoundary()} | ||
> | ||
Try again | ||
</button> | ||
</div> | ||
)} | ||
> | ||
<Page /> | ||
</ErrorBoundary> | ||
)} | ||
</QueryErrorResetBoundary> | ||
</PluginContainer> | ||
<QueryErrorResetBoundary> | ||
{({ reset }) => ( | ||
<ErrorBoundary | ||
onReset={reset} | ||
fallbackRender={({ resetErrorBoundary, error }) => ( | ||
<div className="col-lg justify-center items-center w-full"> | ||
<p className="text-framer-red">{error.message}</p> | ||
<button | ||
className="bg-transparent hover:bg-transparent active:bg-transparent text-blue-600 outline-none" | ||
onClick={() => resetErrorBoundary()} | ||
> | ||
Try again | ||
</button> | ||
</div> | ||
)} | ||
> | ||
<Router /> | ||
</ErrorBoundary> | ||
)} | ||
</QueryErrorResetBoundary> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
plugins/semrush/src/pages/audit/Report.tsx → ...semrush/src/pages/audit/report/Report.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export function AuditReportIssues() { | ||
return <div>Audit report issues</div>; | ||
} |
Oops, something went wrong.