refactor: refactor graphql

This commit is contained in:
2025-06-12 00:15:26 +08:00
parent b09e9e6aaa
commit 258eeddc74
36 changed files with 680 additions and 612 deletions

View File

@@ -137,6 +137,7 @@
}
body {
@apply bg-background text-foreground;
pointer-events: auto !important;
}
button:not(:disabled),

View File

@@ -0,0 +1,136 @@
import type { NavMainGroup } from '@/infra/routes/nav';
import {
BookOpen,
Folders,
KeyRound,
ListTodo,
Settings2,
SquareTerminal,
Telescope,
Tv,
} from 'lucide-react';
export const AppNavMainData: NavMainGroup[] = [
{
group: 'Dashboard',
items: [
{
title: 'Explore',
icon: Telescope,
link: {
to: '/explore',
},
},
{
title: 'Subscriptions',
link: {
to: '/subscriptions/manage',
},
icon: Folders,
children: [
{
title: 'Manage',
link: {
to: '/subscriptions/manage',
},
},
{
title: 'Create',
link: {
to: '/subscriptions/create',
},
},
],
},
{
title: 'Bangumi',
icon: Tv,
children: [
{
title: 'Manage',
link: {
to: '/bangumi/recorder',
},
},
{
title: 'Feed',
link: {
to: '/bangumi/feed',
},
},
],
},
{
title: 'Tasks',
icon: ListTodo,
children: [
{
title: 'Manage',
link: {
to: '/task/manage',
},
},
],
},
{
title: 'Credential 3rd',
link: {
to: '/credential3rd/manage',
},
icon: KeyRound,
children: [
{
title: 'Manage',
link: {
to: '/credential3rd/manage',
},
},
{
title: 'Create',
link: {
to: '/credential3rd/create',
},
},
],
},
{
title: 'Playground',
icon: SquareTerminal,
link: {
to: '/playground',
},
children: [
{
title: 'GraphQL Api',
link: {
to: '/playground/graphql-api',
},
},
],
},
{
title: 'Documentation',
link: {
href: 'https://github.com/dumtruck/konobangu/wiki',
target: '_blank',
},
icon: BookOpen,
},
{
title: 'Settings',
link: {
to: '/settings',
},
icon: Settings2,
children: [
{
title: 'Downloader',
link: {
to: '/settings/downloader',
},
},
],
},
],
},
];

View File

@@ -1,3 +1,4 @@
import { AppNavMainData } from '@/app/config/nav';
import {
Sidebar,
SidebarContent,
@@ -5,7 +6,6 @@ import {
SidebarHeader,
SidebarRail,
} from '@/components/ui/sidebar';
import { AppNavMainData } from '@/infra/routes/nav';
import type { ComponentPropsWithoutRef } from 'react';
import { AppIcon } from './app-icon';
import { NavMain } from './nav-main';

View File

@@ -1,6 +1,6 @@
'use client';
import { ChevronRight, type LucideIcon } from 'lucide-react';
import { ChevronRight } from 'lucide-react';
import {
Collapsible,
@@ -26,20 +26,9 @@ import {
SidebarMenuSubItem,
useSidebar,
} from '@/components/ui/sidebar';
import type { NavMainGroup, NavMainItem } from '@/infra/routes/nav';
import { useMatches } from '@tanstack/react-router';
export interface NavMainItem {
link?: ProLinkProps;
title: string;
icon?: LucideIcon;
children?: { title: string; link: ProLinkProps }[];
}
export interface NavMainGroup {
group: string;
items: NavMainItem[];
}
export function NavMain({
groups,
}: {

View File

@@ -14,7 +14,6 @@ import {
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
import { useMemo } from "react";
interface DataTablePaginationProps<TData> {
table: Table<TData>;

View File

@@ -8,7 +8,6 @@ import { type } from 'arktype';
import {
MikanSubscriptionSeasonSourceUrlSchema,
extractMikanSubscriptionBangumiSourceUrl,
extractMikanSubscriptionSeasonSourceUrl,
extractMikanSubscriptionSubscriberSourceUrl,
} from './mikan';

View File

@@ -0,0 +1,28 @@
import { gql } from '@apollo/client';
export const GET_TASKS = gql`
query GetTasks($filters: SubscriberTasksFilterInput!, $orderBy: SubscriberTasksOrderInput!, $pagination: PaginationInput!) {
subscriberTasks(
pagination: $pagination
filters: $filters
orderBy: $orderBy
) {
nodes {
id,
status,
attempts,
maxAttempts,
runAt,
lastError,
lockAt,
lockBy,
doneAt,
priority
}
paginationInfo {
total
pages
}
}
}
`;

View File

@@ -28,6 +28,7 @@ type Documents = {
"\n mutation SyncSubscriptionFeedsIncremental($id: Int!) {\n subscriptionSyncOneFeedsIncremental(filter: { id: $id }) {\n taskId\n }\n }\n": typeof types.SyncSubscriptionFeedsIncrementalDocument,
"\n mutation SyncSubscriptionFeedsFull($id: Int!) {\n subscriptionSyncOneFeedsFull(filter: { id: $id }) {\n taskId\n }\n }\n": typeof types.SyncSubscriptionFeedsFullDocument,
"\n mutation SyncSubscriptionSources($id: Int!) {\n subscriptionSyncOneSources(filter: { id: $id }) {\n taskId\n }\n }\n": typeof types.SyncSubscriptionSourcesDocument,
"\n query GetTasks($filters: SubscriberTasksFilterInput!, $orderBy: SubscriberTasksOrderInput!, $pagination: PaginationInput!) {\n subscriberTasks(\n pagination: $pagination\n filters: $filters\n orderBy: $orderBy\n ) {\n nodes {\n id,\n status,\n attempts,\n maxAttempts,\n runAt,\n lastError,\n lockAt,\n lockBy,\n doneAt,\n priority\n }\n paginationInfo {\n total\n pages\n }\n }\n }\n": typeof types.GetTasksDocument,
};
const documents: Documents = {
"\n query GetCredential3rd($filters: Credential3rdFilterInput!, $orderBy: Credential3rdOrderInput, $pagination: PaginationInput) {\n credential3rd(filters: $filters, orderBy: $orderBy, pagination: $pagination) {\n nodes {\n id\n cookies\n username\n password\n userAgent\n createdAt\n updatedAt\n credentialType\n }\n paginationInfo {\n total\n pages\n }\n }\n }\n": types.GetCredential3rdDocument,
@@ -44,6 +45,7 @@ const documents: Documents = {
"\n mutation SyncSubscriptionFeedsIncremental($id: Int!) {\n subscriptionSyncOneFeedsIncremental(filter: { id: $id }) {\n taskId\n }\n }\n": types.SyncSubscriptionFeedsIncrementalDocument,
"\n mutation SyncSubscriptionFeedsFull($id: Int!) {\n subscriptionSyncOneFeedsFull(filter: { id: $id }) {\n taskId\n }\n }\n": types.SyncSubscriptionFeedsFullDocument,
"\n mutation SyncSubscriptionSources($id: Int!) {\n subscriptionSyncOneSources(filter: { id: $id }) {\n taskId\n }\n }\n": types.SyncSubscriptionSourcesDocument,
"\n query GetTasks($filters: SubscriberTasksFilterInput!, $orderBy: SubscriberTasksOrderInput!, $pagination: PaginationInput!) {\n subscriberTasks(\n pagination: $pagination\n filters: $filters\n orderBy: $orderBy\n ) {\n nodes {\n id,\n status,\n attempts,\n maxAttempts,\n runAt,\n lastError,\n lockAt,\n lockBy,\n doneAt,\n priority\n }\n paginationInfo {\n total\n pages\n }\n }\n }\n": types.GetTasksDocument,
};
/**
@@ -116,6 +118,10 @@ export function gql(source: "\n mutation SyncSubscriptionFeedsFull($id: Int!) {
* The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function gql(source: "\n mutation SyncSubscriptionSources($id: Int!) {\n subscriptionSyncOneSources(filter: { id: $id }) {\n taskId\n }\n }\n"): (typeof documents)["\n mutation SyncSubscriptionSources($id: Int!) {\n subscriptionSyncOneSources(filter: { id: $id }) {\n taskId\n }\n }\n"];
/**
* The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function gql(source: "\n query GetTasks($filters: SubscriberTasksFilterInput!, $orderBy: SubscriberTasksOrderInput!, $pagination: PaginationInput!) {\n subscriberTasks(\n pagination: $pagination\n filters: $filters\n orderBy: $orderBy\n ) {\n nodes {\n id,\n status,\n attempts,\n maxAttempts,\n runAt,\n lastError,\n lockAt,\n lockBy,\n doneAt,\n priority\n }\n paginationInfo {\n total\n pages\n }\n }\n }\n"): (typeof documents)["\n query GetTasks($filters: SubscriberTasksFilterInput!, $orderBy: SubscriberTasksOrderInput!, $pagination: PaginationInput!) {\n subscriberTasks(\n pagination: $pagination\n filters: $filters\n orderBy: $orderBy\n ) {\n nodes {\n id,\n status,\n attempts,\n maxAttempts,\n runAt,\n lastError,\n lockAt,\n lockBy,\n doneAt,\n priority\n }\n paginationInfo {\n total\n pages\n }\n }\n }\n"];
export function gql(source: string) {
return (documents as any)[source] ?? {};

View File

@@ -1759,6 +1759,15 @@ export type SyncSubscriptionSourcesMutationVariables = Exact<{
export type SyncSubscriptionSourcesMutation = { __typename?: 'Mutation', subscriptionSyncOneSources: { __typename?: 'SyncOneSubscriptionInfo', taskId: string } };
export type GetTasksQueryVariables = Exact<{
filters: SubscriberTasksFilterInput;
orderBy: SubscriberTasksOrderInput;
pagination: PaginationInput;
}>;
export type GetTasksQuery = { __typename?: 'Query', subscriberTasks: { __typename?: 'SubscriberTasksConnection', nodes: Array<{ __typename?: 'SubscriberTasks', id: string, status: string, attempts: number, maxAttempts: number, runAt: string, lastError?: string | null, lockAt?: string | null, lockBy?: string | null, doneAt?: string | null, priority: number }>, paginationInfo?: { __typename?: 'PaginationInfo', total: number, pages: number } | null } };
export const GetCredential3rdDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCredential3rd"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"filters"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Credential3rdFilterInput"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Credential3rdOrderInput"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"pagination"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"PaginationInput"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"credential3rd"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"filters"},"value":{"kind":"Variable","name":{"kind":"Name","value":"filters"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}}},{"kind":"Argument","name":{"kind":"Name","value":"pagination"},"value":{"kind":"Variable","name":{"kind":"Name","value":"pagination"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"cookies"}},{"kind":"Field","name":{"kind":"Name","value":"username"}},{"kind":"Field","name":{"kind":"Name","value":"password"}},{"kind":"Field","name":{"kind":"Name","value":"userAgent"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"credentialType"}}]}},{"kind":"Field","name":{"kind":"Name","value":"paginationInfo"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"pages"}}]}}]}}]}}]} as unknown as DocumentNode<GetCredential3rdQuery, GetCredential3rdQueryVariables>;
export const InsertCredential3rdDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"InsertCredential3rd"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"data"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Credential3rdInsertInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"credential3rdCreateOne"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"data"},"value":{"kind":"Variable","name":{"kind":"Name","value":"data"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"cookies"}},{"kind":"Field","name":{"kind":"Name","value":"username"}},{"kind":"Field","name":{"kind":"Name","value":"password"}},{"kind":"Field","name":{"kind":"Name","value":"userAgent"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"credentialType"}}]}}]}}]} as unknown as DocumentNode<InsertCredential3rdMutation, InsertCredential3rdMutationVariables>;
@@ -1773,4 +1782,5 @@ export const DeleteSubscriptionsDocument = {"kind":"Document","definitions":[{"k
export const GetSubscriptionDetailDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetSubscriptionDetail"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"subscriptions"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"filters"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"id"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"eq"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}]}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"category"}},{"kind":"Field","name":{"kind":"Name","value":"sourceUrl"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"credential3rd"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"username"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bangumi"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"mikanBangumiId"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"rawName"}},{"kind":"Field","name":{"kind":"Name","value":"season"}},{"kind":"Field","name":{"kind":"Name","value":"seasonRaw"}},{"kind":"Field","name":{"kind":"Name","value":"fansub"}},{"kind":"Field","name":{"kind":"Name","value":"mikanFansubId"}},{"kind":"Field","name":{"kind":"Name","value":"rssLink"}},{"kind":"Field","name":{"kind":"Name","value":"posterLink"}},{"kind":"Field","name":{"kind":"Name","value":"savePath"}},{"kind":"Field","name":{"kind":"Name","value":"homepage"}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode<GetSubscriptionDetailQuery, GetSubscriptionDetailQueryVariables>;
export const SyncSubscriptionFeedsIncrementalDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SyncSubscriptionFeedsIncremental"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"subscriptionSyncOneFeedsIncremental"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"filter"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"taskId"}}]}}]}}]} as unknown as DocumentNode<SyncSubscriptionFeedsIncrementalMutation, SyncSubscriptionFeedsIncrementalMutationVariables>;
export const SyncSubscriptionFeedsFullDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SyncSubscriptionFeedsFull"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"subscriptionSyncOneFeedsFull"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"filter"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"taskId"}}]}}]}}]} as unknown as DocumentNode<SyncSubscriptionFeedsFullMutation, SyncSubscriptionFeedsFullMutationVariables>;
export const SyncSubscriptionSourcesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SyncSubscriptionSources"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"subscriptionSyncOneSources"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"filter"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"taskId"}}]}}]}}]} as unknown as DocumentNode<SyncSubscriptionSourcesMutation, SyncSubscriptionSourcesMutationVariables>;
export const SyncSubscriptionSourcesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SyncSubscriptionSources"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"subscriptionSyncOneSources"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"filter"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"taskId"}}]}}]}}]} as unknown as DocumentNode<SyncSubscriptionSourcesMutation, SyncSubscriptionSourcesMutationVariables>;
export const GetTasksDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTasks"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"filters"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SubscriberTasksFilterInput"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SubscriberTasksOrderInput"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"pagination"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"PaginationInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"subscriberTasks"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"pagination"},"value":{"kind":"Variable","name":{"kind":"Name","value":"pagination"}}},{"kind":"Argument","name":{"kind":"Name","value":"filters"},"value":{"kind":"Variable","name":{"kind":"Name","value":"filters"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nodes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"attempts"}},{"kind":"Field","name":{"kind":"Name","value":"maxAttempts"}},{"kind":"Field","name":{"kind":"Name","value":"runAt"}},{"kind":"Field","name":{"kind":"Name","value":"lastError"}},{"kind":"Field","name":{"kind":"Name","value":"lockAt"}},{"kind":"Field","name":{"kind":"Name","value":"lockBy"}},{"kind":"Field","name":{"kind":"Name","value":"doneAt"}},{"kind":"Field","name":{"kind":"Name","value":"priority"}}]}},{"kind":"Field","name":{"kind":"Name","value":"paginationInfo"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"pages"}}]}}]}}]}}]} as unknown as DocumentNode<GetTasksQuery, GetTasksQueryVariables>;

View File

@@ -1,118 +1,26 @@
import type { ProLinkProps } from '@/components/ui/pro-link';
import { type } from 'arktype';
import {
BookOpen,
Folders,
KeyRound,
type LucideIcon,
Settings2,
SquareTerminal,
Telescope,
} from 'lucide-react';
export const AppNavMainData = [
{
group: 'Dashboard',
items: [
{
title: 'Explore',
icon: Telescope,
children: [
{
title: 'Feed',
link: {
to: '/feed',
},
},
{
title: 'Explore',
link: {
to: '/explore',
},
},
],
},
{
title: 'Subscriptions',
link: {
to: '/subscriptions/manage',
},
icon: Folders,
children: [
{
title: 'Manage',
link: {
to: '/subscriptions/manage',
},
},
{
title: 'Create',
link: {
to: '/subscriptions/create',
},
},
],
},
{
title: 'Credential',
link: {
to: '/credential3rd/manage',
},
icon: KeyRound,
children: [
{
title: 'Manage',
link: {
to: '/credential3rd/manage',
},
},
{
title: 'Create',
link: {
to: '/credential3rd/create',
},
},
],
},
{
title: 'Playground',
icon: SquareTerminal,
link: {
to: '/playground',
},
children: [
{
title: 'GraphQL Api',
link: {
to: '/playground/graphql-api',
},
},
],
},
{
title: 'Documentation',
link: {
href: 'https://github.com/dumtruck/konobangu/wiki',
target: '_blank',
},
icon: BookOpen,
},
{
title: 'Settings',
link: {
to: '/settings',
},
icon: Settings2,
children: [
{
title: 'Downloader',
link: {
to: '/settings/downloader',
},
},
],
},
],
},
];
export interface NavMainItem {
link?: ProLinkProps;
title: string;
icon?: LucideIcon;
children?: { title: string; link: ProLinkProps }[];
}
export interface NavMainGroup {
group: string;
items: NavMainItem[];
}
export const CreateCompleteAction = {
Back: 'back',

View File

@@ -1,5 +1,5 @@
import { useEffect } from 'react';
import { useStateRef } from './use-state-ref.ts';
import { useStateRef } from './use-state-ref';
export interface UseDebouncedSkeletonProps {
minSkeletonDuration?: number;
loading?: boolean;

View File

@@ -32,7 +32,6 @@ import { Route as AppPlaygroundGraphqlApiImport } from './routes/_app/playground
import { Route as AppCredential3rdManageImport } from './routes/_app/credential3rd/manage'
import { Route as AppCredential3rdCreateImport } from './routes/_app/credential3rd/create'
import { Route as AppBangumiManageImport } from './routes/_app/bangumi/manage'
import { Route as AppExploreFeedImport } from './routes/_app/_explore/feed'
import { Route as AppExploreExploreImport } from './routes/_app/_explore/explore'
import { Route as AppTasksDetailIdImport } from './routes/_app/tasks/detail.$id'
import { Route as AppSubscriptionsEditIdImport } from './routes/_app/subscriptions/edit.$id'
@@ -169,12 +168,6 @@ const AppBangumiManageRoute = AppBangumiManageImport.update({
getParentRoute: () => AppBangumiRouteRoute,
} as any)
const AppExploreFeedRoute = AppExploreFeedImport.update({
id: '/_explore/feed',
path: '/feed',
getParentRoute: () => AppRouteRoute,
} as any)
const AppExploreExploreRoute = AppExploreExploreImport.update({
id: '/_explore/explore',
path: '/explore',
@@ -306,13 +299,6 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof AppExploreExploreImport
parentRoute: typeof AppRouteImport
}
'/_app/_explore/feed': {
id: '/_app/_explore/feed'
path: '/feed'
fullPath: '/feed'
preLoaderRoute: typeof AppExploreFeedImport
parentRoute: typeof AppRouteImport
}
'/_app/bangumi/manage': {
id: '/_app/bangumi/manage'
path: '/manage'
@@ -510,7 +496,6 @@ interface AppRouteRouteChildren {
AppSubscriptionsRouteRoute: typeof AppSubscriptionsRouteRouteWithChildren
AppTasksRouteRoute: typeof AppTasksRouteRouteWithChildren
AppExploreExploreRoute: typeof AppExploreExploreRoute
AppExploreFeedRoute: typeof AppExploreFeedRoute
}
const AppRouteRouteChildren: AppRouteRouteChildren = {
@@ -521,7 +506,6 @@ const AppRouteRouteChildren: AppRouteRouteChildren = {
AppSubscriptionsRouteRoute: AppSubscriptionsRouteRouteWithChildren,
AppTasksRouteRoute: AppTasksRouteRouteWithChildren,
AppExploreExploreRoute: AppExploreExploreRoute,
AppExploreFeedRoute: AppExploreFeedRoute,
}
const AppRouteRouteWithChildren = AppRouteRoute._addFileChildren(
@@ -542,7 +526,6 @@ export interface FileRoutesByFullPath {
'/auth/sign-in': typeof AuthSignInRoute
'/auth/sign-up': typeof AuthSignUpRoute
'/explore': typeof AppExploreExploreRoute
'/feed': typeof AppExploreFeedRoute
'/bangumi/manage': typeof AppBangumiManageRoute
'/credential3rd/create': typeof AppCredential3rdCreateRoute
'/credential3rd/manage': typeof AppCredential3rdManageRoute
@@ -573,7 +556,6 @@ export interface FileRoutesByTo {
'/auth/sign-in': typeof AuthSignInRoute
'/auth/sign-up': typeof AuthSignUpRoute
'/explore': typeof AppExploreExploreRoute
'/feed': typeof AppExploreFeedRoute
'/bangumi/manage': typeof AppBangumiManageRoute
'/credential3rd/create': typeof AppCredential3rdCreateRoute
'/credential3rd/manage': typeof AppCredential3rdManageRoute
@@ -605,7 +587,6 @@ export interface FileRoutesById {
'/auth/sign-in': typeof AuthSignInRoute
'/auth/sign-up': typeof AuthSignUpRoute
'/_app/_explore/explore': typeof AppExploreExploreRoute
'/_app/_explore/feed': typeof AppExploreFeedRoute
'/_app/bangumi/manage': typeof AppBangumiManageRoute
'/_app/credential3rd/create': typeof AppCredential3rdCreateRoute
'/_app/credential3rd/manage': typeof AppCredential3rdManageRoute
@@ -638,7 +619,6 @@ export interface FileRouteTypes {
| '/auth/sign-in'
| '/auth/sign-up'
| '/explore'
| '/feed'
| '/bangumi/manage'
| '/credential3rd/create'
| '/credential3rd/manage'
@@ -668,7 +648,6 @@ export interface FileRouteTypes {
| '/auth/sign-in'
| '/auth/sign-up'
| '/explore'
| '/feed'
| '/bangumi/manage'
| '/credential3rd/create'
| '/credential3rd/manage'
@@ -698,7 +677,6 @@ export interface FileRouteTypes {
| '/auth/sign-in'
| '/auth/sign-up'
| '/_app/_explore/explore'
| '/_app/_explore/feed'
| '/_app/bangumi/manage'
| '/_app/credential3rd/create'
| '/_app/credential3rd/manage'
@@ -767,8 +745,7 @@ export const routeTree = rootRoute
"/_app/settings",
"/_app/subscriptions",
"/_app/tasks",
"/_app/_explore/explore",
"/_app/_explore/feed"
"/_app/_explore/explore"
]
},
"/404": {
@@ -836,10 +813,6 @@ export const routeTree = rootRoute
"filePath": "_app/_explore/explore.tsx",
"parent": "/_app"
},
"/_app/_explore/feed": {
"filePath": "_app/_explore/feed.tsx",
"parent": "/_app"
},
"/_app/bangumi/manage": {
"filePath": "_app/bangumi/manage.tsx",
"parent": "/_app/bangumi"

View File

@@ -1,15 +0,0 @@
import type { RouteStateDataOption } from '@/infra/routes/traits';
import { createFileRoute } from '@tanstack/react-router';
export const Route = createFileRoute('/_app/_explore/feed')({
component: FeedRouteComponent,
staticData: {
breadcrumb: {
label: 'Feed',
},
} satisfies RouteStateDataOption,
});
function FeedRouteComponent() {
return <div>Hello "/_app/feed"!</div>;
}

View File

@@ -269,7 +269,7 @@ function CredentialManageRouteComponent() {
}, [handleDeleteRecord, navigate, showPasswords, togglePasswordVisibility]);
const table = useReactTable({
data: data?.credential3rd?.nodes ?? [],
data: useMemo(() => credentials?.nodes ?? [], [credentials]),
columns,
getCoreRowModel: getCoreRowModel(),
getPaginationRowModel: getPaginationRowModel(),
@@ -335,7 +335,7 @@ function CredentialManageRouteComponent() {
</TableHeader>
<TableBody>
{showSkeleton &&
Array.from(new Array(pagination.pageSize)).map((_, index) => (
Array.from(new Array(10)).map((_, index) => (
<TableRow key={index}>
{table.getVisibleLeafColumns().map((column) => (
<TableCell key={column.id}>

View File

@@ -220,13 +220,14 @@ function SubscriptionDetailRouteComponent() {
</div>
</div>
{subscription.credential3rd && (
{subscription.category ===
SubscriptionCategoryEnum.MikanSeason && (
<>
<div className="space-y-2">
<Label className="font-medium text-sm">Credential ID</Label>
<div className="rounded-md bg-muted p-3">
<code className="text-sm">
{subscription.credential3rd.id}
{subscription.credential3rd?.id ?? '-'}
</code>
</div>
</div>
@@ -237,7 +238,7 @@ function SubscriptionDetailRouteComponent() {
</Label>
<div className="rounded-md bg-muted p-3">
<code className="text-sm">
{subscription.credential3rd.username}
{subscription.credential3rd?.username ?? '-'}
</code>
</div>
</div>

View File

@@ -90,6 +90,7 @@ function SubscriptionManageRouteComponent() {
},
}
);
const [updateSubscription] = useMutation(UPDATE_SUBSCRIPTIONS, {
onCompleted: async () => {
const refetchResult = await refetch();
@@ -260,7 +261,7 @@ function SubscriptionManageRouteComponent() {
}, [handleUpdateRecord, handleDeleteRecord, navigate]);
const table = useReactTable({
data: data?.subscriptions?.nodes ?? [],
data: useMemo(() => subscriptions?.nodes ?? [], [subscriptions]),
columns,
getCoreRowModel: getCoreRowModel(),
getPaginationRowModel: getPaginationRowModel(),
@@ -270,6 +271,8 @@ function SubscriptionManageRouteComponent() {
pageCount: subscriptions?.paginationInfo?.pages,
rowCount: subscriptions?.paginationInfo?.total,
enableColumnPinning: true,
autoResetPageIndex: true,
manualPagination: true,
state: {
pagination,
sorting,
@@ -323,7 +326,7 @@ function SubscriptionManageRouteComponent() {
</TableHeader>
<TableBody>
{showSkeleton &&
Array.from(new Array(pagination.pageSize)).map((_, index) => (
Array.from(new Array(10)).map((_, index) => (
<TableRow key={index}>
{table.getVisibleLeafColumns().map((column) => (
<TableCell key={column.id}>