This commit is contained in:
phaichayon
2026-06-11 12:46:57 +07:00
parent 1993d88306
commit 7a390cf0df
720 changed files with 100919 additions and 0 deletions

40
src/types/data-table.ts Normal file
View File

@@ -0,0 +1,40 @@
import type { DataTableConfig } from '@/config/data-table';
import type { FilterItemSchema } from '@/lib/parsers';
import type { ColumnSort, Row, RowData } from '@tanstack/react-table';
declare module '@tanstack/react-table' {
// biome-ignore lint/correctness/noUnusedVariables: Interface type parameters required by @tanstack/react-table
interface ColumnMeta<TData extends RowData, TValue> {
label?: string;
placeholder?: string;
variant?: FilterVariant;
options?: Option[];
range?: [number, number];
unit?: string;
icon?: React.FC<React.SVGProps<SVGSVGElement>>;
}
}
export interface Option {
label: string;
value: string;
count?: number;
icon?: React.FC<React.SVGProps<SVGSVGElement>>;
}
export type FilterOperator = DataTableConfig['operators'][number];
export type FilterVariant = DataTableConfig['filterVariants'][number];
export type JoinOperator = DataTableConfig['joinOperators'][number];
export interface ExtendedColumnSort<TData> extends Omit<ColumnSort, 'id'> {
id: Extract<keyof TData, string>;
}
export interface ExtendedColumnFilter<TData> extends FilterItemSchema {
id: Extract<keyof TData, string>;
}
export interface DataTableRowAction<TData> {
row: Row<TData>;
variant: 'update' | 'delete';
}

50
src/types/index.ts Normal file
View File

@@ -0,0 +1,50 @@
import { Icons } from '@/components/icons';
export interface PermissionCheck {
systemRole?: string;
permission?: string;
plan?: string;
feature?: string;
role?: string;
requireOrg?: boolean;
}
export interface NavItem {
title: string;
url: string;
disabled?: boolean;
external?: boolean;
shortcut?: [string, string];
icon?: keyof typeof Icons;
label?: string;
description?: string;
isActive?: boolean;
items?: NavItem[];
access?: PermissionCheck;
}
export interface NavGroup {
label: string;
items: NavItem[];
}
export interface NavItemWithChildren extends NavItem {
items: NavItemWithChildren[];
}
export interface NavItemWithOptionalChildren extends NavItem {
items?: NavItemWithChildren[];
}
export interface FooterItem {
title: string;
items: {
title: string;
href: string;
external?: boolean;
}[];
}
export type MainNavItem = NavItemWithOptionalChildren;
export type SidebarNavItem = NavItemWithChildren;

53
src/types/next-auth.d.ts vendored Normal file
View File

@@ -0,0 +1,53 @@
import type { DefaultSession } from 'next-auth';
declare module 'next-auth' {
interface Session {
user: DefaultSession['user'] & {
id: string;
systemRole: 'super_admin' | 'user';
activeOrganizationId: string | null;
activeOrganizationName: string | null;
activeOrganizationPlan: string | null;
activeMembershipRole: string | null;
activeBusinessRole: string | null;
activePermissions: string[];
organizations: Array<{
id: string;
name: string;
slug: string;
role: string;
businessRole: string;
plan: string;
imageUrl: string | null;
}>;
};
}
interface User {
id: string;
systemRole?: 'super_admin' | 'user';
activeOrganizationId?: string | null;
}
}
declare module 'next-auth/jwt' {
interface JWT {
sub?: string;
systemRole?: 'super_admin' | 'user';
activeOrganizationId?: string | null;
activeOrganizationName?: string | null;
activeOrganizationPlan?: string | null;
activeMembershipRole?: string | null;
activeBusinessRole?: string | null;
activePermissions?: string[];
organizations?: Array<{
id: string;
name: string;
slug: string;
role: string;
businessRole: string;
plan: string;
imageUrl: string | null;
}>;
}
}