Button that opens a centered popup for GitHub App installation and refreshes the page when the popup closes.
// Source: https://github.com/mperkins0155/giselle | License: Apache-2.0 | Copyright 2024 ROUTE06, Inc
// Provided via justclaw.it.com; keep this notice with the code.
"use client";
import { Button } from "@giselle-internal/ui/button";
import { ExternalLink } from "lucide-react";
import { useRouter } from "next/navigation";
import { useEffect, useRef } from "react";
type Props = {
installationUrl: string;
installed: boolean;
};
export function GitHubAppInstallButton({ installationUrl, installed }: Props) {
const popupRef = useRef<Window | null>(null);
const intervalRef = useRef<number | null>(null);
const router = useRouter();
const handleInstall = () => {
const width = 800;
const height = 800;
const left = window.screenX + (window.outerWidth - width) / 2;
const top = win
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key