1
1
import { API } from "api/api" ;
2
2
import { getErrorDetail , getErrorMessage } from "api/errors" ;
3
3
import { disabledRefetchOptions } from "api/queries/util" ;
4
- import type {
5
- Template ,
6
- Workspace ,
7
- WorkspaceAgent ,
8
- WorkspaceApp ,
9
- } from "api/typesGenerated" ;
4
+ import type { Template } from "api/typesGenerated" ;
10
5
import { Avatar } from "components/Avatar/Avatar" ;
11
6
import { AvatarData } from "components/Avatar/AvatarData" ;
12
7
import { Button } from "components/Button/Button" ;
13
- import { ExternalImage } from "components/ExternalImage/ExternalImage" ;
14
8
import { displayError } from "components/GlobalSnackbar/utils" ;
15
9
import { Margins } from "components/Margins/Margins" ;
16
10
import {
@@ -34,23 +28,15 @@ import {
34
28
TableHeader ,
35
29
TableRow ,
36
30
} from "components/Table/Table" ;
37
- import {
38
- Tooltip ,
39
- TooltipContent ,
40
- TooltipProvider ,
41
- TooltipTrigger ,
42
- } from "components/Tooltip/Tooltip" ;
43
31
import { useAuthenticated } from "hooks" ;
44
32
import { ExternalLinkIcon , RotateCcwIcon , SendIcon } from "lucide-react" ;
45
- import { useAppLink } from "modules/apps/useAppLink" ;
46
33
import { AI_PROMPT_PARAMETER_NAME , type Task } from "modules/tasks/tasks" ;
47
34
import { WorkspaceAppStatus } from "modules/workspaces/WorkspaceAppStatus/WorkspaceAppStatus" ;
48
- import type { FC , PropsWithChildren , ReactNode } from "react" ;
35
+ import type { FC , ReactNode } from "react" ;
49
36
import { Helmet } from "react-helmet-async" ;
50
37
import { useMutation , useQuery , useQueryClient } from "react-query" ;
51
38
import { Link as RouterLink } from "react-router-dom" ;
52
39
import TextareaAutosize from "react-textarea-autosize" ;
53
- import { cn } from "utils/cn" ;
54
40
import { pageTitle } from "utils/page" ;
55
41
import { relativeTime } from "utils/time" ;
56
42
@@ -351,11 +337,6 @@ const TasksTable: FC<TasksTableProps> = ({ templates }) => {
351
337
src = { workspace . owner_avatar_url }
352
338
/>
353
339
</ TableCell >
354
- < TableCell className = "pl-10" >
355
- { agent && app && (
356
- < IconAppLink app = { app } workspace = { workspace } agent = { agent } />
357
- ) }
358
- </ TableCell >
359
340
</ TableRow >
360
341
) ;
361
342
} )
@@ -387,82 +368,13 @@ const TasksTable: FC<TasksTableProps> = ({ templates }) => {
387
368
< TableHead > Task</ TableHead >
388
369
< TableHead > Status</ TableHead >
389
370
< TableHead > Created by</ TableHead >
390
- < TableHead className = "w-0" />
391
371
</ TableRow >
392
372
</ TableHeader >
393
373
< TableBody > { body } </ TableBody >
394
374
</ Table >
395
375
) ;
396
376
} ;
397
377
398
- type IconAppLinkProps = {
399
- app : WorkspaceApp ;
400
- workspace : Workspace ;
401
- agent : WorkspaceAgent ;
402
- } ;
403
-
404
- const IconAppLink : FC < IconAppLinkProps > = ( { app, workspace, agent } ) => {
405
- const link = useAppLink ( app , {
406
- workspace,
407
- agent,
408
- } ) ;
409
-
410
- return (
411
- < BaseIconLink
412
- key = { app . id }
413
- label = { `Open ${ link . label } ` }
414
- href = { link . href }
415
- onClick = { ( e ) => {
416
- link . onClick ?.( e ) ;
417
- e . stopPropagation ( ) ;
418
- } }
419
- >
420
- < ExternalImage src = { app . icon ?? "/icon/widgets.svg" } />
421
- </ BaseIconLink >
422
- ) ;
423
- } ;
424
-
425
- type BaseIconLinkProps = PropsWithChildren < {
426
- label : string ;
427
- href : string ;
428
- isLoading ?: boolean ;
429
- target ?: string ;
430
- onClick ?: ( e : React . MouseEvent < HTMLAnchorElement > ) => void ;
431
- } > ;
432
-
433
- const BaseIconLink : FC < BaseIconLinkProps > = ( {
434
- href,
435
- isLoading,
436
- label,
437
- children,
438
- target,
439
- onClick,
440
- } ) => {
441
- return (
442
- < TooltipProvider >
443
- < Tooltip >
444
- < TooltipTrigger asChild >
445
- < Button variant = "outline" size = "icon-lg" asChild >
446
- < a
447
- target = { target }
448
- className = { cn ( [ "z-10 relative" , { "animate-pulse" : isLoading } ] ) }
449
- href = { href }
450
- onClick = { ( e ) => {
451
- e . stopPropagation ( ) ;
452
- onClick ?.( e ) ;
453
- } }
454
- >
455
- { children }
456
- < span className = "sr-only" > { label } </ span >
457
- </ a >
458
- </ Button >
459
- </ TooltipTrigger >
460
- < TooltipContent > { label } </ TooltipContent >
461
- </ Tooltip >
462
- </ TooltipProvider >
463
- ) ;
464
- } ;
465
-
466
378
export const data = {
467
379
// TODO: This function is currently inefficient because it fetches all templates
468
380
// and their parameters individually, resulting in many API calls and slow
0 commit comments