mirror of
https://github.com/eigent-ai/eigent.git
synced 2026-08-17 20:53:30 +00:00
enhance: PR382 Update refer-a-friend invite link generation
This commit is contained in:
parent
c095001da1
commit
c47fbfccff
2 changed files with 14 additions and 18 deletions
|
|
@ -43,16 +43,9 @@ export async function installCommandTool() {
|
|||
|
||||
console.log(`start install ${toolName}`);
|
||||
const isSuccess = await runInstallScript(scriptName);
|
||||
const mainWindow = getMainWindow();
|
||||
if (mainWindow && !mainWindow.isDestroyed() && !isSuccess) {
|
||||
mainWindow.webContents.send('install-dependencies-complete', {
|
||||
success: false,
|
||||
code: 2,
|
||||
error: `${toolName} installation failed (script exit code 2)`,
|
||||
});
|
||||
}
|
||||
const installed = await isBinaryExists(toolName);
|
||||
|
||||
const mainWindow = getMainWindow();
|
||||
if (mainWindow && !mainWindow.isDestroyed()) {
|
||||
if (installed) {
|
||||
mainWindow.webContents.send('install-dependencies-log', {
|
||||
|
|
@ -63,7 +56,7 @@ export async function installCommandTool() {
|
|||
mainWindow.webContents.send('install-dependencies-complete', {
|
||||
success: false,
|
||||
code: 2,
|
||||
error: `${toolName} installation failed (script exit code 2)`,
|
||||
error: `${toolName} installation failed`,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,17 +112,20 @@ function HeaderWin() {
|
|||
chatStore.tasks[chatStore.activeTaskId as string]?.summaryTask,
|
||||
]);
|
||||
|
||||
const getReferFriendsLink = () => {
|
||||
proxyFetchGet("/api/user/invite_code").then((res: any) => {
|
||||
console.log(res);
|
||||
const getReferFriendsLink = async () => {
|
||||
try {
|
||||
const res: any = await proxyFetchGet("/api/user/invite_code");
|
||||
if (res?.invite_code) {
|
||||
const inviteCode =`https://www.eigent.ai/signup?invite_code=${res.invite_code}`;
|
||||
navigator.clipboard.writeText(inviteCode);
|
||||
toast.success("Invitation code copied!");
|
||||
const inviteLink = `https://www.eigent.ai/signup?invite_code=${res.invite_code}`;
|
||||
await navigator.clipboard.writeText(inviteLink);
|
||||
toast.success("Invitation link copied!");
|
||||
} else {
|
||||
toast.error("Failed to get invite code");
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Failed to get referral link:", error);
|
||||
toast.error("Failed to get invitation link");
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
|
|
@ -166,7 +169,7 @@ function HeaderWin() {
|
|||
</Button>
|
||||
{location.pathname !== "/history" && (
|
||||
<>
|
||||
{activeTaskTitle === "New Project" ? (
|
||||
{activeTaskTitle === t("chat.new-project") ? (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
|
|
@ -177,7 +180,7 @@ function HeaderWin() {
|
|||
</Button>
|
||||
) : (
|
||||
<div className="font-bold leading-10 text-base min-w-10 max-w-56 truncate">
|
||||
{t("chat.new-project")}
|
||||
{activeTaskTitle}
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue