1+
12'use client' ;
23
3- import { useState , useEffect } from 'react' ;
4+ // This component is a placeholder and not currently used in the application.
5+ // The OAuth App system has been deprecated in favor of the simpler FlowApps system.
6+ // This file can be safely removed if no longer needed.
7+
48import Link from 'next/link' ;
5- import { useToast } from '@/hooks/use-toast' ;
69import { Card , CardContent , CardDescription , CardHeader , CardTitle } from '@/components/ui/card' ;
710import { Button } from '@/components/ui/button' ;
8- import { AlertDialog , AlertDialogAction , AlertDialogCancel , AlertDialogContent , AlertDialogDescription as UIAlertDialogDescription , AlertDialogFooter , AlertDialogHeader , AlertDialogTitle , AlertDialogTrigger } from "@/components/ui/alert-dialog" ;
11+ import { ArrowLeft , KeyRound } from 'lucide-react' ;
912import { Skeleton } from '@/components/ui/skeleton' ;
10- import { getFlowAppsAction , deleteFlowAppAction } from './actions' ;
11- import { ArrowLeft , Code2 , PlusCircle , Trash2 , Bot , MoreVertical , Edit } from 'lucide-react' ;
12- import type { FlowApp } from '@/types' ;
13- import { Loader2 } from 'lucide-react' ;
14- import { DropdownMenu , DropdownMenuContent , DropdownMenuItem , DropdownMenuTrigger } from '@/components/ui/dropdown-menu' ;
15-
16-
17- export default function DeveloperSettingsPage ( ) {
18- const { toast } = useToast ( ) ;
19-
20- // FlowApp State
21- const [ flowApps , setFlowApps ] = useState < Omit < FlowApp , 'token' | 'secretHash' > [ ] > ( [ ] ) ;
22- const [ isLoadingFlowApps , setIsLoadingFlowApps ] = useState ( true ) ;
23- const [ flowAppToDelete , setFlowAppToDelete ] = useState < FlowApp | null > ( null ) ;
24- const [ isDeletingFlowApp , setIsDeletingFlowApp ] = useState ( false ) ;
25-
26-
27- useEffect ( ( ) => {
28- async function loadApps ( ) {
29- setIsLoadingFlowApps ( true ) ;
30- try {
31- const userFlowApps = await getFlowAppsAction ( ) ;
32- setFlowApps ( userFlowApps ) ;
33- } catch ( error : any ) {
34- toast ( { variant : 'destructive' , title : 'Error' , description : 'Could not load your applications.' } ) ;
35- } finally {
36- setIsLoadingFlowApps ( false ) ;
37- }
38- }
39- loadApps ( ) ;
40- } , [ toast ] ) ;
41-
42-
43- const handleDeleteFlowApp = async ( ) => {
44- if ( ! flowAppToDelete ) return ;
45- setIsDeletingFlowApp ( true ) ;
46- const result = await deleteFlowAppAction ( flowAppToDelete . uuid ) ;
47- if ( result . success ) {
48- toast ( { title : 'Success' , description : 'FlowApp deleted.' } ) ;
49- setFlowApps ( prev => prev . filter ( app => app . uuid !== flowAppToDelete . uuid ) ) ;
50- setFlowAppToDelete ( null ) ;
51- } else {
52- toast ( { variant : 'destructive' , title : 'Error' , description : result . error } ) ;
53- }
54- setIsDeletingFlowApp ( false ) ;
55- } ;
5613
14+ export default function NewOAuthAppPage ( ) {
5715 return (
58- < div className = "space-y-8 " >
16+ < div className = "space-y-6 " >
5917 < Button variant = "outline" asChild >
60- < Link href = "/settings" >
61- < ArrowLeft className = "mr-2 h-4 w-4" /> Back to Settings
18+ < Link href = "/settings/developer " >
19+ < ArrowLeft className = "mr-2 h-4 w-4" /> Back to Developer Settings
6220 </ Link >
6321 </ Button >
64-
6522 < Card >
6623 < CardHeader >
67- < div className = "flex flex-col sm:flex-row justify-between items-center gap-4" >
68- < div >
69- < CardTitle className = "text-2xl font-headline flex items-center" > < Code2 className = "mr-2 h-6 w-6 text-primary" /> Developer Settings</ CardTitle >
70- < CardDescription > Manage your personal access tokens (FlowApps) to integrate with the FlowUp API.</ CardDescription >
71- </ div >
72- </ div >
73- </ CardHeader >
74- </ Card >
75-
76- < Card >
77- < CardHeader >
78- < div className = "flex flex-col sm:flex-row justify-between items-center gap-4" >
79- < div >
80- < CardTitle className = "flex items-center" > < Bot className = "mr-2 h-5 w-5" /> FlowApps (Personal Access Tokens)</ CardTitle >
81- < CardDescription > For personal scripts, automations, and server-to-server integrations.</ CardDescription >
82- </ div >
83- < Button asChild >
84- < Link href = "/settings/developer/new-flow-app" >
85- < PlusCircle className = "mr-2 h-4 w-4" /> Create New FlowApp
86- </ Link >
87- </ Button >
88- </ div >
24+ < CardTitle className = "text-2xl font-headline flex items-center" > < KeyRound className = "mr-2 h-6 w-6 text-primary" /> Create New OAuth Application</ CardTitle >
25+ < CardDescription >
26+ This feature is deprecated in favor of FlowApps.
27+ </ CardDescription >
8928 </ CardHeader >
9029 < CardContent >
91- { isLoadingFlowApps ? (
92- < div className = "space-y-4" >
93- { [ ...Array ( 2 ) ] . map ( ( _ , i ) => < Skeleton key = { i } className = "h-24 w-full" /> ) }
94- </ div >
95- ) : flowApps . length === 0 ? (
96- < div className = "text-center py-8" >
97- < p className = "mt-1 text-sm text-muted-foreground" >
98- You haven't created any FlowApps yet.
99- </ p >
30+ < div className = "space-y-6" >
31+ < Skeleton className = "h-10 w-full" />
32+ < Skeleton className = "h-20 w-full" />
33+ < Skeleton className = "h-10 w-full" />
34+ < div className = "flex justify-end" >
35+ < Skeleton className = "h-10 w-24" />
10036 </ div >
101- ) : (
102- < div className = "space-y-4" >
103- { flowApps . map ( app => (
104- < Card key = { app . uuid } className = "p-4 flex items-center justify-between" >
105- < div className = "flex items-start gap-4" >
106- < div className = "bg-muted p-3 rounded-md" >
107- < Bot className = "h-6 w-6 text-primary" />
108- </ div >
109- < div >
110- < h3 className = "font-semibold" > { app . name } </ h3 >
111- < p className = "text-sm text-muted-foreground truncate max-w-xs" > { app . description || "No description" } </ p >
112- < p className = "text-xs text-muted-foreground" > Created: { new Date ( app . createdAt ) . toLocaleDateString ( ) } </ p >
113- </ div >
114- </ div >
115- < DropdownMenu >
116- < DropdownMenuTrigger asChild >
117- < Button variant = "ghost" size = "icon" className = "h-8 w-8" >
118- < MoreVertical className = "h-4 w-4" />
119- </ Button >
120- </ DropdownMenuTrigger >
121- < DropdownMenuContent align = "end" >
122- < DropdownMenuItem asChild >
123- < Link href = { `/settings/developer/edit-flow-app/${ app . uuid } ` } >
124- < Edit className = "mr-2 h-4 w-4" />
125- < span > Edit</ span >
126- </ Link >
127- </ DropdownMenuItem >
128- < AlertDialog >
129- < AlertDialogTrigger asChild >
130- < DropdownMenuItem onSelect = { ( e ) => { e . preventDefault ( ) ; setFlowAppToDelete ( app as FlowApp ) ; } } >
131- < Trash2 className = "mr-2 h-4 w-4 text-destructive" />
132- < span className = "text-destructive" > Delete</ span >
133- </ DropdownMenuItem >
134- </ AlertDialogTrigger >
135- { flowAppToDelete ?. uuid === app . uuid && (
136- < AlertDialogContent >
137- < AlertDialogHeader >
138- < AlertDialogTitle > Delete "{ flowAppToDelete . name } "?</ AlertDialogTitle >
139- < UIAlertDialogDescription >
140- This will permanently delete the FlowApp and its token. Any application using this token will no longer be able to access the API.
141- </ UIAlertDialogDescription >
142- </ AlertDialogHeader >
143- < AlertDialogFooter >
144- < AlertDialogCancel onClick = { ( ) => setFlowAppToDelete ( null ) } > Cancel</ AlertDialogCancel >
145- < AlertDialogAction onClick = { handleDeleteFlowApp } disabled = { isDeletingFlowApp } className = "bg-destructive hover:bg-destructive/90 text-destructive-foreground" >
146- { isDeletingFlowApp && < Loader2 className = "mr-2 h-4 w-4 animate-spin" /> } Delete
147- </ AlertDialogAction >
148- </ AlertDialogFooter >
149- </ AlertDialogContent >
150- ) }
151- </ AlertDialog >
152- </ DropdownMenuContent >
153- </ DropdownMenu >
154- </ Card >
155- ) ) }
156- </ div >
157- ) }
37+ </ div >
15838 </ CardContent >
15939 </ Card >
16040 </ div >
16141 ) ;
162- }
42+ }
0 commit comments