diff --git a/src/app/(app)/auto-triage/AutoTriagePageClient.tsx b/src/app/(app)/auto-triage/AutoTriagePageClient.tsx deleted file mode 100644 index 2d3b9357a..000000000 --- a/src/app/(app)/auto-triage/AutoTriagePageClient.tsx +++ /dev/null @@ -1,132 +0,0 @@ -'use client'; - -import { useEffect } from 'react'; -import { toast } from 'sonner'; -import { AutoTriageConfigForm } from '@/components/auto-triage/AutoTriageConfigForm'; -import { AutoTriageTicketsCard } from '@/components/auto-triage/AutoTriageTicketsCard'; -import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert'; -import { Badge } from '@/components/ui/badge'; -import { Button } from '@/components/ui/button'; -import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; -import { Rocket, ExternalLink, Settings2, ListChecks } from 'lucide-react'; -import { useTRPC } from '@/lib/trpc/utils'; -import { useQuery } from '@tanstack/react-query'; -import Link from 'next/link'; - -type AutoTriagePageClientProps = { - userId: string; - userName: string; - successMessage?: string; - errorMessage?: string; -}; - -export function AutoTriagePageClient({ - userId: _userId, - userName: _userName, - successMessage, - errorMessage, -}: AutoTriagePageClientProps) { - const trpc = useTRPC(); - - // Fetch GitHub App installation status - const { data: statusData, isLoading: isStatusLoading } = useQuery( - trpc.personalAutoTriage.getGitHubStatus.queryOptions() - ); - - const isGitHubAppInstalled = statusData?.connected && statusData?.integration?.isValid; - - // Show toast messages from URL params - useEffect(() => { - if (successMessage === 'github_connected') { - toast.success('GitHub account connected successfully'); - } - if (errorMessage) { - toast.error('An error occurred', { - description: errorMessage.replace(/_/g, ' '), - }); - } - }, [successMessage, errorMessage]); - - return ( -
- {/* Header */} -
-
-

Auto Triage

- beta -
-

- Automatically triage GitHub issues with Al-powered analysis -

- - Learn how to use it - - -
- - {/* GitHub App Required Alert */} - {!isStatusLoading && !isGitHubAppInstalled && ( - - - GitHub App Required - -

- The Kilo GitHub App must be installed to use Auto Triage. The app automatically - manages workflows and triggers triage on your issues. -

- - - -
-
- )} - - {/* Tabbed Content */} - - - - - Config - - - - Tickets - - - - {/* Configuration Tab */} - - - - - {/* Tickets Tab */} - - {isStatusLoading || isGitHubAppInstalled ? ( - - ) : ( - - - No Tickets Yet - - Install the GitHub App and configure your auto-triage settings to see triage tickets - here. - - - )} - - -
- ); -} diff --git a/src/app/(app)/auto-triage/page.tsx b/src/app/(app)/auto-triage/page.tsx index d2daf867e..1356b5dfe 100644 --- a/src/app/(app)/auto-triage/page.tsx +++ b/src/app/(app)/auto-triage/page.tsx @@ -1,5 +1,5 @@ import { getUserFromAuthOrRedirect } from '@/lib/user.server'; -import { AutoTriagePageClient } from './AutoTriagePageClient'; +import { AutoTriagePageClient } from '@/components/auto-triage/AutoTriagePageClient'; type AutoTriagePageProps = { searchParams: Promise<{ success?: string; error?: string }>; @@ -7,14 +7,7 @@ type AutoTriagePageProps = { export default async function PersonalAutoTriagePage({ searchParams }: AutoTriagePageProps) { const search = await searchParams; - const user = await getUserFromAuthOrRedirect('/users/sign_in?callbackPath=/auto-triage'); + await getUserFromAuthOrRedirect('/users/sign_in?callbackPath=/auto-triage'); - return ( - - ); + return ; } diff --git a/src/app/(app)/organizations/[id]/auto-triage/page.tsx b/src/app/(app)/organizations/[id]/auto-triage/page.tsx index f2f3b1372..12eb54f56 100644 --- a/src/app/(app)/organizations/[id]/auto-triage/page.tsx +++ b/src/app/(app)/organizations/[id]/auto-triage/page.tsx @@ -1,5 +1,5 @@ import { OrganizationByPageLayout } from '@/components/organizations/OrganizationByPageLayout'; -import { AutoTriagePageClient } from './AutoTriagePageClient'; +import { AutoTriagePageClient } from '@/components/auto-triage/AutoTriagePageClient'; type AutoTriagePageProps = { params: Promise<{ id: string }>; diff --git a/src/app/(app)/organizations/[id]/auto-triage/AutoTriagePageClient.tsx b/src/components/auto-triage/AutoTriagePageClient.tsx similarity index 84% rename from src/app/(app)/organizations/[id]/auto-triage/AutoTriagePageClient.tsx rename to src/components/auto-triage/AutoTriagePageClient.tsx index 2fedb4863..f494a7389 100644 --- a/src/app/(app)/organizations/[id]/auto-triage/AutoTriagePageClient.tsx +++ b/src/components/auto-triage/AutoTriagePageClient.tsx @@ -14,8 +14,8 @@ import { useQuery } from '@tanstack/react-query'; import Link from 'next/link'; type AutoTriagePageClientProps = { - organizationId: string; - organizationName: string; + organizationId?: string; + organizationName?: string; successMessage?: string; errorMessage?: string; }; @@ -30,13 +30,21 @@ export function AutoTriagePageClient({ // Fetch GitHub App installation status const { data: statusData, isLoading: isStatusLoading } = useQuery( - trpc.organizations.autoTriage.getGitHubStatus.queryOptions({ - organizationId, - }) + organizationId + ? trpc.organizations.autoTriage.getGitHubStatus.queryOptions({ organizationId }) + : trpc.personalAutoTriage.getGitHubStatus.queryOptions() ); const isGitHubAppInstalled = statusData?.connected && statusData?.integration?.isValid; + const githubIntegrationsHref = organizationId + ? `/organizations/${organizationId}/integrations/github` + : '/integrations/github'; + + const subtitle = organizationName + ? `Automatically triage GitHub issues with AI-powered analysis for ${organizationName}` + : 'Automatically triage GitHub issues with AI-powered analysis'; + // Show toast messages from URL params useEffect(() => { if (successMessage === 'github_connected') { @@ -55,13 +63,11 @@ export function AutoTriagePageClient({

Auto Triage

- new + beta
-

- Automatically triage GitHub issues with AI-powered analysis for {organizationName} -

+

{subtitle}

- +