Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[front] - refacto: get rid PokeLink #8576

Merged
merged 3 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions front/components/poke/assistants/columns.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { EmotionLaughIcon, IconButton, TrashIcon } from "@dust-tt/sparkle";
import {
EmotionLaughIcon,
IconButton,
LinkWrapper,
TrashIcon,
} from "@dust-tt/sparkle";
import type { LightWorkspaceType } from "@dust-tt/types";
import { ArrowsUpDownIcon } from "@heroicons/react/20/solid";
import type { ColumnDef } from "@tanstack/react-table";

import PokeLink from "@app/components/poke/shadcn/ui/link";
import { formatTimestampToFriendlyDate } from "@app/lib/utils";

type AgentConfigurationDisplayType = {
Expand All @@ -27,9 +31,9 @@ export function makeColumnsForAssistants(
const sId: string = row.getValue("sId");

return (
<PokeLink href={`/poke/${owner.sId}/assistants/${sId}`}>
<LinkWrapper href={`/poke/${owner.sId}/assistants/${sId}`}>
{sId}
</PokeLink>
</LinkWrapper>
);
},
header: ({ column }) => {
Expand Down
9 changes: 5 additions & 4 deletions front/components/poke/data_source_views/columns.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { IconButton } from "@dust-tt/sparkle";
import { IconButton, LinkWrapper } from "@dust-tt/sparkle";
import { ArrowsUpDownIcon } from "@heroicons/react/20/solid";
import type { ColumnDef } from "@tanstack/react-table";

import PokeLink from "@app/components/poke/shadcn/ui/link";
import { formatTimestampToFriendlyDate } from "@app/lib/utils";

interface DataSourceView {
Expand All @@ -22,7 +21,7 @@ export function makeColumnsForDataSourceViews(): ColumnDef<DataSourceView>[] {
cell: ({ row }) => {
const { dataSourceViewLink, sId } = row.original;

return <PokeLink href={dataSourceViewLink}>{sId}</PokeLink>;
return <LinkWrapper href={dataSourceViewLink}>{sId}</LinkWrapper>;
},
header: ({ column }) => {
return (
Expand All @@ -44,7 +43,9 @@ export function makeColumnsForDataSourceViews(): ColumnDef<DataSourceView>[] {
cell: ({ row }) => {
const { dataSourceLink, dataSourceName } = row.original;

return <PokeLink href={dataSourceLink}>{dataSourceName}</PokeLink>;
return (
<LinkWrapper href={dataSourceLink}>{dataSourceName}</LinkWrapper>
);
},
header: ({ column }) => {
return (
Expand Down
7 changes: 3 additions & 4 deletions front/components/poke/data_sources/columns.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { IconButton, TrashIcon } from "@dust-tt/sparkle";
import { IconButton, LinkWrapper, TrashIcon } from "@dust-tt/sparkle";
import type { WorkspaceType } from "@dust-tt/types";
import { ArrowsUpDownIcon } from "@heroicons/react/20/solid";
import type { ColumnDef } from "@tanstack/react-table";

import PokeLink from "@app/components/poke/shadcn/ui/link";
import { formatTimestampToFriendlyDate } from "@app/lib/utils";

interface DataSources {
Expand All @@ -26,9 +25,9 @@ export function makeColumnsForDataSources(
const sId: string = row.getValue("sId");

return (
<PokeLink href={`/poke/${owner.sId}/data_sources/${sId}`}>
<LinkWrapper href={`/poke/${owner.sId}/data_sources/${sId}`}>
{sId}
</PokeLink>
</LinkWrapper>
);
},
header: ({ column }) => {
Expand Down
57 changes: 0 additions & 57 deletions front/components/poke/shadcn/ui/link.tsx

This file was deleted.

15 changes: 8 additions & 7 deletions front/components/poke/shadcn/ui/table.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { ClipboardCheckIcon, ClipboardIcon, Label } from "@dust-tt/sparkle";
import {
ClipboardCheckIcon,
ClipboardIcon,
Label,
LinkWrapper,
} from "@dust-tt/sparkle";
import * as React from "react";

import { cn } from "@app/components/poke/shadcn/lib/utils";
import { PokeButton } from "@app/components/poke/shadcn/ui/button";
import PokeLink from "@app/components/poke/shadcn/ui/link";

const Table = React.forwardRef<
HTMLTableElement,
Expand Down Expand Up @@ -154,22 +158,19 @@ interface TableCellWithLinkProps
extends React.TdHTMLAttributes<HTMLTableCellElement> {
href: string;
content: string;
external?: boolean;
}

const TableCellWithLink = React.forwardRef<
HTMLTableCellElement,
TableCellWithLinkProps
>(({ className, href, content, external = false, ...props }, ref) => {
>(({ className, href, content, ...props }, ref) => {
return (
<TableCell
ref={ref}
className={cn("p-2 align-middle", className)}
{...props}
>
<PokeLink href={href} external={external}>
{content}
</PokeLink>
<LinkWrapper href={href}>{content}</LinkWrapper>
</TableCell>
);
});
Expand Down
Loading