mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-06-29 11:24:19 +00:00
ui
# What does this PR do? ## Test Plan # What does this PR do? ## Test Plan # What does this PR do? ## Test Plan
This commit is contained in:
parent
114946ae88
commit
a4d84f7805
22 changed files with 821 additions and 38 deletions
40
llama_stack/ui/components/auth/login-button.tsx
Normal file
40
llama_stack/ui/components/auth/login-button.tsx
Normal file
|
@ -0,0 +1,40 @@
|
|||
import React from "react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { LucideIcon } from "lucide-react";
|
||||
|
||||
interface LoginButtonProps {
|
||||
provider: {
|
||||
id: string;
|
||||
name: string;
|
||||
icon: LucideIcon;
|
||||
loginPath: string;
|
||||
buttonColor?: string;
|
||||
};
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function LoginButton({ provider, className }: LoginButtonProps) {
|
||||
const handleLogin = async () => {
|
||||
// Add redirect_url parameter to tell backend where to redirect after OAuth
|
||||
const redirectUrl = `${window.location.origin}/auth/github/callback`;
|
||||
const loginUrl = `${provider.loginPath}?redirect_url=${encodeURIComponent(redirectUrl)}`;
|
||||
window.location.href = loginUrl;
|
||||
};
|
||||
|
||||
const Icon = provider.icon;
|
||||
|
||||
return (
|
||||
<Button
|
||||
onClick={handleLogin}
|
||||
className={cn(
|
||||
"w-full flex items-center justify-center gap-3",
|
||||
provider.buttonColor || "bg-gray-900 hover:bg-gray-800",
|
||||
className,
|
||||
)}
|
||||
>
|
||||
<Icon className="h-5 w-5" />
|
||||
<span>Continue with {provider.name}</span>
|
||||
</Button>
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue