fix: fix subscriptions api
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
'use client';
|
||||
"use client";
|
||||
|
||||
import type { Row } from '@tanstack/react-table';
|
||||
import { MoreHorizontal } from 'lucide-react';
|
||||
import type { Row } from "@tanstack/react-table";
|
||||
import { MoreHorizontal } from "lucide-react";
|
||||
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
@@ -11,9 +11,9 @@ import {
|
||||
DropdownMenuSeparator,
|
||||
DropdownMenuShortcut,
|
||||
DropdownMenuTrigger,
|
||||
} from '@/components/ui/dropdown-menu';
|
||||
} from "@/components/ui/dropdown-menu";
|
||||
|
||||
import { useMemo } from 'react';
|
||||
import { PropsWithChildren, useMemo } from "react";
|
||||
|
||||
interface DataTableRowActionsProps<DataView, Id> {
|
||||
row: Row<DataView>;
|
||||
@@ -24,6 +24,7 @@ interface DataTableRowActionsProps<DataView, Id> {
|
||||
onDetail?: (id: Id) => void;
|
||||
onDelete?: (id: Id) => void;
|
||||
onEdit?: (id: Id) => void;
|
||||
modal?: boolean;
|
||||
}
|
||||
|
||||
export function DataTableRowActions<DataView, Id>({
|
||||
@@ -35,10 +36,12 @@ export function DataTableRowActions<DataView, Id>({
|
||||
onDetail,
|
||||
onDelete,
|
||||
onEdit,
|
||||
}: DataTableRowActionsProps<DataView, Id>) {
|
||||
children,
|
||||
modal,
|
||||
}: PropsWithChildren<DataTableRowActionsProps<DataView, Id>>) {
|
||||
const id = useMemo(() => getId(row), [getId, row]);
|
||||
return (
|
||||
<DropdownMenu>
|
||||
<DropdownMenu modal={modal}>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button
|
||||
variant="ghost"
|
||||
@@ -49,6 +52,7 @@ export function DataTableRowActions<DataView, Id>({
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end" className="w-[160px]">
|
||||
{children}
|
||||
{showDetail && (
|
||||
<DropdownMenuItem onClick={() => onDetail?.(id)}>
|
||||
Detail
|
||||
|
||||
@@ -3,6 +3,8 @@ import { Button } from '@/components/ui/button';
|
||||
import { DataTablePagination } from '@/components/ui/data-table-pagination';
|
||||
import { DataTableRowActions } from '@/components/ui/data-table-row-actions';
|
||||
import { DataTableViewOptions } from '@/components/ui/data-table-view-options';
|
||||
import { DialogTrigger } from '@/components/ui/dialog';
|
||||
import { DropdownMenuItem } from '@/components/ui/dropdown-menu';
|
||||
import { QueryErrorView } from '@/components/ui/query-error-view';
|
||||
import { Skeleton } from '@/components/ui/skeleton';
|
||||
import {
|
||||
@@ -28,6 +30,7 @@ import { useDebouncedSkeleton } from '@/presentation/hooks/use-debounded-skeleto
|
||||
import { useEvent } from '@/presentation/hooks/use-event';
|
||||
import { cn } from '@/presentation/utils';
|
||||
import { useMutation, useQuery } from '@apollo/client';
|
||||
import { Dialog } from '@radix-ui/react-dialog';
|
||||
import { createFileRoute, useNavigate } from '@tanstack/react-router';
|
||||
import {
|
||||
type ColumnDef,
|
||||
@@ -44,6 +47,7 @@ import { format } from 'date-fns';
|
||||
import { Eye, EyeOff, Plus } from 'lucide-react';
|
||||
import { useMemo, useState } from 'react';
|
||||
import { toast } from 'sonner';
|
||||
import { Credential3rdCheckAvailableViewDialogContent } from './-check-available';
|
||||
|
||||
export const Route = createFileRoute('/_app/credential3rd/manage')({
|
||||
component: CredentialManageRouteComponent,
|
||||
@@ -246,7 +250,18 @@ function CredentialManageRouteComponent() {
|
||||
});
|
||||
}}
|
||||
onDelete={handleDeleteRecord(row)}
|
||||
/>
|
||||
>
|
||||
<Dialog>
|
||||
<DialogTrigger asChild>
|
||||
<DropdownMenuItem onSelect={(e) => e.preventDefault()}>
|
||||
Check Available
|
||||
</DropdownMenuItem>
|
||||
</DialogTrigger>
|
||||
<Credential3rdCheckAvailableViewDialogContent
|
||||
id={row.original.id}
|
||||
/>
|
||||
</Dialog>
|
||||
</DataTableRowActions>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
@@ -126,7 +126,7 @@ export const SubscriptionSyncView = memo(
|
||||
|
||||
export interface SubscriptionSyncDialogContentProps {
|
||||
id: number;
|
||||
onCancel: VoidFunction;
|
||||
onCancel?: VoidFunction;
|
||||
}
|
||||
|
||||
export const SubscriptionSyncDialogContent = memo(
|
||||
|
||||
@@ -2,6 +2,8 @@ import { Button } from '@/components/ui/button';
|
||||
import { DataTablePagination } from '@/components/ui/data-table-pagination';
|
||||
import { DataTableRowActions } from '@/components/ui/data-table-row-actions';
|
||||
import { DataTableViewOptions } from '@/components/ui/data-table-view-options';
|
||||
import { Dialog, DialogTrigger } from '@/components/ui/dialog';
|
||||
import { DropdownMenuItem } from '@/components/ui/dropdown-menu';
|
||||
import { QueryErrorView } from '@/components/ui/query-error-view';
|
||||
import { Skeleton } from '@/components/ui/skeleton';
|
||||
import { Switch } from '@/components/ui/switch';
|
||||
@@ -49,6 +51,7 @@ import { format } from 'date-fns';
|
||||
import { Plus } from 'lucide-react';
|
||||
import { useMemo, useState } from 'react';
|
||||
import { toast } from 'sonner';
|
||||
import { SubscriptionSyncDialogContent } from './-sync';
|
||||
|
||||
export const Route = createFileRoute('/_app/subscriptions/manage')({
|
||||
component: SubscriptionManageRouteComponent,
|
||||
@@ -240,7 +243,16 @@ function SubscriptionManageRouteComponent() {
|
||||
});
|
||||
}}
|
||||
onDelete={handleDeleteRecord(row)}
|
||||
/>
|
||||
>
|
||||
<Dialog>
|
||||
<DialogTrigger asChild>
|
||||
<DropdownMenuItem onSelect={(e) => e.preventDefault()}>
|
||||
Sync
|
||||
</DropdownMenuItem>
|
||||
</DialogTrigger>
|
||||
<SubscriptionSyncDialogContent id={row.original.id} />
|
||||
</Dialog>
|
||||
</DataTableRowActions>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user