Skip to content

Commit 696d264

Browse files
refactor: remove app column from tasks table (#18135)
Remove the "app" column from the tasks table since the user can click on the task and use apps there.
1 parent d44d8ab commit 696d264

File tree

1 file changed

+2
-90
lines changed

1 file changed

+2
-90
lines changed

site/src/pages/TasksPage/TasksPage.tsx

Lines changed: 2 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
11
import { API } from "api/api";
22
import { getErrorDetail, getErrorMessage } from "api/errors";
33
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";
105
import { Avatar } from "components/Avatar/Avatar";
116
import { AvatarData } from "components/Avatar/AvatarData";
127
import { Button } from "components/Button/Button";
13-
import { ExternalImage } from "components/ExternalImage/ExternalImage";
148
import { displayError } from "components/GlobalSnackbar/utils";
159
import { Margins } from "components/Margins/Margins";
1610
import {
@@ -34,23 +28,15 @@ import {
3428
TableHeader,
3529
TableRow,
3630
} from "components/Table/Table";
37-
import {
38-
Tooltip,
39-
TooltipContent,
40-
TooltipProvider,
41-
TooltipTrigger,
42-
} from "components/Tooltip/Tooltip";
4331
import { useAuthenticated } from "hooks";
4432
import { ExternalLinkIcon, RotateCcwIcon, SendIcon } from "lucide-react";
45-
import { useAppLink } from "modules/apps/useAppLink";
4633
import { AI_PROMPT_PARAMETER_NAME, type Task } from "modules/tasks/tasks";
4734
import { WorkspaceAppStatus } from "modules/workspaces/WorkspaceAppStatus/WorkspaceAppStatus";
48-
import type { FC, PropsWithChildren, ReactNode } from "react";
35+
import type { FC, ReactNode } from "react";
4936
import { Helmet } from "react-helmet-async";
5037
import { useMutation, useQuery, useQueryClient } from "react-query";
5138
import { Link as RouterLink } from "react-router-dom";
5239
import TextareaAutosize from "react-textarea-autosize";
53-
import { cn } from "utils/cn";
5440
import { pageTitle } from "utils/page";
5541
import { relativeTime } from "utils/time";
5642

@@ -351,11 +337,6 @@ const TasksTable: FC<TasksTableProps> = ({ templates }) => {
351337
src={workspace.owner_avatar_url}
352338
/>
353339
</TableCell>
354-
<TableCell className="pl-10">
355-
{agent && app && (
356-
<IconAppLink app={app} workspace={workspace} agent={agent} />
357-
)}
358-
</TableCell>
359340
</TableRow>
360341
);
361342
})
@@ -387,82 +368,13 @@ const TasksTable: FC<TasksTableProps> = ({ templates }) => {
387368
<TableHead>Task</TableHead>
388369
<TableHead>Status</TableHead>
389370
<TableHead>Created by</TableHead>
390-
<TableHead className="w-0" />
391371
</TableRow>
392372
</TableHeader>
393373
<TableBody>{body}</TableBody>
394374
</Table>
395375
);
396376
};
397377

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-
466378
export const data = {
467379
// TODO: This function is currently inefficient because it fetches all templates
468380
// and their parameters individually, resulting in many API calls and slow

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy