Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat(web): gate empty-state Chrome CTA on browser or install

Richie McIlroye7881b9ee825
diff --git a/apps/web/app/(org)/dashboard/caps/components/EmptyCapState.tsx b/apps/web/app/(org)/dashboard/caps/components/EmptyCapState.tsx
index 627f00a2f..82f268932 100644
--- a/apps/web/app/(org)/dashboard/caps/components/EmptyCapState.tsx
+++ b/apps/web/app/(org)/dashboard/caps/components/EmptyCapState.tsx
@@ -1,6 +1,7 @@
import { Button } from "@cap/ui";
import { faDownload } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { useCapChromeExtension } from "hooks/useCapChromeExtension";
import { ChromeRecorderButton } from "@/components/ChromeRecorderButton";
import { CHROME_EXTENSION_BUTTON_CLASS } from "@/lib/chrome-extension";
import { useRive } from "@/lib/rive";
@@ -14,6 +15,8 @@ interface EmptyCapStateProps {
export const EmptyCapState: React.FC<EmptyCapStateProps> = ({ userName }) => {
const { theme } = useTheme();
+ const { isChromeBrowser, isInstalled } = useCapChromeExtension();
+ const showChromeButton = isChromeBrowser || isInstalled;
const { RiveComponent: EmptyCap } = useRive({
src: "/rive/main.riv",
artboard: theme === "light" ? "empty" : "darkempty",
@@ -44,10 +47,14 @@ export const EmptyCapState: React.FC<EmptyCapStateProps> = ({ userName }) => {
</Button>
<p className="text-sm text-gray-10">or</p>
<WebRecorderDialog />
- <p className="text-sm text-gray-10">or</p>
- <ChromeRecorderButton
- className={`${CHROME_EXTENSION_BUTTON_CLASS} font-medium`}
- />
+ {showChromeButton && (
+ <>
+ <p className="text-sm text-gray-10">or</p>
+ <ChromeRecorderButton
+ className={`${CHROME_EXTENSION_BUTTON_CLASS} font-medium`}
+ />
+ </>
+ )}
<p className="text-sm text-gray-10">or</p>
<UploadCapButton />
</div>