2024-12-02 21:53:22 +00:00
|
|
|
import { IconButton } from '~/components/ui/IconButton';
|
|
|
|
import { useGit } from '~/lib/hooks/useGit';
|
2024-11-25 14:23:54 +00:00
|
|
|
|
|
|
|
export default function GitCloneButton() {
|
2024-12-02 21:53:22 +00:00
|
|
|
const { ready, gitClone } = useGit();
|
|
|
|
const onClick = async (_e: any) => {
|
|
|
|
if (!ready) {
|
|
|
|
return;
|
2024-11-25 14:23:54 +00:00
|
|
|
}
|
2024-12-02 21:53:22 +00:00
|
|
|
|
|
|
|
const repoUrl = prompt('Enter the Git url');
|
|
|
|
|
|
|
|
if (repoUrl) {
|
|
|
|
await gitClone(repoUrl);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2024-11-25 14:23:54 +00:00
|
|
|
return (
|
2024-12-02 21:53:22 +00:00
|
|
|
<IconButton
|
|
|
|
onClick={(e) => {
|
|
|
|
onClick(e);
|
|
|
|
}}
|
|
|
|
className="w-full justify-center"
|
|
|
|
title="Clone A Git Repo"
|
|
|
|
>
|
|
|
|
<span className="mr-2 text-xs lg:text-sm">Clone A Git Repo</span>
|
|
|
|
<div className="i-ph:git-branch" />
|
2024-11-25 14:23:54 +00:00
|
|
|
</IconButton>
|
2024-12-02 21:53:22 +00:00
|
|
|
);
|
2024-11-25 14:23:54 +00:00
|
|
|
}
|