diff --git a/web/default/AGENTS.md b/web/default/AGENTS.md index 24498be8..4af5e86b 100644 --- a/web/default/AGENTS.md +++ b/web/default/AGENTS.md @@ -8,19 +8,19 @@ ### 技术栈 -| 类别 | 技术 | -|----------|------| -| 包管理 | Bun | -| 框架 | React 19、TypeScript | -| 数据与请求 | @tanstack/react-query、axios、Zustand | -| 路由 | @tanstack/react-router | -| 表格与列表 | @tanstack/react-table、@tanstack/react-virtual | -| 国际化 | i18next、react-i18next、i18next-browser-languagedetector | -| 日期 | Day.js | -| UI 与样式 | Base UI、Hugeicons、Tailwind CSS、clsx / class-variance-authority | -| 表单 | React Hook Form、Zod | -| 图表 | @visactor/vchart、@visactor/react-vchart | -| 工具 | qrcode.react、oxfmt、oxlint、vitest(可选)| +| 类别 | 技术 | +| ---------- | ----------------------------------------------------------------- | +| 包管理 | Bun | +| 框架 | React 19、TypeScript | +| 数据与请求 | @tanstack/react-query、axios、Zustand | +| 路由 | @tanstack/react-router | +| 表格与列表 | @tanstack/react-table、@tanstack/react-virtual | +| 国际化 | i18next、react-i18next、i18next-browser-languagedetector | +| 日期 | Day.js | +| UI 与样式 | Base UI、Hugeicons、Tailwind CSS、clsx / class-variance-authority | +| 表单 | React Hook Form、Zod | +| 图表 | @visactor/vchart、@visactor/react-vchart | +| 工具 | qrcode.react、oxfmt、oxlint、vitest(可选) | 优先选用成熟、维护良好的开源库;仅在现有库无法满足或需特殊适配时自行实现,并评估可维护性与通用性。 @@ -57,17 +57,17 @@ ### 3.1 国际化 - **页面文本**:所有面向用户的文案均需支持 i18n,使用 `useTranslation()` 的 `t()` 进行翻译。 -- **使用场景** - - **React 组件**:必须使用 `const { t } = useTranslation()`,以保证语言切换时组件会重新渲染。 - - **非 React 环境**(工具函数、常量、类方法):可使用 `import { t } from 'i18next'`;此类用法不会随语言切换自动更新,仅在不依赖响应式更新的场景使用。 +- **使用场景** + - **React 组件**:必须使用 `const { t } = useTranslation()`,以保证语言切换时组件会重新渲染。 + - **非 React 环境**(工具函数、常量、类方法):可使用 `import { t } from 'i18next'`;此类用法不会随语言切换自动更新,仅在不依赖响应式更新的场景使用。 - 即使父组件已使用 `useTranslation()`,子组件仍应自行使用,以保证独立性。 - **专有名词**:品牌、产品、技术术语等可保留英文(如 API、React、TypeScript);若有约定俗成的译法则使用翻译。 - **翻译键**:使用有层级、语义清晰的键名,如 `dashboard.overview.title`,并保持命名一致。 - **枚举与文案(常量中的 i18n)** - 各 feature 的 `constants.ts` 中常出现「枚举/状态 + 展示文案」或「成功/错误消息」,须统一约定以免遗漏 i18n、用法混乱: - - **成功/错误/提示类消息**(如 `SUCCESS_MESSAGES`、`ERROR_MESSAGES`):常量值仅表示 **i18n 键**(与英文 fallback 同字面量)。展示时**必须**通过 `t()` 使用,例如 `toast.success(t(SUCCESS_MESSAGES.API_KEY_CREATED))`、`toast.error(t(ERROR_MESSAGES.UNEXPECTED))`,**禁止**直接 `toast.success(SUCCESS_MESSAGES.xxx)` 当作最终文案。 - - **状态/选项的 label**:在常量中统一用 **labelKey**(字符串,即 i18n 键),组件中通过 `t(config.labelKey)` 渲染;或约定用 `label` 存与 en 一致的 key 字符串,组件用 `t(config.label)`。同一 feature 内只采用一种方式,避免混用。 + 各 feature 的 `constants.ts` 中常出现「枚举/状态 + 展示文案」或「成功/错误消息」,须统一约定以免遗漏 i18n、用法混乱: + - **成功/错误/提示类消息**(如 `SUCCESS_MESSAGES`、`ERROR_MESSAGES`):常量值仅表示 **i18n 键**(与英文 fallback 同字面量)。展示时**必须**通过 `t()` 使用,例如 `toast.success(t(SUCCESS_MESSAGES.API_KEY_CREATED))`、`toast.error(t(ERROR_MESSAGES.UNEXPECTED))`,**禁止**直接 `toast.success(SUCCESS_MESSAGES.xxx)` 当作最终文案。 + - **状态/选项的 label**:在常量中统一用 **labelKey**(字符串,即 i18n 键),组件中通过 `t(config.labelKey)` 渲染;或约定用 `label` 存与 en 一致的 key 字符串,组件用 `t(config.label)`。同一 feature 内只采用一种方式,避免混用。 - **新增此类常量时**:同步在 `src/i18n/static-keys.ts` 中登记对应 key(若项目用其做提取),或确保文案以 `t('...')` 字面量形式出现以便扫描,避免遗漏翻译。 ### 3.2 代码风格与类型 diff --git a/web/default/knip.config.ts b/web/default/knip.config.ts index cd0e90ee..cc10beed 100644 --- a/web/default/knip.config.ts +++ b/web/default/knip.config.ts @@ -1,8 +1,8 @@ -import type { KnipConfig } from 'knip'; +import type { KnipConfig } from 'knip' const config: KnipConfig = { ignore: ['src/components/ui/**', 'src/routeTree.gen.ts'], - ignoreDependencies: ["tailwindcss", "tw-animate-css"] -}; + ignoreDependencies: ['tailwindcss', 'tw-animate-css'], +} -export default config; \ No newline at end of file +export default config diff --git a/web/default/netlify.toml b/web/default/netlify.toml index ff1c0508..6a3dd09c 100644 --- a/web/default/netlify.toml +++ b/web/default/netlify.toml @@ -1,4 +1,4 @@ [[redirects]] - from = "/*" - to = "/index.html" - status = 200 \ No newline at end of file +from = "/*" +to = "/index.html" +status = 200 diff --git a/web/default/scripts/sync-i18n.mjs b/web/default/scripts/sync-i18n.mjs index 3235a9ec..51dd3897 100644 --- a/web/default/scripts/sync-i18n.mjs +++ b/web/default/scripts/sync-i18n.mjs @@ -138,7 +138,14 @@ function countLeafKeys(obj) { return count } -function reorderLikeBase(base, target, fill, extras, missing, currentPath = []) { +function reorderLikeBase( + base, + target, + fill, + extras, + missing, + currentPath = [] +) { // If base is an object, we keep base's key order and recurse. if (isPlainObject(base)) { const out = {} @@ -148,10 +155,24 @@ function reorderLikeBase(base, target, fill, extras, missing, currentPath = []) for (const key of Object.keys(base)) { const nextPath = [...currentPath, key] if (Object.prototype.hasOwnProperty.call(t, key)) { - out[key] = reorderLikeBase(base[key], t[key], f[key], extras, missing, nextPath) + out[key] = reorderLikeBase( + base[key], + t[key], + f[key], + extras, + missing, + nextPath + ) } else { missing.push(nextPath.join('.')) - out[key] = reorderLikeBase(base[key], undefined, f[key], extras, missing, nextPath) + out[key] = reorderLikeBase( + base[key], + undefined, + f[key], + extras, + missing, + nextPath + ) } } @@ -208,7 +229,8 @@ function isLikelyUntranslated({ locale, baseValue, value }) { if (locale === 'ru') return true // For fr/vi: still useful but noisier; keep it conservative. - if (locale === 'fr' || locale === 'vi') return /\b(the|and|or|to|with|please)\b/i.test(s) + if (locale === 'fr' || locale === 'vi') + return /\b(the|and|or|to|with|please)\b/i.test(s) return false } @@ -234,7 +256,9 @@ async function main() { const trans = json?.translation ?? {} return { locale, score: countLeafKeys(trans) } }) - .sort((a, b) => b.score - a.score || a.locale.localeCompare(b.locale))[0]?.locale + .sort( + (a, b) => b.score - a.score || a.locale.localeCompare(b.locale) + )[0]?.locale if (!baseLocale) throw new Error('No locale files found.') @@ -289,31 +313,44 @@ async function main() { } if (Object.keys(extras).length > 0) { - await fs.writeFile(path.join(extrasDir, `${locale}.extras.json`), stableStringify(extras), 'utf8') + await fs.writeFile( + path.join(extrasDir, `${locale}.extras.json`), + stableStringify(extras), + 'utf8' + ) } else { - await fs.rm(path.join(extrasDir, `${locale}.extras.json`), { force: true }) + await fs.rm(path.join(extrasDir, `${locale}.extras.json`), { + force: true, + }) } if (Object.keys(untranslated).length > 0) { await fs.writeFile( path.join(reportsDir, `${locale}.untranslated.json`), stableStringify(untranslated), - 'utf8', + 'utf8' ) } else { - await fs.rm(path.join(reportsDir, `${locale}.untranslated.json`), { force: true }) + await fs.rm(path.join(reportsDir, `${locale}.untranslated.json`), { + force: true, + }) } // Rewrite locale file in base order (even for en to normalize formatting) await fs.writeFile(full, stableStringify(fixed), 'utf8') } - await fs.writeFile(path.join(reportsDir, '_sync-report.json'), stableStringify(report), 'utf8') - - console.log(`i18n sync done. Report: ${path.join(reportsDir, '_sync-report.json')}`) + await fs.writeFile( + path.join(reportsDir, '_sync-report.json'), + stableStringify(report), + 'utf8' + ) + + console.log( + `i18n sync done. Report: ${path.join(reportsDir, '_sync-report.json')}` + ) } main().catch((err) => { - console.error(err) process.exitCode = 1 }) diff --git a/web/default/src/assets/brand-icons/icon-discord.tsx b/web/default/src/assets/brand-icons/icon-discord.tsx index b03eda43..f24d1bd8 100644 --- a/web/default/src/assets/brand-icons/icon-discord.tsx +++ b/web/default/src/assets/brand-icons/icon-discord.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { type SVGProps } from 'react' + import { cn } from '@/lib/utils' export function IconDiscord({ className, ...props }: SVGProps) { diff --git a/web/default/src/assets/brand-icons/icon-docker.tsx b/web/default/src/assets/brand-icons/icon-docker.tsx index e3e03382..f01a1094 100644 --- a/web/default/src/assets/brand-icons/icon-docker.tsx +++ b/web/default/src/assets/brand-icons/icon-docker.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { type SVGProps } from 'react' + import { cn } from '@/lib/utils' export function IconDocker({ className, ...props }: SVGProps) { diff --git a/web/default/src/assets/brand-icons/icon-facebook.tsx b/web/default/src/assets/brand-icons/icon-facebook.tsx index 12237176..1dcc98a7 100644 --- a/web/default/src/assets/brand-icons/icon-facebook.tsx +++ b/web/default/src/assets/brand-icons/icon-facebook.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { type SVGProps } from 'react' + import { cn } from '@/lib/utils' export function IconFacebook({ className, ...props }: SVGProps) { diff --git a/web/default/src/assets/brand-icons/icon-figma.tsx b/web/default/src/assets/brand-icons/icon-figma.tsx index 1ecd4ccb..039d7e0b 100644 --- a/web/default/src/assets/brand-icons/icon-figma.tsx +++ b/web/default/src/assets/brand-icons/icon-figma.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { type SVGProps } from 'react' + import { cn } from '@/lib/utils' export function IconFigma({ className, ...props }: SVGProps) { diff --git a/web/default/src/assets/brand-icons/icon-github.tsx b/web/default/src/assets/brand-icons/icon-github.tsx index 007386a5..d8eafd60 100644 --- a/web/default/src/assets/brand-icons/icon-github.tsx +++ b/web/default/src/assets/brand-icons/icon-github.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { type SVGProps } from 'react' + import { cn } from '@/lib/utils' export function IconGithub({ className, ...props }: SVGProps) { diff --git a/web/default/src/assets/brand-icons/icon-gitlab.tsx b/web/default/src/assets/brand-icons/icon-gitlab.tsx index cca7600e..110cadda 100644 --- a/web/default/src/assets/brand-icons/icon-gitlab.tsx +++ b/web/default/src/assets/brand-icons/icon-gitlab.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { type SVGProps } from 'react' + import { cn } from '@/lib/utils' export function IconGitlab({ className, ...props }: SVGProps) { diff --git a/web/default/src/assets/brand-icons/icon-gmail.tsx b/web/default/src/assets/brand-icons/icon-gmail.tsx index fdba884b..fed0c97d 100644 --- a/web/default/src/assets/brand-icons/icon-gmail.tsx +++ b/web/default/src/assets/brand-icons/icon-gmail.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { type SVGProps } from 'react' + import { cn } from '@/lib/utils' export function IconGmail({ className, ...props }: SVGProps) { diff --git a/web/default/src/assets/brand-icons/icon-linuxdo.tsx b/web/default/src/assets/brand-icons/icon-linuxdo.tsx index 555d6e7b..fb093506 100644 --- a/web/default/src/assets/brand-icons/icon-linuxdo.tsx +++ b/web/default/src/assets/brand-icons/icon-linuxdo.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { type SVGProps } from 'react' + import { cn } from '@/lib/utils' export function IconLinuxDo({ className, ...props }: SVGProps) { diff --git a/web/default/src/assets/brand-icons/icon-medium.tsx b/web/default/src/assets/brand-icons/icon-medium.tsx index 57e4a651..2b1079bf 100644 --- a/web/default/src/assets/brand-icons/icon-medium.tsx +++ b/web/default/src/assets/brand-icons/icon-medium.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { type SVGProps } from 'react' + import { cn } from '@/lib/utils' export function IconMedium({ className, ...props }: SVGProps) { diff --git a/web/default/src/assets/brand-icons/icon-notion.tsx b/web/default/src/assets/brand-icons/icon-notion.tsx index 8eb16afc..5a1d2cf6 100644 --- a/web/default/src/assets/brand-icons/icon-notion.tsx +++ b/web/default/src/assets/brand-icons/icon-notion.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { type SVGProps } from 'react' + import { cn } from '@/lib/utils' export function IconNotion({ className, ...props }: SVGProps) { diff --git a/web/default/src/assets/brand-icons/icon-skype.tsx b/web/default/src/assets/brand-icons/icon-skype.tsx index 87d6e70d..6596fb6f 100644 --- a/web/default/src/assets/brand-icons/icon-skype.tsx +++ b/web/default/src/assets/brand-icons/icon-skype.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { type SVGProps } from 'react' + import { cn } from '@/lib/utils' export function IconSkype({ className, ...props }: SVGProps) { diff --git a/web/default/src/assets/brand-icons/icon-slack.tsx b/web/default/src/assets/brand-icons/icon-slack.tsx index dd1b70a6..4711b155 100644 --- a/web/default/src/assets/brand-icons/icon-slack.tsx +++ b/web/default/src/assets/brand-icons/icon-slack.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { type SVGProps } from 'react' + import { cn } from '@/lib/utils' export function IconSlack({ className, ...props }: SVGProps) { diff --git a/web/default/src/assets/brand-icons/icon-stripe.tsx b/web/default/src/assets/brand-icons/icon-stripe.tsx index 7988827d..19f0ec51 100644 --- a/web/default/src/assets/brand-icons/icon-stripe.tsx +++ b/web/default/src/assets/brand-icons/icon-stripe.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { type SVGProps } from 'react' + import { cn } from '@/lib/utils' export function IconStripe({ className, ...props }: SVGProps) { diff --git a/web/default/src/assets/brand-icons/icon-telegram.tsx b/web/default/src/assets/brand-icons/icon-telegram.tsx index 3098088a..21fc6811 100644 --- a/web/default/src/assets/brand-icons/icon-telegram.tsx +++ b/web/default/src/assets/brand-icons/icon-telegram.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { type SVGProps } from 'react' + import { cn } from '@/lib/utils' export function IconTelegram({ className, ...props }: SVGProps) { diff --git a/web/default/src/assets/brand-icons/icon-trello.tsx b/web/default/src/assets/brand-icons/icon-trello.tsx index 2254392f..80fd8233 100644 --- a/web/default/src/assets/brand-icons/icon-trello.tsx +++ b/web/default/src/assets/brand-icons/icon-trello.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { type SVGProps } from 'react' + import { cn } from '@/lib/utils' export function IconTrello({ className, ...props }: SVGProps) { diff --git a/web/default/src/assets/brand-icons/icon-wechat.tsx b/web/default/src/assets/brand-icons/icon-wechat.tsx index e9489f51..2c723d13 100644 --- a/web/default/src/assets/brand-icons/icon-wechat.tsx +++ b/web/default/src/assets/brand-icons/icon-wechat.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { type SVGProps } from 'react' + import { cn } from '@/lib/utils' export function IconWeChat({ className, ...props }: SVGProps) { diff --git a/web/default/src/assets/brand-icons/icon-whatsapp.tsx b/web/default/src/assets/brand-icons/icon-whatsapp.tsx index 8a7ed1c0..a37bec94 100644 --- a/web/default/src/assets/brand-icons/icon-whatsapp.tsx +++ b/web/default/src/assets/brand-icons/icon-whatsapp.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { type SVGProps } from 'react' + import { cn } from '@/lib/utils' export function IconWhatsapp({ className, ...props }: SVGProps) { diff --git a/web/default/src/assets/brand-icons/icon-zoom.tsx b/web/default/src/assets/brand-icons/icon-zoom.tsx index cf80df0f..88fa613b 100644 --- a/web/default/src/assets/brand-icons/icon-zoom.tsx +++ b/web/default/src/assets/brand-icons/icon-zoom.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { type SVGProps } from 'react' + import { cn } from '@/lib/utils' export function IconZoom({ className, ...props }: SVGProps) { diff --git a/web/default/src/assets/clerk-logo.tsx b/web/default/src/assets/clerk-logo.tsx index de8a33ff..6efdf4f8 100644 --- a/web/default/src/assets/clerk-logo.tsx +++ b/web/default/src/assets/clerk-logo.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { type SVGProps } from 'react' + import { cn } from '@/lib/utils' export function ClerkLogo({ className, ...props }: SVGProps) { diff --git a/web/default/src/assets/custom/icon-dir.tsx b/web/default/src/assets/custom/icon-dir.tsx index 679b7ffe..58d6e4ca 100644 --- a/web/default/src/assets/custom/icon-dir.tsx +++ b/web/default/src/assets/custom/icon-dir.tsx @@ -17,8 +17,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { type SVGProps } from 'react' -import { cn } from '@/lib/utils' + import { type Direction } from '@/context/direction-provider' +import { cn } from '@/lib/utils' type IconDirProps = SVGProps & { dir: Direction diff --git a/web/default/src/assets/custom/icon-theme-system.tsx b/web/default/src/assets/custom/icon-theme-system.tsx index e01dea05..fde626f5 100644 --- a/web/default/src/assets/custom/icon-theme-system.tsx +++ b/web/default/src/assets/custom/icon-theme-system.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { type SVGProps } from 'react' + import { cn } from '@/lib/utils' export function IconThemeSystem({ diff --git a/web/default/src/assets/logo.tsx b/web/default/src/assets/logo.tsx index 4bd61b86..1f9dd232 100644 --- a/web/default/src/assets/logo.tsx +++ b/web/default/src/assets/logo.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { type SVGProps } from 'react' + import { cn } from '@/lib/utils' export function Logo({ className, ...props }: SVGProps) { diff --git a/web/default/src/components/ai-elements/actions.tsx b/web/default/src/components/ai-elements/actions.tsx index 3d3bb405..9d3c2da4 100644 --- a/web/default/src/components/ai-elements/actions.tsx +++ b/web/default/src/components/ai-elements/actions.tsx @@ -19,7 +19,7 @@ For commercial licensing, please contact support@quantumnous.com 'use client' import type { ComponentProps } from 'react' -import { cn } from '@/lib/utils' + import { Button } from '@/components/ui/button' import { Tooltip, @@ -27,6 +27,7 @@ import { TooltipProvider, TooltipTrigger, } from '@/components/ui/tooltip' +import { cn } from '@/lib/utils' export type ActionsProps = ComponentProps<'div'> diff --git a/web/default/src/components/ai-elements/artifact.tsx b/web/default/src/components/ai-elements/artifact.tsx index c491cc3f..8bb68a61 100644 --- a/web/default/src/components/ai-elements/artifact.tsx +++ b/web/default/src/components/ai-elements/artifact.tsx @@ -18,10 +18,10 @@ For commercial licensing, please contact support@quantumnous.com */ 'use client' -import type { ComponentProps, HTMLAttributes } from 'react' import { type LucideIcon, XIcon } from 'lucide-react' +import type { ComponentProps, HTMLAttributes } from 'react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + import { Button } from '@/components/ui/button' import { Tooltip, @@ -29,6 +29,7 @@ import { TooltipProvider, TooltipTrigger, } from '@/components/ui/tooltip' +import { cn } from '@/lib/utils' export type ArtifactProps = HTMLAttributes diff --git a/web/default/src/components/ai-elements/branch.tsx b/web/default/src/components/ai-elements/branch.tsx index 6c3537ef..d0fe67f6 100644 --- a/web/default/src/components/ai-elements/branch.tsx +++ b/web/default/src/components/ai-elements/branch.tsx @@ -18,6 +18,8 @@ For commercial licensing, please contact support@quantumnous.com */ 'use client' +import type { UIMessage } from 'ai' +import { ChevronLeftIcon, ChevronRightIcon } from 'lucide-react' import { type ComponentProps, createContext, @@ -28,11 +30,10 @@ import { useMemo, useState, } from 'react' -import type { UIMessage } from 'ai' -import { ChevronLeftIcon, ChevronRightIcon } from 'lucide-react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + import { Button } from '@/components/ui/button' +import { cn } from '@/lib/utils' type BranchContextType = { currentBranch: number diff --git a/web/default/src/components/ai-elements/canvas.tsx b/web/default/src/components/ai-elements/canvas.tsx index 0df5a856..8e190705 100644 --- a/web/default/src/components/ai-elements/canvas.tsx +++ b/web/default/src/components/ai-elements/canvas.tsx @@ -16,8 +16,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import type { ReactNode } from 'react' import { Background, ReactFlow, type ReactFlowProps } from '@xyflow/react' +import type { ReactNode } from 'react' + import '@xyflow/react/dist/style.css' import { Controls } from './controls' diff --git a/web/default/src/components/ai-elements/chain-of-thought.tsx b/web/default/src/components/ai-elements/chain-of-thought.tsx index caf5b644..b1ed9446 100644 --- a/web/default/src/components/ai-elements/chain-of-thought.tsx +++ b/web/default/src/components/ai-elements/chain-of-thought.tsx @@ -18,6 +18,12 @@ For commercial licensing, please contact support@quantumnous.com */ 'use client' +import { + BrainIcon, + ChevronDownIcon, + DotIcon, + type LucideIcon, +} from 'lucide-react' import { type ComponentProps, createContext, @@ -25,20 +31,15 @@ import { useContext, useMemo, } from 'react' -import { - BrainIcon, - ChevronDownIcon, - DotIcon, - type LucideIcon, -} from 'lucide-react' -import { useControllableState } from '@/lib/use-controllable-state' -import { cn } from '@/lib/utils' + import { Badge } from '@/components/ui/badge' import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from '@/components/ui/collapsible' +import { useControllableState } from '@/lib/use-controllable-state' +import { cn } from '@/lib/utils' type ChainOfThoughtContextValue = { isOpen: boolean diff --git a/web/default/src/components/ai-elements/confirmation.tsx b/web/default/src/components/ai-elements/confirmation.tsx index e78eb93b..b86d65bb 100644 --- a/web/default/src/components/ai-elements/confirmation.tsx +++ b/web/default/src/components/ai-elements/confirmation.tsx @@ -18,16 +18,17 @@ For commercial licensing, please contact support@quantumnous.com */ 'use client' +import type { ToolUIPart } from 'ai' import { type ComponentProps, createContext, type ReactNode, useContext, } from 'react' -import type { ToolUIPart } from 'ai' -import { cn } from '@/lib/utils' + import { Alert, AlertDescription } from '@/components/ui/alert' import { Button } from '@/components/ui/button' +import { cn } from '@/lib/utils' // Workaround for missing types in 'ai' package type ExtendedToolState = diff --git a/web/default/src/components/ai-elements/context.tsx b/web/default/src/components/ai-elements/context.tsx index a300025c..ec7afafa 100644 --- a/web/default/src/components/ai-elements/context.tsx +++ b/web/default/src/components/ai-elements/context.tsx @@ -18,11 +18,11 @@ For commercial licensing, please contact support@quantumnous.com */ 'use client' -import { type ComponentProps, createContext, useContext } from 'react' import type { LanguageModelUsage } from 'ai' +import { type ComponentProps, createContext, useContext } from 'react' import { useTranslation } from 'react-i18next' import { getUsage } from 'tokenlens' -import { cn } from '@/lib/utils' + import { Button } from '@/components/ui/button' import { HoverCard, @@ -30,6 +30,7 @@ import { HoverCardTrigger, } from '@/components/ui/hover-card' import { Progress } from '@/components/ui/progress' +import { cn } from '@/lib/utils' const PERCENT_MAX = 100 const ICON_RADIUS = 10 diff --git a/web/default/src/components/ai-elements/controls.tsx b/web/default/src/components/ai-elements/controls.tsx index 48af3cca..0801e741 100644 --- a/web/default/src/components/ai-elements/controls.tsx +++ b/web/default/src/components/ai-elements/controls.tsx @@ -18,8 +18,9 @@ For commercial licensing, please contact support@quantumnous.com */ 'use client' -import type { ComponentProps } from 'react' import { Controls as ControlsPrimitive } from '@xyflow/react' +import type { ComponentProps } from 'react' + import { cn } from '@/lib/utils' export type ControlsProps = ComponentProps diff --git a/web/default/src/components/ai-elements/image.tsx b/web/default/src/components/ai-elements/image.tsx index a0646226..e38241e1 100644 --- a/web/default/src/components/ai-elements/image.tsx +++ b/web/default/src/components/ai-elements/image.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import type { Experimental_GeneratedImage } from 'ai' + import { cn } from '@/lib/utils' export type ImageProps = Experimental_GeneratedImage & { diff --git a/web/default/src/components/ai-elements/inline-citation.tsx b/web/default/src/components/ai-elements/inline-citation.tsx index 0b380c43..429fcb38 100644 --- a/web/default/src/components/ai-elements/inline-citation.tsx +++ b/web/default/src/components/ai-elements/inline-citation.tsx @@ -18,6 +18,7 @@ For commercial licensing, please contact support@quantumnous.com */ 'use client' +import { ArrowLeftIcon, ArrowRightIcon } from 'lucide-react' import { type ComponentProps, createContext, @@ -26,9 +27,8 @@ import { useEffect, useState, } from 'react' -import { ArrowLeftIcon, ArrowRightIcon } from 'lucide-react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + import { Badge } from '@/components/ui/badge' import { Button } from '@/components/ui/button' import { @@ -42,6 +42,7 @@ import { HoverCardContent, HoverCardTrigger, } from '@/components/ui/hover-card' +import { cn } from '@/lib/utils' export type InlineCitationProps = ComponentProps<'span'> diff --git a/web/default/src/components/ai-elements/loader.tsx b/web/default/src/components/ai-elements/loader.tsx index 92c9bdb9..e804abfd 100644 --- a/web/default/src/components/ai-elements/loader.tsx +++ b/web/default/src/components/ai-elements/loader.tsx @@ -18,6 +18,7 @@ For commercial licensing, please contact support@quantumnous.com */ import type { HTMLAttributes } from 'react' import { useTranslation } from 'react-i18next' + import { cn } from '@/lib/utils' type LoaderIconProps = { diff --git a/web/default/src/components/ai-elements/message.tsx b/web/default/src/components/ai-elements/message.tsx index 044d19d5..937a7739 100644 --- a/web/default/src/components/ai-elements/message.tsx +++ b/web/default/src/components/ai-elements/message.tsx @@ -16,11 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import type { ComponentProps, HTMLAttributes } from 'react' import type { UIMessage } from 'ai' import { cva, type VariantProps } from 'class-variance-authority' -import { cn } from '@/lib/utils' +import type { ComponentProps, HTMLAttributes } from 'react' + import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar' +import { cn } from '@/lib/utils' export type MessageProps = HTMLAttributes & { from: UIMessage['role'] diff --git a/web/default/src/components/ai-elements/node.tsx b/web/default/src/components/ai-elements/node.tsx index c20c72be..9f7ea7a9 100644 --- a/web/default/src/components/ai-elements/node.tsx +++ b/web/default/src/components/ai-elements/node.tsx @@ -16,9 +16,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import type { ComponentProps } from 'react' import { Handle, Position } from '@xyflow/react' -import { cn } from '@/lib/utils' +import type { ComponentProps } from 'react' + import { Card, CardAction, @@ -28,6 +28,7 @@ import { CardHeader, CardTitle, } from '@/components/ui/card' +import { cn } from '@/lib/utils' export type NodeProps = ComponentProps & { handles: { diff --git a/web/default/src/components/ai-elements/open-in-chat.tsx b/web/default/src/components/ai-elements/open-in-chat.tsx index c512af16..b5dbb360 100644 --- a/web/default/src/components/ai-elements/open-in-chat.tsx +++ b/web/default/src/components/ai-elements/open-in-chat.tsx @@ -16,14 +16,14 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { type ComponentProps, createContext, useContext } from 'react' import { ChevronDownIcon, ExternalLinkIcon, MessageCircleIcon, } from 'lucide-react' +import { type ComponentProps, createContext, useContext } from 'react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + import { Button } from '@/components/ui/button' import { DropdownMenu, @@ -33,6 +33,7 @@ import { DropdownMenuSeparator, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu' +import { cn } from '@/lib/utils' const providers = { github: { diff --git a/web/default/src/components/ai-elements/panel.tsx b/web/default/src/components/ai-elements/panel.tsx index 85340e3c..7984260c 100644 --- a/web/default/src/components/ai-elements/panel.tsx +++ b/web/default/src/components/ai-elements/panel.tsx @@ -16,8 +16,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import type { ComponentProps } from 'react' import { Panel as PanelPrimitive } from '@xyflow/react' +import type { ComponentProps } from 'react' + import { cn } from '@/lib/utils' type PanelProps = ComponentProps diff --git a/web/default/src/components/ai-elements/plan.tsx b/web/default/src/components/ai-elements/plan.tsx index da697138..774b528f 100644 --- a/web/default/src/components/ai-elements/plan.tsx +++ b/web/default/src/components/ai-elements/plan.tsx @@ -18,10 +18,10 @@ For commercial licensing, please contact support@quantumnous.com */ 'use client' -import { type ComponentProps, createContext, useContext } from 'react' import { ChevronsUpDownIcon } from 'lucide-react' +import { type ComponentProps, createContext, useContext } from 'react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + import { Button } from '@/components/ui/button' import { Card, @@ -37,6 +37,8 @@ import { CollapsibleContent, CollapsibleTrigger, } from '@/components/ui/collapsible' +import { cn } from '@/lib/utils' + import { Shimmer } from './shimmer' type PlanContextValue = { diff --git a/web/default/src/components/ai-elements/prompt-input.tsx b/web/default/src/components/ai-elements/prompt-input.tsx index 9a50fff4..46ab3f67 100644 --- a/web/default/src/components/ai-elements/prompt-input.tsx +++ b/web/default/src/components/ai-elements/prompt-input.tsx @@ -19,6 +19,18 @@ For commercial licensing, please contact support@quantumnous.com /* eslint-disable react-refresh/only-export-components */ 'use client' +import type { ChatStatus, FileUIPart } from 'ai' +import { + ImageIcon, + Loader2Icon, + MicIcon, + PaperclipIcon, + PlusIcon, + SendIcon, + SquareIcon, + XIcon, +} from 'lucide-react' +import { nanoid } from 'nanoid' import { type ChangeEvent, type ChangeEventHandler, @@ -41,20 +53,8 @@ import { useRef, useState, } from 'react' -import type { ChatStatus, FileUIPart } from 'ai' -import { - ImageIcon, - Loader2Icon, - MicIcon, - PaperclipIcon, - PlusIcon, - SendIcon, - SquareIcon, - XIcon, -} from 'lucide-react' -import { nanoid } from 'nanoid' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + import { Button } from '@/components/ui/button' import { Command, @@ -89,6 +89,7 @@ import { SelectTrigger, SelectValue, } from '@/components/ui/select' +import { cn } from '@/lib/utils' // ============================================================================ // Provider Context & Types diff --git a/web/default/src/components/ai-elements/queue.tsx b/web/default/src/components/ai-elements/queue.tsx index 9fd99880..a5f1456f 100644 --- a/web/default/src/components/ai-elements/queue.tsx +++ b/web/default/src/components/ai-elements/queue.tsx @@ -18,9 +18,9 @@ For commercial licensing, please contact support@quantumnous.com */ 'use client' -import type { ComponentProps } from 'react' import { ChevronDownIcon, PaperclipIcon } from 'lucide-react' -import { cn } from '@/lib/utils' +import type { ComponentProps } from 'react' + import { Button } from '@/components/ui/button' import { Collapsible, @@ -28,6 +28,7 @@ import { CollapsibleTrigger, } from '@/components/ui/collapsible' import { ScrollArea } from '@/components/ui/scroll-area' +import { cn } from '@/lib/utils' export type QueueMessagePart = { type: string diff --git a/web/default/src/components/ai-elements/response-renderer-alert.tsx b/web/default/src/components/ai-elements/response-renderer-alert.tsx index 157e48d8..f5be2fc0 100644 --- a/web/default/src/components/ai-elements/response-renderer-alert.tsx +++ b/web/default/src/components/ai-elements/response-renderer-alert.tsx @@ -16,8 +16,8 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import type { ReactNode } from 'react' import { t } from 'i18next' +import type { ReactNode } from 'react' import type { BlockquoteNode, ParsedNode } from 'stream-markdown-parser' import { cn } from '@/lib/utils' diff --git a/web/default/src/components/ai-elements/response-renderer-details.tsx b/web/default/src/components/ai-elements/response-renderer-details.tsx index 08e9a4b0..07c6756a 100644 --- a/web/default/src/components/ai-elements/response-renderer-details.tsx +++ b/web/default/src/components/ai-elements/response-renderer-details.tsx @@ -16,8 +16,8 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import type { ReactNode } from 'react' import { t } from 'i18next' +import type { ReactNode } from 'react' import type { HtmlBlockNode, ParsedNode } from 'stream-markdown-parser' import { hasParsedChildren, isHtmlBlockNode } from './response-node-guards' diff --git a/web/default/src/components/ai-elements/response-renderer-footnotes.tsx b/web/default/src/components/ai-elements/response-renderer-footnotes.tsx index 0923412b..34592ae3 100644 --- a/web/default/src/components/ai-elements/response-renderer-footnotes.tsx +++ b/web/default/src/components/ai-elements/response-renderer-footnotes.tsx @@ -16,8 +16,8 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import type { ReactNode } from 'react' import { t } from 'i18next' +import type { ReactNode } from 'react' import type { FootnoteNode } from 'stream-markdown-parser' import type { BlockRendererOptions } from './response-types' diff --git a/web/default/src/components/ai-elements/shimmer.tsx b/web/default/src/components/ai-elements/shimmer.tsx index 4fb68b0d..ec8c2216 100644 --- a/web/default/src/components/ai-elements/shimmer.tsx +++ b/web/default/src/components/ai-elements/shimmer.tsx @@ -18,8 +18,9 @@ For commercial licensing, please contact support@quantumnous.com */ 'use client' -import { type CSSProperties, type ElementType, memo, useMemo } from 'react' import { motion } from 'motion/react' +import { type CSSProperties, type ElementType, memo, useMemo } from 'react' + import { cn } from '@/lib/utils' export type TextShimmerProps = { diff --git a/web/default/src/components/ai-elements/suggestion.tsx b/web/default/src/components/ai-elements/suggestion.tsx index 19cb2cfb..2f764711 100644 --- a/web/default/src/components/ai-elements/suggestion.tsx +++ b/web/default/src/components/ai-elements/suggestion.tsx @@ -19,9 +19,10 @@ For commercial licensing, please contact support@quantumnous.com 'use client' import type { ComponentProps } from 'react' -import { cn } from '@/lib/utils' + import { Button } from '@/components/ui/button' import { ScrollArea, ScrollBar } from '@/components/ui/scroll-area' +import { cn } from '@/lib/utils' export type SuggestionsProps = ComponentProps diff --git a/web/default/src/components/ai-elements/task.tsx b/web/default/src/components/ai-elements/task.tsx index a2156ff1..d40d4ba5 100644 --- a/web/default/src/components/ai-elements/task.tsx +++ b/web/default/src/components/ai-elements/task.tsx @@ -18,14 +18,15 @@ For commercial licensing, please contact support@quantumnous.com */ 'use client' -import type { ComponentProps } from 'react' import { ChevronDownIcon, SearchIcon } from 'lucide-react' -import { cn } from '@/lib/utils' +import type { ComponentProps } from 'react' + import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from '@/components/ui/collapsible' +import { cn } from '@/lib/utils' export type TaskItemFileProps = ComponentProps<'div'> diff --git a/web/default/src/components/ai-elements/tool.tsx b/web/default/src/components/ai-elements/tool.tsx index 5689ae04..5268f4ac 100644 --- a/web/default/src/components/ai-elements/tool.tsx +++ b/web/default/src/components/ai-elements/tool.tsx @@ -18,7 +18,6 @@ For commercial licensing, please contact support@quantumnous.com */ 'use client' -import { type ComponentProps, isValidElement, type ReactNode } from 'react' import type { ToolUIPart } from 'ai' import { CheckCircleIcon, @@ -28,14 +27,17 @@ import { WrenchIcon, XCircleIcon, } from 'lucide-react' +import { type ComponentProps, isValidElement, type ReactNode } from 'react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + import { Badge } from '@/components/ui/badge' import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from '@/components/ui/collapsible' +import { cn } from '@/lib/utils' + import { CodeBlock } from './code-block' // Workaround for missing types in 'ai' package diff --git a/web/default/src/components/ai-elements/toolbar.tsx b/web/default/src/components/ai-elements/toolbar.tsx index 5bc7c5dc..0f76883e 100644 --- a/web/default/src/components/ai-elements/toolbar.tsx +++ b/web/default/src/components/ai-elements/toolbar.tsx @@ -16,8 +16,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import type { ComponentProps } from 'react' import { NodeToolbar, Position } from '@xyflow/react' +import type { ComponentProps } from 'react' + import { cn } from '@/lib/utils' type ToolbarProps = ComponentProps diff --git a/web/default/src/components/ai-elements/web-preview.tsx b/web/default/src/components/ai-elements/web-preview.tsx index 95e290f1..fe994817 100644 --- a/web/default/src/components/ai-elements/web-preview.tsx +++ b/web/default/src/components/ai-elements/web-preview.tsx @@ -18,6 +18,7 @@ For commercial licensing, please contact support@quantumnous.com */ 'use client' +import { ChevronDownIcon } from 'lucide-react' import { type ComponentProps, createContext, @@ -26,10 +27,8 @@ import { useEffect, useState, } from 'react' -import { ChevronDownIcon } from 'lucide-react' import { useTranslation } from 'react-i18next' -import dayjs from '@/lib/dayjs' -import { cn } from '@/lib/utils' + import { Button } from '@/components/ui/button' import { Collapsible, @@ -43,6 +42,8 @@ import { TooltipProvider, TooltipTrigger, } from '@/components/ui/tooltip' +import dayjs from '@/lib/dayjs' +import { cn } from '@/lib/utils' export type WebPreviewContextValue = { url: string diff --git a/web/default/src/components/animate-in-view.tsx b/web/default/src/components/animate-in-view.tsx index 58a12ff9..f47c1691 100644 --- a/web/default/src/components/animate-in-view.tsx +++ b/web/default/src/components/animate-in-view.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useRef, useEffect, type ReactNode } from 'react' + import { cn } from '@/lib/utils' interface AnimateInViewProps { diff --git a/web/default/src/components/auto-skeleton.tsx b/web/default/src/components/auto-skeleton.tsx index 341880a0..5f1931dc 100644 --- a/web/default/src/components/auto-skeleton.tsx +++ b/web/default/src/components/auto-skeleton.tsx @@ -16,11 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import type { ReactNode } from 'react' import type { UseQueryResult } from '@tanstack/react-query' import { AutoSkeleton } from 'auto-skeleton-react' -import { useThemeRadiusPx } from '@/lib/theme-radius' +import type { ReactNode } from 'react' + import { ErrorState } from '@/components/error-state' +import { useThemeRadiusPx } from '@/lib/theme-radius' interface ContentSkeletonProps { loading: boolean diff --git a/web/default/src/components/command-menu.tsx b/web/default/src/components/command-menu.tsx index 692cf863..0f4d320a 100644 --- a/web/default/src/components/command-menu.tsx +++ b/web/default/src/components/command-menu.tsx @@ -16,13 +16,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import React from 'react' import { useLocation, useNavigate } from '@tanstack/react-router' import { ArrowRight, ChevronRight, Laptop, Moon, Sun } from 'lucide-react' +import React from 'react' import { useTranslation } from 'react-i18next' -import { useSearch } from '@/context/search-provider' -import { useTheme } from '@/context/theme-provider' -import { useSidebarData } from '@/hooks/use-sidebar-data' + import { Command, CommandDialog, @@ -33,6 +31,10 @@ import { CommandList, CommandSeparator, } from '@/components/ui/command' +import { useSearch } from '@/context/search-provider' +import { useTheme } from '@/context/theme-provider' +import { useSidebarData } from '@/hooks/use-sidebar-data' + import { getNavGroupsForPath } from './layout/lib/sidebar-view-registry' import { ScrollArea } from './ui/scroll-area' diff --git a/web/default/src/components/config-drawer.tsx b/web/default/src/components/config-drawer.tsx index 10273678..5eda5152 100644 --- a/web/default/src/components/config-drawer.tsx +++ b/web/default/src/components/config-drawer.tsx @@ -16,11 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { type SVGProps } from 'react' import { Radio as RadioPrimitive } from '@base-ui/react/radio' import { RadioGroup as Radio } from '@base-ui/react/radio-group' import { CircleCheck, Palette, RotateCcw } from 'lucide-react' +import { type SVGProps } from 'react' import { useTranslation } from 'react-i18next' + import { IconDir } from '@/assets/custom/icon-dir' import { IconLayoutCompact } from '@/assets/custom/icon-layout-compact' import { IconLayoutDefault } from '@/assets/custom/icon-layout-default' @@ -32,18 +33,11 @@ import { IconThemeDark } from '@/assets/custom/icon-theme-dark' import { IconThemeLight } from '@/assets/custom/icon-theme-light' import { IconThemeSystem } from '@/assets/custom/icon-theme-system' import { - type ContentLayout, - THEME_PRESETS, - type ThemeFont, - type ThemePreset, - type ThemeRadius, - type ThemeScale, -} from '@/lib/theme-customization' -import { cn } from '@/lib/utils' -import { useDirection } from '@/context/direction-provider' -import { type Collapsible, useLayout } from '@/context/layout-provider' -import { useThemeCustomization } from '@/context/theme-customization-provider' -import { useTheme } from '@/context/theme-provider' + sideDrawerContentClassName, + sideDrawerFooterClassName, + sideDrawerFormClassName, + sideDrawerHeaderClassName, +} from '@/components/drawer-layout' import { Button } from '@/components/ui/button' import { Sheet, @@ -54,12 +48,20 @@ import { SheetTitle, SheetTrigger, } from '@/components/ui/sheet' +import { useDirection } from '@/context/direction-provider' +import { type Collapsible, useLayout } from '@/context/layout-provider' +import { useThemeCustomization } from '@/context/theme-customization-provider' +import { useTheme } from '@/context/theme-provider' import { - sideDrawerContentClassName, - sideDrawerFooterClassName, - sideDrawerFormClassName, - sideDrawerHeaderClassName, -} from '@/components/drawer-layout' + type ContentLayout, + THEME_PRESETS, + type ThemeFont, + type ThemePreset, + type ThemeRadius, + type ThemeScale, +} from '@/lib/theme-customization' +import { cn } from '@/lib/utils' + import { useSidebar } from './ui/sidebar' const Item = RadioPrimitive.Root diff --git a/web/default/src/components/confirm-dialog.tsx b/web/default/src/components/confirm-dialog.tsx index 7ed9e3df..848707d0 100644 --- a/web/default/src/components/confirm-dialog.tsx +++ b/web/default/src/components/confirm-dialog.tsx @@ -17,7 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + import { AlertDialog, AlertDialogCancel, @@ -28,6 +28,7 @@ import { AlertDialogTitle, } from '@/components/ui/alert-dialog' import { Button } from '@/components/ui/button' +import { cn } from '@/lib/utils' type ConfirmDialogProps = { open: boolean diff --git a/web/default/src/components/copy-button.tsx b/web/default/src/components/copy-button.tsx index 310ede1e..950c2393 100644 --- a/web/default/src/components/copy-button.tsx +++ b/web/default/src/components/copy-button.tsx @@ -16,17 +16,18 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { type ReactNode } from 'react' import { Check, Copy } from 'lucide-react' +import { type ReactNode } from 'react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' -import { useCopyToClipboard } from '@/hooks/use-copy-to-clipboard' + import { Button } from '@/components/ui/button' import { Tooltip, TooltipContent, TooltipTrigger, } from '@/components/ui/tooltip' +import { useCopyToClipboard } from '@/hooks/use-copy-to-clipboard' +import { cn } from '@/lib/utils' interface CopyButtonProps { value: string diff --git a/web/default/src/components/data-table/core/badge-cell.tsx b/web/default/src/components/data-table/core/badge-cell.tsx index be9fdf18..5de4c4bd 100644 --- a/web/default/src/components/data-table/core/badge-cell.tsx +++ b/web/default/src/components/data-table/core/badge-cell.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import * as React from 'react' + import { cn } from '@/lib/utils' type BadgeCellProps = React.HTMLAttributes diff --git a/web/default/src/components/data-table/core/badge-list-cell.tsx b/web/default/src/components/data-table/core/badge-list-cell.tsx index 7196a785..4609c9f0 100644 --- a/web/default/src/components/data-table/core/badge-list-cell.tsx +++ b/web/default/src/components/data-table/core/badge-list-cell.tsx @@ -17,13 +17,14 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import * as React from 'react' + +import { StatusBadgeList } from '@/components/status-badge' import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from '@/components/ui/tooltip' -import { StatusBadgeList } from '@/components/status-badge' interface BadgeListCellProps { items: React.ReactNode[] diff --git a/web/default/src/components/data-table/core/column-header.tsx b/web/default/src/components/data-table/core/column-header.tsx index 04d68bac..48a797a7 100644 --- a/web/default/src/components/data-table/core/column-header.tsx +++ b/web/default/src/components/data-table/core/column-header.tsx @@ -24,7 +24,7 @@ import { EyeOff as EyeNoneIcon, } from 'lucide-react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + import { Button } from '@/components/ui/button' import { DropdownMenu, @@ -33,6 +33,7 @@ import { DropdownMenuSeparator, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu' +import { cn } from '@/lib/utils' type DataTableColumnHeaderProps = React.HTMLAttributes & { diff --git a/web/default/src/components/data-table/core/data-table-header.tsx b/web/default/src/components/data-table/core/data-table-header.tsx index 05aeaf18..14f25faf 100644 --- a/web/default/src/components/data-table/core/data-table-header.tsx +++ b/web/default/src/components/data-table/core/data-table-header.tsx @@ -21,7 +21,9 @@ import { type Header, type Table as TanstackTable, } from '@tanstack/react-table' + import { TableHead, TableHeader, TableRow } from '@/components/ui/table' + import { DataTableColumnHeader } from './column-header' import { isContentSizedColumn } from './content-sized-columns' import type { DataTableColumnClassName } from './types' diff --git a/web/default/src/components/data-table/core/data-table-row.tsx b/web/default/src/components/data-table/core/data-table-row.tsx index cb4b8e8c..308ec74c 100644 --- a/web/default/src/components/data-table/core/data-table-row.tsx +++ b/web/default/src/components/data-table/core/data-table-row.tsx @@ -16,15 +16,17 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import * as React from 'react' import { flexRender, type Cell, type Row, type Table as TanstackTable, } from '@tanstack/react-table' -import { cn } from '@/lib/utils' +import * as React from 'react' + import { TableCell, TableRow } from '@/components/ui/table' +import { cn } from '@/lib/utils' + import { TruncatedCell } from './truncated-cell' import type { DataTableColumnClassName } from './types' diff --git a/web/default/src/components/data-table/core/data-table-view.tsx b/web/default/src/components/data-table/core/data-table-view.tsx index 9a631058..54c83c87 100644 --- a/web/default/src/components/data-table/core/data-table-view.tsx +++ b/web/default/src/components/data-table/core/data-table-view.tsx @@ -16,8 +16,8 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import * as React from 'react' import type { Row, Table as TanstackTable } from '@tanstack/react-table' +import * as React from 'react' import { Table, TableBody, TableCell, TableRow } from '@/components/ui/table' import { cn } from '@/lib/utils' diff --git a/web/default/src/components/data-table/core/pagination.tsx b/web/default/src/components/data-table/core/pagination.tsx index 4b57dc67..7eef0390 100644 --- a/web/default/src/components/data-table/core/pagination.tsx +++ b/web/default/src/components/data-table/core/pagination.tsx @@ -24,7 +24,7 @@ import { ChevronsRight as DoubleArrowRightIcon, } from 'lucide-react' import { useTranslation } from 'react-i18next' -import { cn, getPageNumbers } from '@/lib/utils' + import { Button } from '@/components/ui/button' import { Select, @@ -34,6 +34,7 @@ import { SelectTrigger, SelectValue, } from '@/components/ui/select' +import { cn, getPageNumbers } from '@/lib/utils' type DataTablePaginationProps = { table: Table diff --git a/web/default/src/components/data-table/core/row-action-menu.tsx b/web/default/src/components/data-table/core/row-action-menu.tsx index 3cfab7b1..c7f71bbc 100644 --- a/web/default/src/components/data-table/core/row-action-menu.tsx +++ b/web/default/src/components/data-table/core/row-action-menu.tsx @@ -16,8 +16,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import * as React from 'react' import { MoreHorizontal } from 'lucide-react' +import * as React from 'react' + import { Button } from '@/components/ui/button' import { DropdownMenu, diff --git a/web/default/src/components/data-table/core/table-empty.tsx b/web/default/src/components/data-table/core/table-empty.tsx index 0854387c..70575d73 100644 --- a/web/default/src/components/data-table/core/table-empty.tsx +++ b/web/default/src/components/data-table/core/table-empty.tsx @@ -18,6 +18,7 @@ For commercial licensing, please contact support@quantumnous.com */ import { Database } from 'lucide-react' import { useTranslation } from 'react-i18next' + import { Empty, EmptyDescription, diff --git a/web/default/src/components/data-table/core/table-sizing.ts b/web/default/src/components/data-table/core/table-sizing.ts index bd8e45cd..bfb5c2fa 100644 --- a/web/default/src/components/data-table/core/table-sizing.ts +++ b/web/default/src/components/data-table/core/table-sizing.ts @@ -16,8 +16,8 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import type * as React from 'react' import type { Table as TanstackTable } from '@tanstack/react-table' +import type * as React from 'react' import { isContentSizedColumn } from './content-sized-columns' diff --git a/web/default/src/components/data-table/core/table-skeleton.tsx b/web/default/src/components/data-table/core/table-skeleton.tsx index 55b5c75b..2c934bfa 100644 --- a/web/default/src/components/data-table/core/table-skeleton.tsx +++ b/web/default/src/components/data-table/core/table-skeleton.tsx @@ -17,9 +17,10 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import type { Table } from '@tanstack/react-table' -import { cn } from '@/lib/utils' + import { Skeleton } from '@/components/ui/skeleton' import { TableRow, TableCell } from '@/components/ui/table' +import { cn } from '@/lib/utils' const SKELETON_WIDTHS = [ '75%', diff --git a/web/default/src/components/data-table/core/truncated-cell.tsx b/web/default/src/components/data-table/core/truncated-cell.tsx index f635cb6e..cf598a9a 100644 --- a/web/default/src/components/data-table/core/truncated-cell.tsx +++ b/web/default/src/components/data-table/core/truncated-cell.tsx @@ -17,12 +17,13 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import * as React from 'react' -import { cn } from '@/lib/utils' + import { Tooltip, TooltipContent, TooltipTrigger, } from '@/components/ui/tooltip' +import { cn } from '@/lib/utils' type TruncatedCellProps = { children: React.ReactNode diff --git a/web/default/src/components/data-table/core/types.ts b/web/default/src/components/data-table/core/types.ts index cf31cebb..bb55f02c 100644 --- a/web/default/src/components/data-table/core/types.ts +++ b/web/default/src/components/data-table/core/types.ts @@ -16,8 +16,8 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import type * as React from 'react' import type { Row, Table as TanstackTable } from '@tanstack/react-table' +import type * as React from 'react' export type DataTableColumnClassName = ( columnId: string, diff --git a/web/default/src/components/data-table/hooks/use-data-table.ts b/web/default/src/components/data-table/hooks/use-data-table.ts index bcd0a613..1b8d170b 100644 --- a/web/default/src/components/data-table/hooks/use-data-table.ts +++ b/web/default/src/components/data-table/hooks/use-data-table.ts @@ -16,7 +16,6 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import * as React from 'react' import { type ColumnDef, type ColumnFiltersState, @@ -37,6 +36,7 @@ import { getSortedRowModel, useReactTable, } from '@tanstack/react-table' +import * as React from 'react' type DataTableFeatureOptions = Pick< TableOptions, diff --git a/web/default/src/components/data-table/hooks/use-debounced-column-filter.ts b/web/default/src/components/data-table/hooks/use-debounced-column-filter.ts index f7806695..cc12d5a4 100644 --- a/web/default/src/components/data-table/hooks/use-debounced-column-filter.ts +++ b/web/default/src/components/data-table/hooks/use-debounced-column-filter.ts @@ -16,8 +16,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import * as React from 'react' import type { ColumnFiltersState, OnChangeFn } from '@tanstack/react-table' +import * as React from 'react' + import { useDebounce } from '@/hooks/use-debounce' type UseDebouncedColumnFilterOptions = { diff --git a/web/default/src/components/data-table/layout/card-row-content.tsx b/web/default/src/components/data-table/layout/card-row-content.tsx index bd10eb38..ab0996ed 100644 --- a/web/default/src/components/data-table/layout/card-row-content.tsx +++ b/web/default/src/components/data-table/layout/card-row-content.tsx @@ -16,9 +16,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import * as React from 'react' import type { Row } from '@tanstack/react-table' +import * as React from 'react' + import { StatusBadgeTypeContext } from '@/components/status-badge' + import { getCellLabel, renderCellContent } from './card-cell-utils' /** diff --git a/web/default/src/components/data-table/static/static-data-table.tsx b/web/default/src/components/data-table/static/static-data-table.tsx index d882c4c6..bde3f406 100644 --- a/web/default/src/components/data-table/static/static-data-table.tsx +++ b/web/default/src/components/data-table/static/static-data-table.tsx @@ -17,7 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import * as React from 'react' -import { cn } from '@/lib/utils' + import { Table, TableBody, @@ -26,6 +26,8 @@ import { TableHeader, TableRow, } from '@/components/ui/table' +import { cn } from '@/lib/utils' + import { TruncatedCell } from '../core/truncated-cell' import { staticDataTableClassNames } from './static-data-table-classnames' diff --git a/web/default/src/components/data-table/static/static-row-actions.tsx b/web/default/src/components/data-table/static/static-row-actions.tsx index 80ed0578..581b66f5 100644 --- a/web/default/src/components/data-table/static/static-row-actions.tsx +++ b/web/default/src/components/data-table/static/static-row-actions.tsx @@ -17,11 +17,13 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { Pencil, Trash2 } from 'lucide-react' + import { Button } from '@/components/ui/button' import { DropdownMenuItem, DropdownMenuShortcut, } from '@/components/ui/dropdown-menu' + import { DataTableRowActionMenu } from '../core/row-action-menu' type StaticRowActionsProps = { diff --git a/web/default/src/components/data-table/toolbar/bulk-actions.tsx b/web/default/src/components/data-table/toolbar/bulk-actions.tsx index 69be45b2..a10fc190 100644 --- a/web/default/src/components/data-table/toolbar/bulk-actions.tsx +++ b/web/default/src/components/data-table/toolbar/bulk-actions.tsx @@ -16,11 +16,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useEffect, useLayoutEffect, useRef } from 'react' import { type Table } from '@tanstack/react-table' import { X } from 'lucide-react' +import { useState, useEffect, useLayoutEffect, useRef } from 'react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + import { Badge } from '@/components/ui/badge' import { Button } from '@/components/ui/button' import { Separator } from '@/components/ui/separator' @@ -29,6 +29,7 @@ import { TooltipContent, TooltipTrigger, } from '@/components/ui/tooltip' +import { cn } from '@/lib/utils' type DataTableBulkActionsProps = { table: Table diff --git a/web/default/src/components/data-table/toolbar/faceted-filter.tsx b/web/default/src/components/data-table/toolbar/faceted-filter.tsx index 5fb80015..9dc31b0c 100644 --- a/web/default/src/components/data-table/toolbar/faceted-filter.tsx +++ b/web/default/src/components/data-table/toolbar/faceted-filter.tsx @@ -16,11 +16,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import * as React from 'react' import { type Column } from '@tanstack/react-table' import { Check as CheckIcon, PlusCircle as PlusCircledIcon } from 'lucide-react' +import * as React from 'react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + import { Badge } from '@/components/ui/badge' import { Button } from '@/components/ui/button' import { @@ -38,6 +38,7 @@ import { PopoverTrigger, } from '@/components/ui/popover' import { Separator } from '@/components/ui/separator' +import { cn } from '@/lib/utils' type DataTableFacetedFilterProps = { column?: Column diff --git a/web/default/src/components/data-table/toolbar/toolbar.tsx b/web/default/src/components/data-table/toolbar/toolbar.tsx index bfb9514b..6d1881a0 100644 --- a/web/default/src/components/data-table/toolbar/toolbar.tsx +++ b/web/default/src/components/data-table/toolbar/toolbar.tsx @@ -16,15 +16,17 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ +import type { Table } from '@tanstack/react-table' +import { ChevronDown, Loader2, X as Cross2Icon } from 'lucide-react' import * as React from 'react' import { useState, type ReactNode } from 'react' -import type { Table } from '@tanstack/react-table' -import { useDebounce } from '@/hooks' -import { ChevronDown, Loader2, X as Cross2Icon } from 'lucide-react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' +import { useDebounce } from '@/hooks' +import { cn } from '@/lib/utils' + import { DataTableFacetedFilter } from './faceted-filter' import { DataTableViewOptions } from './view-options' diff --git a/web/default/src/components/data-table/toolbar/view-mode-toggle.tsx b/web/default/src/components/data-table/toolbar/view-mode-toggle.tsx index 2f4df2f7..0e999d6c 100644 --- a/web/default/src/components/data-table/toolbar/view-mode-toggle.tsx +++ b/web/default/src/components/data-table/toolbar/view-mode-toggle.tsx @@ -18,12 +18,14 @@ For commercial licensing, please contact support@quantumnous.com */ import { Grid2X2, Table2 } from 'lucide-react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + import { Tooltip, TooltipContent, TooltipTrigger, } from '@/components/ui/tooltip' +import { cn } from '@/lib/utils' + import { DATA_TABLE_VIEW_MODES, type DataTableViewMode, diff --git a/web/default/src/components/data-table/toolbar/view-options.tsx b/web/default/src/components/data-table/toolbar/view-options.tsx index 5e431789..76d0d57c 100644 --- a/web/default/src/components/data-table/toolbar/view-options.tsx +++ b/web/default/src/components/data-table/toolbar/view-options.tsx @@ -16,9 +16,10 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import * as React from 'react' import { type Table } from '@tanstack/react-table' +import * as React from 'react' import { useTranslation } from 'react-i18next' + import { Button } from '@/components/ui/button' import { DropdownMenu, diff --git a/web/default/src/components/date-picker.tsx b/web/default/src/components/date-picker.tsx index a3c89fbe..12d2d30c 100644 --- a/web/default/src/components/date-picker.tsx +++ b/web/default/src/components/date-picker.tsx @@ -19,7 +19,7 @@ For commercial licensing, please contact support@quantumnous.com import { Calendar as CalendarIcon } from 'lucide-react' import { enUS, fr, ja, ru, vi, zhCN } from 'react-day-picker/locale' import { useTranslation } from 'react-i18next' -import dayjs from '@/lib/dayjs' + import { Button } from '@/components/ui/button' import { Calendar } from '@/components/ui/calendar' import { @@ -27,6 +27,7 @@ import { PopoverContent, PopoverTrigger, } from '@/components/ui/popover' +import dayjs from '@/lib/dayjs' const calendarLocales = { en: enUS, diff --git a/web/default/src/components/datetime-picker.tsx b/web/default/src/components/datetime-picker.tsx index 8dbc6eac..b9dd3f60 100644 --- a/web/default/src/components/datetime-picker.tsx +++ b/web/default/src/components/datetime-picker.tsx @@ -16,12 +16,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import * as React from 'react' import { ChevronDownIcon } from 'lucide-react' +import * as React from 'react' import { enUS, fr, ja, ru, vi, zhCN } from 'react-day-picker/locale' import { useTranslation } from 'react-i18next' -import dayjs from '@/lib/dayjs' -import { cn } from '@/lib/utils' + import { Button } from '@/components/ui/button' import { Calendar } from '@/components/ui/calendar' import { Input } from '@/components/ui/input' @@ -30,6 +29,8 @@ import { PopoverContent, PopoverTrigger, } from '@/components/ui/popover' +import dayjs from '@/lib/dayjs' +import { cn } from '@/lib/utils' const calendarLocales = { en: enUS, diff --git a/web/default/src/components/dialog.tsx b/web/default/src/components/dialog.tsx index 0e93b17b..d31eddd7 100644 --- a/web/default/src/components/dialog.tsx +++ b/web/default/src/components/dialog.tsx @@ -17,7 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import * as React from 'react' -import { cn } from '@/lib/utils' + import { Dialog as DialogRoot, DialogContent, @@ -27,6 +27,7 @@ import { DialogTitle, DialogTrigger, } from '@/components/ui/dialog' +import { cn } from '@/lib/utils' type DialogProps = React.ComponentProps & { title: React.ReactNode diff --git a/web/default/src/components/drawer-layout.ts b/web/default/src/components/drawer-layout.ts index f3c64ff3..4dd02511 100644 --- a/web/default/src/components/drawer-layout.ts +++ b/web/default/src/components/drawer-layout.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createElement, type ReactNode } from 'react' + import { cn } from '@/lib/utils' export const sideDrawerContentClassName = (className?: string) => diff --git a/web/default/src/components/empty-state.tsx b/web/default/src/components/empty-state.tsx index 01d4e907..351f0296 100644 --- a/web/default/src/components/empty-state.tsx +++ b/web/default/src/components/empty-state.tsx @@ -16,10 +16,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import type { ReactNode } from 'react' import { Database, type LucideIcon } from 'lucide-react' +import type { ReactNode } from 'react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + +import { FadeIn } from '@/components/page-transition' import { Empty, EmptyContent, @@ -28,7 +29,7 @@ import { EmptyMedia, EmptyTitle, } from '@/components/ui/empty' -import { FadeIn } from '@/components/page-transition' +import { cn } from '@/lib/utils' interface EmptyStateProps { icon?: LucideIcon diff --git a/web/default/src/components/error-state.tsx b/web/default/src/components/error-state.tsx index 0fd2c988..adfc2f2d 100644 --- a/web/default/src/components/error-state.tsx +++ b/web/default/src/components/error-state.tsx @@ -16,10 +16,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import type { ReactNode } from 'react' import { AlertTriangle, type LucideIcon } from 'lucide-react' +import type { ReactNode } from 'react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + +import { FadeIn } from '@/components/page-transition' import { Button } from '@/components/ui/button' import { Empty, @@ -29,7 +30,7 @@ import { EmptyMedia, EmptyTitle, } from '@/components/ui/empty' -import { FadeIn } from '@/components/page-transition' +import { cn } from '@/lib/utils' interface ErrorStateProps { icon?: LucideIcon diff --git a/web/default/src/components/group-badge.tsx b/web/default/src/components/group-badge.tsx index 9d01a0a6..b153d59f 100644 --- a/web/default/src/components/group-badge.tsx +++ b/web/default/src/components/group-badge.tsx @@ -17,7 +17,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useTranslation } from 'react-i18next' + import { cn } from '@/lib/utils' + import { StatusBadge, type StatusBadgeProps } from './status-badge' type GroupBadgeProps = Omit< diff --git a/web/default/src/components/json-code-editor.tsx b/web/default/src/components/json-code-editor.tsx index a5cc6c9e..e15d53d6 100644 --- a/web/default/src/components/json-code-editor.tsx +++ b/web/default/src/components/json-code-editor.tsx @@ -16,6 +16,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ +import { AlertCircle, Braces, CheckCircle2, Code2 } from 'lucide-react' import { useMemo, useRef, @@ -23,11 +24,11 @@ import { type ComponentProps, type KeyboardEvent, } from 'react' -import { AlertCircle, Braces, CheckCircle2, Code2 } from 'lucide-react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + import { Button } from '@/components/ui/button' import { Textarea } from '@/components/ui/textarea' +import { cn } from '@/lib/utils' export type JsonCodeEditorProps = Omit, 'onChange'> & { value: string diff --git a/web/default/src/components/json-editor.tsx b/web/default/src/components/json-editor.tsx index a109e456..034155f3 100644 --- a/web/default/src/components/json-editor.tsx +++ b/web/default/src/components/json-editor.tsx @@ -16,13 +16,14 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useEffect } from 'react' import { Code, Table, Plus, Trash2 } from 'lucide-react' +import { useState, useEffect } from 'react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Textarea } from '@/components/ui/textarea' +import { cn } from '@/lib/utils' type JsonEditorProps = { value: string diff --git a/web/default/src/components/language-switcher.tsx b/web/default/src/components/language-switcher.tsx index e7fdcf2f..5a8e02da 100644 --- a/web/default/src/components/language-switcher.tsx +++ b/web/default/src/components/language-switcher.tsx @@ -16,16 +16,10 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useCallback } from 'react' -import { - INTERFACE_LANGUAGE_OPTIONS, - normalizeInterfaceLanguage, -} from '@/i18n/languages' import { Languages, Check } from 'lucide-react' +import { useCallback } from 'react' import { useTranslation } from 'react-i18next' -import { useAuthStore } from '@/stores/auth-store' -import { api } from '@/lib/api' -import { cn } from '@/lib/utils' + import { Button } from '@/components/ui/button' import { DropdownMenu, @@ -33,6 +27,13 @@ import { DropdownMenuItem, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu' +import { + INTERFACE_LANGUAGE_OPTIONS, + normalizeInterfaceLanguage, +} from '@/i18n/languages' +import { api } from '@/lib/api' +import { cn } from '@/lib/utils' +import { useAuthStore } from '@/stores/auth-store' export function LanguageSwitcher() { const { i18n, t } = useTranslation() diff --git a/web/default/src/components/layout/components/app-header.tsx b/web/default/src/components/layout/components/app-header.tsx index 43a3b5b7..bdf244c8 100644 --- a/web/default/src/components/layout/components/app-header.tsx +++ b/web/default/src/components/layout/components/app-header.tsx @@ -16,13 +16,14 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useNotifications } from '@/hooks/use-notifications' -import { useTopNavLinks } from '@/hooks/use-top-nav-links' import { ConfigDrawer } from '@/components/config-drawer' import { LanguageSwitcher } from '@/components/language-switcher' import { NotificationPopover } from '@/components/notification-popover' import { ProfileDropdown } from '@/components/profile-dropdown' import { Search } from '@/components/search' +import { useNotifications } from '@/hooks/use-notifications' +import { useTopNavLinks } from '@/hooks/use-top-nav-links' + import { defaultTopNavLinks } from '../config/top-nav.config' import { type TopNavLink } from '../types' import { Header } from './header' diff --git a/web/default/src/components/layout/components/app-sidebar.tsx b/web/default/src/components/layout/components/app-sidebar.tsx index f96926b3..f8c238af 100644 --- a/web/default/src/components/layout/components/app-sidebar.tsx +++ b/web/default/src/components/layout/components/app-sidebar.tsx @@ -17,10 +17,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { AnimatePresence, motion, useReducedMotion } from 'motion/react' -import { MOTION_TRANSITION, MOTION_VARIANTS } from '@/lib/motion' + +import { Sidebar, SidebarContent, SidebarRail } from '@/components/ui/sidebar' import { useLayout } from '@/context/layout-provider' import { useSidebarView } from '@/hooks/use-sidebar-view' -import { Sidebar, SidebarContent, SidebarRail } from '@/components/ui/sidebar' +import { MOTION_TRANSITION, MOTION_VARIANTS } from '@/lib/motion' + import { NavGroup } from './nav-group' import { SidebarViewHeader } from './sidebar-view-header' diff --git a/web/default/src/components/layout/components/authenticated-layout.tsx b/web/default/src/components/layout/components/authenticated-layout.tsx index 129625ee..237031a2 100644 --- a/web/default/src/components/layout/components/authenticated-layout.tsx +++ b/web/default/src/components/layout/components/authenticated-layout.tsx @@ -16,13 +16,14 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { getCookie } from '@/lib/cookies' -import { cn } from '@/lib/utils' -import { LayoutProvider } from '@/context/layout-provider' -import { SearchProvider } from '@/context/search-provider' -import { SidebarInset, SidebarProvider } from '@/components/ui/sidebar' import { AnimatedOutlet } from '@/components/page-transition' import { SkipToMain } from '@/components/skip-to-main' +import { SidebarInset, SidebarProvider } from '@/components/ui/sidebar' +import { LayoutProvider } from '@/context/layout-provider' +import { SearchProvider } from '@/context/search-provider' +import { getCookie } from '@/lib/cookies' +import { cn } from '@/lib/utils' + import { AppHeader } from './app-header' import { AppSidebar } from './app-sidebar' diff --git a/web/default/src/components/layout/components/chat-presets-item.tsx b/web/default/src/components/layout/components/chat-presets-item.tsx index c954113d..da4c3417 100644 --- a/web/default/src/components/layout/components/chat-presets-item.tsx +++ b/web/default/src/components/layout/components/chat-presets-item.tsx @@ -16,11 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useMemo, useCallback, useRef, useState } from 'react' import { Link, useLocation } from '@tanstack/react-router' import { ExternalLink, Loader2, ChevronRight } from 'lucide-react' +import { useMemo, useCallback, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' + import { Collapsible, CollapsibleContent, @@ -47,6 +48,7 @@ import { resolveChatUrl, type ChatPreset, } from '@/features/chat/lib/chat-links' + import { normalizeHref } from '../lib/url-utils' import type { NavChatPresets } from '../types' diff --git a/web/default/src/components/layout/components/footer.tsx b/web/default/src/components/layout/components/footer.tsx index be4e612f..438fc6cf 100644 --- a/web/default/src/components/layout/components/footer.tsx +++ b/web/default/src/components/layout/components/footer.tsx @@ -16,12 +16,13 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { Fragment, useMemo } from 'react' import { Link } from '@tanstack/react-router' +import { Fragment, useMemo } from 'react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + import { useStatus } from '@/hooks/use-status' import { useSystemConfig } from '@/hooks/use-system-config' +import { cn } from '@/lib/utils' interface FooterLink { text: string diff --git a/web/default/src/components/layout/components/glow.tsx b/web/default/src/components/layout/components/glow.tsx index 76b92a2e..c8191088 100644 --- a/web/default/src/components/layout/components/glow.tsx +++ b/web/default/src/components/layout/components/glow.tsx @@ -16,8 +16,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import React from 'react' import { cva, type VariantProps } from 'class-variance-authority' +import React from 'react' + import { cn } from '@/lib/utils' const glowVariants = cva('absolute w-full', { diff --git a/web/default/src/components/layout/components/header.tsx b/web/default/src/components/layout/components/header.tsx index 81baca69..981f32f2 100644 --- a/web/default/src/components/layout/components/header.tsx +++ b/web/default/src/components/layout/components/header.tsx @@ -16,8 +16,8 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { cn } from '@/lib/utils' import { SidebarTrigger } from '@/components/ui/sidebar' +import { cn } from '@/lib/utils' type HeaderProps = React.HTMLAttributes diff --git a/web/default/src/components/layout/components/logo.tsx b/web/default/src/components/layout/components/logo.tsx index 14463011..d4c6b131 100644 --- a/web/default/src/components/layout/components/logo.tsx +++ b/web/default/src/components/layout/components/logo.tsx @@ -17,8 +17,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import React from 'react' -import { cn } from '@/lib/utils' + import { Badge } from '@/components/ui/badge' +import { cn } from '@/lib/utils' export interface LogoProps extends React.HTMLAttributes { image: React.ComponentType> diff --git a/web/default/src/components/layout/components/mobile-drawer.tsx b/web/default/src/components/layout/components/mobile-drawer.tsx index 81086312..9e09df77 100644 --- a/web/default/src/components/layout/components/mobile-drawer.tsx +++ b/web/default/src/components/layout/components/mobile-drawer.tsx @@ -20,13 +20,15 @@ import { Link } from '@tanstack/react-router' import { X, User, Wallet, LogOut } from 'lucide-react' import { AnimatePresence, motion, type Variants } from 'motion/react' import { useTranslation } from 'react-i18next' -import type { AuthUser } from '@/stores/auth-store' -import useDialogState from '@/hooks/use-dialog' -import { useUserDisplay } from '@/hooks/use-user-display' + +import { SignOutDialog } from '@/components/sign-out-dialog' import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar' import { Button } from '@/components/ui/button' import { Skeleton } from '@/components/ui/skeleton' -import { SignOutDialog } from '@/components/sign-out-dialog' +import useDialogState from '@/hooks/use-dialog' +import { useUserDisplay } from '@/hooks/use-user-display' +import type { AuthUser } from '@/stores/auth-store' + import { MOBILE_DRAWER_ANIMATION, MOBILE_DRAWER_CONFIG } from '../constants' import type { TopNavLink } from '../types' diff --git a/web/default/src/components/layout/components/mockup.tsx b/web/default/src/components/layout/components/mockup.tsx index 7f50ed5d..896dcc15 100644 --- a/web/default/src/components/layout/components/mockup.tsx +++ b/web/default/src/components/layout/components/mockup.tsx @@ -16,8 +16,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import React from 'react' import { cva, type VariantProps } from 'class-variance-authority' +import React from 'react' + import { cn } from '@/lib/utils' const mockupVariants = cva( diff --git a/web/default/src/components/layout/components/nav-group.tsx b/web/default/src/components/layout/components/nav-group.tsx index 23845e54..be6a1521 100644 --- a/web/default/src/components/layout/components/nav-group.tsx +++ b/web/default/src/components/layout/components/nav-group.tsx @@ -16,9 +16,10 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { type ReactNode, useState, useEffect } from 'react' import { Link, useLocation } from '@tanstack/react-router' import { ChevronRight } from 'lucide-react' +import { type ReactNode, useState, useEffect } from 'react' + import { Badge } from '@/components/ui/badge' import { Collapsible, @@ -45,6 +46,7 @@ import { SidebarMenuSubItem, useSidebar, } from '@/components/ui/sidebar' + import { checkIsActive } from '../lib/url-utils' import { type NavCollapsible, diff --git a/web/default/src/components/layout/components/nav-link-item.tsx b/web/default/src/components/layout/components/nav-link-item.tsx index 87167958..a2febc23 100644 --- a/web/default/src/components/layout/components/nav-link-item.tsx +++ b/web/default/src/components/layout/components/nav-link-item.tsx @@ -17,7 +17,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { Link } from '@tanstack/react-router' + import { cn } from '@/lib/utils' + import type { TopNavLink } from '../types' interface NavLinkItemProps { diff --git a/web/default/src/components/layout/components/navbar.tsx b/web/default/src/components/layout/components/navbar.tsx index 981bd2db..5552ff01 100644 --- a/web/default/src/components/layout/components/navbar.tsx +++ b/web/default/src/components/layout/components/navbar.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import * as React from 'react' + import { cn } from '@/lib/utils' export function Navbar({ className, ...props }: React.ComponentProps<'nav'>) { diff --git a/web/default/src/components/layout/components/public-header.tsx b/web/default/src/components/layout/components/public-header.tsx index 7030a7c5..43a7e9c9 100644 --- a/web/default/src/components/layout/components/public-header.tsx +++ b/web/default/src/components/layout/components/public-header.tsx @@ -16,21 +16,23 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useCallback, useEffect, useState } from 'react' import { Link, useNavigate, useRouterState } from '@tanstack/react-router' +import { useCallback, useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' -import { useAuthStore } from '@/stores/auth-store' -import { cn } from '@/lib/utils' -import { useNotifications } from '@/hooks/use-notifications' -import { useSystemConfig } from '@/hooks/use-system-config' -import { useTopNavLinks } from '@/hooks/use-top-nav-links' -import { Button } from '@/components/ui/button' -import { Skeleton } from '@/components/ui/skeleton' + import { Dialog } from '@/components/dialog' import { LanguageSwitcher } from '@/components/language-switcher' import { NotificationPopover } from '@/components/notification-popover' import { ProfileDropdown } from '@/components/profile-dropdown' import { ThemeSwitch } from '@/components/theme-switch' +import { Button } from '@/components/ui/button' +import { Skeleton } from '@/components/ui/skeleton' +import { useNotifications } from '@/hooks/use-notifications' +import { useSystemConfig } from '@/hooks/use-system-config' +import { useTopNavLinks } from '@/hooks/use-top-nav-links' +import { cn } from '@/lib/utils' +import { useAuthStore } from '@/stores/auth-store' + import { defaultTopNavLinks } from '../config/top-nav.config' import type { TopNavLink } from '../types' import { HeaderLogo } from './header-logo' diff --git a/web/default/src/components/layout/components/public-navigation.tsx b/web/default/src/components/layout/components/public-navigation.tsx index 4e8cb752..1bc69b4e 100644 --- a/web/default/src/components/layout/components/public-navigation.tsx +++ b/web/default/src/components/layout/components/public-navigation.tsx @@ -17,8 +17,10 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { Link } from '@tanstack/react-router' -import { cn } from '@/lib/utils' + import { useTopNavLinks } from '@/hooks/use-top-nav-links' +import { cn } from '@/lib/utils' + import { defaultTopNavLinks } from '../config/top-nav.config' import type { TopNavLink } from '../types' diff --git a/web/default/src/components/layout/components/section-page-layout.tsx b/web/default/src/components/layout/components/section-page-layout.tsx index c92eb251..11e9255b 100644 --- a/web/default/src/components/layout/components/section-page-layout.tsx +++ b/web/default/src/components/layout/components/section-page-layout.tsx @@ -23,6 +23,7 @@ import { type ReactElement, type ReactNode, } from 'react' + import { Main } from './main' import { PageFooterProvider } from './page-footer' diff --git a/web/default/src/components/layout/components/section.tsx b/web/default/src/components/layout/components/section.tsx index 135be4f3..e0940004 100644 --- a/web/default/src/components/layout/components/section.tsx +++ b/web/default/src/components/layout/components/section.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import * as React from 'react' + import { cn } from '@/lib/utils' export function Section({ diff --git a/web/default/src/components/layout/components/sidebar-view-header.tsx b/web/default/src/components/layout/components/sidebar-view-header.tsx index 97d001bc..b0be5966 100644 --- a/web/default/src/components/layout/components/sidebar-view-header.tsx +++ b/web/default/src/components/layout/components/sidebar-view-header.tsx @@ -19,7 +19,7 @@ For commercial licensing, please contact support@quantumnous.com import { Link } from '@tanstack/react-router' import { ChevronLeft } from 'lucide-react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + import { SidebarHeader, SidebarMenu, @@ -27,6 +27,8 @@ import { SidebarMenuItem, useSidebar, } from '@/components/ui/sidebar' +import { cn } from '@/lib/utils' + import type { SidebarView } from '../types' type SidebarViewHeaderProps = { diff --git a/web/default/src/components/layout/components/system-brand.tsx b/web/default/src/components/layout/components/system-brand.tsx index c3b6b933..b38efb8e 100644 --- a/web/default/src/components/layout/components/system-brand.tsx +++ b/web/default/src/components/layout/components/system-brand.tsx @@ -18,14 +18,15 @@ For commercial licensing, please contact support@quantumnous.com */ import { Link } from '@tanstack/react-router' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' -import { useStatus } from '@/hooks/use-status' -import { useSystemConfig } from '@/hooks/use-system-config' + import { SidebarMenu, SidebarMenuButton, SidebarMenuItem, } from '@/components/ui/sidebar' +import { useStatus } from '@/hooks/use-status' +import { useSystemConfig } from '@/hooks/use-system-config' +import { cn } from '@/lib/utils' type SystemBrandProps = { defaultName?: string diff --git a/web/default/src/components/layout/components/top-nav.tsx b/web/default/src/components/layout/components/top-nav.tsx index 7d50c216..83262ed3 100644 --- a/web/default/src/components/layout/components/top-nav.tsx +++ b/web/default/src/components/layout/components/top-nav.tsx @@ -16,10 +16,10 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useMemo } from 'react' import { Link } from '@tanstack/react-router' import { Menu } from 'lucide-react' -import { cn } from '@/lib/utils' +import { useMemo } from 'react' + import { Button } from '@/components/ui/button' import { DropdownMenu, @@ -27,6 +27,8 @@ import { DropdownMenuItem, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu' +import { cn } from '@/lib/utils' + import { type TopNavLink } from '../types' type TopNavProps = React.HTMLAttributes & { diff --git a/web/default/src/components/layout/config/system-settings.config.ts b/web/default/src/components/layout/config/system-settings.config.ts index c0b7b260..8469c027 100644 --- a/web/default/src/components/layout/config/system-settings.config.ts +++ b/web/default/src/components/layout/config/system-settings.config.ts @@ -26,6 +26,7 @@ import { ShieldAlert, Wrench, } from 'lucide-react' + import { getAuthSectionNavItems } from '@/features/system-settings/auth/section-registry.tsx' import { getBillingSectionNavItems } from '@/features/system-settings/billing/section-registry.tsx' import { getContentSectionNavItems } from '@/features/system-settings/content/section-registry.tsx' @@ -33,6 +34,7 @@ import { getModelsSectionNavItems } from '@/features/system-settings/models/sect import { getOperationsSectionNavItems } from '@/features/system-settings/operations/section-registry.tsx' import { getSecuritySectionNavItems } from '@/features/system-settings/security/section-registry.tsx' import { getSiteSectionNavItems } from '@/features/system-settings/site/section-registry.tsx' + import type { NavGroup, SidebarView } from '../types' /** diff --git a/web/default/src/components/layout/lib/sidebar-view-registry.ts b/web/default/src/components/layout/lib/sidebar-view-registry.ts index c22f8808..a9632a84 100644 --- a/web/default/src/components/layout/lib/sidebar-view-registry.ts +++ b/web/default/src/components/layout/lib/sidebar-view-registry.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { type TFunction } from 'i18next' + import { SYSTEM_SETTINGS_VIEW } from '../config/system-settings.config' import type { NavGroup, SidebarView } from '../types' diff --git a/web/default/src/components/layout/lib/url-utils.ts b/web/default/src/components/layout/lib/url-utils.ts index 36334067..50d021dc 100644 --- a/web/default/src/components/layout/lib/url-utils.ts +++ b/web/default/src/components/layout/lib/url-utils.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import type { LinkProps } from '@tanstack/react-router' + import type { NavItem, NavCollapsible } from '../types' /** diff --git a/web/default/src/components/learn-more.tsx b/web/default/src/components/learn-more.tsx index 4915f19f..242a3531 100644 --- a/web/default/src/components/learn-more.tsx +++ b/web/default/src/components/learn-more.tsx @@ -18,13 +18,14 @@ For commercial licensing, please contact support@quantumnous.com */ import { CircleQuestionMark } from 'lucide-react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + import { Button } from '@/components/ui/button' import { Popover, PopoverContent, PopoverTrigger, } from '@/components/ui/popover' +import { cn } from '@/lib/utils' type LearnMoreProps = Omit, 'children'> & { children?: React.ReactNode diff --git a/web/default/src/components/loading-state.tsx b/web/default/src/components/loading-state.tsx index 3efe9361..6f5cb381 100644 --- a/web/default/src/components/loading-state.tsx +++ b/web/default/src/components/loading-state.tsx @@ -18,6 +18,7 @@ For commercial licensing, please contact support@quantumnous.com */ import { Loader2 } from 'lucide-react' import { useTranslation } from 'react-i18next' + import { cn } from '@/lib/utils' interface LoadingStateProps { diff --git a/web/default/src/components/long-text.tsx b/web/default/src/components/long-text.tsx index 936897ec..79284836 100644 --- a/web/default/src/components/long-text.tsx +++ b/web/default/src/components/long-text.tsx @@ -17,7 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useEffect, useRef, useState } from 'react' -import { cn } from '@/lib/utils' + import { Popover, PopoverContent, @@ -29,6 +29,7 @@ import { TooltipProvider, TooltipTrigger, } from '@/components/ui/tooltip' +import { cn } from '@/lib/utils' type LongTextProps = { children: React.ReactNode diff --git a/web/default/src/components/masked-value-display.tsx b/web/default/src/components/masked-value-display.tsx index aa563637..ad4347ef 100644 --- a/web/default/src/components/masked-value-display.tsx +++ b/web/default/src/components/masked-value-display.tsx @@ -16,13 +16,13 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ +import { CopyButton } from '@/components/copy-button' import { Button } from '@/components/ui/button' import { Popover, PopoverContent, PopoverTrigger, } from '@/components/ui/popover' -import { CopyButton } from '@/components/copy-button' interface MaskedValueDisplayProps { /** 弹层内标题,如 "Full API Key" / "Full Code" */ diff --git a/web/default/src/components/multi-select.tsx b/web/default/src/components/multi-select.tsx index 3d350051..706546e7 100644 --- a/web/default/src/components/multi-select.tsx +++ b/web/default/src/components/multi-select.tsx @@ -16,13 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import * as React from 'react' import { Add01Icon } from '@hugeicons/core-free-icons' import { HugeiconsIcon } from '@hugeicons/react' +import * as React from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { copyToClipboard } from '@/lib/copy-to-clipboard' -import { cn } from '@/lib/utils' + import { Combobox, ComboboxChip, @@ -36,6 +35,8 @@ import { ComboboxValue, useComboboxAnchor, } from '@/components/ui/combobox' +import { copyToClipboard } from '@/lib/copy-to-clipboard' +import { cn } from '@/lib/utils' export type Option = { label: string diff --git a/web/default/src/components/navigation-progress.tsx b/web/default/src/components/navigation-progress.tsx index 3e46b00b..6181d36d 100644 --- a/web/default/src/components/navigation-progress.tsx +++ b/web/default/src/components/navigation-progress.tsx @@ -16,8 +16,8 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useRef } from 'react' import { useRouterState } from '@tanstack/react-router' +import { useEffect, useRef } from 'react' import LoadingBar, { type LoadingBarRef } from 'react-top-loading-bar' export function NavigationProgress() { diff --git a/web/default/src/components/notification-popover.tsx b/web/default/src/components/notification-popover.tsx index 947cdd44..2b19390a 100644 --- a/web/default/src/components/notification-popover.tsx +++ b/web/default/src/components/notification-popover.tsx @@ -19,10 +19,8 @@ For commercial licensing, please contact support@quantumnous.com import type { TFunction } from 'i18next' import { Bell, Megaphone } from 'lucide-react' import { useTranslation } from 'react-i18next' + import { RichContent } from '@/components/rich-content' -import { getAnnouncementColorClass } from '@/lib/colors' -import { formatDateTimeObject } from '@/lib/time' -import { cn } from '@/lib/utils' import { Badge } from '@/components/ui/badge' import { Button } from '@/components/ui/button' import { @@ -42,6 +40,9 @@ import { import { ScrollArea } from '@/components/ui/scroll-area' import { Separator } from '@/components/ui/separator' import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs' +import { getAnnouncementColorClass } from '@/lib/colors' +import { formatDateTimeObject } from '@/lib/time' +import { cn } from '@/lib/utils' interface AnnouncementItem { id?: number | string diff --git a/web/default/src/components/page-transition.tsx b/web/default/src/components/page-transition.tsx index d46fac9a..9c90951d 100644 --- a/web/default/src/components/page-transition.tsx +++ b/web/default/src/components/page-transition.tsx @@ -16,9 +16,10 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import type { ReactNode } from 'react' import { Outlet, useRouterState } from '@tanstack/react-router' import { motion, useReducedMotion, type Variants } from 'motion/react' +import type { ReactNode } from 'react' + import { CARD_ITEM_VARIANTS, CARD_STAGGER_VARIANTS, diff --git a/web/default/src/components/password-input.tsx b/web/default/src/components/password-input.tsx index 781e0638..7e93da19 100644 --- a/web/default/src/components/password-input.tsx +++ b/web/default/src/components/password-input.tsx @@ -16,9 +16,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import * as React from 'react' import { Eye, EyeOff } from 'lucide-react' +import * as React from 'react' + import { cn } from '@/lib/utils' + import { Button } from './ui/button' import { Input } from './ui/input' diff --git a/web/default/src/components/profile-dropdown.tsx b/web/default/src/components/profile-dropdown.tsx index f76199d2..f34c7556 100644 --- a/web/default/src/components/profile-dropdown.tsx +++ b/web/default/src/components/profile-dropdown.tsx @@ -16,16 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useMemo } from 'react' import { useNavigate } from '@tanstack/react-router' import { User, Wallet, LogOut, Settings } from 'lucide-react' +import { useMemo } from 'react' import { useTranslation } from 'react-i18next' -import { useAuthStore } from '@/stores/auth-store' -import { getUserAvatarFallback, getUserAvatarStyle } from '@/lib/avatar' -import { ROLE } from '@/lib/roles' -import useDialogState from '@/hooks/use-dialog' -import { useIsSidebarModuleVisible } from '@/hooks/use-sidebar-config' -import { useUserDisplay } from '@/hooks/use-user-display' + +import { SignOutDialog } from '@/components/sign-out-dialog' import { Avatar, AvatarFallback } from '@/components/ui/avatar' import { Button } from '@/components/ui/button' import { @@ -35,7 +31,12 @@ import { DropdownMenuSeparator, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu' -import { SignOutDialog } from '@/components/sign-out-dialog' +import useDialogState from '@/hooks/use-dialog' +import { useIsSidebarModuleVisible } from '@/hooks/use-sidebar-config' +import { useUserDisplay } from '@/hooks/use-user-display' +import { getUserAvatarFallback, getUserAvatarStyle } from '@/lib/avatar' +import { ROLE } from '@/lib/roles' +import { useAuthStore } from '@/stores/auth-store' const avatarFallbackClassName = 'font-semibold text-white' diff --git a/web/default/src/components/provider-badge.tsx b/web/default/src/components/provider-badge.tsx index 791f0dee..0f0d659c 100644 --- a/web/default/src/components/provider-badge.tsx +++ b/web/default/src/components/provider-badge.tsx @@ -18,6 +18,7 @@ For commercial licensing, please contact support@quantumnous.com */ import { getLobeIcon } from '@/lib/lobe-icon' import { cn } from '@/lib/utils' + import { StatusBadge, type StatusBadgeProps } from './status-badge' type ProviderBadgeProps = Omit & { diff --git a/web/default/src/components/risk-acknowledgement-dialog.tsx b/web/default/src/components/risk-acknowledgement-dialog.tsx index 388223f5..76863632 100644 --- a/web/default/src/components/risk-acknowledgement-dialog.tsx +++ b/web/default/src/components/risk-acknowledgement-dialog.tsx @@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com */ import { useEffect, useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + import { AlertDialog, AlertDialogCancel, @@ -32,6 +32,7 @@ import { Button } from '@/components/ui/button' import { Checkbox } from '@/components/ui/checkbox' import { Label } from '@/components/ui/label' import { Textarea } from '@/components/ui/textarea' +import { cn } from '@/lib/utils' type RequiredTextPart = { type: 'input' | 'static' diff --git a/web/default/src/components/search.tsx b/web/default/src/components/search.tsx index 04cd3b6c..0c8feb4c 100644 --- a/web/default/src/components/search.tsx +++ b/web/default/src/components/search.tsx @@ -18,8 +18,10 @@ For commercial licensing, please contact support@quantumnous.com */ import { SearchIcon } from 'lucide-react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + import { useSearch } from '@/context/search-provider' +import { cn } from '@/lib/utils' + import { Button } from './ui/button' type SearchProps = { diff --git a/web/default/src/components/sign-out-dialog.tsx b/web/default/src/components/sign-out-dialog.tsx index b6e2ca71..537002d9 100644 --- a/web/default/src/components/sign-out-dialog.tsx +++ b/web/default/src/components/sign-out-dialog.tsx @@ -18,9 +18,10 @@ For commercial licensing, please contact support@quantumnous.com */ import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { useAuthStore } from '@/stores/auth-store' + import { ConfirmDialog } from '@/components/confirm-dialog' import { logout } from '@/features/auth/api' +import { useAuthStore } from '@/stores/auth-store' interface SignOutDialogProps { open: boolean diff --git a/web/default/src/components/tag-input.tsx b/web/default/src/components/tag-input.tsx index fdd1333f..62f4c234 100644 --- a/web/default/src/components/tag-input.tsx +++ b/web/default/src/components/tag-input.tsx @@ -16,12 +16,13 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useRef, type KeyboardEvent } from 'react' import { X } from 'lucide-react' +import { useState, useRef, type KeyboardEvent } from 'react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + import { Badge } from '@/components/ui/badge' import { Button } from '@/components/ui/button' +import { cn } from '@/lib/utils' interface TagInputProps { value: string[] diff --git a/web/default/src/components/theme-quick-switcher.tsx b/web/default/src/components/theme-quick-switcher.tsx index 77a61da1..0b948e60 100644 --- a/web/default/src/components/theme-quick-switcher.tsx +++ b/web/default/src/components/theme-quick-switcher.tsx @@ -19,9 +19,10 @@ For commercial licensing, please contact support@quantumnous.com import { Monitor, Sun, MoonStar } from 'lucide-react' import { motion } from 'motion/react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' -import { useTheme } from '@/context/theme-provider' + import { Button } from '@/components/ui/button' +import { useTheme } from '@/context/theme-provider' +import { cn } from '@/lib/utils' export function ThemeQuickSwitcher() { const { t } = useTranslation() diff --git a/web/default/src/components/theme-switch.tsx b/web/default/src/components/theme-switch.tsx index 7b16495c..7a3a69ea 100644 --- a/web/default/src/components/theme-switch.tsx +++ b/web/default/src/components/theme-switch.tsx @@ -16,11 +16,10 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect } from 'react' import { Check, Moon, Sun } from 'lucide-react' +import { useEffect } from 'react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' -import { useTheme } from '@/context/theme-provider' + import { Button } from '@/components/ui/button' import { DropdownMenu, @@ -28,6 +27,8 @@ import { DropdownMenuItem, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu' +import { useTheme } from '@/context/theme-provider' +import { cn } from '@/lib/utils' export function ThemeSwitch() { const { t } = useTranslation() diff --git a/web/default/src/components/truncated-text.tsx b/web/default/src/components/truncated-text.tsx index 2e18d950..826942e6 100644 --- a/web/default/src/components/truncated-text.tsx +++ b/web/default/src/components/truncated-text.tsx @@ -1,5 +1,5 @@ -import { cn } from '@/lib/utils' import { TruncatedCell } from '@/components/data-table/core/truncated-cell' +import { cn } from '@/lib/utils' interface TruncatedTextProps { text: string diff --git a/web/default/src/components/ui/accordion.tsx b/web/default/src/components/ui/accordion.tsx index f6dc7fbd..6e5dae7d 100644 --- a/web/default/src/components/ui/accordion.tsx +++ b/web/default/src/components/ui/accordion.tsx @@ -19,6 +19,7 @@ For commercial licensing, please contact support@quantumnous.com import { Accordion as AccordionPrimitive } from '@base-ui/react/accordion' import { ArrowDown01Icon, ArrowUp01Icon } from '@hugeicons/core-free-icons' import { HugeiconsIcon } from '@hugeicons/react' + import { cn } from '@/lib/utils' function Accordion({ className, ...props }: AccordionPrimitive.Root.Props) { diff --git a/web/default/src/components/ui/alert-dialog.tsx b/web/default/src/components/ui/alert-dialog.tsx index 627fcc2e..ae07ebac 100644 --- a/web/default/src/components/ui/alert-dialog.tsx +++ b/web/default/src/components/ui/alert-dialog.tsx @@ -18,10 +18,11 @@ For commercial licensing, please contact support@quantumnous.com */ 'use client' -import * as React from 'react' import { AlertDialog as AlertDialogPrimitive } from '@base-ui/react/alert-dialog' -import { cn } from '@/lib/utils' +import * as React from 'react' + import { Button } from '@/components/ui/button' +import { cn } from '@/lib/utils' function AlertDialog({ ...props }: AlertDialogPrimitive.Root.Props) { return diff --git a/web/default/src/components/ui/alert.tsx b/web/default/src/components/ui/alert.tsx index cc5a0248..b3c6d8a0 100644 --- a/web/default/src/components/ui/alert.tsx +++ b/web/default/src/components/ui/alert.tsx @@ -16,8 +16,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import * as React from 'react' import { cva, type VariantProps } from 'class-variance-authority' +import * as React from 'react' + import { cn } from '@/lib/utils' const alertVariants = cva( diff --git a/web/default/src/components/ui/avatar.tsx b/web/default/src/components/ui/avatar.tsx index f0686f14..cf81c08d 100644 --- a/web/default/src/components/ui/avatar.tsx +++ b/web/default/src/components/ui/avatar.tsx @@ -16,8 +16,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import * as React from 'react' import { Avatar as AvatarPrimitive } from '@base-ui/react/avatar' +import * as React from 'react' + import { cn } from '@/lib/utils' function Avatar({ diff --git a/web/default/src/components/ui/badge.tsx b/web/default/src/components/ui/badge.tsx index dea7e939..d703d006 100644 --- a/web/default/src/components/ui/badge.tsx +++ b/web/default/src/components/ui/badge.tsx @@ -19,6 +19,7 @@ For commercial licensing, please contact support@quantumnous.com import { mergeProps } from '@base-ui/react/merge-props' import { useRender } from '@base-ui/react/use-render' import { cva, type VariantProps } from 'class-variance-authority' + import { cn } from '@/lib/utils' const badgeVariants = cva( diff --git a/web/default/src/components/ui/breadcrumb.tsx b/web/default/src/components/ui/breadcrumb.tsx index bc1cf805..bebc8ad7 100644 --- a/web/default/src/components/ui/breadcrumb.tsx +++ b/web/default/src/components/ui/breadcrumb.tsx @@ -16,7 +16,6 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import * as React from 'react' import { mergeProps } from '@base-ui/react/merge-props' import { useRender } from '@base-ui/react/use-render' import { @@ -24,6 +23,8 @@ import { MoreHorizontalCircle01Icon, } from '@hugeicons/core-free-icons' import { HugeiconsIcon } from '@hugeicons/react' +import * as React from 'react' + import { cn } from '@/lib/utils' function Breadcrumb({ className, ...props }: React.ComponentProps<'nav'>) { diff --git a/web/default/src/components/ui/button-group.tsx b/web/default/src/components/ui/button-group.tsx index 3fa19252..005af881 100644 --- a/web/default/src/components/ui/button-group.tsx +++ b/web/default/src/components/ui/button-group.tsx @@ -19,8 +19,9 @@ For commercial licensing, please contact support@quantumnous.com import { mergeProps } from '@base-ui/react/merge-props' import { useRender } from '@base-ui/react/use-render' import { cva, type VariantProps } from 'class-variance-authority' -import { cn } from '@/lib/utils' + import { Separator } from '@/components/ui/separator' +import { cn } from '@/lib/utils' const buttonGroupVariants = cva( "flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1", diff --git a/web/default/src/components/ui/button.tsx b/web/default/src/components/ui/button.tsx index 6ab4441f..26f8f4ae 100644 --- a/web/default/src/components/ui/button.tsx +++ b/web/default/src/components/ui/button.tsx @@ -16,9 +16,10 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { isValidElement } from 'react' import { Button as ButtonPrimitive } from '@base-ui/react/button' import { cva, type VariantProps } from 'class-variance-authority' +import { isValidElement } from 'react' + import { cn } from '@/lib/utils' const buttonVariants = cva( diff --git a/web/default/src/components/ui/calendar.tsx b/web/default/src/components/ui/calendar.tsx index 6ebb50ec..3ec5b95f 100644 --- a/web/default/src/components/ui/calendar.tsx +++ b/web/default/src/components/ui/calendar.tsx @@ -16,21 +16,22 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import * as React from 'react' import { ArrowLeftIcon, ArrowRightIcon, ArrowDownIcon, } from '@hugeicons/core-free-icons' import { HugeiconsIcon } from '@hugeicons/react' +import * as React from 'react' import { DayPicker, getDefaultClassNames, type DayButton, type Locale, } from 'react-day-picker' -import { cn } from '@/lib/utils' + import { Button, buttonVariants } from '@/components/ui/button' +import { cn } from '@/lib/utils' function Calendar({ className, diff --git a/web/default/src/components/ui/card.tsx b/web/default/src/components/ui/card.tsx index b6f20b36..3573f127 100644 --- a/web/default/src/components/ui/card.tsx +++ b/web/default/src/components/ui/card.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import * as React from 'react' + import { cn } from '@/lib/utils' function Card({ diff --git a/web/default/src/components/ui/carousel.tsx b/web/default/src/components/ui/carousel.tsx index b3b5235d..ba40c12d 100644 --- a/web/default/src/components/ui/carousel.tsx +++ b/web/default/src/components/ui/carousel.tsx @@ -18,14 +18,15 @@ For commercial licensing, please contact support@quantumnous.com */ 'use client' -import * as React from 'react' import { ArrowLeft01Icon, ArrowRight01Icon } from '@hugeicons/core-free-icons' import { HugeiconsIcon } from '@hugeicons/react' import useEmblaCarousel, { type UseEmblaCarouselType, } from 'embla-carousel-react' -import { cn } from '@/lib/utils' +import * as React from 'react' + import { Button } from '@/components/ui/button' +import { cn } from '@/lib/utils' type CarouselApi = UseEmblaCarouselType[1] type UseCarouselParameters = Parameters diff --git a/web/default/src/components/ui/chart.tsx b/web/default/src/components/ui/chart.tsx index 50ec1691..02d2ccc6 100644 --- a/web/default/src/components/ui/chart.tsx +++ b/web/default/src/components/ui/chart.tsx @@ -19,6 +19,7 @@ For commercial licensing, please contact support@quantumnous.com import * as React from 'react' import * as RechartsPrimitive from 'recharts' import type { TooltipValueType } from 'recharts' + import { cn } from '@/lib/utils' // Format: { THEME_NAME: CSS_SELECTOR } diff --git a/web/default/src/components/ui/checkbox.tsx b/web/default/src/components/ui/checkbox.tsx index bc20380c..c724d8c8 100644 --- a/web/default/src/components/ui/checkbox.tsx +++ b/web/default/src/components/ui/checkbox.tsx @@ -21,6 +21,7 @@ For commercial licensing, please contact support@quantumnous.com import { Checkbox as CheckboxPrimitive } from '@base-ui/react/checkbox' import { Tick02Icon } from '@hugeicons/core-free-icons' import { HugeiconsIcon } from '@hugeicons/react' + import { cn } from '@/lib/utils' function Checkbox({ className, ...props }: CheckboxPrimitive.Root.Props) { diff --git a/web/default/src/components/ui/combobox-input.tsx b/web/default/src/components/ui/combobox-input.tsx index f7c33aae..b7fed9e2 100644 --- a/web/default/src/components/ui/combobox-input.tsx +++ b/web/default/src/components/ui/combobox-input.tsx @@ -16,11 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import * as React from 'react' import { Check, ChevronsUpDown } from 'lucide-react' +import * as React from 'react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + import { Input } from '@/components/ui/input' +import { cn } from '@/lib/utils' export type ComboboxInputOption = { value: string diff --git a/web/default/src/components/ui/combobox.tsx b/web/default/src/components/ui/combobox.tsx index cdce3ab7..78c73a6e 100644 --- a/web/default/src/components/ui/combobox.tsx +++ b/web/default/src/components/ui/combobox.tsx @@ -16,7 +16,6 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import * as React from 'react' import { Combobox as ComboboxPrimitive } from '@base-ui/react' import { ArrowDown01Icon, @@ -24,7 +23,8 @@ import { Tick02Icon, } from '@hugeicons/core-free-icons' import { HugeiconsIcon } from '@hugeicons/react' -import { cn } from '@/lib/utils' +import * as React from 'react' + import { Button } from '@/components/ui/button' import { ComboboxInput as LegacyComboboxInput, @@ -36,6 +36,7 @@ import { InputGroupButton, InputGroupInput, } from '@/components/ui/input-group' +import { cn } from '@/lib/utils' type LegacyComboboxProps = { options: ComboboxInputOption[] diff --git a/web/default/src/components/ui/command.tsx b/web/default/src/components/ui/command.tsx index 9deb0148..4e1e04af 100644 --- a/web/default/src/components/ui/command.tsx +++ b/web/default/src/components/ui/command.tsx @@ -18,11 +18,11 @@ For commercial licensing, please contact support@quantumnous.com */ 'use client' -import * as React from 'react' import { SearchIcon, Tick02Icon } from '@hugeicons/core-free-icons' import { HugeiconsIcon } from '@hugeicons/react' import { Command as CommandPrimitive } from 'cmdk' -import { cn } from '@/lib/utils' +import * as React from 'react' + import { Dialog, DialogContent, @@ -31,6 +31,7 @@ import { DialogTitle, } from '@/components/ui/dialog' import { InputGroup, InputGroupAddon } from '@/components/ui/input-group' +import { cn } from '@/lib/utils' function Command({ className, diff --git a/web/default/src/components/ui/context-menu.tsx b/web/default/src/components/ui/context-menu.tsx index 82a324f4..746a5fe6 100644 --- a/web/default/src/components/ui/context-menu.tsx +++ b/web/default/src/components/ui/context-menu.tsx @@ -18,10 +18,11 @@ For commercial licensing, please contact support@quantumnous.com */ 'use client' -import * as React from 'react' import { ContextMenu as ContextMenuPrimitive } from '@base-ui/react/context-menu' import { ArrowRight01Icon, Tick02Icon } from '@hugeicons/core-free-icons' import { HugeiconsIcon } from '@hugeicons/react' +import * as React from 'react' + import { cn } from '@/lib/utils' function ContextMenu({ ...props }: ContextMenuPrimitive.Root.Props) { diff --git a/web/default/src/components/ui/dialog.tsx b/web/default/src/components/ui/dialog.tsx index 128cd011..3fa548b9 100644 --- a/web/default/src/components/ui/dialog.tsx +++ b/web/default/src/components/ui/dialog.tsx @@ -16,12 +16,13 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import * as React from 'react' import { Dialog as DialogPrimitive } from '@base-ui/react/dialog' import { Cancel01Icon } from '@hugeicons/core-free-icons' import { HugeiconsIcon } from '@hugeicons/react' -import { cn } from '@/lib/utils' +import * as React from 'react' + import { Button } from '@/components/ui/button' +import { cn } from '@/lib/utils' function Dialog({ ...props }: DialogPrimitive.Root.Props) { return diff --git a/web/default/src/components/ui/drawer.tsx b/web/default/src/components/ui/drawer.tsx index 93177980..f44317be 100644 --- a/web/default/src/components/ui/drawer.tsx +++ b/web/default/src/components/ui/drawer.tsx @@ -20,6 +20,7 @@ For commercial licensing, please contact support@quantumnous.com import * as React from 'react' import { Drawer as DrawerPrimitive } from 'vaul' + import { cn } from '@/lib/utils' function Drawer({ diff --git a/web/default/src/components/ui/dropdown-menu.test.tsx b/web/default/src/components/ui/dropdown-menu.test.tsx index 33917663..892991b1 100644 --- a/web/default/src/components/ui/dropdown-menu.test.tsx +++ b/web/default/src/components/ui/dropdown-menu.test.tsx @@ -1,5 +1,6 @@ import assert from 'node:assert/strict' import { describe, test } from 'node:test' + import { handleDropdownMenuItemSelect } from './dropdown-menu-events' function createMenuEvent() { diff --git a/web/default/src/components/ui/dropdown-menu.tsx b/web/default/src/components/ui/dropdown-menu.tsx index f45ffb83..dd5212a6 100644 --- a/web/default/src/components/ui/dropdown-menu.tsx +++ b/web/default/src/components/ui/dropdown-menu.tsx @@ -16,11 +16,13 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import * as React from 'react' import { Menu as MenuPrimitive } from '@base-ui/react/menu' import { ArrowRight01Icon, Tick02Icon } from '@hugeicons/core-free-icons' import { HugeiconsIcon } from '@hugeicons/react' +import * as React from 'react' + import { cn } from '@/lib/utils' + import { handleDropdownMenuItemSelect, type DropdownMenuItemSelectHandler, diff --git a/web/default/src/components/ui/empty.tsx b/web/default/src/components/ui/empty.tsx index f991314a..cd24bfa6 100644 --- a/web/default/src/components/ui/empty.tsx +++ b/web/default/src/components/ui/empty.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { cva, type VariantProps } from 'class-variance-authority' + import { cn } from '@/lib/utils' function Empty({ className, ...props }: React.ComponentProps<'div'>) { diff --git a/web/default/src/components/ui/field.tsx b/web/default/src/components/ui/field.tsx index 9cacc2b7..0104695f 100644 --- a/web/default/src/components/ui/field.tsx +++ b/web/default/src/components/ui/field.tsx @@ -16,11 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useMemo } from 'react' import { cva, type VariantProps } from 'class-variance-authority' -import { cn } from '@/lib/utils' +import { useMemo } from 'react' + import { Label } from '@/components/ui/label' import { Separator } from '@/components/ui/separator' +import { cn } from '@/lib/utils' function FieldSet({ className, ...props }: React.ComponentProps<'fieldset'>) { return ( diff --git a/web/default/src/components/ui/form.tsx b/web/default/src/components/ui/form.tsx index db1a5365..25175b25 100644 --- a/web/default/src/components/ui/form.tsx +++ b/web/default/src/components/ui/form.tsx @@ -16,6 +16,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ +import { useRender } from '@base-ui/react/use-render' import * as React from 'react' import { Controller, @@ -26,10 +27,10 @@ import { type FieldPath, type FieldValues, } from 'react-hook-form' -import { useRender } from '@base-ui/react/use-render' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + import { Label } from '@/components/ui/label' +import { cn } from '@/lib/utils' type FormRootContextValue = { id: string diff --git a/web/default/src/components/ui/hover-card.tsx b/web/default/src/components/ui/hover-card.tsx index 399c6a7c..a90df64a 100644 --- a/web/default/src/components/ui/hover-card.tsx +++ b/web/default/src/components/ui/hover-card.tsx @@ -19,6 +19,7 @@ For commercial licensing, please contact support@quantumnous.com 'use client' import { PreviewCard as PreviewCardPrimitive } from '@base-ui/react/preview-card' + import { cn } from '@/lib/utils' function HoverCard({ ...props }: PreviewCardPrimitive.Root.Props) { diff --git a/web/default/src/components/ui/input-group.tsx b/web/default/src/components/ui/input-group.tsx index 84f78474..f1a06d56 100644 --- a/web/default/src/components/ui/input-group.tsx +++ b/web/default/src/components/ui/input-group.tsx @@ -18,12 +18,13 @@ For commercial licensing, please contact support@quantumnous.com */ 'use client' -import * as React from 'react' import { cva, type VariantProps } from 'class-variance-authority' -import { cn } from '@/lib/utils' +import * as React from 'react' + import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Textarea } from '@/components/ui/textarea' +import { cn } from '@/lib/utils' function InputGroup({ className, ...props }: React.ComponentProps<'div'>) { return ( diff --git a/web/default/src/components/ui/input-otp.tsx b/web/default/src/components/ui/input-otp.tsx index 8ef4615a..1ff742fd 100644 --- a/web/default/src/components/ui/input-otp.tsx +++ b/web/default/src/components/ui/input-otp.tsx @@ -16,10 +16,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import * as React from 'react' import { MinusSignIcon } from '@hugeicons/core-free-icons' import { HugeiconsIcon } from '@hugeicons/react' import { OTPInput, OTPInputContext } from 'input-otp' +import * as React from 'react' + import { cn } from '@/lib/utils' function InputOTP({ diff --git a/web/default/src/components/ui/input.tsx b/web/default/src/components/ui/input.tsx index c3e45a39..80f36979 100644 --- a/web/default/src/components/ui/input.tsx +++ b/web/default/src/components/ui/input.tsx @@ -16,8 +16,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import * as React from 'react' import { Input as InputPrimitive } from '@base-ui/react/input' +import * as React from 'react' + import { cn } from '@/lib/utils' function Input({ className, type, ...props }: React.ComponentProps<'input'>) { diff --git a/web/default/src/components/ui/item.tsx b/web/default/src/components/ui/item.tsx index e42d5679..f3c194ee 100644 --- a/web/default/src/components/ui/item.tsx +++ b/web/default/src/components/ui/item.tsx @@ -16,12 +16,13 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import * as React from 'react' import { mergeProps } from '@base-ui/react/merge-props' import { useRender } from '@base-ui/react/use-render' import { cva, type VariantProps } from 'class-variance-authority' -import { cn } from '@/lib/utils' +import * as React from 'react' + import { Separator } from '@/components/ui/separator' +import { cn } from '@/lib/utils' function ItemGroup({ className, ...props }: React.ComponentProps<'div'>) { return ( diff --git a/web/default/src/components/ui/label.tsx b/web/default/src/components/ui/label.tsx index c5b37e56..decc5a89 100644 --- a/web/default/src/components/ui/label.tsx +++ b/web/default/src/components/ui/label.tsx @@ -19,6 +19,7 @@ For commercial licensing, please contact support@quantumnous.com 'use client' import * as React from 'react' + import { cn } from '@/lib/utils' function Label({ className, ...props }: React.ComponentProps<'label'>) { diff --git a/web/default/src/components/ui/markdown.tsx b/web/default/src/components/ui/markdown.tsx index 30df268e..cd7a2f70 100644 --- a/web/default/src/components/ui/markdown.tsx +++ b/web/default/src/components/ui/markdown.tsx @@ -18,9 +18,11 @@ For commercial licensing, please contact support@quantumnous.com */ import DOMPurify from 'dompurify' import * as katex from 'katex' + import 'katex/dist/katex.min.css' import { Marked, Renderer, type MarkedExtension, type Tokens } from 'marked' import { useMemo } from 'react' + import { cn } from '@/lib/utils' interface MarkdownProps { @@ -232,7 +234,8 @@ function splitFlowLabel(label: string, maxUnits: number): string[] { function renderFlowText(layout: FlowNodeLayout): string { const lineHeight = 18 - const firstLineY = layout.y - ((layout.labelLines.length - 1) * lineHeight) / 2 + 5 + const firstLineY = + layout.y - ((layout.labelLines.length - 1) * lineHeight) / 2 + 5 return layout.labelLines .map((line, index) => { @@ -241,10 +244,16 @@ function renderFlowText(layout: FlowNodeLayout): string { .join('') } -function getFlowNodeLayout(node: FlowNode, index: number, centerX: number): FlowNodeLayout { +function getFlowNodeLayout( + node: FlowNode, + index: number, + centerX: number +): FlowNodeLayout { const isCondition = node.type === 'condition' const labelLines = splitFlowLabel(node.label, isCondition ? 14 : 18) - const labelWidth = Math.max(...labelLines.map((line) => getTextUnits(line) * 7.2)) + const labelWidth = Math.max( + ...labelLines.map((line) => getTextUnits(line) * 7.2) + ) const textHeight = labelLines.length * 18 if (isCondition) { @@ -279,7 +288,10 @@ function getFlowNodeLayout(node: FlowNode, index: number, centerX: number): Flow } } -function getFlowAnchor(layout: FlowNodeLayout, side: 'bottom' | 'left' | 'right' | 'top'): { +function getFlowAnchor( + layout: FlowNodeLayout, + side: 'bottom' | 'left' | 'right' | 'top' +): { x: number y: number } { @@ -323,7 +335,10 @@ function renderFlowShape(layout: FlowNodeLayout): string { ` } -function parseFlowDiagram(source: string): { edges: FlowEdge[]; nodes: FlowNode[] } { +function parseFlowDiagram(source: string): { + edges: FlowEdge[] + nodes: FlowNode[] +} { const lines = source .split('\n') .map((line) => line.trim()) @@ -347,8 +362,12 @@ function parseFlowDiagram(source: string): { edges: FlowEdge[]; nodes: FlowNode[ } for (let index = 0; index < edgeParts.length - 1; index += 1) { - const fromMatch = /^([A-Za-z][\w-]*)(?:\(([^)]+)\))?$/.exec(edgeParts[index]) - const toMatch = /^([A-Za-z][\w-]*)(?:\(([^)]+)\))?$/.exec(edgeParts[index + 1]) + const fromMatch = /^([A-Za-z][\w-]*)(?:\(([^)]+)\))?$/.exec( + edgeParts[index] + ) + const toMatch = /^([A-Za-z][\w-]*)(?:\(([^)]+)\))?$/.exec( + edgeParts[index + 1] + ) if (!fromMatch || !toMatch) { continue @@ -371,10 +390,17 @@ function renderFlowDiagram(source: string): string { const loopX = 520 const nodeIndex = new Map(nodes.map((node, index) => [node.id, index])) const nodePositions = new Map( - nodes.map((node, index) => [node.id, getFlowNodeLayout(node, index, centerX)]) + nodes.map((node, index) => [ + node.id, + getFlowNodeLayout(node, index, centerX), + ]) + ) + const lastNode = + nodes.length > 0 ? nodePositions.get(nodes.at(-1)?.id ?? '') : undefined + const height = Math.max( + 180, + (lastNode?.y ?? 64) + (lastNode?.height ?? 40) / 2 + 54 ) - const lastNode = nodes.length > 0 ? nodePositions.get(nodes.at(-1)?.id ?? '') : undefined - const height = Math.max(180, (lastNode?.y ?? 64) + (lastNode?.height ?? 40) / 2 + 54) const renderedEdges = edges .map((edge) => { const from = nodePositions.get(edge.from) @@ -384,7 +410,8 @@ function renderFlowDiagram(source: string): string { return '' } - const isBackward = (nodeIndex.get(edge.to) ?? 0) <= (nodeIndex.get(edge.from) ?? 0) + const isBackward = + (nodeIndex.get(edge.to) ?? 0) <= (nodeIndex.get(edge.from) ?? 0) if (isBackward) { const fromAnchor = getFlowAnchor(from, 'right') @@ -436,7 +463,10 @@ function renderFlowDiagram(source: string): string { ` } -function parseSequenceDiagram(source: string): { messages: SequenceMessage[]; participants: string[] } { +function parseSequenceDiagram(source: string): { + messages: SequenceMessage[] + participants: string[] +} { const lines = source .split('\n') .map((line) => line.trim()) @@ -466,7 +496,9 @@ function parseSequenceDiagram(source: string): { messages: SequenceMessage[]; pa return } - const messageMatch = /^([^-\s]+)\s*(-{1,2}>>?|-->)\s*([^:]+):\s*(.+)$/.exec(line) + const messageMatch = /^([^-\s]+)\s*(-{1,2}>>?|-->)\s*([^:]+):\s*(.+)$/.exec( + line + ) if (!messageMatch) { return @@ -495,10 +527,16 @@ function renderSequenceDiagram(source: string): string { const marginX = 80 const top = 42 const rowGap = 72 - const width = Math.max(360, marginX * 2 + Math.max(0, participants.length - 1) * laneGap) + const width = Math.max( + 360, + marginX * 2 + Math.max(0, participants.length - 1) * laneGap + ) const height = Math.max(180, 126 + messages.length * rowGap) const positions = new Map( - participants.map((participant, index) => [participant, marginX + index * laneGap]) + participants.map((participant, index) => [ + participant, + marginX + index * laneGap, + ]) ) const participantBoxes = participants .map((participant) => { @@ -539,7 +577,8 @@ function renderSequenceDiagram(source: string): string { const toX = positions.get(message.to ?? '') ?? marginX const labelX = (fromX + toX) / 2 const label = escapeHtml(message.label) - const dash = message.lineStyle === 'dashed' ? ' stroke-dasharray="4 4"' : '' + const dash = + message.lineStyle === 'dashed' ? ' stroke-dasharray="4 4"' : '' return ` diff --git a/web/default/src/components/ui/menubar.tsx b/web/default/src/components/ui/menubar.tsx index bb3b30ad..4faaad9c 100644 --- a/web/default/src/components/ui/menubar.tsx +++ b/web/default/src/components/ui/menubar.tsx @@ -18,12 +18,12 @@ For commercial licensing, please contact support@quantumnous.com */ 'use client' -import * as React from 'react' import { Menu as MenuPrimitive } from '@base-ui/react/menu' import { Menubar as MenubarPrimitive } from '@base-ui/react/menubar' import { Tick02Icon } from '@hugeicons/core-free-icons' import { HugeiconsIcon } from '@hugeicons/react' -import { cn } from '@/lib/utils' +import * as React from 'react' + import { DropdownMenu, DropdownMenuContent, @@ -39,6 +39,7 @@ import { DropdownMenuSubTrigger, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu' +import { cn } from '@/lib/utils' function Menubar({ className, ...props }: MenubarPrimitive.Props) { return ( diff --git a/web/default/src/components/ui/native-select.tsx b/web/default/src/components/ui/native-select.tsx index 0ae8c376..6254fbff 100644 --- a/web/default/src/components/ui/native-select.tsx +++ b/web/default/src/components/ui/native-select.tsx @@ -16,9 +16,10 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import * as React from 'react' import { UnfoldMoreIcon } from '@hugeicons/core-free-icons' import { HugeiconsIcon } from '@hugeicons/react' +import * as React from 'react' + import { cn } from '@/lib/utils' type NativeSelectProps = Omit, 'size'> & { diff --git a/web/default/src/components/ui/navigation-menu.tsx b/web/default/src/components/ui/navigation-menu.tsx index beda059a..c156fa5e 100644 --- a/web/default/src/components/ui/navigation-menu.tsx +++ b/web/default/src/components/ui/navigation-menu.tsx @@ -20,6 +20,7 @@ import { NavigationMenu as NavigationMenuPrimitive } from '@base-ui/react/naviga import { ArrowDown01Icon } from '@hugeicons/core-free-icons' import { HugeiconsIcon } from '@hugeicons/react' import { cva } from 'class-variance-authority' + import { cn } from '@/lib/utils' function NavigationMenu({ diff --git a/web/default/src/components/ui/pagination.tsx b/web/default/src/components/ui/pagination.tsx index 691d8958..7bdc70ec 100644 --- a/web/default/src/components/ui/pagination.tsx +++ b/web/default/src/components/ui/pagination.tsx @@ -16,15 +16,16 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import * as React from 'react' import { ArrowLeft01Icon, ArrowRight01Icon, MoreHorizontalCircle01Icon, } from '@hugeicons/core-free-icons' import { HugeiconsIcon } from '@hugeicons/react' -import { cn } from '@/lib/utils' +import * as React from 'react' + import { Button } from '@/components/ui/button' +import { cn } from '@/lib/utils' function Pagination({ className, ...props }: React.ComponentProps<'nav'>) { return ( diff --git a/web/default/src/components/ui/popover.tsx b/web/default/src/components/ui/popover.tsx index 4ddb95e7..026c691f 100644 --- a/web/default/src/components/ui/popover.tsx +++ b/web/default/src/components/ui/popover.tsx @@ -16,8 +16,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import * as React from 'react' import { Popover as PopoverPrimitive } from '@base-ui/react/popover' +import * as React from 'react' + import { cn } from '@/lib/utils' function Popover({ ...props }: PopoverPrimitive.Root.Props) { diff --git a/web/default/src/components/ui/progress.tsx b/web/default/src/components/ui/progress.tsx index c3ab2e7d..71fee573 100644 --- a/web/default/src/components/ui/progress.tsx +++ b/web/default/src/components/ui/progress.tsx @@ -19,6 +19,7 @@ For commercial licensing, please contact support@quantumnous.com 'use client' import { Progress as ProgressPrimitive } from '@base-ui/react/progress' + import { cn } from '@/lib/utils' function Progress({ diff --git a/web/default/src/components/ui/radio-group.tsx b/web/default/src/components/ui/radio-group.tsx index aff629ce..dc06a77d 100644 --- a/web/default/src/components/ui/radio-group.tsx +++ b/web/default/src/components/ui/radio-group.tsx @@ -18,6 +18,7 @@ For commercial licensing, please contact support@quantumnous.com */ import { Radio as RadioPrimitive } from '@base-ui/react/radio' import { RadioGroup as RadioGroupPrimitive } from '@base-ui/react/radio-group' + import { cn } from '@/lib/utils' function RadioGroup({ className, ...props }: RadioGroupPrimitive.Props) { diff --git a/web/default/src/components/ui/resizable.tsx b/web/default/src/components/ui/resizable.tsx index e21832fd..9369b5fb 100644 --- a/web/default/src/components/ui/resizable.tsx +++ b/web/default/src/components/ui/resizable.tsx @@ -19,6 +19,7 @@ For commercial licensing, please contact support@quantumnous.com 'use client' import * as ResizablePrimitive from 'react-resizable-panels' + import { cn } from '@/lib/utils' function ResizablePanelGroup({ diff --git a/web/default/src/components/ui/scroll-area.tsx b/web/default/src/components/ui/scroll-area.tsx index e72e40a7..4b828632 100644 --- a/web/default/src/components/ui/scroll-area.tsx +++ b/web/default/src/components/ui/scroll-area.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { ScrollArea as ScrollAreaPrimitive } from '@base-ui/react/scroll-area' + import { cn } from '@/lib/utils' function ScrollArea({ diff --git a/web/default/src/components/ui/select.tsx b/web/default/src/components/ui/select.tsx index d5553a52..b3dc987c 100644 --- a/web/default/src/components/ui/select.tsx +++ b/web/default/src/components/ui/select.tsx @@ -18,8 +18,6 @@ For commercial licensing, please contact support@quantumnous.com */ 'use client' -import * as React from 'react' -import { useMediaQuery } from '@/hooks' import { Select as SelectPrimitive } from '@base-ui/react/select' import { UnfoldMoreIcon, @@ -28,6 +26,9 @@ import { ArrowDown01Icon, } from '@hugeicons/core-free-icons' import { HugeiconsIcon } from '@hugeicons/react' +import * as React from 'react' + +import { useMediaQuery } from '@/hooks' import { cn } from '@/lib/utils' const Select = SelectPrimitive.Root diff --git a/web/default/src/components/ui/separator.tsx b/web/default/src/components/ui/separator.tsx index e7d1cb47..28dd4b85 100644 --- a/web/default/src/components/ui/separator.tsx +++ b/web/default/src/components/ui/separator.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { Separator as SeparatorPrimitive } from '@base-ui/react/separator' + import { cn } from '@/lib/utils' function Separator({ diff --git a/web/default/src/components/ui/sheet.tsx b/web/default/src/components/ui/sheet.tsx index 600e4b3f..097b5bb3 100644 --- a/web/default/src/components/ui/sheet.tsx +++ b/web/default/src/components/ui/sheet.tsx @@ -18,12 +18,13 @@ For commercial licensing, please contact support@quantumnous.com */ 'use client' -import * as React from 'react' import { Dialog as SheetPrimitive } from '@base-ui/react/dialog' import { Cancel01Icon } from '@hugeicons/core-free-icons' import { HugeiconsIcon } from '@hugeicons/react' -import { cn } from '@/lib/utils' +import * as React from 'react' + import { Button } from '@/components/ui/button' +import { cn } from '@/lib/utils' function Sheet({ ...props }: SheetPrimitive.Root.Props) { return diff --git a/web/default/src/components/ui/sidebar.tsx b/web/default/src/components/ui/sidebar.tsx index 2e711b85..30175e87 100644 --- a/web/default/src/components/ui/sidebar.tsx +++ b/web/default/src/components/ui/sidebar.tsx @@ -18,14 +18,13 @@ For commercial licensing, please contact support@quantumnous.com */ 'use client' -import * as React from 'react' import { mergeProps } from '@base-ui/react/merge-props' import { useRender } from '@base-ui/react/use-render' import { SidebarLeftIcon } from '@hugeicons/core-free-icons' import { HugeiconsIcon } from '@hugeicons/react' import { cva, type VariantProps } from 'class-variance-authority' -import { cn } from '@/lib/utils' -import { useIsMobile } from '@/hooks/use-mobile' +import * as React from 'react' + import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Separator } from '@/components/ui/separator' @@ -43,6 +42,8 @@ import { TooltipProvider, TooltipTrigger, } from '@/components/ui/tooltip' +import { useIsMobile } from '@/hooks/use-mobile' +import { cn } from '@/lib/utils' const SIDEBAR_COOKIE_NAME = 'sidebar_state' const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7 diff --git a/web/default/src/components/ui/slider.tsx b/web/default/src/components/ui/slider.tsx index d7afd965..1de6dcc8 100644 --- a/web/default/src/components/ui/slider.tsx +++ b/web/default/src/components/ui/slider.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { Slider as SliderPrimitive } from '@base-ui/react/slider' + import { cn } from '@/lib/utils' function Slider({ diff --git a/web/default/src/components/ui/sonner.tsx b/web/default/src/components/ui/sonner.tsx index f54f4f03..d11aae6b 100644 --- a/web/default/src/components/ui/sonner.tsx +++ b/web/default/src/components/ui/sonner.tsx @@ -27,6 +27,7 @@ import { } from '@hugeicons/core-free-icons' import { HugeiconsIcon } from '@hugeicons/react' import { Toaster as Sonner, type ToasterProps } from 'sonner' + import { useTheme } from '@/context/theme-provider' const Toaster = (props: ToasterProps) => { diff --git a/web/default/src/components/ui/spinner.tsx b/web/default/src/components/ui/spinner.tsx index a8550d71..6b228fbf 100644 --- a/web/default/src/components/ui/spinner.tsx +++ b/web/default/src/components/ui/spinner.tsx @@ -18,6 +18,7 @@ For commercial licensing, please contact support@quantumnous.com */ import { Loading03Icon } from '@hugeicons/core-free-icons' import { HugeiconsIcon } from '@hugeicons/react' + import { cn } from '@/lib/utils' type SpinnerProps = Omit< diff --git a/web/default/src/components/ui/switch.tsx b/web/default/src/components/ui/switch.tsx index eaf512c0..50e1e40f 100644 --- a/web/default/src/components/ui/switch.tsx +++ b/web/default/src/components/ui/switch.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { Switch as SwitchPrimitive } from '@base-ui/react/switch' + import { cn } from '@/lib/utils' function Switch({ diff --git a/web/default/src/components/ui/table.tsx b/web/default/src/components/ui/table.tsx index 8ed071da..2163c119 100644 --- a/web/default/src/components/ui/table.tsx +++ b/web/default/src/components/ui/table.tsx @@ -19,6 +19,7 @@ For commercial licensing, please contact support@quantumnous.com 'use client' import * as React from 'react' + import { cn } from '@/lib/utils' function Table({ className, ...props }: React.ComponentProps<'table'>) { diff --git a/web/default/src/components/ui/tabs.tsx b/web/default/src/components/ui/tabs.tsx index 6d99bd81..149dff8d 100644 --- a/web/default/src/components/ui/tabs.tsx +++ b/web/default/src/components/ui/tabs.tsx @@ -18,6 +18,7 @@ For commercial licensing, please contact support@quantumnous.com */ import { Tabs as TabsPrimitive } from '@base-ui/react/tabs' import { cva, type VariantProps } from 'class-variance-authority' + import { cn } from '@/lib/utils' function Tabs({ diff --git a/web/default/src/components/ui/textarea.tsx b/web/default/src/components/ui/textarea.tsx index c42fcb30..665fe8d2 100644 --- a/web/default/src/components/ui/textarea.tsx +++ b/web/default/src/components/ui/textarea.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import * as React from 'react' + import { cn } from '@/lib/utils' function Textarea({ className, ...props }: React.ComponentProps<'textarea'>) { diff --git a/web/default/src/components/ui/titled-card.tsx b/web/default/src/components/ui/titled-card.tsx index 28fed927..131ffb05 100644 --- a/web/default/src/components/ui/titled-card.tsx +++ b/web/default/src/components/ui/titled-card.tsx @@ -17,7 +17,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import type { ReactNode } from 'react' + import { cn } from '@/lib/utils' + import { Card, CardContent, diff --git a/web/default/src/components/ui/toggle-group.tsx b/web/default/src/components/ui/toggle-group.tsx index 3ca2b185..229da72c 100644 --- a/web/default/src/components/ui/toggle-group.tsx +++ b/web/default/src/components/ui/toggle-group.tsx @@ -16,12 +16,13 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import * as React from 'react' import { Toggle as TogglePrimitive } from '@base-ui/react/toggle' import { ToggleGroup as ToggleGroupPrimitive } from '@base-ui/react/toggle-group' import { type VariantProps } from 'class-variance-authority' -import { cn } from '@/lib/utils' +import * as React from 'react' + import { toggleVariants } from '@/components/ui/toggle' +import { cn } from '@/lib/utils' const ToggleGroupContext = React.createContext< VariantProps & { diff --git a/web/default/src/components/ui/toggle.tsx b/web/default/src/components/ui/toggle.tsx index fb902065..5e09dcf2 100644 --- a/web/default/src/components/ui/toggle.tsx +++ b/web/default/src/components/ui/toggle.tsx @@ -20,6 +20,7 @@ For commercial licensing, please contact support@quantumnous.com import { Toggle as TogglePrimitive } from '@base-ui/react/toggle' import { cva, type VariantProps } from 'class-variance-authority' + import { cn } from '@/lib/utils' const toggleVariants = cva( diff --git a/web/default/src/components/ui/tooltip.tsx b/web/default/src/components/ui/tooltip.tsx index dd61b070..e7f65740 100644 --- a/web/default/src/components/ui/tooltip.tsx +++ b/web/default/src/components/ui/tooltip.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { Tooltip as TooltipPrimitive } from '@base-ui/react/tooltip' + import { cn } from '@/lib/utils' function TooltipProvider({ diff --git a/web/default/src/context/direction-provider.tsx b/web/default/src/context/direction-provider.tsx index c656ad5f..dcdbb639 100644 --- a/web/default/src/context/direction-provider.tsx +++ b/web/default/src/context/direction-provider.tsx @@ -16,8 +16,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { createContext, useContext, useEffect, useState } from 'react' import { DirectionProvider as BaseDirectionProvider } from '@base-ui/react/direction-provider' +import { createContext, useContext, useEffect, useState } from 'react' + import { getCookie, setCookie, removeCookie } from '@/lib/cookies' export type Direction = 'ltr' | 'rtl' diff --git a/web/default/src/context/font-provider.tsx b/web/default/src/context/font-provider.tsx index 6d9e2bb2..e18e9348 100644 --- a/web/default/src/context/font-provider.tsx +++ b/web/default/src/context/font-provider.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createContext, useContext, useEffect, useState } from 'react' + import { fonts } from '@/config/fonts' import { getCookie, setCookie, removeCookie } from '@/lib/cookies' diff --git a/web/default/src/context/layout-provider.tsx b/web/default/src/context/layout-provider.tsx index ec25f609..7528fd90 100644 --- a/web/default/src/context/layout-provider.tsx +++ b/web/default/src/context/layout-provider.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createContext, useContext, useState } from 'react' + import { getCookie, setCookie } from '@/lib/cookies' export type Collapsible = 'offcanvas' | 'icon' | 'none' diff --git a/web/default/src/context/search-provider.tsx b/web/default/src/context/search-provider.tsx index b30caabe..338c1dc9 100644 --- a/web/default/src/context/search-provider.tsx +++ b/web/default/src/context/search-provider.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createContext, useContext, useEffect, useState } from 'react' + import { CommandMenu } from '@/components/command-menu' type SearchContextType = { diff --git a/web/default/src/context/theme-customization-provider.tsx b/web/default/src/context/theme-customization-provider.tsx index 0bead8fe..2d404f81 100644 --- a/web/default/src/context/theme-customization-provider.tsx +++ b/web/default/src/context/theme-customization-provider.tsx @@ -24,6 +24,7 @@ import { useMemo, useState, } from 'react' + import { getCookie, removeCookie, setCookie } from '@/lib/cookies' import { CONTENT_LAYOUT_VALUES, diff --git a/web/default/src/context/theme-provider.tsx b/web/default/src/context/theme-provider.tsx index 9b5da8ef..c93bee19 100644 --- a/web/default/src/context/theme-provider.tsx +++ b/web/default/src/context/theme-provider.tsx @@ -24,6 +24,7 @@ import { useMemo, useState, } from 'react' + import { getCookie, setCookie, removeCookie } from '@/lib/cookies' type Theme = 'dark' | 'light' | 'system' diff --git a/web/default/src/features/about/api.ts b/web/default/src/features/about/api.ts index 48175f86..de604be6 100644 --- a/web/default/src/features/about/api.ts +++ b/web/default/src/features/about/api.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { api } from '@/lib/api' + import type { AboutResponse } from './types' export async function getAboutContent() { diff --git a/web/default/src/features/auth/api.ts b/web/default/src/features/auth/api.ts index 8a775705..24c45558 100644 --- a/web/default/src/features/auth/api.ts +++ b/web/default/src/features/auth/api.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { api } from '@/lib/api' + import type { LoginPayload, LoginResponse, diff --git a/web/default/src/features/auth/auth-layout.tsx b/web/default/src/features/auth/auth-layout.tsx index c23739e8..ba3a5bf9 100644 --- a/web/default/src/features/auth/auth-layout.tsx +++ b/web/default/src/features/auth/auth-layout.tsx @@ -18,8 +18,9 @@ For commercial licensing, please contact support@quantumnous.com */ import { Link } from '@tanstack/react-router' import { useTranslation } from 'react-i18next' -import { useSystemConfig } from '@/hooks/use-system-config' + import { Skeleton } from '@/components/ui/skeleton' +import { useSystemConfig } from '@/hooks/use-system-config' type AuthLayoutProps = { children: React.ReactNode diff --git a/web/default/src/features/auth/components/legal-consent.tsx b/web/default/src/features/auth/components/legal-consent.tsx index 5184ca75..6bb38a26 100644 --- a/web/default/src/features/auth/components/legal-consent.tsx +++ b/web/default/src/features/auth/components/legal-consent.tsx @@ -17,9 +17,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + import { Checkbox } from '@/components/ui/checkbox' import { Label } from '@/components/ui/label' +import { cn } from '@/lib/utils' + import type { SystemStatus } from '../types' interface LegalConsentProps { diff --git a/web/default/src/features/auth/components/oauth-callback-screen.tsx b/web/default/src/features/auth/components/oauth-callback-screen.tsx index aab90939..100bdf12 100644 --- a/web/default/src/features/auth/components/oauth-callback-screen.tsx +++ b/web/default/src/features/auth/components/oauth-callback-screen.tsx @@ -16,10 +16,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useMemo } from 'react' import { Loader2, Send, Shield, UserRound, type LucideIcon } from 'lucide-react' +import { useMemo } from 'react' import { useTranslation } from 'react-i18next' import { SiGithub, SiLinux, SiWechat } from 'react-icons/si' + import { AuthLayout } from '../auth-layout' type OAuthCallbackScreenProps = { diff --git a/web/default/src/features/auth/components/oauth-providers.tsx b/web/default/src/features/auth/components/oauth-providers.tsx index 39c20c6e..e2924691 100644 --- a/web/default/src/features/auth/components/oauth-providers.tsx +++ b/web/default/src/features/auth/components/oauth-providers.tsx @@ -18,14 +18,16 @@ For commercial licensing, please contact support@quantumnous.com */ import type { ReactNode } from 'react' import { useTranslation } from 'react-i18next' + import { IconDiscord, IconGithub, IconLinuxDo, IconWeChat, } from '@/assets/brand-icons' -import { cn } from '@/lib/utils' import { Button } from '@/components/ui/button' +import { cn } from '@/lib/utils' + import { useOAuthLogin } from '../hooks/use-oauth-login' import type { SystemStatus } from '../types' diff --git a/web/default/src/features/auth/components/terms-footer.tsx b/web/default/src/features/auth/components/terms-footer.tsx index c2885d81..1d5dca4c 100644 --- a/web/default/src/features/auth/components/terms-footer.tsx +++ b/web/default/src/features/auth/components/terms-footer.tsx @@ -17,7 +17,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useTranslation } from 'react-i18next' + import { cn } from '@/lib/utils' + import type { SystemStatus } from '../types' interface TermsFooterProps { diff --git a/web/default/src/features/auth/forgot-password/components/forgot-password-form.tsx b/web/default/src/features/auth/forgot-password/components/forgot-password-form.tsx index d36dccaf..9ba93321 100644 --- a/web/default/src/features/auth/forgot-password/components/forgot-password-form.tsx +++ b/web/default/src/features/auth/forgot-password/components/forgot-password-form.tsx @@ -16,15 +16,15 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState } from 'react' -import type { z } from 'zod' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' import { ArrowRight, Loader2 } from 'lucide-react' +import { useState } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { cn } from '@/lib/utils' -import { useCountdown } from '@/hooks/use-countdown' +import type { z } from 'zod' + +import { Turnstile } from '@/components/turnstile' import { Button } from '@/components/ui/button' import { Form, @@ -35,13 +35,14 @@ import { FormMessage, } from '@/components/ui/form' import { Input } from '@/components/ui/input' -import { Turnstile } from '@/components/turnstile' import { sendPasswordResetEmail } from '@/features/auth/api' import { forgotPasswordFormSchema, PASSWORD_RESET_COUNTDOWN, } from '@/features/auth/constants' import { useTurnstile } from '@/features/auth/hooks/use-turnstile' +import { useCountdown } from '@/hooks/use-countdown' +import { cn } from '@/lib/utils' export function ForgotPasswordForm({ className, diff --git a/web/default/src/features/auth/forgot-password/index.tsx b/web/default/src/features/auth/forgot-password/index.tsx index 15e3364e..1a9108d0 100644 --- a/web/default/src/features/auth/forgot-password/index.tsx +++ b/web/default/src/features/auth/forgot-password/index.tsx @@ -18,6 +18,7 @@ For commercial licensing, please contact support@quantumnous.com */ import { Link } from '@tanstack/react-router' import { useTranslation } from 'react-i18next' + import { AuthLayout } from '../auth-layout' import { ForgotPasswordForm } from './components/forgot-password-form' diff --git a/web/default/src/features/auth/hooks/use-auth-redirect.ts b/web/default/src/features/auth/hooks/use-auth-redirect.ts index bdac4aa9..1da60716 100644 --- a/web/default/src/features/auth/hooks/use-auth-redirect.ts +++ b/web/default/src/features/auth/hooks/use-auth-redirect.ts @@ -18,9 +18,11 @@ For commercial licensing, please contact support@quantumnous.com */ import { useNavigate } from '@tanstack/react-router' import i18n from 'i18next' -import { useAuthStore } from '@/stores/auth-store' -import { getSelf } from '@/lib/api' + import type { User } from '@/features/users/types' +import { getSelf } from '@/lib/api' +import { useAuthStore } from '@/stores/auth-store' + import { saveUserId } from '../lib/storage' function getSavedLanguage(user: User): string | undefined { diff --git a/web/default/src/features/auth/hooks/use-email-verification.ts b/web/default/src/features/auth/hooks/use-email-verification.ts index e88038ed..7fe79b61 100644 --- a/web/default/src/features/auth/hooks/use-email-verification.ts +++ b/web/default/src/features/auth/hooks/use-email-verification.ts @@ -16,10 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState } from 'react' import i18next from 'i18next' +import { useState } from 'react' import { toast } from 'sonner' + import { useCountdown } from '@/hooks/use-countdown' + import { sendEmailVerification } from '../api' import { EMAIL_VERIFICATION_COUNTDOWN } from '../constants' diff --git a/web/default/src/features/auth/hooks/use-oauth-login.ts b/web/default/src/features/auth/hooks/use-oauth-login.ts index 238b039d..ff4f4e69 100644 --- a/web/default/src/features/auth/hooks/use-oauth-login.ts +++ b/web/default/src/features/auth/hooks/use-oauth-login.ts @@ -16,12 +16,14 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useRef, useEffect } from 'react' import type { AxiosRequestConfig } from 'axios' +import { useState, useRef, useEffect } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { useAuthStore } from '@/stores/auth-store' + import { api } from '@/lib/api' +import { useAuthStore } from '@/stores/auth-store' + import { getOAuthState } from '../api' import { buildGitHubOAuthUrl, diff --git a/web/default/src/features/auth/hooks/use-turnstile.ts b/web/default/src/features/auth/hooks/use-turnstile.ts index f90ab607..bdeec631 100644 --- a/web/default/src/features/auth/hooks/use-turnstile.ts +++ b/web/default/src/features/auth/hooks/use-turnstile.ts @@ -16,9 +16,10 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState } from 'react' import i18next from 'i18next' +import { useState } from 'react' import { toast } from 'sonner' + import { useStatus } from '@/hooks/use-status' /** diff --git a/web/default/src/features/auth/otp/components/otp-form.tsx b/web/default/src/features/auth/otp/components/otp-form.tsx index 5d2d3692..cf5c1fcb 100644 --- a/web/default/src/features/auth/otp/components/otp-form.tsx +++ b/web/default/src/features/auth/otp/components/otp-form.tsx @@ -16,15 +16,14 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState } from 'react' -import type { z } from 'zod' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' import { Loader2 } from 'lucide-react' +import { useState } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { useAuthStore } from '@/stores/auth-store' -import { cn } from '@/lib/utils' +import type { z } from 'zod' + import { Button } from '@/components/ui/button' import { Form, @@ -57,6 +56,8 @@ import { cleanBackupCode, } from '@/features/auth/lib/validation' import type { User } from '@/features/users/types' +import { cn } from '@/lib/utils' +import { useAuthStore } from '@/stores/auth-store' type OtpFormProps = React.HTMLAttributes diff --git a/web/default/src/features/auth/otp/index.tsx b/web/default/src/features/auth/otp/index.tsx index bce1f3f7..6e248b53 100644 --- a/web/default/src/features/auth/otp/index.tsx +++ b/web/default/src/features/auth/otp/index.tsx @@ -18,6 +18,7 @@ For commercial licensing, please contact support@quantumnous.com */ import { Link } from '@tanstack/react-router' import { useTranslation } from 'react-i18next' + import { AuthLayout } from '../auth-layout' import { OtpForm } from './components/otp-form' diff --git a/web/default/src/features/auth/passkey/api.ts b/web/default/src/features/auth/passkey/api.ts index 264c0d11..077fa662 100644 --- a/web/default/src/features/auth/passkey/api.ts +++ b/web/default/src/features/auth/passkey/api.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { api } from '@/lib/api' + import type { ApiResponse, PasskeyOptionsPayload, PasskeyStatus } from './types' export async function getPasskeyStatus(): Promise> { diff --git a/web/default/src/features/auth/passkey/hooks/use-passkey-management.ts b/web/default/src/features/auth/passkey/hooks/use-passkey-management.ts index 3b957be4..670c9d66 100644 --- a/web/default/src/features/auth/passkey/hooks/use-passkey-management.ts +++ b/web/default/src/features/auth/passkey/hooks/use-passkey-management.ts @@ -16,15 +16,17 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useCallback, useEffect, useMemo, useState } from 'react' import i18next from 'i18next' +import { useCallback, useEffect, useMemo, useState } from 'react' import { toast } from 'sonner' + import { buildRegistrationResult, createCredential, isPasskeySupported as detectPasskeySupport, prepareCredentialCreationOptions, } from '@/lib/passkey' + import { beginPasskeyRegistration, deletePasskey, diff --git a/web/default/src/features/auth/reset-password-confirm/index.tsx b/web/default/src/features/auth/reset-password-confirm/index.tsx index 63415364..5109af33 100644 --- a/web/default/src/features/auth/reset-password-confirm/index.tsx +++ b/web/default/src/features/auth/reset-password-confirm/index.tsx @@ -16,18 +16,20 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState } from 'react' import { useNavigate } from '@tanstack/react-router' import { CheckIcon, CopyIcon } from 'lucide-react' +import { useState } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { api } from '@/lib/api' -import { copyToClipboard } from '@/lib/copy-to-clipboard' -import { useCountdown } from '@/hooks/use-countdown' + import { Alert, AlertDescription } from '@/components/ui/alert' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' +import { useCountdown } from '@/hooks/use-countdown' +import { api } from '@/lib/api' +import { copyToClipboard } from '@/lib/copy-to-clipboard' + import { AuthLayout } from '../auth-layout' export type ResetPasswordSearchParams = { diff --git a/web/default/src/features/auth/secure-verification/api.ts b/web/default/src/features/auth/secure-verification/api.ts index 37aad3fa..d5cada89 100644 --- a/web/default/src/features/auth/secure-verification/api.ts +++ b/web/default/src/features/auth/secure-verification/api.ts @@ -22,6 +22,7 @@ import { prepareCredentialRequestOptions, isPasskeySupported as detectPasskeySupport, } from '@/lib/passkey' + import { beginPasskeyVerification, finishPasskeyVerification, diff --git a/web/default/src/features/auth/secure-verification/components/secure-verification-dialog.tsx b/web/default/src/features/auth/secure-verification/components/secure-verification-dialog.tsx index 02e8c16d..dcced4cf 100644 --- a/web/default/src/features/auth/secure-verification/components/secure-verification-dialog.tsx +++ b/web/default/src/features/auth/secure-verification/components/secure-verification-dialog.tsx @@ -16,13 +16,15 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useMemo } from 'react' import { ShieldCheck, KeyRound, Loader2 } from 'lucide-react' +import { useMemo } from 'react' import { useTranslation } from 'react-i18next' + +import { Dialog } from '@/components/dialog' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs' -import { Dialog } from '@/components/dialog' + import type { SecureVerificationState, VerificationMethod, diff --git a/web/default/src/features/auth/secure-verification/hooks/use-secure-verification.ts b/web/default/src/features/auth/secure-verification/hooks/use-secure-verification.ts index c61f9702..a9d95ccc 100644 --- a/web/default/src/features/auth/secure-verification/hooks/use-secure-verification.ts +++ b/web/default/src/features/auth/secure-verification/hooks/use-secure-verification.ts @@ -16,13 +16,15 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useCallback, useEffect, useMemo, useState } from 'react' import i18next from 'i18next' +import { useCallback, useEffect, useMemo, useState } from 'react' import { toast } from 'sonner' + import { extractVerificationInfo, isVerificationRequiredError, } from '@/lib/secure-verification' + import { checkVerificationMethods, verify } from '../api' import type { SecureVerificationState, diff --git a/web/default/src/features/auth/sign-in/components/user-auth-form.tsx b/web/default/src/features/auth/sign-in/components/user-auth-form.tsx index 1830517c..913c9886 100644 --- a/web/default/src/features/auth/sign-in/components/user-auth-form.tsx +++ b/web/default/src/features/auth/sign-in/components/user-auth-form.tsx @@ -16,21 +16,18 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useMemo, useState } from 'react' -import type { z } from 'zod' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' import { Link } from '@tanstack/react-router' import { Loader2, LogIn, KeyRound } from 'lucide-react' +import { useEffect, useMemo, useState } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { - buildAssertionResult, - prepareCredentialRequestOptions, - isPasskeySupported as detectPasskeySupport, -} from '@/lib/passkey' -import { cn } from '@/lib/utils' -import { useStatus } from '@/hooks/use-status' +import type { z } from 'zod' + +import { Dialog } from '@/components/dialog' +import { PasswordInput } from '@/components/password-input' +import { Turnstile } from '@/components/turnstile' import { Button } from '@/components/ui/button' import { Form, @@ -42,9 +39,6 @@ import { } from '@/components/ui/form' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' -import { Dialog } from '@/components/dialog' -import { PasswordInput } from '@/components/password-input' -import { Turnstile } from '@/components/turnstile' import { login, wechatLoginByCode } from '@/features/auth/api' import { LegalConsent } from '@/features/auth/components/legal-consent' import { OAuthProviders } from '@/features/auth/components/oauth-providers' @@ -53,6 +47,13 @@ import { useAuthRedirect } from '@/features/auth/hooks/use-auth-redirect' import { useTurnstile } from '@/features/auth/hooks/use-turnstile' import { beginPasskeyLogin, finishPasskeyLogin } from '@/features/auth/passkey' import type { AuthFormProps } from '@/features/auth/types' +import { useStatus } from '@/hooks/use-status' +import { + buildAssertionResult, + prepareCredentialRequestOptions, + isPasskeySupported as detectPasskeySupport, +} from '@/lib/passkey' +import { cn } from '@/lib/utils' export function UserAuthForm({ className, diff --git a/web/default/src/features/auth/sign-in/index.tsx b/web/default/src/features/auth/sign-in/index.tsx index 1cf73730..1b76aad7 100644 --- a/web/default/src/features/auth/sign-in/index.tsx +++ b/web/default/src/features/auth/sign-in/index.tsx @@ -18,7 +18,9 @@ For commercial licensing, please contact support@quantumnous.com */ import { Link, useSearch } from '@tanstack/react-router' import { useTranslation } from 'react-i18next' + import { useStatus } from '@/hooks/use-status' + import { AuthLayout } from '../auth-layout' import { TermsFooter } from '../components/terms-footer' import { UserAuthForm } from './components/user-auth-form' diff --git a/web/default/src/features/auth/sign-up/components/sign-up-form.tsx b/web/default/src/features/auth/sign-up/components/sign-up-form.tsx index 94e262a1..d0674fed 100644 --- a/web/default/src/features/auth/sign-up/components/sign-up-form.tsx +++ b/web/default/src/features/auth/sign-up/components/sign-up-form.tsx @@ -16,15 +16,17 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useMemo, useState } from 'react' -import type { z } from 'zod' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' import { Loader2 } from 'lucide-react' +import { useEffect, useMemo, useState } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { cn } from '@/lib/utils' -import { useStatus } from '@/hooks/use-status' +import type { z } from 'zod' + +import { Dialog } from '@/components/dialog' +import { PasswordInput } from '@/components/password-input' +import { Turnstile } from '@/components/turnstile' import { Button } from '@/components/ui/button' import { Form, @@ -36,9 +38,6 @@ import { } from '@/components/ui/form' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' -import { Dialog } from '@/components/dialog' -import { PasswordInput } from '@/components/password-input' -import { Turnstile } from '@/components/turnstile' import { register, wechatLoginByCode } from '@/features/auth/api' import { LegalConsent } from '@/features/auth/components/legal-consent' import { OAuthProviders } from '@/features/auth/components/oauth-providers' @@ -50,6 +49,8 @@ import { getAffiliateCode, saveAffiliateCode, } from '@/features/auth/lib/storage' +import { useStatus } from '@/hooks/use-status' +import { cn } from '@/lib/utils' export function SignUpForm({ className, diff --git a/web/default/src/features/auth/sign-up/index.tsx b/web/default/src/features/auth/sign-up/index.tsx index 57429a24..771d6088 100644 --- a/web/default/src/features/auth/sign-up/index.tsx +++ b/web/default/src/features/auth/sign-up/index.tsx @@ -18,7 +18,9 @@ For commercial licensing, please contact support@quantumnous.com */ import { Link } from '@tanstack/react-router' import { useTranslation } from 'react-i18next' + import { useStatus } from '@/hooks/use-status' + import { AuthLayout } from '../auth-layout' import { TermsFooter } from '../components/terms-footer' import { SignUpForm } from './components/sign-up-form' diff --git a/web/default/src/features/channels/api.ts b/web/default/src/features/channels/api.ts index 9e80801d..ba8a67ef 100644 --- a/web/default/src/features/channels/api.ts +++ b/web/default/src/features/channels/api.ts @@ -16,8 +16,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { api, type ApiRequestConfig } from '@/lib/api' import { getGroups as getUserGroups } from '@/features/users/api' +import { api, type ApiRequestConfig } from '@/lib/api' + import type { AddChannelRequest, BatchDeleteParams, diff --git a/web/default/src/features/channels/components/data-table-bulk-actions.tsx b/web/default/src/features/channels/components/data-table-bulk-actions.tsx index 389bfe3f..f35eb60f 100644 --- a/web/default/src/features/channels/components/data-table-bulk-actions.tsx +++ b/web/default/src/features/channels/components/data-table-bulk-actions.tsx @@ -16,28 +16,30 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState } from 'react' import { useQueryClient } from '@tanstack/react-query' import { type Table } from '@tanstack/react-table' import { Power, PowerOff, Tag, Trash2 } from 'lucide-react' +import { useState } from 'react' import { useTranslation } from 'react-i18next' + +import { DataTableBulkActions as BulkActionsToolbar } from '@/components/data-table' +import { Dialog } from '@/components/dialog' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' -import { useAuthStore } from '@/stores/auth-store' +import { + Tooltip, + TooltipContent, + TooltipTrigger, +} from '@/components/ui/tooltip' import { ADMIN_PERMISSION_ACTIONS, ADMIN_PERMISSION_RESOURCES, hasPermission, } from '@/lib/admin-permissions' import { cn } from '@/lib/utils' -import { - Tooltip, - TooltipContent, - TooltipTrigger, -} from '@/components/ui/tooltip' -import { DataTableBulkActions as BulkActionsToolbar } from '@/components/data-table' -import { Dialog } from '@/components/dialog' +import { useAuthStore } from '@/stores/auth-store' + import { handleBatchDelete, handleBatchDisable, diff --git a/web/default/src/features/channels/components/data-table-row-actions.tsx b/web/default/src/features/channels/components/data-table-row-actions.tsx index 49b57bdc..7e15463c 100644 --- a/web/default/src/features/channels/components/data-table-row-actions.tsx +++ b/web/default/src/features/channels/components/data-table-row-actions.tsx @@ -16,7 +16,6 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useContext, useState } from 'react' import { useQueryClient } from '@tanstack/react-query' import type { Row } from '@tanstack/react-table' import { @@ -35,16 +34,11 @@ import { RefreshCw, Loader2, } from 'lucide-react' +import { useContext, useState } from 'react' import { useTranslation } from 'react-i18next' import { ConfirmDialog } from '@/components/confirm-dialog' import { Button } from '@/components/ui/button' -import { - ADMIN_PERMISSION_ACTIONS, - ADMIN_PERMISSION_RESOURCES, - hasPermission, -} from '@/lib/admin-permissions' -import { useAuthStore } from '@/stores/auth-store' import { DropdownMenu, DropdownMenuContent, @@ -58,6 +52,12 @@ import { TooltipContent, TooltipTrigger, } from '@/components/ui/tooltip' +import { + ADMIN_PERMISSION_ACTIONS, + ADMIN_PERMISSION_RESOURCES, + hasPermission, +} from '@/lib/admin-permissions' +import { useAuthStore } from '@/stores/auth-store' import { MODEL_FETCHABLE_TYPES } from '../constants' import { diff --git a/web/default/src/features/channels/components/data-table-tag-row-actions.tsx b/web/default/src/features/channels/components/data-table-tag-row-actions.tsx index 32641a8d..8246cf1a 100644 --- a/web/default/src/features/channels/components/data-table-tag-row-actions.tsx +++ b/web/default/src/features/channels/components/data-table-tag-row-actions.tsx @@ -20,18 +20,20 @@ import { useQueryClient } from '@tanstack/react-query' import type { Row } from '@tanstack/react-table' import { Power, PowerOff, Pencil, Edit } from 'lucide-react' import { useTranslation } from 'react-i18next' + +import { DataTableRowActionMenu } from '@/components/data-table/core/row-action-menu' import { Button } from '@/components/ui/button' import { DropdownMenuItem, DropdownMenuSeparator, DropdownMenuShortcut, } from '@/components/ui/dropdown-menu' -import { DataTableRowActionMenu } from '@/components/data-table/core/row-action-menu' import { Tooltip, TooltipContent, TooltipTrigger, } from '@/components/ui/tooltip' + import { handleEnableTagChannels, handleDisableTagChannels } from '../lib' import type { Channel } from '../types' import { useChannels } from './channels-provider' diff --git a/web/default/src/features/channels/components/dialogs/advanced-custom-editor-dialog.tsx b/web/default/src/features/channels/components/dialogs/advanced-custom-editor-dialog.tsx index 8f9372f6..c287f05b 100644 --- a/web/default/src/features/channels/components/dialogs/advanced-custom-editor-dialog.tsx +++ b/web/default/src/features/channels/components/dialogs/advanced-custom-editor-dialog.tsx @@ -16,10 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { type ReactNode, useMemo, useRef, useState } from 'react' import { ArrowRight, Check, Plus, Shuffle, Trash2 } from 'lucide-react' +import { type ReactNode, useMemo, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' + +import { Dialog } from '@/components/dialog' import { Alert, AlertDescription } from '@/components/ui/alert' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' @@ -39,8 +41,8 @@ import { TooltipProvider, TooltipTrigger, } from '@/components/ui/tooltip' -import { Dialog } from '@/components/dialog' import { cn } from '@/lib/utils' + import { ADVANCED_CUSTOM_AUTH_MODE_OPTIONS, ADVANCED_CUSTOM_CONVERTER_OPTIONS, @@ -341,7 +343,7 @@ export function AdvancedCustomEditorDialog({ ) } > - + {t(templateLabel)} @@ -357,7 +359,7 @@ export function AdvancedCustomEditorDialog({ value={option.value} className={longSelectItemClass} > - + {t(option.label)} @@ -495,8 +497,10 @@ function RouteEditor({ [incomingPath] ) const incomingPathLabel = getAdvancedCustomIncomingPathLabel(incomingPath) - const converterLabel = - getOptionLabel(ADVANCED_CUSTOM_CONVERTER_OPTIONS, converter) + const converterLabel = getOptionLabel( + ADVANCED_CUSTOM_CONVERTER_OPTIONS, + converter + ) const authLabel = getOptionLabel(ADVANCED_CUSTOM_AUTH_MODE_OPTIONS, authMode) const isNativeConverter = converter === 'none' const ConverterVisualIcon = isNativeConverter ? ArrowRight : Shuffle @@ -575,7 +579,9 @@ function RouteEditor({ /> {t(converterLabel)} - {t(converterLabel)} + + {t(converterLabel)} + @@ -597,10 +603,7 @@ function RouteEditor({ className='lg:gap-1' labelClassName='lg:sr-only' > - {`${incomingPathLabel}`} @@ -617,9 +620,9 @@ function RouteEditor({ value={option.value} className={longSelectItemClass} > -
+
{option.label} - + {option.value}
@@ -676,7 +679,7 @@ function RouteEditor({ value={option.value} className={longSelectItemClass} > - + {t(option.label)} @@ -785,9 +788,7 @@ function FieldBlock({ }) { return (
- - {label} - + {label} {children}
) diff --git a/web/default/src/features/channels/components/dialogs/balance-query-dialog.tsx b/web/default/src/features/channels/components/dialogs/balance-query-dialog.tsx index 32b91f09..68a5c64b 100644 --- a/web/default/src/features/channels/components/dialogs/balance-query-dialog.tsx +++ b/web/default/src/features/channels/components/dialogs/balance-query-dialog.tsx @@ -16,15 +16,17 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useState } from 'react' import { useQueryClient } from '@tanstack/react-query' import { Loader2, RefreshCw, DollarSign } from 'lucide-react' +import { useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' + +import { Dialog } from '@/components/dialog' +import { Button } from '@/components/ui/button' import { formatCurrencyFromUSD } from '@/lib/currency' import { formatTimestampToDate } from '@/lib/format' -import { Button } from '@/components/ui/button' -import { Dialog } from '@/components/dialog' + import { getCodexUsage, updateChannelBalance } from '../../api' import { channelsQueryKeys } from '../../lib' import { useChannels } from '../channels-provider' diff --git a/web/default/src/features/channels/components/dialogs/channel-test-dialog.tsx b/web/default/src/features/channels/components/dialogs/channel-test-dialog.tsx index 886ffcd8..5bf22921 100644 --- a/web/default/src/features/channels/components/dialogs/channel-test-dialog.tsx +++ b/web/default/src/features/channels/components/dialogs/channel-test-dialog.tsx @@ -16,7 +16,6 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { type ChangeEvent, useCallback, useMemo, useRef, useState } from 'react' import { useQueryClient } from '@tanstack/react-query' import { type ColumnDef, @@ -32,10 +31,25 @@ import { Settings, Trash2, } from 'lucide-react' +import { type ChangeEvent, useCallback, useMemo, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { useCopyToClipboard } from '@/hooks/use-copy-to-clipboard' -import { useIsMobile } from '@/hooks/use-mobile' + +import { ConfirmDialog } from '@/components/confirm-dialog' +import { + DataTableBulkActions as BulkActionsToolbar, + DataTablePagination, + DataTableView, + useDataTable, +} from '@/components/data-table' +import { Dialog } from '@/components/dialog' +import { + sideDrawerContentClassName, + sideDrawerFooterClassName, + sideDrawerFormClassName, + sideDrawerHeaderClassName, +} from '@/components/drawer-layout' +import { StatusBadge } from '@/components/status-badge' import { Button } from '@/components/ui/button' import { Checkbox } from '@/components/ui/checkbox' import { Input } from '@/components/ui/input' @@ -63,21 +77,9 @@ import { TooltipContent, TooltipTrigger, } from '@/components/ui/tooltip' -import { - DataTableBulkActions as BulkActionsToolbar, - DataTablePagination, - DataTableView, - useDataTable, -} from '@/components/data-table' -import { ConfirmDialog } from '@/components/confirm-dialog' -import { Dialog } from '@/components/dialog' -import { - sideDrawerContentClassName, - sideDrawerFooterClassName, - sideDrawerFormClassName, - sideDrawerHeaderClassName, -} from '@/components/drawer-layout' -import { StatusBadge } from '@/components/status-badge' +import { useCopyToClipboard } from '@/hooks/use-copy-to-clipboard' +import { useIsMobile } from '@/hooks/use-mobile' + import { updateChannel } from '../../api' import { channelsQueryKeys, @@ -947,7 +949,7 @@ function ChannelTestDialogContent({ value={option.value} className={endpointSelectItemClass} > - + {option.label} @@ -1341,11 +1343,7 @@ function FailureDetailsSheet({ ) } -function TestModelsBulkActions({ - table, -}: { - table: TanStackTable -}) { +function TestModelsBulkActions({ table }: { table: TanStackTable }) { const { t } = useTranslation() const { copyToClipboard } = useCopyToClipboard() const selectedRows = table.getFilteredSelectedRowModel().rows diff --git a/web/default/src/features/channels/components/dialogs/copy-channel-dialog.tsx b/web/default/src/features/channels/components/dialogs/copy-channel-dialog.tsx index 9edaaaeb..ea805788 100644 --- a/web/default/src/features/channels/components/dialogs/copy-channel-dialog.tsx +++ b/web/default/src/features/channels/components/dialogs/copy-channel-dialog.tsx @@ -16,15 +16,17 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState } from 'react' import { useQueryClient } from '@tanstack/react-query' import { Loader2 } from 'lucide-react' +import { useState } from 'react' import { useTranslation } from 'react-i18next' + +import { Dialog } from '@/components/dialog' import { Button } from '@/components/ui/button' import { Checkbox } from '@/components/ui/checkbox' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' -import { Dialog } from '@/components/dialog' + import { handleCopyChannel } from '../../lib' import { useChannels } from '../channels-provider' diff --git a/web/default/src/features/channels/components/dialogs/edit-tag-dialog.tsx b/web/default/src/features/channels/components/dialogs/edit-tag-dialog.tsx index 9967fa98..6f439ebf 100644 --- a/web/default/src/features/channels/components/dialogs/edit-tag-dialog.tsx +++ b/web/default/src/features/channels/components/dialogs/edit-tag-dialog.tsx @@ -16,11 +16,15 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useState } from 'react' import { useQuery, useQueryClient } from '@tanstack/react-query' import { Loader2 } from 'lucide-react' +import { useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' + +import { Dialog } from '@/components/dialog' +import { GroupBadge } from '@/components/group-badge' +import { StatusBadge } from '@/components/status-badge' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' @@ -35,9 +39,7 @@ import { } from '@/components/ui/select' import { Separator } from '@/components/ui/separator' import { Textarea } from '@/components/ui/textarea' -import { Dialog } from '@/components/dialog' -import { GroupBadge } from '@/components/group-badge' -import { StatusBadge } from '@/components/status-badge' + import { editTagChannels, getTagModels, diff --git a/web/default/src/features/channels/components/dialogs/fetch-models-dialog.tsx b/web/default/src/features/channels/components/dialogs/fetch-models-dialog.tsx index 5dc7558a..cca720d9 100644 --- a/web/default/src/features/channels/components/dialogs/fetch-models-dialog.tsx +++ b/web/default/src/features/channels/components/dialogs/fetch-models-dialog.tsx @@ -16,11 +16,13 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useEffect, useMemo } from 'react' import { useQueryClient } from '@tanstack/react-query' import { Loader2, Search, Info, ChevronDown } from 'lucide-react' +import { useState, useEffect, useMemo } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' + +import { Dialog } from '@/components/dialog' import { Button } from '@/components/ui/button' import { Checkbox } from '@/components/ui/checkbox' import { @@ -36,7 +38,7 @@ import { TooltipContent, TooltipTrigger, } from '@/components/ui/tooltip' -import { Dialog } from '@/components/dialog' + import { fetchUpstreamModels, updateChannel } from '../../api' import { channelsQueryKeys, diff --git a/web/default/src/features/channels/components/dialogs/missing-models-confirmation-dialog.tsx b/web/default/src/features/channels/components/dialogs/missing-models-confirmation-dialog.tsx index 68fb189e..1659d874 100644 --- a/web/default/src/features/channels/components/dialogs/missing-models-confirmation-dialog.tsx +++ b/web/default/src/features/channels/components/dialogs/missing-models-confirmation-dialog.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useTranslation } from 'react-i18next' + import { AlertDialog, AlertDialogAction, diff --git a/web/default/src/features/channels/components/dialogs/multi-key-manage-dialog.tsx b/web/default/src/features/channels/components/dialogs/multi-key-manage-dialog.tsx index a00809aa..22f75214 100644 --- a/web/default/src/features/channels/components/dialogs/multi-key-manage-dialog.tsx +++ b/web/default/src/features/channels/components/dialogs/multi-key-manage-dialog.tsx @@ -16,17 +16,16 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useEffect } from 'react' import { useQueryClient } from '@tanstack/react-query' import { Loader2, RefreshCw, Trash2, Power, PowerOff } from 'lucide-react' +import { useState, useEffect } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { - ADMIN_PERMISSION_ACTIONS, - ADMIN_PERMISSION_RESOURCES, - hasPermission, -} from '@/lib/admin-permissions' -import { useAuthStore } from '@/stores/auth-store' + +import { ConfirmDialog } from '@/components/confirm-dialog' +import { StaticDataTable } from '@/components/data-table' +import { Dialog } from '@/components/dialog' +import { StatusBadge } from '@/components/status-badge' import { Button } from '@/components/ui/button' import { Select, @@ -37,10 +36,13 @@ import { SelectValue, } from '@/components/ui/select' import { Separator } from '@/components/ui/separator' -import { ConfirmDialog } from '@/components/confirm-dialog' -import { StaticDataTable } from '@/components/data-table' -import { Dialog } from '@/components/dialog' -import { StatusBadge } from '@/components/status-badge' +import { + ADMIN_PERMISSION_ACTIONS, + ADMIN_PERMISSION_RESOURCES, + hasPermission, +} from '@/lib/admin-permissions' +import { useAuthStore } from '@/stores/auth-store' + import { getMultiKeyStatus, enableMultiKey, diff --git a/web/default/src/features/channels/components/dialogs/multi-key-table-row-actions.tsx b/web/default/src/features/channels/components/dialogs/multi-key-table-row-actions.tsx index 08345f96..7834edcd 100644 --- a/web/default/src/features/channels/components/dialogs/multi-key-table-row-actions.tsx +++ b/web/default/src/features/channels/components/dialogs/multi-key-table-row-actions.tsx @@ -17,7 +17,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useTranslation } from 'react-i18next' + import { Button } from '@/components/ui/button' + import type { MultiKeyConfirmAction } from '../../types' type MultiKeyTableRowActionsProps = { @@ -64,9 +66,7 @@ export function MultiKeyTableRowActions({ }} disabled={!canDelete} title={ - canDelete - ? undefined - : t('No permission to perform this action') + canDelete ? undefined : t('No permission to perform this action') } > {t('Delete')} diff --git a/web/default/src/features/channels/components/dialogs/ollama-models-dialog.tsx b/web/default/src/features/channels/components/dialogs/ollama-models-dialog.tsx index 90b69086..3157fb9c 100644 --- a/web/default/src/features/channels/components/dialogs/ollama-models-dialog.tsx +++ b/web/default/src/features/channels/components/dialogs/ollama-models-dialog.tsx @@ -16,12 +16,13 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useCallback, useEffect, useMemo, useRef, useState } from 'react' import { useQueryClient } from '@tanstack/react-query' import { Loader2, RefreshCw, Trash2, Download, Search } from 'lucide-react' +import { useCallback, useEffect, useMemo, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { getCommonHeaders } from '@/lib/api' + +import { Dialog } from '@/components/dialog' import { AlertDialog, AlertDialogAction, @@ -38,7 +39,8 @@ import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' import { Progress } from '@/components/ui/progress' import { Separator } from '@/components/ui/separator' -import { Dialog } from '@/components/dialog' +import { getCommonHeaders } from '@/lib/api' + import { deleteOllamaModel, fetchModels as fetchModelsFromEndpoint, diff --git a/web/default/src/features/channels/components/dialogs/param-override-editor-dialog.tsx b/web/default/src/features/channels/components/dialogs/param-override-editor-dialog.tsx index 776581da..9ded59b8 100644 --- a/web/default/src/features/channels/components/dialogs/param-override-editor-dialog.tsx +++ b/web/default/src/features/channels/components/dialogs/param-override-editor-dialog.tsx @@ -16,14 +16,6 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { - type DragEvent, - type KeyboardEvent, - useCallback, - useEffect, - useMemo, - useState, -} from 'react' import { ChevronDown, ChevronUp, @@ -33,9 +25,18 @@ import { Search, Trash2, } from 'lucide-react' +import { + type DragEvent, + type KeyboardEvent, + useCallback, + useEffect, + useMemo, + useState, +} from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { cn } from '@/lib/utils' + +import { Dialog } from '@/components/dialog' import { Badge } from '@/components/ui/badge' import { Button } from '@/components/ui/button' import { @@ -55,7 +56,7 @@ import { } from '@/components/ui/select' import { Switch } from '@/components/ui/switch' import { Textarea } from '@/components/ui/textarea' -import { Dialog } from '@/components/dialog' +import { cn } from '@/lib/utils' // --------------------------------------------------------------------------- // Types diff --git a/web/default/src/features/channels/components/dialogs/status-code-risk-dialog.tsx b/web/default/src/features/channels/components/dialogs/status-code-risk-dialog.tsx index 6620754b..07145db3 100644 --- a/web/default/src/features/channels/components/dialogs/status-code-risk-dialog.tsx +++ b/web/default/src/features/channels/components/dialogs/status-code-risk-dialog.tsx @@ -16,14 +16,15 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState } from 'react' import { AlertTriangle } from 'lucide-react' +import { useState } from 'react' import { useTranslation } from 'react-i18next' + +import { Dialog } from '@/components/dialog' import { Button } from '@/components/ui/button' import { Checkbox } from '@/components/ui/checkbox' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' -import { Dialog } from '@/components/dialog' interface StatusCodeRiskDialogProps { open: boolean diff --git a/web/default/src/features/channels/components/dialogs/tag-batch-edit-dialog.tsx b/web/default/src/features/channels/components/dialogs/tag-batch-edit-dialog.tsx index 3d2126ad..26233d19 100644 --- a/web/default/src/features/channels/components/dialogs/tag-batch-edit-dialog.tsx +++ b/web/default/src/features/channels/components/dialogs/tag-batch-edit-dialog.tsx @@ -16,19 +16,21 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useEffect, useMemo } from 'react' import { useQuery, useQueryClient } from '@tanstack/react-query' import { Loader2, AlertCircle } from 'lucide-react' +import { useState, useEffect, useMemo } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' + +import { Dialog } from '@/components/dialog' +import { MultiSelect } from '@/components/multi-select' import { Alert, AlertDescription } from '@/components/ui/alert' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' import { Skeleton } from '@/components/ui/skeleton' import { Textarea } from '@/components/ui/textarea' -import { Dialog } from '@/components/dialog' -import { MultiSelect } from '@/components/multi-select' + import { getTagModels, editTagChannels, diff --git a/web/default/src/features/channels/components/dialogs/upstream-update-dialog.tsx b/web/default/src/features/channels/components/dialogs/upstream-update-dialog.tsx index 923a1b3a..b2963c02 100644 --- a/web/default/src/features/channels/components/dialogs/upstream-update-dialog.tsx +++ b/web/default/src/features/channels/components/dialogs/upstream-update-dialog.tsx @@ -16,17 +16,18 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useMemo } from 'react' import { Search } from 'lucide-react' +import { useState, useMemo } from 'react' import { useTranslation } from 'react-i18next' + +import { ConfirmDialog } from '@/components/confirm-dialog' +import { Dialog } from '@/components/dialog' +import { StatusBadge } from '@/components/status-badge' import { Button } from '@/components/ui/button' import { Checkbox } from '@/components/ui/checkbox' import { Input } from '@/components/ui/input' import { ScrollArea } from '@/components/ui/scroll-area' import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs' -import { ConfirmDialog } from '@/components/confirm-dialog' -import { Dialog } from '@/components/dialog' -import { StatusBadge } from '@/components/status-badge' interface UpstreamUpdateDialogProps { open: boolean diff --git a/web/default/src/features/channels/components/drawers/channel-mutate-drawer.tsx b/web/default/src/features/channels/components/drawers/channel-mutate-drawer.tsx index 4ee913d1..b766d481 100644 --- a/web/default/src/features/channels/components/drawers/channel-mutate-drawer.tsx +++ b/web/default/src/features/channels/components/drawers/channel-mutate-drawer.tsx @@ -16,15 +16,6 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { - type ReactNode, - useEffect, - useState, - useMemo, - useCallback, - useRef, -} from 'react' -import { type SubmitErrorHandler, useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' import { useQuery, useQueryClient } from '@tanstack/react-query' import { @@ -51,6 +42,15 @@ import { SlidersHorizontal, Wand2, } from 'lucide-react' +import { + type ReactNode, + useEffect, + useState, + useMemo, + useCallback, + useRef, +} from 'react' +import { type SubmitErrorHandler, useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' @@ -729,9 +729,7 @@ export function ChannelMutateDrawer({ const currentAllowServiceTier = form.watch('allow_service_tier') const currentDisableStore = form.watch('disable_store') const currentAllowSafetyIdentifier = form.watch('allow_safety_identifier') - const currentAllowIncludeObfuscation = form.watch( - 'allow_include_obfuscation' - ) + const currentAllowIncludeObfuscation = form.watch('allow_include_obfuscation') const currentAllowInferenceGeo = form.watch('allow_inference_geo') const currentAllowSpeed = form.watch('allow_speed') const currentClaudeBetaQuery = form.watch('claude_beta_query') @@ -912,56 +910,56 @@ export function ChannelMutateDrawer({ const advancedSummary = advancedHaveErrors ? t('Error') : undefined const routingStrategyConfigured = Boolean( currentPriority || - currentWeight || - currentTestModel?.trim() || - (currentAutoBan ?? 1) !== 1 + currentWeight || + currentTestModel?.trim() || + (currentAutoBan ?? 1) !== 1 ) const internalNotesConfigured = Boolean( currentTag?.trim() || currentRemark?.trim() ) const overrideRulesConfigured = Boolean( hasConfiguredOverrideValue(currentStatusCodeMapping) || - hasConfiguredOverrideValue(currentParamOverride) || - hasConfiguredOverrideValue(currentHeaderOverride) + hasConfiguredOverrideValue(currentParamOverride) || + hasConfiguredOverrideValue(currentHeaderOverride) ) const extraSettingsConfigured = Boolean( currentForceFormat || - currentThinkingToContent || - currentPassThroughBodyEnabled || - currentDisableTaskPollingSleep || - currentProxy?.trim() || - currentSystemPrompt?.trim() || - currentSystemPromptOverride + currentThinkingToContent || + currentPassThroughBodyEnabled || + currentDisableTaskPollingSleep || + currentProxy?.trim() || + currentSystemPrompt?.trim() || + currentSystemPromptOverride ) let fieldPassthroughConfigured = false if (currentType === 1) { fieldPassthroughConfigured = Boolean( currentAllowServiceTier || - currentDisableStore || - currentAllowSafetyIdentifier || - currentAllowIncludeObfuscation || - currentAllowInferenceGeo + currentDisableStore || + currentAllowSafetyIdentifier || + currentAllowIncludeObfuscation || + currentAllowInferenceGeo ) } else if (currentType === 14) { fieldPassthroughConfigured = Boolean( currentAllowServiceTier || - currentAllowInferenceGeo || - currentAllowSpeed || - currentClaudeBetaQuery + currentAllowInferenceGeo || + currentAllowSpeed || + currentClaudeBetaQuery ) } const upstreamModelDetectionConfigured = Boolean( upstreamModelUpdateCheckEnabled || - currentUpstreamModelUpdateAutoSyncEnabled || - currentUpstreamModelUpdateIgnoredModels?.trim() + currentUpstreamModelUpdateAutoSyncEnabled || + currentUpstreamModelUpdateIgnoredModels?.trim() ) const advancedConfigured = Boolean( routingStrategyConfigured || - internalNotesConfigured || - overrideRulesConfigured || - extraSettingsConfigured || - fieldPassthroughConfigured || - upstreamModelDetectionConfigured + internalNotesConfigured || + overrideRulesConfigured || + extraSettingsConfigured || + fieldPassthroughConfigured || + upstreamModelDetectionConfigured ) const advancedNavChildren: ChannelEditorNavChildItem[] = [ { @@ -2674,14 +2672,18 @@ export function ChannelMutateDrawer({ ) )} - {hiddenAdvancedCustomRouteTypeCount > 0 && ( + {hiddenAdvancedCustomRouteTypeCount > + 0 && ( - +{hiddenAdvancedCustomRouteTypeCount} + + + { + hiddenAdvancedCustomRouteTypeCount + } )} {!advancedCustomStats.valid && ( @@ -4116,9 +4118,7 @@ export function ChannelMutateDrawer({ > - } + icon={} />
. For commercial licensing, please contact support@quantumnous.com */ -import type { ReactNode } from 'react' import { KeyRound } from 'lucide-react' +import type { ReactNode } from 'react' import { useTranslation } from 'react-i18next' import { diff --git a/web/default/src/features/channels/components/drawers/sections/channel-auth-section.tsx b/web/default/src/features/channels/components/drawers/sections/channel-auth-section.tsx index 99ce14fc..8a193af8 100644 --- a/web/default/src/features/channels/components/drawers/sections/channel-auth-section.tsx +++ b/web/default/src/features/channels/components/drawers/sections/channel-auth-section.tsx @@ -16,8 +16,8 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import type { ReactNode } from 'react' import { KeyRound } from 'lucide-react' +import type { ReactNode } from 'react' import { useTranslation } from 'react-i18next' type ChannelAuthSectionProps = { diff --git a/web/default/src/features/channels/components/drawers/sections/channel-basic-section.tsx b/web/default/src/features/channels/components/drawers/sections/channel-basic-section.tsx index cf06582a..56986a99 100644 --- a/web/default/src/features/channels/components/drawers/sections/channel-basic-section.tsx +++ b/web/default/src/features/channels/components/drawers/sections/channel-basic-section.tsx @@ -16,9 +16,10 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import type { ReactNode } from 'react' import { Server } from 'lucide-react' +import type { ReactNode } from 'react' import { useTranslation } from 'react-i18next' + import { SideDrawerSection, SideDrawerSectionHeader, diff --git a/web/default/src/features/channels/components/drawers/sections/channel-editor-loading-state.tsx b/web/default/src/features/channels/components/drawers/sections/channel-editor-loading-state.tsx index bf0aa798..5a749001 100644 --- a/web/default/src/features/channels/components/drawers/sections/channel-editor-loading-state.tsx +++ b/web/default/src/features/channels/components/drawers/sections/channel-editor-loading-state.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useTranslation } from 'react-i18next' + import { Skeleton } from '@/components/ui/skeleton' export function ChannelEditorLoadingState() { diff --git a/web/default/src/features/channels/components/drawers/sections/channel-models-section.tsx b/web/default/src/features/channels/components/drawers/sections/channel-models-section.tsx index f70cba32..52cdf9dd 100644 --- a/web/default/src/features/channels/components/drawers/sections/channel-models-section.tsx +++ b/web/default/src/features/channels/components/drawers/sections/channel-models-section.tsx @@ -16,9 +16,10 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import type { ReactNode } from 'react' import { Boxes } from 'lucide-react' +import type { ReactNode } from 'react' import { useTranslation } from 'react-i18next' + import { SideDrawerSection, SideDrawerSectionHeader, diff --git a/web/default/src/features/channels/components/model-mapping-editor.tsx b/web/default/src/features/channels/components/model-mapping-editor.tsx index de207d7c..808e5772 100644 --- a/web/default/src/features/channels/components/model-mapping-editor.tsx +++ b/web/default/src/features/channels/components/model-mapping-editor.tsx @@ -16,15 +16,16 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useId, useMemo, useRef, useState } from 'react' import { Code, Plus, Table, Trash2 } from 'lucide-react' +import { useEffect, useId, useMemo, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + import { Alert, AlertDescription } from '@/components/ui/alert' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs' import { Textarea } from '@/components/ui/textarea' +import { cn } from '@/lib/utils' type ModelMappingEditorProps = { value: string diff --git a/web/default/src/features/channels/components/numeric-spinner-input.tsx b/web/default/src/features/channels/components/numeric-spinner-input.tsx index 780d1416..ab5736c4 100644 --- a/web/default/src/features/channels/components/numeric-spinner-input.tsx +++ b/web/default/src/features/channels/components/numeric-spinner-input.tsx @@ -16,10 +16,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useEffect, useRef } from 'react' import { Minus, Plus } from 'lucide-react' -import { cn } from '@/lib/utils' +import { useState, useEffect, useRef } from 'react' + import { Label } from '@/components/ui/label' +import { cn } from '@/lib/utils' interface NumericSpinnerInputProps { value: number | null | undefined diff --git a/web/default/src/features/channels/hooks/use-channel-mutate-form.ts b/web/default/src/features/channels/hooks/use-channel-mutate-form.ts index 1393759a..a74cda22 100644 --- a/web/default/src/features/channels/hooks/use-channel-mutate-form.ts +++ b/web/default/src/features/channels/hooks/use-channel-mutate-form.ts @@ -19,12 +19,14 @@ For commercial licensing, please contact support@quantumnous.com import { useMutation } from '@tanstack/react-query' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' + import { ADMIN_PERMISSION_ACTIONS, ADMIN_PERMISSION_RESOURCES, hasPermission, } from '@/lib/admin-permissions' import { useAuthStore } from '@/stores/auth-store' + import { createChannel, updateChannel } from '../api' import { ERROR_MESSAGES, SUCCESS_MESSAGES } from '../constants' import { diff --git a/web/default/src/features/channels/hooks/use-channel-upstream-updates.ts b/web/default/src/features/channels/hooks/use-channel-upstream-updates.ts index 315b8c67..88b7c052 100644 --- a/web/default/src/features/channels/hooks/use-channel-upstream-updates.ts +++ b/web/default/src/features/channels/hooks/use-channel-upstream-updates.ts @@ -19,7 +19,9 @@ For commercial licensing, please contact support@quantumnous.com import { useRef, useState, useCallback, useMemo } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' + import { api, type ApiRequestConfig } from '@/lib/api' + import { normalizeModelList } from '../lib/upstream-update-utils' const upstreamUpdateRequestConfig = { diff --git a/web/default/src/features/channels/index.tsx b/web/default/src/features/channels/index.tsx index 79b4faa6..7e0114bd 100644 --- a/web/default/src/features/channels/index.tsx +++ b/web/default/src/features/channels/index.tsx @@ -16,10 +16,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useTranslation } from 'react-i18next' -import { Link } from '@tanstack/react-router' import { useQuery } from '@tanstack/react-query' +import { Link } from '@tanstack/react-router' import { Settings2 } from 'lucide-react' +import { useTranslation } from 'react-i18next' + import { SectionPageLayout } from '@/components/layout' import { Badge } from '@/components/ui/badge' import { @@ -29,6 +30,7 @@ import { } from '@/components/ui/tooltip' import { ROLE } from '@/lib/roles' import { useAuthStore } from '@/stores/auth-store' + import { getChannelOps } from './api' import { ChannelsDialogs } from './components/channels-dialogs' import { ChannelsPrimaryButtons } from './components/channels-primary-buttons' @@ -48,9 +50,7 @@ export function Channels() { }) const retryTimes = channelOpsQuery.data?.data?.retry_times const retryLabel = - typeof retryTimes === 'number' - ? `${t('Max Retries')}: ${retryTimes}` - : null + typeof retryTimes === 'number' ? `${t('Max Retries')}: ${retryTimes}` : null let retryBadge = null if (retryLabel) { retryBadge = isRoot ? ( diff --git a/web/default/src/features/channels/lib/advanced-custom.ts b/web/default/src/features/channels/lib/advanced-custom.ts index 150ce11b..0e2f6cf2 100644 --- a/web/default/src/features/channels/lib/advanced-custom.ts +++ b/web/default/src/features/channels/lib/advanced-custom.ts @@ -565,7 +565,9 @@ function normalizeAdvancedCustomRoute( return nextRoute } -function getAdvancedCustomRouteUpstreamPath(route: AdvancedCustomRoute): string { +function getAdvancedCustomRouteUpstreamPath( + route: AdvancedCustomRoute +): string { return (route.upstream_path || '').trim() } diff --git a/web/default/src/features/channels/lib/channel-form-errors.ts b/web/default/src/features/channels/lib/channel-form-errors.ts index 9f173c74..f6873ebc 100644 --- a/web/default/src/features/channels/lib/channel-form-errors.ts +++ b/web/default/src/features/channels/lib/channel-form-errors.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import type { FieldPath } from 'react-hook-form' + import type { ChannelFormValues } from './channel-form' type ChannelFormErrorMap = Partial< diff --git a/web/default/src/features/channels/lib/channel-form.ts b/web/default/src/features/channels/lib/channel-form.ts index 57ab8c5f..b0e72563 100644 --- a/web/default/src/features/channels/lib/channel-form.ts +++ b/web/default/src/features/channels/lib/channel-form.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { z } from 'zod' + import { CHANNEL_STATUS, ERROR_MESSAGES, diff --git a/web/default/src/features/chat/hooks/use-active-chat-key.ts b/web/default/src/features/chat/hooks/use-active-chat-key.ts index eaec33b6..04ad15aa 100644 --- a/web/default/src/features/chat/hooks/use-active-chat-key.ts +++ b/web/default/src/features/chat/hooks/use-active-chat-key.ts @@ -17,9 +17,10 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useQuery } from '@tanstack/react-query' -import { useAuthStore } from '@/stores/auth-store' + import { fetchTokenKey, getApiKeys } from '@/features/keys/api' import { API_KEY_STATUS } from '@/features/keys/constants' +import { useAuthStore } from '@/stores/auth-store' export async function fetchActiveChatKey() { const result = await getApiKeys({ p: 1, size: 50 }) diff --git a/web/default/src/features/chat/hooks/use-chat-presets.ts b/web/default/src/features/chat/hooks/use-chat-presets.ts index c5702588..e5b7f0f3 100644 --- a/web/default/src/features/chat/hooks/use-chat-presets.ts +++ b/web/default/src/features/chat/hooks/use-chat-presets.ts @@ -17,8 +17,10 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useMemo } from 'react' -import { useStatus } from '@/hooks/use-status' + import type { SystemStatus } from '@/features/auth/types' +import { useStatus } from '@/hooks/use-status' + import { type ChatPreset, parseChatConfig, diff --git a/web/default/src/features/dashboard/api.ts b/web/default/src/features/dashboard/api.ts index 18a7fe18..8e823169 100644 --- a/web/default/src/features/dashboard/api.ts +++ b/web/default/src/features/dashboard/api.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { api } from '@/lib/api' + import type { FlowQuotaDataItem, QuotaDataItem, diff --git a/web/default/src/features/dashboard/components/flow/flow-charts.tsx b/web/default/src/features/dashboard/components/flow/flow-charts.tsx index 926042c6..0cf3e1fa 100644 --- a/web/default/src/features/dashboard/components/flow/flow-charts.tsx +++ b/web/default/src/features/dashboard/components/flow/flow-charts.tsx @@ -16,14 +16,6 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { - Fragment, - useCallback, - useEffect, - useMemo, - useRef, - useState, -} from 'react' import { useQuery } from '@tanstack/react-query' import { VChart } from '@visactor/react-vchart' import type { EventParamsDefinition, IVChart } from '@visactor/vchart' @@ -39,6 +31,14 @@ import { Route, WalletCards, } from 'lucide-react' +import { + Fragment, + useCallback, + useEffect, + useMemo, + useRef, + useState, +} from 'react' import { useTranslation } from 'react-i18next' import { MultiSelect } from '@/components/multi-select' @@ -90,6 +90,7 @@ import { useChartTheme } from '@/lib/use-chart-theme' import { cn } from '@/lib/utils' import { VCHART_OPTION } from '@/lib/vchart' import { useAuthStore } from '@/stores/auth-store' + import { FlowNodeFilterControl } from './flow-node-filter' interface FlowChartsProps { @@ -172,9 +173,7 @@ const FLOW_OTHER_NODE_LABEL_KEYS: Record = { type FlowChartPointerEvent = EventParamsDefinition['pointerdown'] -function chartRecordValue( - value: unknown -): Record | undefined { +function chartRecordValue(value: unknown): Record | undefined { return value && typeof value === 'object' ? (value as Record) : undefined @@ -469,7 +468,9 @@ export function FlowCharts(props: FlowChartsProps) { overflowMode, flowRole, activeFlowNode ? flowNodeFilterKey(activeFlowNode) : '', - activeFlowLink ? `${activeFlowLink.source}\u0000${activeFlowLink.target}` : '', + activeFlowLink + ? `${activeFlowLink.source}\u0000${activeFlowLink.target}` + : '', selectedNodes.map(flowNodeFilterKey).join(','), selectedUsers.join(','), visibleStages.join(','), diff --git a/web/default/src/features/dashboard/components/flow/flow-node-filter.tsx b/web/default/src/features/dashboard/components/flow/flow-node-filter.tsx index 1e239398..953b6fa6 100644 --- a/web/default/src/features/dashboard/components/flow/flow-node-filter.tsx +++ b/web/default/src/features/dashboard/components/flow/flow-node-filter.tsx @@ -16,8 +16,8 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useMemo } from 'react' import { Filter, X } from 'lucide-react' +import { useMemo } from 'react' import { useTranslation } from 'react-i18next' import { Badge } from '@/components/ui/badge' diff --git a/web/default/src/features/dashboard/components/models/consumption-distribution-chart.tsx b/web/default/src/features/dashboard/components/models/consumption-distribution-chart.tsx index 56816c42..1e5f0ec0 100644 --- a/web/default/src/features/dashboard/components/models/consumption-distribution-chart.tsx +++ b/web/default/src/features/dashboard/components/models/consumption-distribution-chart.tsx @@ -16,13 +16,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useMemo, useRef, useState } from 'react' import { VChart } from '@visactor/react-vchart' import { AreaChart, BarChart3, WalletCards } from 'lucide-react' +import { useEffect, useMemo, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' -import { useThemeRadiusPx } from '@/lib/theme-radius' -import type { TimeGranularity } from '@/lib/time' -import { VCHART_OPTION } from '@/lib/vchart' + import { useThemeCustomization } from '@/context/theme-customization-provider' import { useTheme } from '@/context/theme-provider' import { @@ -34,6 +32,9 @@ import type { ConsumptionDistributionChartType, QuotaDataItem, } from '@/features/dashboard/types' +import { useThemeRadiusPx } from '@/lib/theme-radius' +import type { TimeGranularity } from '@/lib/time' +import { VCHART_OPTION } from '@/lib/vchart' let themeManagerPromise: Promise< (typeof import('@visactor/vchart'))['ThemeManager'] diff --git a/web/default/src/features/dashboard/components/models/log-stat-cards.tsx b/web/default/src/features/dashboard/components/models/log-stat-cards.tsx index d0a3c091..d6800cf6 100644 --- a/web/default/src/features/dashboard/components/models/log-stat-cards.tsx +++ b/web/default/src/features/dashboard/components/models/log-stat-cards.tsx @@ -18,10 +18,7 @@ For commercial licensing, please contact support@quantumnous.com */ import { useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' -import { useAuthStore } from '@/stores/auth-store' -import { formatCompactNumber, formatNumber, formatQuota } from '@/lib/format' -import { computeTimeRange } from '@/lib/time' -import { cn } from '@/lib/utils' + import { Skeleton } from '@/components/ui/skeleton' import { getUserQuotaDates } from '@/features/dashboard/api' import { useModelStatCardsConfig } from '@/features/dashboard/hooks/use-dashboard-config' @@ -34,6 +31,10 @@ import type { QuotaDataItem, DashboardFilters, } from '@/features/dashboard/types' +import { formatCompactNumber, formatNumber, formatQuota } from '@/lib/format' +import { computeTimeRange } from '@/lib/time' +import { cn } from '@/lib/utils' +import { useAuthStore } from '@/stores/auth-store' interface LogStatCardsProps { filters?: DashboardFilters diff --git a/web/default/src/features/dashboard/components/models/model-charts.tsx b/web/default/src/features/dashboard/components/models/model-charts.tsx index eb186ee0..5599dd87 100644 --- a/web/default/src/features/dashboard/components/models/model-charts.tsx +++ b/web/default/src/features/dashboard/components/models/model-charts.tsx @@ -16,13 +16,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useMemo, useState, useRef } from 'react' import { VChart } from '@visactor/react-vchart' import { PieChart as PieChartIcon } from 'lucide-react' +import { useEffect, useMemo, useState, useRef } from 'react' import { useTranslation } from 'react-i18next' -import { useThemeRadiusPx } from '@/lib/theme-radius' -import type { TimeGranularity } from '@/lib/time' -import { VCHART_OPTION } from '@/lib/vchart' + import { useThemeCustomization } from '@/context/theme-customization-provider' import { useTheme } from '@/context/theme-provider' import { @@ -34,6 +32,9 @@ import type { ModelAnalyticsChartTab, QuotaDataItem, } from '@/features/dashboard/types' +import { useThemeRadiusPx } from '@/lib/theme-radius' +import type { TimeGranularity } from '@/lib/time' +import { VCHART_OPTION } from '@/lib/vchart' let themeManagerPromise: Promise< (typeof import('@visactor/vchart'))['ThemeManager'] diff --git a/web/default/src/features/dashboard/components/models/models-chart-preferences.tsx b/web/default/src/features/dashboard/components/models/models-chart-preferences.tsx index 5714c8bc..20f8de93 100644 --- a/web/default/src/features/dashboard/components/models/models-chart-preferences.tsx +++ b/web/default/src/features/dashboard/components/models/models-chart-preferences.tsx @@ -16,10 +16,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState } from 'react' import { Save, Settings2 } from 'lucide-react' +import { useState } from 'react' import { useTranslation } from 'react-i18next' -import type { TimeGranularity } from '@/lib/time' + +import { Dialog } from '@/components/dialog' import { Button } from '@/components/ui/button' import { Label } from '@/components/ui/label' import { @@ -30,7 +31,6 @@ import { SelectTrigger, SelectValue, } from '@/components/ui/select' -import { Dialog } from '@/components/dialog' import { CONSUMPTION_DISTRIBUTION_CHART_OPTIONS, MODEL_ANALYTICS_CHART_OPTIONS, @@ -42,6 +42,7 @@ import type { DashboardChartPreferences, ModelAnalyticsChartTab, } from '@/features/dashboard/types' +import type { TimeGranularity } from '@/lib/time' interface ModelsChartPreferencesProps { preferences: DashboardChartPreferences diff --git a/web/default/src/features/dashboard/components/models/models-filter-dialog.tsx b/web/default/src/features/dashboard/components/models/models-filter-dialog.tsx index ea718c5a..44cd6309 100644 --- a/web/default/src/features/dashboard/components/models/models-filter-dialog.tsx +++ b/web/default/src/features/dashboard/components/models/models-filter-dialog.tsx @@ -16,12 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState } from 'react' import { Filter, RotateCcw, Calendar, Search } from 'lucide-react' +import { useState } from 'react' import { useTranslation } from 'react-i18next' -import { useAuthStore } from '@/stores/auth-store' -import { getRollingDateRange, type TimeGranularity } from '@/lib/time' -import { cn } from '@/lib/utils' + +import { DateTimePicker } from '@/components/datetime-picker' +import { Dialog } from '@/components/dialog' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' @@ -34,8 +34,6 @@ import { SelectTrigger, SelectValue, } from '@/components/ui/select' -import { DateTimePicker } from '@/components/datetime-picker' -import { Dialog } from '@/components/dialog' import { TIME_GRANULARITY_OPTIONS, TIME_RANGE_PRESETS, @@ -48,6 +46,9 @@ import type { DashboardChartPreferences, DashboardFilters, } from '@/features/dashboard/types' +import { getRollingDateRange, type TimeGranularity } from '@/lib/time' +import { cn } from '@/lib/utils' +import { useAuthStore } from '@/stores/auth-store' interface ModelsFilterProps { preferences: DashboardChartPreferences @@ -103,7 +104,8 @@ export function ModelsFilter(props: ModelsFilterProps) { const [open, setOpen] = useState(false) const [filters, setFilters] = useState( - () => props.currentFilters ?? buildDefaultDashboardFilters(props.preferences) + () => + props.currentFilters ?? buildDefaultDashboardFilters(props.preferences) ) const [selectedRange, setSelectedRange] = useState(() => detectQuickRangeDays(props.currentFilters) diff --git a/web/default/src/features/dashboard/components/models/performance-overview.tsx b/web/default/src/features/dashboard/components/models/performance-overview.tsx index 72ed9570..d5380d93 100644 --- a/web/default/src/features/dashboard/components/models/performance-overview.tsx +++ b/web/default/src/features/dashboard/components/models/performance-overview.tsx @@ -16,11 +16,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useMemo } from 'react' import { useQuery } from '@tanstack/react-query' import { Gauge, HeartPulse, Timer } from 'lucide-react' +import { useMemo } from 'react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + import { Skeleton } from '@/components/ui/skeleton' import { getPerfMetricsSummary } from '@/features/performance-metrics/api' import { @@ -31,6 +31,7 @@ import { getSuccessRateTextClass, } from '@/features/performance-metrics/lib/format' import type { PerfModelSummary } from '@/features/performance-metrics/types' +import { cn } from '@/lib/utils' const PERFORMANCE_WINDOW_HOURS = 24 const TOP_MODEL_LIMIT = 6 diff --git a/web/default/src/features/dashboard/components/overview/announcement-detail-dialog.tsx b/web/default/src/features/dashboard/components/overview/announcement-detail-dialog.tsx index 76d31005..446df267 100644 --- a/web/default/src/features/dashboard/components/overview/announcement-detail-dialog.tsx +++ b/web/default/src/features/dashboard/components/overview/announcement-detail-dialog.tsx @@ -17,10 +17,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useTranslation } from 'react-i18next' -import { RichContent } from '@/components/rich-content' -import { formatDateTimeObject } from '@/lib/time' -import { ScrollArea } from '@/components/ui/scroll-area' + import { Dialog } from '@/components/dialog' +import { RichContent } from '@/components/rich-content' +import { ScrollArea } from '@/components/ui/scroll-area' +import { formatDateTimeObject } from '@/lib/time' interface AnnouncementDetailModalProps { open: boolean diff --git a/web/default/src/features/dashboard/components/overview/announcements-panel.tsx b/web/default/src/features/dashboard/components/overview/announcements-panel.tsx index 43c1a080..a8c6c481 100644 --- a/web/default/src/features/dashboard/components/overview/announcements-panel.tsx +++ b/web/default/src/features/dashboard/components/overview/announcements-panel.tsx @@ -16,16 +16,18 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { memo, useState } from 'react' import { Megaphone } from 'lucide-react' +import { memo, useState } from 'react' import { useTranslation } from 'react-i18next' -import { getAnnouncementColorClass } from '@/lib/colors' -import { formatDateTimeObject } from '@/lib/time' -import { cn } from '@/lib/utils' + import { ScrollArea } from '@/components/ui/scroll-area' import { useAnnouncements } from '@/features/dashboard/hooks/use-status-data' import { getPreviewText } from '@/features/dashboard/lib' import type { AnnouncementItem } from '@/features/dashboard/types' +import { getAnnouncementColorClass } from '@/lib/colors' +import { formatDateTimeObject } from '@/lib/time' +import { cn } from '@/lib/utils' + import { PanelWrapper } from '../ui/panel-wrapper' import { AnnouncementDetailModal } from './announcement-detail-dialog' diff --git a/web/default/src/features/dashboard/components/overview/api-info-item.tsx b/web/default/src/features/dashboard/components/overview/api-info-item.tsx index 6161e74f..32ad45ad 100644 --- a/web/default/src/features/dashboard/components/overview/api-info-item.tsx +++ b/web/default/src/features/dashboard/components/overview/api-info-item.tsx @@ -18,16 +18,17 @@ For commercial licensing, please contact support@quantumnous.com */ import { Zap, ExternalLink, Gauge } from 'lucide-react' import { useTranslation } from 'react-i18next' -import { getBgColorClass } from '@/lib/colors' -import { cn } from '@/lib/utils' -import { Button } from '@/components/ui/button' + import { CopyButton } from '@/components/copy-button' import { StatusBadge } from '@/components/status-badge' +import { Button } from '@/components/ui/button' import { getLatencyColorClass, openExternalSpeedTest, } from '@/features/dashboard/lib/api-info' import type { ApiInfoItem, PingStatus } from '@/features/dashboard/types' +import { getBgColorClass } from '@/lib/colors' +import { cn } from '@/lib/utils' interface ApiInfoItemProps { item: ApiInfoItem diff --git a/web/default/src/features/dashboard/components/overview/api-info-panel.tsx b/web/default/src/features/dashboard/components/overview/api-info-panel.tsx index 944f2a7e..35b71949 100644 --- a/web/default/src/features/dashboard/components/overview/api-info-panel.tsx +++ b/web/default/src/features/dashboard/components/overview/api-info-panel.tsx @@ -16,9 +16,10 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useCallback } from 'react' import { Route } from 'lucide-react' +import { useState, useCallback } from 'react' import { useTranslation } from 'react-i18next' + import { ScrollArea } from '@/components/ui/scroll-area' import { useApiInfo } from '@/features/dashboard/hooks/use-status-data' import { @@ -26,6 +27,7 @@ import { getDefaultPingStatus, } from '@/features/dashboard/lib/api-info' import type { PingStatusMap, ApiInfoItem } from '@/features/dashboard/types' + import { PanelWrapper } from '../ui/panel-wrapper' import { ApiInfoItemComponent } from './api-info-item' diff --git a/web/default/src/features/dashboard/components/overview/faq-panel.tsx b/web/default/src/features/dashboard/components/overview/faq-panel.tsx index 1a223d66..924cd04c 100644 --- a/web/default/src/features/dashboard/components/overview/faq-panel.tsx +++ b/web/default/src/features/dashboard/components/overview/faq-panel.tsx @@ -18,6 +18,7 @@ For commercial licensing, please contact support@quantumnous.com */ import { HelpCircle } from 'lucide-react' import { useTranslation } from 'react-i18next' + import { Accordion, AccordionContent, @@ -28,6 +29,7 @@ import { Markdown } from '@/components/ui/markdown' import { ScrollArea } from '@/components/ui/scroll-area' import { useFAQ } from '@/features/dashboard/hooks/use-status-data' import type { FAQItem } from '@/features/dashboard/types' + import { PanelWrapper } from '../ui/panel-wrapper' export function FAQPanel() { diff --git a/web/default/src/features/dashboard/components/overview/overview-dashboard.tsx b/web/default/src/features/dashboard/components/overview/overview-dashboard.tsx index b303ff1f..6f094329 100644 --- a/web/default/src/features/dashboard/components/overview/overview-dashboard.tsx +++ b/web/default/src/features/dashboard/components/overview/overview-dashboard.tsx @@ -16,7 +16,6 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useMemo, useState } from 'react' import { useQuery } from '@tanstack/react-query' import { Link } from '@tanstack/react-router' import { @@ -38,21 +37,24 @@ import { type LucideIcon, } from 'lucide-react' import { motion, useReducedMotion } from 'motion/react' +import { useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { useAuthStore } from '@/stores/auth-store' -import { getUserModels } from '@/lib/api' -import { MOTION_TRANSITION } from '@/lib/motion' -import { ROLE } from '@/lib/roles' -import { cn } from '@/lib/utils' -import { useCopyToClipboard } from '@/hooks/use-copy-to-clipboard' -import { Button } from '@/components/ui/button' + import { CardStaggerContainer, CardStaggerItem, } from '@/components/page-transition' +import { Button } from '@/components/ui/button' import { fetchTokenKey, getApiKeys } from '@/features/keys/api' import type { ApiKey } from '@/features/keys/types' +import { useCopyToClipboard } from '@/hooks/use-copy-to-clipboard' +import { getUserModels } from '@/lib/api' +import { MOTION_TRANSITION } from '@/lib/motion' +import { ROLE } from '@/lib/roles' +import { cn } from '@/lib/utils' +import { useAuthStore } from '@/stores/auth-store' + import { useApiInfo, useDashboardContentVisibility, diff --git a/web/default/src/features/dashboard/components/overview/performance-health-panel.tsx b/web/default/src/features/dashboard/components/overview/performance-health-panel.tsx index c42698b6..ac6b015d 100644 --- a/web/default/src/features/dashboard/components/overview/performance-health-panel.tsx +++ b/web/default/src/features/dashboard/components/overview/performance-health-panel.tsx @@ -16,11 +16,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useMemo } from 'react' import { useQuery } from '@tanstack/react-query' import { Gauge, HeartPulse, Timer } from 'lucide-react' +import { useMemo } from 'react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + import { Skeleton } from '@/components/ui/skeleton' import { getPerfMetricsSummary } from '@/features/performance-metrics/api' import { @@ -31,6 +31,7 @@ import { getSuccessRateTextClass, } from '@/features/performance-metrics/lib/format' import type { PerfModelSummary } from '@/features/performance-metrics/types' +import { cn } from '@/lib/utils' const PERFORMANCE_WINDOW_HOURS = 24 const TOP_MODEL_LIMIT = 6 diff --git a/web/default/src/features/dashboard/components/overview/summary-cards.tsx b/web/default/src/features/dashboard/components/overview/summary-cards.tsx index 37ef4003..6970b681 100644 --- a/web/default/src/features/dashboard/components/overview/summary-cards.tsx +++ b/web/default/src/features/dashboard/components/overview/summary-cards.tsx @@ -16,22 +16,24 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useMemo } from 'react' import { useQuery } from '@tanstack/react-query' import { Link } from '@tanstack/react-router' import { ArrowRight, Flame, ShieldCheck, TrendingDown } from 'lucide-react' +import { useMemo } from 'react' import { useTranslation } from 'react-i18next' -import { useAuthStore } from '@/stores/auth-store' + +import { StaggerContainer, StaggerItem } from '@/components/page-transition' +import { Button } from '@/components/ui/button' +import { getUserQuotaDates } from '@/features/dashboard/api' +import { useSummaryCardsConfig } from '@/features/dashboard/hooks/use-dashboard-config' +import type { QuotaDataItem } from '@/features/dashboard/types' +import { useStatus } from '@/hooks/use-status' import { getCurrencyLabel, isCurrencyDisplayEnabled } from '@/lib/currency' import { formatNumber, formatQuota } from '@/lib/format' import { computeTimeRange } from '@/lib/time' import { cn } from '@/lib/utils' -import { useStatus } from '@/hooks/use-status' -import { Button } from '@/components/ui/button' -import { StaggerContainer, StaggerItem } from '@/components/page-transition' -import { getUserQuotaDates } from '@/features/dashboard/api' -import { useSummaryCardsConfig } from '@/features/dashboard/hooks/use-dashboard-config' -import type { QuotaDataItem } from '@/features/dashboard/types' +import { useAuthStore } from '@/stores/auth-store' + import { StatCard } from '../ui/stat-card' const SUMMARY_SPARKLINE_BUCKETS = 12 diff --git a/web/default/src/features/dashboard/components/overview/uptime-panel.tsx b/web/default/src/features/dashboard/components/overview/uptime-panel.tsx index 192a6b57..4e1376c9 100644 --- a/web/default/src/features/dashboard/components/overview/uptime-panel.tsx +++ b/web/default/src/features/dashboard/components/overview/uptime-panel.tsx @@ -16,10 +16,10 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { memo, useEffect, useState } from 'react' import { Activity, RotateCw } from 'lucide-react' +import { memo, useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + import { Button } from '@/components/ui/button' import { ScrollArea } from '@/components/ui/scroll-area' import { getUptimeStatus } from '@/features/dashboard/api' @@ -27,6 +27,8 @@ import type { UptimeGroupResult, UptimeMonitor, } from '@/features/dashboard/types' +import { cn } from '@/lib/utils' + import { PanelWrapper } from '../ui/panel-wrapper' const STATUS_COLOR_MAP: Record = { diff --git a/web/default/src/features/dashboard/components/ui/panel-wrapper.tsx b/web/default/src/features/dashboard/components/ui/panel-wrapper.tsx index 53d6803c..00d57351 100644 --- a/web/default/src/features/dashboard/components/ui/panel-wrapper.tsx +++ b/web/default/src/features/dashboard/components/ui/panel-wrapper.tsx @@ -18,8 +18,9 @@ For commercial licensing, please contact support@quantumnous.com */ import { type ReactNode } from 'react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + import { Skeleton } from '@/components/ui/skeleton' +import { cn } from '@/lib/utils' interface PanelWrapperProps { title: ReactNode diff --git a/web/default/src/features/dashboard/components/ui/stat-card.tsx b/web/default/src/features/dashboard/components/ui/stat-card.tsx index b2c9d129..65b8e346 100644 --- a/web/default/src/features/dashboard/components/ui/stat-card.tsx +++ b/web/default/src/features/dashboard/components/ui/stat-card.tsx @@ -16,10 +16,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useId, type ReactNode } from 'react' import { type LucideIcon } from 'lucide-react' -import { cn } from '@/lib/utils' +import { useId, type ReactNode } from 'react' + import { Skeleton } from '@/components/ui/skeleton' +import { cn } from '@/lib/utils' type StatCardTone = 'rose' | 'teal' | 'gray' type StatCardSparklineVariant = 'bars' | 'line' diff --git a/web/default/src/features/dashboard/components/users/user-charts.tsx b/web/default/src/features/dashboard/components/users/user-charts.tsx index 8c1d6376..1155e697 100644 --- a/web/default/src/features/dashboard/components/users/user-charts.tsx +++ b/web/default/src/features/dashboard/components/users/user-charts.tsx @@ -16,16 +16,15 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useMemo, useState, useRef, useCallback } from 'react' import { useQuery } from '@tanstack/react-query' import { VChart } from '@visactor/react-vchart' import { Users, Loader2 } from 'lucide-react' +import { useEffect, useMemo, useState, useRef, useCallback } from 'react' import { useTranslation } from 'react-i18next' -import { getRollingDateRange, type TimeGranularity } from '@/lib/time' -import { VCHART_OPTION } from '@/lib/vchart' -import { useTheme } from '@/context/theme-provider' + import { Skeleton } from '@/components/ui/skeleton' import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs' +import { useTheme } from '@/context/theme-provider' import { getUserQuotaDataByUsers } from '@/features/dashboard/api' import { TIME_GRANULARITY_OPTIONS, @@ -40,6 +39,8 @@ import type { ProcessedUserChartData, UserChartsFilters, } from '@/features/dashboard/types' +import { getRollingDateRange, type TimeGranularity } from '@/lib/time' +import { VCHART_OPTION } from '@/lib/vchart' let themeManagerPromise: Promise< (typeof import('@visactor/vchart'))['ThemeManager'] diff --git a/web/default/src/features/dashboard/hooks/use-dashboard-config.tsx b/web/default/src/features/dashboard/hooks/use-dashboard-config.tsx index 1ef03896..d6b2c793 100644 --- a/web/default/src/features/dashboard/hooks/use-dashboard-config.tsx +++ b/web/default/src/features/dashboard/hooks/use-dashboard-config.tsx @@ -28,6 +28,7 @@ import { type LucideIcon, } from 'lucide-react' import { useTranslation } from 'react-i18next' + import { safeDivide } from '@/features/dashboard/lib' interface StatCardConfig { diff --git a/web/default/src/features/dashboard/hooks/use-status-data.ts b/web/default/src/features/dashboard/hooks/use-status-data.ts index 8f10e8a5..5ade707c 100644 --- a/web/default/src/features/dashboard/hooks/use-status-data.ts +++ b/web/default/src/features/dashboard/hooks/use-status-data.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useStatus } from '@/hooks/use-status' + import type { AnnouncementItem, ApiInfoItem, FAQItem } from '../types' /** diff --git a/web/default/src/features/dashboard/index.tsx b/web/default/src/features/dashboard/index.tsx index 64f68654..748d1052 100644 --- a/web/default/src/features/dashboard/index.tsx +++ b/web/default/src/features/dashboard/index.tsx @@ -16,12 +16,13 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useCallback, useMemo, lazy, Suspense } from 'react' import { getRouteApi, useNavigate } from '@tanstack/react-router' import { Eye, EyeOff } from 'lucide-react' +import { useState, useCallback, useMemo, lazy, Suspense } from 'react' import { useTranslation } from 'react-i18next' -import { useAuthStore } from '@/stores/auth-store' -import { ROLE } from '@/lib/roles' + +import { SectionPageLayout } from '@/components/layout' +import { FadeIn } from '@/components/page-transition' import { Button } from '@/components/ui/button' import { Skeleton } from '@/components/ui/skeleton' import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs' @@ -30,8 +31,9 @@ import { TooltipContent, TooltipTrigger, } from '@/components/ui/tooltip' -import { SectionPageLayout } from '@/components/layout' -import { FadeIn } from '@/components/page-transition' +import { ROLE } from '@/lib/roles' +import { useAuthStore } from '@/stores/auth-store' + import { ModelsChartPreferences } from './components/models/models-chart-preferences' import { ModelsFilter } from './components/models/models-filter-dialog' import { OverviewDashboard } from './components/overview/overview-dashboard' diff --git a/web/default/src/features/dashboard/lib/charts.ts b/web/default/src/features/dashboard/lib/charts.ts index 119c6c66..044476c0 100644 --- a/web/default/src/features/dashboard/lib/charts.ts +++ b/web/default/src/features/dashboard/lib/charts.ts @@ -17,14 +17,15 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { dataScheme as vchartDefaultDataScheme } from '@visactor/vchart/esm/theme/color-scheme/builtin/default' -import { getCurrencyDisplay } from '@/lib/currency' -import { formatChartTime, type TimeGranularity } from '@/lib/time' + import { MAX_CHART_TREND_POINTS } from '@/features/dashboard/constants' import type { QuotaDataItem, ProcessedChartData, ProcessedUserChartData, } from '@/features/dashboard/types' +import { getCurrencyDisplay } from '@/lib/currency' +import { formatChartTime, type TimeGranularity } from '@/lib/time' type TFunction = (key: string) => string type TooltipLineItem = { diff --git a/web/default/src/features/dashboard/lib/filters.ts b/web/default/src/features/dashboard/lib/filters.ts index 82777548..321f608d 100644 --- a/web/default/src/features/dashboard/lib/filters.ts +++ b/web/default/src/features/dashboard/lib/filters.ts @@ -16,7 +16,6 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { getRollingDateRange, type TimeGranularity } from '@/lib/time' import { DASHBOARD_CHART_PREFERENCES_STORAGE_KEY, DEFAULT_DASHBOARD_CHART_PREFERENCES, @@ -32,6 +31,7 @@ import type { DashboardFilters, ModelAnalyticsChartTab, } from '@/features/dashboard/types' +import { getRollingDateRange, type TimeGranularity } from '@/lib/time' function isTimeGranularity(value: unknown): value is TimeGranularity { return value === 'hour' || value === 'day' || value === 'week' diff --git a/web/default/src/features/dashboard/lib/flow-selection.test.ts b/web/default/src/features/dashboard/lib/flow-selection.test.ts index 8b06309b..8de97c10 100644 --- a/web/default/src/features/dashboard/lib/flow-selection.test.ts +++ b/web/default/src/features/dashboard/lib/flow-selection.test.ts @@ -1,5 +1,6 @@ import assert from 'node:assert/strict' import { describe, test } from 'node:test' + import type { FlowUserFilterOption } from '../types' import { compactFlowSelectionLabel, diff --git a/web/default/src/features/dashboard/lib/flow.test.ts b/web/default/src/features/dashboard/lib/flow.test.ts index 02a4016c..705fc906 100644 --- a/web/default/src/features/dashboard/lib/flow.test.ts +++ b/web/default/src/features/dashboard/lib/flow.test.ts @@ -297,8 +297,7 @@ describe('dashboard flow data', () => { assert.equal( result.filterOptions.nodes.some( - (option) => - option.kind === 'model' && option.value === 'model:model-c' + (option) => option.kind === 'model' && option.value === 'model:model-c' ), true ) @@ -779,8 +778,7 @@ describe('dashboard flow data', () => { ) const dimmedLink = values.links.find( (link: Record) => - link.source === 'model:claude-4-sonnet' && - link.target === 'channel:101' + link.source === 'model:claude-4-sonnet' && link.target === 'channel:101' ) const nodeOpacity = flowSpec.node.style.fillOpacity const linkOpacity = flowSpec.link.style.fillOpacity diff --git a/web/default/src/features/dashboard/lib/flow.ts b/web/default/src/features/dashboard/lib/flow.ts index 34770b9f..5d0f5132 100644 --- a/web/default/src/features/dashboard/lib/flow.ts +++ b/web/default/src/features/dashboard/lib/flow.ts @@ -138,7 +138,9 @@ const SENSITIVE_FLOW_KINDS = new Set([ 'channel', ]) -const OTHER_FLOW_NODE_ID_SET = new Set(Object.values(OTHER_FLOW_NODE_IDS)) +const OTHER_FLOW_NODE_ID_SET = new Set( + Object.values(OTHER_FLOW_NODE_IDS) +) function numberValue(value: unknown): number { const n = Number(value) @@ -146,7 +148,9 @@ function numberValue(value: unknown): number { } function isFlowNodeKind(value: unknown): value is FlowNodeKind { - return typeof value === 'string' && FLOW_NODE_KIND_SET.has(value as FlowNodeKind) + return ( + typeof value === 'string' && FLOW_NODE_KIND_SET.has(value as FlowNodeKind) + ) } function rowMetrics(row: FlowQuotaDataItem): FlowMetrics { @@ -399,7 +403,9 @@ function selectedNodeFiltersExceptKind( selectedNodes: readonly FlowNodeFilter[] | undefined, kind: FlowNodeKind ): FlowNodeFilter[] | undefined { - const filtered = (selectedNodes ?? []).filter((filter) => filter.kind !== kind) + const filtered = (selectedNodes ?? []).filter( + (filter) => filter.kind !== kind + ) return filtered.length > 0 ? filtered : undefined } @@ -932,14 +938,13 @@ function buildNodeFilterOptions( } } - return options - .sort( - (a, b) => - (stageOrder.get(a.kind) ?? 0) - (stageOrder.get(b.kind) ?? 0) || - b.valueRaw - a.valueRaw || - a.label.localeCompare(b.label) || - a.value.localeCompare(b.value) - ) + return options.sort( + (a, b) => + (stageOrder.get(a.kind) ?? 0) - (stageOrder.get(b.kind) ?? 0) || + b.valueRaw - a.valueRaw || + a.label.localeCompare(b.label) || + a.value.localeCompare(b.value) + ) } export function buildFlowFilterOptions( @@ -1041,17 +1046,11 @@ function sankeyDatumValue( return sankeyDatumSource(datum)[key] } -function sankeyDatumFlag( - datum: Record, - key: string -): boolean { +function sankeyDatumFlag(datum: Record, key: string): boolean { return sankeyDatumValue(datum, key) === true } -export function flowSankeyDatumValue( - datum: unknown, - key: string -): unknown { +export function flowSankeyDatumValue(datum: unknown, key: string): unknown { const record = recordValue(datum) return record ? sankeyDatumValue(record, key) : undefined } diff --git a/web/default/src/features/dashboard/section-registry.tsx b/web/default/src/features/dashboard/section-registry.tsx index c9901788..16755a3e 100644 --- a/web/default/src/features/dashboard/section-registry.tsx +++ b/web/default/src/features/dashboard/section-registry.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import type { TFunction } from 'i18next' + import { createSectionRegistry } from '@/features/system-settings/utils/section-registry' /** diff --git a/web/default/src/features/errors/forbidden.tsx b/web/default/src/features/errors/forbidden.tsx index ae7dd3bc..d121f240 100644 --- a/web/default/src/features/errors/forbidden.tsx +++ b/web/default/src/features/errors/forbidden.tsx @@ -18,6 +18,7 @@ For commercial licensing, please contact support@quantumnous.com */ import { useNavigate, useRouter } from '@tanstack/react-router' import { useTranslation } from 'react-i18next' + import { Button } from '@/components/ui/button' export function ForbiddenError() { diff --git a/web/default/src/features/errors/general-error.tsx b/web/default/src/features/errors/general-error.tsx index e94893b4..a6414e83 100644 --- a/web/default/src/features/errors/general-error.tsx +++ b/web/default/src/features/errors/general-error.tsx @@ -18,8 +18,9 @@ For commercial licensing, please contact support@quantumnous.com */ import { useNavigate, useRouter } from '@tanstack/react-router' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + import { Button } from '@/components/ui/button' +import { cn } from '@/lib/utils' const FEEDBACK_URL = 'https://github.com/QuantumNous/new-api/issues' diff --git a/web/default/src/features/errors/maintenance-error.tsx b/web/default/src/features/errors/maintenance-error.tsx index d7a932b6..8d6b7ba0 100644 --- a/web/default/src/features/errors/maintenance-error.tsx +++ b/web/default/src/features/errors/maintenance-error.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useTranslation } from 'react-i18next' + import { Button } from '@/components/ui/button' export function MaintenanceError() { diff --git a/web/default/src/features/errors/not-found-error.tsx b/web/default/src/features/errors/not-found-error.tsx index cb3f271f..49605d04 100644 --- a/web/default/src/features/errors/not-found-error.tsx +++ b/web/default/src/features/errors/not-found-error.tsx @@ -18,6 +18,7 @@ For commercial licensing, please contact support@quantumnous.com */ import { useNavigate, useRouter } from '@tanstack/react-router' import { useTranslation } from 'react-i18next' + import { Button } from '@/components/ui/button' export function NotFoundError() { diff --git a/web/default/src/features/errors/unauthorized-error.tsx b/web/default/src/features/errors/unauthorized-error.tsx index d3a833f3..ca6d4711 100644 --- a/web/default/src/features/errors/unauthorized-error.tsx +++ b/web/default/src/features/errors/unauthorized-error.tsx @@ -18,6 +18,7 @@ For commercial licensing, please contact support@quantumnous.com */ import { useNavigate, useRouter } from '@tanstack/react-router' import { useTranslation } from 'react-i18next' + import { Button } from '@/components/ui/button' export function UnauthorisedError() { diff --git a/web/default/src/features/home/api.ts b/web/default/src/features/home/api.ts index 009de4e4..e15928ec 100644 --- a/web/default/src/features/home/api.ts +++ b/web/default/src/features/home/api.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { api } from '@/lib/api' + import type { HomePageContentResponse } from './types' // ============================================================================ diff --git a/web/default/src/features/home/components/gateway-card.tsx b/web/default/src/features/home/components/gateway-card.tsx index cfd35cf0..df4c70c6 100644 --- a/web/default/src/features/home/components/gateway-card.tsx +++ b/web/default/src/features/home/components/gateway-card.tsx @@ -17,7 +17,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useTranslation } from 'react-i18next' + import { Separator } from '@/components/ui/separator' + import { getGatewayFeatures } from '../constants' interface GatewayCardProps { diff --git a/web/default/src/features/home/components/hero-buttons.tsx b/web/default/src/features/home/components/hero-buttons.tsx index 90913db2..7ee90475 100644 --- a/web/default/src/features/home/components/hero-buttons.tsx +++ b/web/default/src/features/home/components/hero-buttons.tsx @@ -19,6 +19,7 @@ For commercial licensing, please contact support@quantumnous.com import { Link } from '@tanstack/react-router' import { ArrowRight } from 'lucide-react' import { useTranslation } from 'react-i18next' + import { Button } from '@/components/ui/button' interface HeroButtonsProps { diff --git a/web/default/src/features/home/components/hero-terminal-demo.tsx b/web/default/src/features/home/components/hero-terminal-demo.tsx index bd57ecbf..2b4651a2 100644 --- a/web/default/src/features/home/components/hero-terminal-demo.tsx +++ b/web/default/src/features/home/components/hero-terminal-demo.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useState, useEffect, useRef, type ReactNode } from 'react' + import { cn } from '@/lib/utils' type AccentTone = 'emerald' | 'amber' | 'blue' | 'violet' diff --git a/web/default/src/features/home/components/scrolling-icons.tsx b/web/default/src/features/home/components/scrolling-icons.tsx index 68a069ca..3a39875b 100644 --- a/web/default/src/features/home/components/scrolling-icons.tsx +++ b/web/default/src/features/home/components/scrolling-icons.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { cn } from '@/lib/utils' + import { IconCard } from './icon-card' interface ScrollingIconsProps { diff --git a/web/default/src/features/home/components/sections/cta.tsx b/web/default/src/features/home/components/sections/cta.tsx index 929069a3..cffb4ca6 100644 --- a/web/default/src/features/home/components/sections/cta.tsx +++ b/web/default/src/features/home/components/sections/cta.tsx @@ -19,8 +19,9 @@ For commercial licensing, please contact support@quantumnous.com import { Link } from '@tanstack/react-router' import { ArrowRight } from 'lucide-react' import { useTranslation } from 'react-i18next' -import { Button } from '@/components/ui/button' + import { AnimateInView } from '@/components/animate-in-view' +import { Button } from '@/components/ui/button' interface CTAProps { className?: string diff --git a/web/default/src/features/home/components/sections/features.tsx b/web/default/src/features/home/components/sections/features.tsx index 005e5614..79ea703a 100644 --- a/web/default/src/features/home/components/sections/features.tsx +++ b/web/default/src/features/home/components/sections/features.tsx @@ -27,6 +27,7 @@ import { HeartHandshake, } from 'lucide-react' import { useTranslation } from 'react-i18next' + import { AnimateInView } from '@/components/animate-in-view' interface FeaturesProps { diff --git a/web/default/src/features/home/components/sections/hero.tsx b/web/default/src/features/home/components/sections/hero.tsx index 58a4ae3f..4a08151a 100644 --- a/web/default/src/features/home/components/sections/hero.tsx +++ b/web/default/src/features/home/components/sections/hero.tsx @@ -16,12 +16,14 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { Link } from '@tanstack/react-router' import { CherryStudio } from '@lobehub/icons' +import { Link } from '@tanstack/react-router' import { ArrowRight, BookOpen } from 'lucide-react' import { useTranslation } from 'react-i18next' -import { useStatus } from '@/hooks/use-status' + import { Button } from '@/components/ui/button' +import { useStatus } from '@/hooks/use-status' + import { HeroTerminalDemo } from '../hero-terminal-demo' interface HeroProps { diff --git a/web/default/src/features/home/components/sections/how-it-works.tsx b/web/default/src/features/home/components/sections/how-it-works.tsx index b4f7fb28..2959fd87 100644 --- a/web/default/src/features/home/components/sections/how-it-works.tsx +++ b/web/default/src/features/home/components/sections/how-it-works.tsx @@ -18,6 +18,7 @@ For commercial licensing, please contact support@quantumnous.com */ import { Settings, Zap, BarChart3 } from 'lucide-react' import { useTranslation } from 'react-i18next' + import { AnimateInView } from '@/components/animate-in-view' export function HowItWorks() { diff --git a/web/default/src/features/home/hooks/use-home-page-content.ts b/web/default/src/features/home/hooks/use-home-page-content.ts index 4ff5a1f5..be6f9e5d 100644 --- a/web/default/src/features/home/hooks/use-home-page-content.ts +++ b/web/default/src/features/home/hooks/use-home-page-content.ts @@ -16,10 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useState } from 'react' import i18next from 'i18next' +import { useEffect, useState } from 'react' import { toast } from 'sonner' + import { isHttpUrl } from '@/lib/content-format' + import { getHomePageContent } from '../api' import type { HomePageContentResult } from '../types' diff --git a/web/default/src/features/keys/api.ts b/web/default/src/features/keys/api.ts index 80727e56..df3cc5ff 100644 --- a/web/default/src/features/keys/api.ts +++ b/web/default/src/features/keys/api.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { api } from '@/lib/api' + import type { ApiKey, ApiResponse, diff --git a/web/default/src/features/keys/components/api-key-group-combobox.tsx b/web/default/src/features/keys/components/api-key-group-combobox.tsx index c0a59cdc..2593eff0 100644 --- a/web/default/src/features/keys/components/api-key-group-combobox.tsx +++ b/web/default/src/features/keys/components/api-key-group-combobox.tsx @@ -16,10 +16,10 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useMemo, useState } from 'react' import { Check, ChevronsUpDown } from 'lucide-react' +import { useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + import { Badge } from '@/components/ui/badge' import { Button } from '@/components/ui/button' import { @@ -35,6 +35,7 @@ import { PopoverContent, PopoverTrigger, } from '@/components/ui/popover' +import { cn } from '@/lib/utils' export type ApiKeyGroupOption = { value: string diff --git a/web/default/src/features/keys/components/api-keys-cells.tsx b/web/default/src/features/keys/components/api-keys-cells.tsx index 4403b958..4195cb5d 100644 --- a/web/default/src/features/keys/components/api-keys-cells.tsx +++ b/web/default/src/features/keys/components/api-keys-cells.tsx @@ -16,11 +16,13 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useCallback } from 'react' import { Check, Copy, Loader2 } from 'lucide-react' +import { useState, useCallback } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { copyToClipboard } from '@/lib/copy-to-clipboard' + +import { BadgeCell } from '@/components/data-table' +import { StatusBadge } from '@/components/status-badge' import { Button } from '@/components/ui/button' import { Popover, @@ -32,8 +34,8 @@ import { TooltipContent, TooltipTrigger, } from '@/components/ui/tooltip' -import { BadgeCell } from '@/components/data-table' -import { StatusBadge } from '@/components/status-badge' +import { copyToClipboard } from '@/lib/copy-to-clipboard' + import { type ApiKey } from '../types' import { useApiKeys } from './api-keys-provider' diff --git a/web/default/src/features/keys/components/api-keys-columns.tsx b/web/default/src/features/keys/components/api-keys-columns.tsx index fc3f12d2..6c553873 100644 --- a/web/default/src/features/keys/components/api-keys-columns.tsx +++ b/web/default/src/features/keys/components/api-keys-columns.tsx @@ -19,9 +19,10 @@ For commercial licensing, please contact support@quantumnous.com import { useQuery } from '@tanstack/react-query' import { type ColumnDef } from '@tanstack/react-table' import { useTranslation } from 'react-i18next' -import { getUserGroups } from '@/lib/api' -import { formatQuota, formatTimestampToDate } from '@/lib/format' -import { cn } from '@/lib/utils' + +import { BadgeCell, TruncatedCell } from '@/components/data-table' +import { GroupBadge } from '@/components/group-badge' +import { StatusBadge } from '@/components/status-badge' import { Checkbox } from '@/components/ui/checkbox' import { Progress } from '@/components/ui/progress' import { @@ -29,9 +30,10 @@ import { TooltipContent, TooltipTrigger, } from '@/components/ui/tooltip' -import { BadgeCell, TruncatedCell } from '@/components/data-table' -import { GroupBadge } from '@/components/group-badge' -import { StatusBadge } from '@/components/status-badge' +import { getUserGroups } from '@/lib/api' +import { formatQuota, formatTimestampToDate } from '@/lib/format' +import { cn } from '@/lib/utils' + import { API_KEY_STATUSES } from '../constants' import { type ApiKey } from '../types' import { diff --git a/web/default/src/features/keys/components/api-keys-delete-dialog.tsx b/web/default/src/features/keys/components/api-keys-delete-dialog.tsx index 133921b8..496ea08c 100644 --- a/web/default/src/features/keys/components/api-keys-delete-dialog.tsx +++ b/web/default/src/features/keys/components/api-keys-delete-dialog.tsx @@ -19,6 +19,7 @@ For commercial licensing, please contact support@quantumnous.com import { useState } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' + import { AlertDialog, AlertDialogAction, @@ -29,6 +30,7 @@ import { AlertDialogHeader, AlertDialogTitle, } from '@/components/ui/alert-dialog' + import { deleteApiKey } from '../api' import { ERROR_MESSAGES, SUCCESS_MESSAGES } from '../constants' import { useApiKeys } from './api-keys-provider' diff --git a/web/default/src/features/keys/components/api-keys-multi-delete-dialog.tsx b/web/default/src/features/keys/components/api-keys-multi-delete-dialog.tsx index 9b114f1f..4f52b094 100644 --- a/web/default/src/features/keys/components/api-keys-multi-delete-dialog.tsx +++ b/web/default/src/features/keys/components/api-keys-multi-delete-dialog.tsx @@ -16,11 +16,13 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState } from 'react' import { type Table } from '@tanstack/react-table' +import { useState } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' + import { ConfirmDialog } from '@/components/confirm-dialog' + import { batchDeleteApiKeys } from '../api' import { ERROR_MESSAGES } from '../constants' import { type ApiKey } from '../types' diff --git a/web/default/src/features/keys/components/api-keys-mutate-drawer.tsx b/web/default/src/features/keys/components/api-keys-mutate-drawer.tsx index 9a9611ba..bcc121d2 100644 --- a/web/default/src/features/keys/components/api-keys-mutate-drawer.tsx +++ b/web/default/src/features/keys/components/api-keys-mutate-drawer.tsx @@ -16,17 +16,25 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useState } from 'react' -import { useForm, type SubmitErrorHandler } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' import { useQuery } from '@tanstack/react-query' import { ChevronDown, KeyRound, Settings2, WalletCards } from 'lucide-react' +import { useEffect, useState } from 'react' +import { useForm, type SubmitErrorHandler } from 'react-hook-form' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { getUserModels, getUserGroups } from '@/lib/api' -import { getCurrencyDisplay, getCurrencyLabel } from '@/lib/currency' -import { cn } from '@/lib/utils' -import { useStatus } from '@/hooks/use-status' + +import { DateTimePicker } from '@/components/datetime-picker' +import { + SideDrawerSection, + SideDrawerSectionHeader, + sideDrawerContentClassName, + sideDrawerFooterClassName, + sideDrawerFormClassName, + sideDrawerHeaderClassName, + sideDrawerSwitchItemClassName, +} from '@/components/drawer-layout' +import { MultiSelect } from '@/components/multi-select' import { Button } from '@/components/ui/button' import { Collapsible, @@ -54,17 +62,11 @@ import { } from '@/components/ui/sheet' import { Switch } from '@/components/ui/switch' import { Textarea } from '@/components/ui/textarea' -import { DateTimePicker } from '@/components/datetime-picker' -import { - SideDrawerSection, - SideDrawerSectionHeader, - sideDrawerContentClassName, - sideDrawerFooterClassName, - sideDrawerFormClassName, - sideDrawerHeaderClassName, - sideDrawerSwitchItemClassName, -} from '@/components/drawer-layout' -import { MultiSelect } from '@/components/multi-select' +import { useStatus } from '@/hooks/use-status' +import { getUserModels, getUserGroups } from '@/lib/api' +import { getCurrencyDisplay, getCurrencyLabel } from '@/lib/currency' +import { cn } from '@/lib/utils' + import { createApiKey, updateApiKey, getApiKey } from '../api' import { ERROR_MESSAGES, SUCCESS_MESSAGES } from '../constants' import { diff --git a/web/default/src/features/keys/components/api-keys-primary-buttons.tsx b/web/default/src/features/keys/components/api-keys-primary-buttons.tsx index 25cd2ab3..da68dc28 100644 --- a/web/default/src/features/keys/components/api-keys-primary-buttons.tsx +++ b/web/default/src/features/keys/components/api-keys-primary-buttons.tsx @@ -18,7 +18,9 @@ For commercial licensing, please contact support@quantumnous.com */ import { Plus } from 'lucide-react' import { useTranslation } from 'react-i18next' + import { Button } from '@/components/ui/button' + import { useApiKeys } from './api-keys-provider' export function ApiKeysPrimaryButtons() { diff --git a/web/default/src/features/keys/components/api-keys-provider.tsx b/web/default/src/features/keys/components/api-keys-provider.tsx index 8d4129a1..6b1c0caa 100644 --- a/web/default/src/features/keys/components/api-keys-provider.tsx +++ b/web/default/src/features/keys/components/api-keys-provider.tsx @@ -19,7 +19,9 @@ For commercial licensing, please contact support@quantumnous.com import React, { useState, useCallback, useRef, useEffect } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' + import useDialogState from '@/hooks/use-dialog' + import { fetchTokenKey, fetchTokenKeysBatch } from '../api' import { ERROR_MESSAGES } from '../constants' import { type ApiKey, type ApiKeysDialogType } from '../types' diff --git a/web/default/src/features/keys/components/api-keys-table.tsx b/web/default/src/features/keys/components/api-keys-table.tsx index 3378d084..a7847fa6 100644 --- a/web/default/src/features/keys/components/api-keys-table.tsx +++ b/web/default/src/features/keys/components/api-keys-table.tsx @@ -22,9 +22,15 @@ import { type Table as TanstackTable } from '@tanstack/react-table' import { Database } from 'lucide-react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { formatQuota } from '@/lib/format' -import { cn } from '@/lib/utils' -import { useTableUrlState } from '@/hooks/use-table-url-state' + +import { + DISABLED_ROW_DESKTOP, + DISABLED_ROW_MOBILE, + DataTablePage, + useDebouncedColumnFilter, + useDataTable, +} from '@/components/data-table' +import { StatusBadge } from '@/components/status-badge' import { Empty, EmptyDescription, @@ -34,14 +40,10 @@ import { } from '@/components/ui/empty' import { Input } from '@/components/ui/input' import { Skeleton } from '@/components/ui/skeleton' -import { - DISABLED_ROW_DESKTOP, - DISABLED_ROW_MOBILE, - DataTablePage, - useDebouncedColumnFilter, - useDataTable, -} from '@/components/data-table' -import { StatusBadge } from '@/components/status-badge' +import { useTableUrlState } from '@/hooks/use-table-url-state' +import { formatQuota } from '@/lib/format' +import { cn } from '@/lib/utils' + import { getApiKeys, searchApiKeys } from '../api' import { API_KEY_STATUS, @@ -57,8 +59,7 @@ import { DataTableBulkActions } from './data-table-bulk-actions' import { DataTableRowActions } from './data-table-row-actions' const route = getRouteApi('/_authenticated/keys/') -const API_KEYS_COLUMN_VISIBILITY_STORAGE_KEY = - 'api-keys:column-visibility' +const API_KEYS_COLUMN_VISIBILITY_STORAGE_KEY = 'api-keys:column-visibility' function isDisabledApiKeyRow(apiKey: ApiKey) { return apiKey.status !== API_KEY_STATUS.ENABLED diff --git a/web/default/src/features/keys/components/data-table-bulk-actions.tsx b/web/default/src/features/keys/components/data-table-bulk-actions.tsx index 79d7a736..6cb71d26 100644 --- a/web/default/src/features/keys/components/data-table-bulk-actions.tsx +++ b/web/default/src/features/keys/components/data-table-bulk-actions.tsx @@ -16,19 +16,21 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useCallback } from 'react' import { type Table } from '@tanstack/react-table' import { Copy, Trash2, Loader2 } from 'lucide-react' +import { useState, useCallback } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { copyToClipboard } from '@/lib/copy-to-clipboard' + +import { DataTableBulkActions as BulkActionsToolbar } from '@/components/data-table' import { Button } from '@/components/ui/button' import { Tooltip, TooltipContent, TooltipTrigger, } from '@/components/ui/tooltip' -import { DataTableBulkActions as BulkActionsToolbar } from '@/components/data-table' +import { copyToClipboard } from '@/lib/copy-to-clipboard' + import { type ApiKey } from '../types' import { ApiKeysMultiDeleteDialog } from './api-keys-multi-delete-dialog' import { useApiKeys } from './api-keys-provider' diff --git a/web/default/src/features/keys/components/data-table-row-actions.tsx b/web/default/src/features/keys/components/data-table-row-actions.tsx index 18c8cd8b..265d3b8e 100644 --- a/web/default/src/features/keys/components/data-table-row-actions.tsx +++ b/web/default/src/features/keys/components/data-table-row-actions.tsx @@ -16,7 +16,6 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useCallback, useState } from 'react' import type { Row } from '@tanstack/react-table' import { Trash2, @@ -29,6 +28,7 @@ import { Link, Loader2, } from 'lucide-react' +import { useCallback, useState } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' diff --git a/web/default/src/features/keys/components/dialogs/cc-switch-dialog.tsx b/web/default/src/features/keys/components/dialogs/cc-switch-dialog.tsx index 52866112..238fba6d 100644 --- a/web/default/src/features/keys/components/dialogs/cc-switch-dialog.tsx +++ b/web/default/src/features/keys/components/dialogs/cc-switch-dialog.tsx @@ -16,16 +16,17 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useEffect, useMemo } from 'react' import { useQuery } from '@tanstack/react-query' +import { useState, useEffect, useMemo } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { getUserModels } from '@/lib/api' + +import { Dialog } from '@/components/dialog' import { Button } from '@/components/ui/button' import { ComboboxInput } from '@/components/ui/combobox-input' import { Label } from '@/components/ui/label' import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group' -import { Dialog } from '@/components/dialog' +import { getUserModels } from '@/lib/api' const APP_CONFIGS = { claude: { diff --git a/web/default/src/features/keys/index.tsx b/web/default/src/features/keys/index.tsx index 4c4c4cf3..4e2ddbe1 100644 --- a/web/default/src/features/keys/index.tsx +++ b/web/default/src/features/keys/index.tsx @@ -17,7 +17,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useTranslation } from 'react-i18next' + import { SectionPageLayout } from '@/components/layout' + import { ApiKeysDialogs } from './components/api-keys-dialogs' import { ApiKeysPrimaryButtons } from './components/api-keys-primary-buttons' import { ApiKeysProvider } from './components/api-keys-provider' diff --git a/web/default/src/features/keys/lib/api-key-form.ts b/web/default/src/features/keys/lib/api-key-form.ts index a2635db2..827ce326 100644 --- a/web/default/src/features/keys/lib/api-key-form.ts +++ b/web/default/src/features/keys/lib/api-key-form.ts @@ -16,9 +16,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { z } from 'zod' import type { TFunction } from 'i18next' +import { z } from 'zod' + import { parseQuotaFromDollars, quotaUnitsToDollars } from '@/lib/format' + import { DEFAULT_GROUP } from '../constants' import { type ApiKeyFormData, type ApiKey } from '../types' diff --git a/web/default/src/features/legal/api.ts b/web/default/src/features/legal/api.ts index 3a173e0a..0ffbe12e 100644 --- a/web/default/src/features/legal/api.ts +++ b/web/default/src/features/legal/api.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { api } from '@/lib/api' + import type { LegalDocumentResponse } from './types' export async function getUserAgreement() { diff --git a/web/default/src/features/legal/privacy-policy.tsx b/web/default/src/features/legal/privacy-policy.tsx index 2e0bc12b..17a6af57 100644 --- a/web/default/src/features/legal/privacy-policy.tsx +++ b/web/default/src/features/legal/privacy-policy.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useTranslation } from 'react-i18next' + import { getPrivacyPolicy } from './api' import { LegalDocument } from './legal-document' diff --git a/web/default/src/features/legal/user-agreement.tsx b/web/default/src/features/legal/user-agreement.tsx index 07379146..6e7d8d08 100644 --- a/web/default/src/features/legal/user-agreement.tsx +++ b/web/default/src/features/legal/user-agreement.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useTranslation } from 'react-i18next' + import { getUserAgreement } from './api' import { LegalDocument } from './legal-document' diff --git a/web/default/src/features/models/api.ts b/web/default/src/features/models/api.ts index 00eac290..13586f16 100644 --- a/web/default/src/features/models/api.ts +++ b/web/default/src/features/models/api.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { api } from '@/lib/api' + import type { GetModelsParams, GetModelsResponse, diff --git a/web/default/src/features/models/components/data-table-bulk-actions.tsx b/web/default/src/features/models/components/data-table-bulk-actions.tsx index 6ba6e079..9106a146 100644 --- a/web/default/src/features/models/components/data-table-bulk-actions.tsx +++ b/web/default/src/features/models/components/data-table-bulk-actions.tsx @@ -16,21 +16,23 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState } from 'react' import { useQueryClient } from '@tanstack/react-query' import { type Table } from '@tanstack/react-table' import { Power, PowerOff, Trash2, Copy } from 'lucide-react' +import { useState } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { copyToClipboard } from '@/lib/copy-to-clipboard' + +import { DataTableBulkActions as BulkActionsToolbar } from '@/components/data-table' +import { Dialog } from '@/components/dialog' import { Button } from '@/components/ui/button' import { Tooltip, TooltipContent, TooltipTrigger, } from '@/components/ui/tooltip' -import { DataTableBulkActions as BulkActionsToolbar } from '@/components/data-table' -import { Dialog } from '@/components/dialog' +import { copyToClipboard } from '@/lib/copy-to-clipboard' + import { handleBatchEnableModels, handleBatchDisableModels, diff --git a/web/default/src/features/models/components/data-table-row-actions.tsx b/web/default/src/features/models/components/data-table-row-actions.tsx index 36377aa5..6e4ba49c 100644 --- a/web/default/src/features/models/components/data-table-row-actions.tsx +++ b/web/default/src/features/models/components/data-table-row-actions.tsx @@ -16,23 +16,25 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState } from 'react' import { useQueryClient } from '@tanstack/react-query' import type { Row } from '@tanstack/react-table' import { Pencil, Power, PowerOff, Trash2 } from 'lucide-react' +import { useState } from 'react' import { useTranslation } from 'react-i18next' + +import { ConfirmDialog } from '@/components/confirm-dialog' +import { DataTableRowActionMenu } from '@/components/data-table/core/row-action-menu' import { Button } from '@/components/ui/button' import { DropdownMenuItem, DropdownMenuShortcut, } from '@/components/ui/dropdown-menu' -import { DataTableRowActionMenu } from '@/components/data-table/core/row-action-menu' import { Tooltip, TooltipContent, TooltipTrigger, } from '@/components/ui/tooltip' -import { ConfirmDialog } from '@/components/confirm-dialog' + import { handleDeleteModel, handleToggleModelStatus, diff --git a/web/default/src/features/models/components/deployment-access-guard.tsx b/web/default/src/features/models/components/deployment-access-guard.tsx index 8333be9c..5f9f1298 100644 --- a/web/default/src/features/models/components/deployment-access-guard.tsx +++ b/web/default/src/features/models/components/deployment-access-guard.tsx @@ -16,7 +16,6 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import type { ReactNode } from 'react' import { useNavigate } from '@tanstack/react-router' import { AlertCircle, @@ -27,10 +26,12 @@ import { Settings, WifiOff, } from 'lucide-react' +import type { ReactNode } from 'react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert' import { Button } from '@/components/ui/button' +import { cn } from '@/lib/utils' type LoadingPhase = 'idle' | 'settings' | 'connection' | 'done' type StepStatus = 'pending' | 'loading' | 'done' diff --git a/web/default/src/features/models/components/deployments-table.tsx b/web/default/src/features/models/components/deployments-table.tsx index 6aa199b1..616ea6be 100644 --- a/web/default/src/features/models/components/deployments-table.tsx +++ b/web/default/src/features/models/components/deployments-table.tsx @@ -16,13 +16,13 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useMemo, useState } from 'react' import { useQuery, useQueryClient } from '@tanstack/react-query' import { getRouteApi } from '@tanstack/react-router' -import { useMediaQuery } from '@/hooks' +import { useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { useTableUrlState } from '@/hooks/use-table-url-state' + +import { DataTablePage, useDataTable } from '@/components/data-table' import { AlertDialog, AlertDialogAction, @@ -33,7 +33,9 @@ import { AlertDialogHeader, AlertDialogTitle, } from '@/components/ui/alert-dialog' -import { DataTablePage, useDataTable } from '@/components/data-table' +import { useMediaQuery } from '@/hooks' +import { useTableUrlState } from '@/hooks/use-table-url-state' + import { deleteDeployment, listDeployments, searchDeployments } from '../api' import { getDeploymentStatusOptions } from '../constants' import { deploymentsQueryKeys } from '../lib' diff --git a/web/default/src/features/models/components/description-cell.tsx b/web/default/src/features/models/components/description-cell.tsx index b6a6a17b..f8f7522c 100644 --- a/web/default/src/features/models/components/description-cell.tsx +++ b/web/default/src/features/models/components/description-cell.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { Button } from '@/components/ui/button' + import { useModels } from './models-provider' type DescriptionCellProps = { diff --git a/web/default/src/features/models/components/dialogs/create-deployment-drawer.tsx b/web/default/src/features/models/components/dialogs/create-deployment-drawer.tsx index 531ea6bf..19ba7a09 100644 --- a/web/default/src/features/models/components/dialogs/create-deployment-drawer.tsx +++ b/web/default/src/features/models/components/dialogs/create-deployment-drawer.tsx @@ -16,13 +16,22 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useMemo } from 'react' -import { z } from 'zod' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query' +import { useEffect, useMemo } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' +import { z } from 'zod' + +import { + SideDrawerSection, + sideDrawerContentClassName, + sideDrawerFooterClassName, + sideDrawerFormClassName, + sideDrawerHeaderClassName, +} from '@/components/drawer-layout' +import { MultiSelect } from '@/components/multi-select' import { Button } from '@/components/ui/button' import { Form, @@ -51,14 +60,7 @@ import { SheetTitle, } from '@/components/ui/sheet' import { Textarea } from '@/components/ui/textarea' -import { - SideDrawerSection, - sideDrawerContentClassName, - sideDrawerFooterClassName, - sideDrawerFormClassName, - sideDrawerHeaderClassName, -} from '@/components/drawer-layout' -import { MultiSelect } from '@/components/multi-select' + import { checkClusterNameAvailability, createDeployment, diff --git a/web/default/src/features/models/components/dialogs/description-dialog.tsx b/web/default/src/features/models/components/dialogs/description-dialog.tsx index 64ad1a4d..e30f9ad8 100644 --- a/web/default/src/features/models/components/dialogs/description-dialog.tsx +++ b/web/default/src/features/models/components/dialogs/description-dialog.tsx @@ -17,8 +17,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useTranslation } from 'react-i18next' -import { ScrollArea } from '@/components/ui/scroll-area' + import { Dialog } from '@/components/dialog' +import { ScrollArea } from '@/components/ui/scroll-area' type DescriptionDialogProps = { open: boolean diff --git a/web/default/src/features/models/components/dialogs/extend-deployment-dialog.tsx b/web/default/src/features/models/components/dialogs/extend-deployment-dialog.tsx index b6243b40..b4cf3cd2 100644 --- a/web/default/src/features/models/components/dialogs/extend-deployment-dialog.tsx +++ b/web/default/src/features/models/components/dialogs/extend-deployment-dialog.tsx @@ -16,15 +16,17 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useMemo, useState } from 'react' import { useQuery, useQueryClient } from '@tanstack/react-query' import { Loader2 } from 'lucide-react' +import { useEffect, useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' + +import { Dialog } from '@/components/dialog' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Separator } from '@/components/ui/separator' -import { Dialog } from '@/components/dialog' + import { estimatePrice, extendDeployment, getDeployment } from '../../api' import { deploymentsQueryKeys } from '../../lib' diff --git a/web/default/src/features/models/components/dialogs/missing-models-dialog.tsx b/web/default/src/features/models/components/dialogs/missing-models-dialog.tsx index 033accc2..bce9dc7d 100644 --- a/web/default/src/features/models/components/dialogs/missing-models-dialog.tsx +++ b/web/default/src/features/models/components/dialogs/missing-models-dialog.tsx @@ -16,11 +16,13 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useMemo, useState } from 'react' import { useQuery } from '@tanstack/react-query' import { ChevronLeft, ChevronRight, Loader2, Plus, Search } from 'lucide-react' +import { useEffect, useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' -import { useIsMobile } from '@/hooks/use-mobile' + +import { Dialog } from '@/components/dialog' +import { StatusBadge } from '@/components/status-badge' import { Button } from '@/components/ui/button' import { Empty, @@ -30,8 +32,8 @@ import { EmptyTitle, } from '@/components/ui/empty' import { Input } from '@/components/ui/input' -import { Dialog } from '@/components/dialog' -import { StatusBadge } from '@/components/status-badge' +import { useIsMobile } from '@/hooks/use-mobile' + import { getMissingModels } from '../../api' import { DEFAULT_PAGE_SIZE } from '../../constants' import { modelsQueryKeys } from '../../lib' diff --git a/web/default/src/features/models/components/dialogs/prefill-group-management-dialog.tsx b/web/default/src/features/models/components/dialogs/prefill-group-management-dialog.tsx index 335f0416..01ddbc98 100644 --- a/web/default/src/features/models/components/dialogs/prefill-group-management-dialog.tsx +++ b/web/default/src/features/models/components/dialogs/prefill-group-management-dialog.tsx @@ -16,7 +16,6 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useMemo, useState, type ReactNode } from 'react' import { useQuery, useQueryClient } from '@tanstack/react-query' import { Layers3, @@ -26,6 +25,7 @@ import { RefreshCcw, Trash2, } from 'lucide-react' +import { useEffect, useMemo, useState, type ReactNode } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' @@ -143,9 +143,7 @@ export function PrefillGroupManagementDialog({ try { const response = await deletePrefillGroup(deleteState.group.id) if (response.success) { - toast.success( - t('Deleted "{{name}}"', { name: deleteState.group.name }) - ) + toast.success(t('Deleted "{{name}}"', { name: deleteState.group.name })) queryClient.invalidateQueries({ queryKey: prefillGroupsQueryKeys.lists(), }) diff --git a/web/default/src/features/models/components/dialogs/prefill-group-management.tsx b/web/default/src/features/models/components/dialogs/prefill-group-management.tsx index c6c22bb7..00f20c95 100644 --- a/web/default/src/features/models/components/dialogs/prefill-group-management.tsx +++ b/web/default/src/features/models/components/dialogs/prefill-group-management.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useEffect, useState } from 'react' + import type { PrefillGroup } from '../../types' import { PrefillGroupFormDrawer } from '../drawers/prefill-group-form-drawer' import { PrefillGroupManagementDialog } from './prefill-group-management-dialog' diff --git a/web/default/src/features/models/components/dialogs/rename-deployment-dialog.tsx b/web/default/src/features/models/components/dialogs/rename-deployment-dialog.tsx index a468677c..46af524f 100644 --- a/web/default/src/features/models/components/dialogs/rename-deployment-dialog.tsx +++ b/web/default/src/features/models/components/dialogs/rename-deployment-dialog.tsx @@ -16,14 +16,16 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useMemo, useState } from 'react' import { useQuery, useQueryClient } from '@tanstack/react-query' import { Loader2 } from 'lucide-react' +import { useEffect, useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' + +import { Dialog } from '@/components/dialog' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' -import { Dialog } from '@/components/dialog' + import { checkClusterNameAvailability, updateDeploymentName } from '../../api' import { deploymentsQueryKeys } from '../../lib' diff --git a/web/default/src/features/models/components/dialogs/sync-wizard-dialog.tsx b/web/default/src/features/models/components/dialogs/sync-wizard-dialog.tsx index af1e9848..4a438203 100644 --- a/web/default/src/features/models/components/dialogs/sync-wizard-dialog.tsx +++ b/web/default/src/features/models/components/dialogs/sync-wizard-dialog.tsx @@ -16,18 +16,20 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useState } from 'react' import { useQueryClient } from '@tanstack/react-query' import { Loader2, RefreshCw } from 'lucide-react' +import { useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { cn } from '@/lib/utils' -import { useIsMobile } from '@/hooks/use-mobile' + +import { Dialog } from '@/components/dialog' +import { StatusBadge } from '@/components/status-badge' import { Button } from '@/components/ui/button' import { Label } from '@/components/ui/label' import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group' -import { Dialog } from '@/components/dialog' -import { StatusBadge } from '@/components/status-badge' +import { useIsMobile } from '@/hooks/use-mobile' +import { cn } from '@/lib/utils' + import { syncUpstream, previewUpstreamDiff } from '../../api' import { getSyncLocaleOptions, getSyncSourceOptions } from '../../constants' import { modelsQueryKeys, vendorsQueryKeys } from '../../lib' diff --git a/web/default/src/features/models/components/dialogs/update-config-dialog.tsx b/web/default/src/features/models/components/dialogs/update-config-dialog.tsx index 601ea6cd..d3174255 100644 --- a/web/default/src/features/models/components/dialogs/update-config-dialog.tsx +++ b/web/default/src/features/models/components/dialogs/update-config-dialog.tsx @@ -16,14 +16,16 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useMemo } from 'react' -import { z } from 'zod' -import { useForm, type Resolver } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' import { useQuery, useQueryClient } from '@tanstack/react-query' import { Loader2 } from 'lucide-react' +import { useEffect, useMemo } from 'react' +import { useForm, type Resolver } from 'react-hook-form' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' +import { z } from 'zod' + +import { Dialog } from '@/components/dialog' import { Button } from '@/components/ui/button' import { Collapsible, @@ -40,7 +42,7 @@ import { } from '@/components/ui/form' import { Input } from '@/components/ui/input' import { Textarea } from '@/components/ui/textarea' -import { Dialog } from '@/components/dialog' + import { getDeployment, updateDeployment } from '../../api' import { deploymentsQueryKeys } from '../../lib' diff --git a/web/default/src/features/models/components/dialogs/upstream-conflict-dialog.tsx b/web/default/src/features/models/components/dialogs/upstream-conflict-dialog.tsx index beb9d92e..e43108ea 100644 --- a/web/default/src/features/models/components/dialogs/upstream-conflict-dialog.tsx +++ b/web/default/src/features/models/components/dialogs/upstream-conflict-dialog.tsx @@ -16,7 +16,6 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useMemo, useState, useCallback } from 'react' import { useQueryClient } from '@tanstack/react-query' import { type ColumnDef, type RowSelectionState } from '@tanstack/react-table' import { @@ -26,9 +25,13 @@ import { ChevronLeft, ChevronRight, } from 'lucide-react' +import { useEffect, useMemo, useState, useCallback } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { useIsMobile } from '@/hooks/use-mobile' + +import { DataTableView, useDataTable } from '@/components/data-table' +import { Dialog } from '@/components/dialog' +import { StatusBadge } from '@/components/status-badge' import { Button } from '@/components/ui/button' import { Checkbox } from '@/components/ui/checkbox' import { Input } from '@/components/ui/input' @@ -45,9 +48,8 @@ import { SelectTrigger, SelectValue, } from '@/components/ui/select' -import { DataTableView, useDataTable } from '@/components/data-table' -import { Dialog } from '@/components/dialog' -import { StatusBadge } from '@/components/status-badge' +import { useIsMobile } from '@/hooks/use-mobile' + import { applyUpstreamOverwrite } from '../../api' import { modelsQueryKeys, vendorsQueryKeys } from '../../lib' import type { SyncOverwritePayload } from '../../types' diff --git a/web/default/src/features/models/components/dialogs/vendor-mutate-dialog.tsx b/web/default/src/features/models/components/dialogs/vendor-mutate-dialog.tsx index dc8470a5..751d8d91 100644 --- a/web/default/src/features/models/components/dialogs/vendor-mutate-dialog.tsx +++ b/web/default/src/features/models/components/dialogs/vendor-mutate-dialog.tsx @@ -16,13 +16,15 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useState } from 'react' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' import { useQueryClient } from '@tanstack/react-query' import { Loader2 } from 'lucide-react' +import { useEffect, useState } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' + +import { Dialog } from '@/components/dialog' import { Button } from '@/components/ui/button' import { Form, @@ -35,7 +37,7 @@ import { } from '@/components/ui/form' import { Input } from '@/components/ui/input' import { Textarea } from '@/components/ui/textarea' -import { Dialog } from '@/components/dialog' + import { createVendor, updateVendor } from '../../api' import { vendorsQueryKeys, modelsQueryKeys } from '../../lib' import { vendorFormSchema, type Vendor } from '../../types' diff --git a/web/default/src/features/models/components/drawers/model-mutate-drawer.tsx b/web/default/src/features/models/components/drawers/model-mutate-drawer.tsx index 01e22e71..db8330ef 100644 --- a/web/default/src/features/models/components/drawers/model-mutate-drawer.tsx +++ b/web/default/src/features/models/components/drawers/model-mutate-drawer.tsx @@ -16,14 +16,25 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useState, useCallback, useMemo } from 'react' -import * as z from 'zod' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' import { useQuery, useQueryClient } from '@tanstack/react-query' import { ChevronDown, Loader2 } from 'lucide-react' +import { useEffect, useState, useCallback, useMemo } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' +import * as z from 'zod' + +import { + SideDrawerSection, + sideDrawerContentClassName, + sideDrawerFooterClassName, + sideDrawerFormClassName, + sideDrawerHeaderClassName, + sideDrawerSwitchItemClassName, +} from '@/components/drawer-layout' +import { JsonEditor } from '@/components/json-editor' +import { TagInput } from '@/components/tag-input' import { Button } from '@/components/ui/button' import { Collapsible, @@ -61,16 +72,6 @@ import { } from '@/components/ui/sheet' import { Switch } from '@/components/ui/switch' import { Textarea } from '@/components/ui/textarea' -import { - SideDrawerSection, - sideDrawerContentClassName, - sideDrawerFooterClassName, - sideDrawerFormClassName, - sideDrawerHeaderClassName, - sideDrawerSwitchItemClassName, -} from '@/components/drawer-layout' -import { JsonEditor } from '@/components/json-editor' -import { TagInput } from '@/components/tag-input' import { useSystemOptions, getOptionValue, @@ -79,6 +80,7 @@ import { useUpdateOption } from '@/features/system-settings/hooks/use-update-opt import { normalizeJsonString } from '@/features/system-settings/models/utils' import type { ModelSettings } from '@/features/system-settings/types' import { safeJsonParse } from '@/features/system-settings/utils/json-parser' + import { createModel, updateModel, getModel, getVendors } from '../../api' import { getNameRuleOptions, ENDPOINT_TEMPLATES } from '../../constants' import { modelsQueryKeys, vendorsQueryKeys, parseModelTags } from '../../lib' @@ -269,7 +271,8 @@ export function ModelMutateDrawer({ !Number.isNaN(Number.parseFloat(promptPrice)) && Number.parseFloat(promptPrice) > 0 ) { - const completionRatio = Number.parseFloat(value) / Number.parseFloat(promptPrice) + const completionRatio = + Number.parseFloat(value) / Number.parseFloat(promptPrice) form.setValue('completionRatio', completionRatio.toString()) } else { form.setValue('completionRatio', '') @@ -520,7 +523,9 @@ export function ModelMutateDrawer({ ratioMap[finalModelName] = Number.parseFloat(values.ratio) } if (values.cacheRatio && values.cacheRatio !== '') { - cacheMap[finalModelName] = Number.parseFloat(values.cacheRatio) + cacheMap[finalModelName] = Number.parseFloat( + values.cacheRatio + ) } if (values.completionRatio && values.completionRatio !== '') { completionMap[finalModelName] = Number.parseFloat( @@ -528,10 +533,14 @@ export function ModelMutateDrawer({ ) } if (values.imageRatio && values.imageRatio !== '') { - imageMap[finalModelName] = Number.parseFloat(values.imageRatio) + imageMap[finalModelName] = Number.parseFloat( + values.imageRatio + ) } if (values.audioRatio && values.audioRatio !== '') { - audioMap[finalModelName] = Number.parseFloat(values.audioRatio) + audioMap[finalModelName] = Number.parseFloat( + values.audioRatio + ) } if ( values.audioCompletionRatio && @@ -747,9 +756,9 @@ export function ModelMutateDrawer({ {t('Vendor')} - handlePromptPriceChange(e.target.value) - } - /> -

- {promptPrice && !Number.isNaN(Number.parseFloat(promptPrice)) - ? `Calculated ratio: ${(Number.parseFloat(promptPrice) / 2).toFixed(4)}` - : t('Enter Input price to calculate ratio')} -

-
+
+ + + handlePromptPriceChange(e.target.value) + } + /> +

+ {promptPrice && + !Number.isNaN(Number.parseFloat(promptPrice)) + ? `Calculated ratio: ${(Number.parseFloat(promptPrice) / 2).toFixed(4)}` + : t('Enter Input price to calculate ratio')} +

+
-
- - - handleCompletionPriceChange(e.target.value) - } - /> -

- {completionPrice && - !Number.isNaN(Number.parseFloat(completionPrice)) && - promptPrice && - !Number.isNaN(Number.parseFloat(promptPrice)) && - Number.parseFloat(promptPrice) > 0 - ? `Calculated ratio: ${(Number.parseFloat(completionPrice) / Number.parseFloat(promptPrice)).toFixed(4)}` - : t('Enter Completion price to calculate ratio')} -

-
+
+ + + handleCompletionPriceChange(e.target.value) + } + /> +

+ {completionPrice && + !Number.isNaN(Number.parseFloat(completionPrice)) && + promptPrice && + !Number.isNaN(Number.parseFloat(promptPrice)) && + Number.parseFloat(promptPrice) > 0 + ? `Calculated ratio: ${(Number.parseFloat(completionPrice) / Number.parseFloat(promptPrice)).toFixed(4)}` + : t('Enter Completion price to calculate ratio')} +

+
)} diff --git a/web/default/src/features/models/components/drawers/prefill-group-form-drawer.tsx b/web/default/src/features/models/components/drawers/prefill-group-form-drawer.tsx index 4ac25447..04d6ee60 100644 --- a/web/default/src/features/models/components/drawers/prefill-group-form-drawer.tsx +++ b/web/default/src/features/models/components/drawers/prefill-group-form-drawer.tsx @@ -16,13 +16,24 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useState } from 'react' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' import { useQueryClient } from '@tanstack/react-query' import { Loader2 } from 'lucide-react' +import { useEffect, useState } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' + +import { + SideDrawerSection, + sideDrawerContentClassName, + sideDrawerFooterClassName, + sideDrawerFormClassName, + sideDrawerHeaderClassName, +} from '@/components/drawer-layout' +import { JsonEditor } from '@/components/json-editor' +import { StatusBadge } from '@/components/status-badge' +import { TagInput } from '@/components/tag-input' import { Button } from '@/components/ui/button' import { Form, @@ -52,16 +63,7 @@ import { SheetTitle, } from '@/components/ui/sheet' import { Textarea } from '@/components/ui/textarea' -import { - SideDrawerSection, - sideDrawerContentClassName, - sideDrawerFooterClassName, - sideDrawerFormClassName, - sideDrawerHeaderClassName, -} from '@/components/drawer-layout' -import { JsonEditor } from '@/components/json-editor' -import { StatusBadge } from '@/components/status-badge' -import { TagInput } from '@/components/tag-input' + import { createPrefillGroup, updatePrefillGroup } from '../../api' import { ENDPOINT_TEMPLATES } from '../../constants' import { prefillGroupsQueryKeys } from '../../lib' diff --git a/web/default/src/features/models/components/models-columns.tsx b/web/default/src/features/models/components/models-columns.tsx index f7bb3c49..61afe555 100644 --- a/web/default/src/features/models/components/models-columns.tsx +++ b/web/default/src/features/models/components/models-columns.tsx @@ -18,8 +18,12 @@ For commercial licensing, please contact support@quantumnous.com */ import { type ColumnDef } from '@tanstack/react-table' import { useTranslation } from 'react-i18next' -import { formatTimestampToDate } from '@/lib/format' -import { getLobeIcon } from '@/lib/lobe-icon' + +import { BadgeCell, BadgeListCell } from '@/components/data-table' +import { GroupBadge } from '@/components/group-badge' +import { ProviderBadge } from '@/components/provider-badge' +import { StatusBadge } from '@/components/status-badge' +import { TableId } from '@/components/table-id' import { Checkbox } from '@/components/ui/checkbox' import { Tooltip, @@ -27,11 +31,9 @@ import { TooltipProvider, TooltipTrigger, } from '@/components/ui/tooltip' -import { BadgeCell, BadgeListCell } from '@/components/data-table' -import { GroupBadge } from '@/components/group-badge' -import { ProviderBadge } from '@/components/provider-badge' -import { StatusBadge } from '@/components/status-badge' -import { TableId } from '@/components/table-id' +import { formatTimestampToDate } from '@/lib/format' +import { getLobeIcon } from '@/lib/lobe-icon' + import { getModelStatusConfig, getNameRuleConfig, diff --git a/web/default/src/features/models/components/models-primary-buttons.tsx b/web/default/src/features/models/components/models-primary-buttons.tsx index 6a7cfc64..ec6745ce 100644 --- a/web/default/src/features/models/components/models-primary-buttons.tsx +++ b/web/default/src/features/models/components/models-primary-buttons.tsx @@ -25,6 +25,7 @@ import { AlertCircle, } from 'lucide-react' import { useTranslation } from 'react-i18next' + import { Button } from '@/components/ui/button' import { DropdownMenu, @@ -34,6 +35,7 @@ import { DropdownMenuShortcut, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu' + import { useModels } from './models-provider' export function ModelsPrimaryButtons() { diff --git a/web/default/src/features/models/components/models-provider.tsx b/web/default/src/features/models/components/models-provider.tsx index 7793057c..e021d703 100644 --- a/web/default/src/features/models/components/models-provider.tsx +++ b/web/default/src/features/models/components/models-provider.tsx @@ -18,6 +18,7 @@ For commercial licensing, please contact support@quantumnous.com */ /* eslint-disable react-refresh/only-export-components */ import React, { createContext, useContext, useState } from 'react' + import type { Model, ModelTabCategory, diff --git a/web/default/src/features/models/components/models-table.tsx b/web/default/src/features/models/components/models-table.tsx index 14a3233b..ceff4039 100644 --- a/web/default/src/features/models/components/models-table.tsx +++ b/web/default/src/features/models/components/models-table.tsx @@ -16,13 +16,15 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useMemo } from 'react' import { useQuery } from '@tanstack/react-query' import { getRouteApi } from '@tanstack/react-router' -import { useMediaQuery } from '@/hooks' +import { useMemo } from 'react' import { useTranslation } from 'react-i18next' -import { useTableUrlState } from '@/hooks/use-table-url-state' + import { DataTablePage, useDataTable } from '@/components/data-table' +import { useMediaQuery } from '@/hooks' +import { useTableUrlState } from '@/hooks/use-table-url-state' + import { getModels, searchModels, getVendors } from '../api' import { DEFAULT_PAGE_SIZE, diff --git a/web/default/src/features/models/components/prefill-group-shared.ts b/web/default/src/features/models/components/prefill-group-shared.ts index 9758104c..5644cf76 100644 --- a/web/default/src/features/models/components/prefill-group-shared.ts +++ b/web/default/src/features/models/components/prefill-group-shared.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import type { StatusBadgeProps } from '@/components/status-badge' + import { type PrefillGroup, type PrefillGroupFormValues } from '../types' export type PrefillGroupType = PrefillGroup['type'] diff --git a/web/default/src/features/models/constants.ts b/web/default/src/features/models/constants.ts index 9e476dfc..b40638b1 100644 --- a/web/default/src/features/models/constants.ts +++ b/web/default/src/features/models/constants.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { type TFunction } from 'i18next' + import type { NameRule, ModelStatus, SyncSource } from './types' // ============================================================================ diff --git a/web/default/src/features/models/hooks/use-model-deployment-settings.ts b/web/default/src/features/models/hooks/use-model-deployment-settings.ts index 6bfcc504..469c1a48 100644 --- a/web/default/src/features/models/hooks/use-model-deployment-settings.ts +++ b/web/default/src/features/models/hooks/use-model-deployment-settings.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useCallback, useEffect, useRef, useState } from 'react' + import { getDeploymentSettings, testDeploymentConnection } from '../api' interface ConnectionState { diff --git a/web/default/src/features/models/index.tsx b/web/default/src/features/models/index.tsx index ce4c6147..1ff713b0 100644 --- a/web/default/src/features/models/index.tsx +++ b/web/default/src/features/models/index.tsx @@ -16,14 +16,16 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useCallback, useEffect, useState } from 'react' import { useQueryClient } from '@tanstack/react-query' import { getRouteApi, useNavigate } from '@tanstack/react-router' import { Plus } from 'lucide-react' +import { useCallback, useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' + +import { SectionPageLayout } from '@/components/layout' import { Button } from '@/components/ui/button' import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs' -import { SectionPageLayout } from '@/components/layout' + import { listDeployments } from './api' import { DeploymentAccessGuard } from './components/deployment-access-guard' import { DeploymentsTable } from './components/deployments-table' diff --git a/web/default/src/features/models/lib/model-actions.ts b/web/default/src/features/models/lib/model-actions.ts index 5744cf22..00e40f77 100644 --- a/web/default/src/features/models/lib/model-actions.ts +++ b/web/default/src/features/models/lib/model-actions.ts @@ -19,6 +19,7 @@ For commercial licensing, please contact support@quantumnous.com import { type QueryClient } from '@tanstack/react-query' import i18next from 'i18next' import { toast } from 'sonner' + import { updateModelStatus, deleteModel as deleteModelAPI } from '../api' import { modelsQueryKeys } from './query-keys' diff --git a/web/default/src/features/models/lib/model-form.ts b/web/default/src/features/models/lib/model-form.ts index 99aecb46..5ebb573d 100644 --- a/web/default/src/features/models/lib/model-form.ts +++ b/web/default/src/features/models/lib/model-form.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { z } from 'zod' + import type { Model } from '../types' import { parseModelTags as parseTagsFromUtils } from './model-utils' diff --git a/web/default/src/features/models/lib/model-utils.ts b/web/default/src/features/models/lib/model-utils.ts index 88dbfdec..7e4b1f12 100644 --- a/web/default/src/features/models/lib/model-utils.ts +++ b/web/default/src/features/models/lib/model-utils.ts @@ -17,7 +17,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { type TFunction } from 'i18next' + import { formatTimestampToDate } from '@/lib/format' + import { getNameRuleConfig, getQuotaTypeConfig } from '../constants' import type { NameRule, Model } from '../types' diff --git a/web/default/src/features/models/lib/vendor-actions.ts b/web/default/src/features/models/lib/vendor-actions.ts index 88ee455c..36c69887 100644 --- a/web/default/src/features/models/lib/vendor-actions.ts +++ b/web/default/src/features/models/lib/vendor-actions.ts @@ -19,6 +19,7 @@ For commercial licensing, please contact support@quantumnous.com import { type QueryClient } from '@tanstack/react-query' import i18next from 'i18next' import { toast } from 'sonner' + import { deleteVendor as deleteVendorAPI } from '../api' import { vendorsQueryKeys, modelsQueryKeys } from './query-keys' diff --git a/web/default/src/features/performance-metrics/api.ts b/web/default/src/features/performance-metrics/api.ts index cbc3004d..e27ba849 100644 --- a/web/default/src/features/performance-metrics/api.ts +++ b/web/default/src/features/performance-metrics/api.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { api } from '@/lib/api' + import type { PerformanceMetricsData, PerfSummaryAllData } from './types' export async function getPerfMetricsSummary( diff --git a/web/default/src/features/playground/components/message/message-action-button.tsx b/web/default/src/features/playground/components/message/message-action-button.tsx index e4e99396..45e73d0a 100644 --- a/web/default/src/features/playground/components/message/message-action-button.tsx +++ b/web/default/src/features/playground/components/message/message-action-button.tsx @@ -17,12 +17,14 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import type { LucideIcon } from 'lucide-react' + import { Button } from '@/components/ui/button' import { Tooltip, TooltipContent, TooltipTrigger, } from '@/components/ui/tooltip' + import { MESSAGE_ACTION_BUTTON_STYLES } from '../../constants' interface MessageActionButtonProps { diff --git a/web/default/src/features/playground/hooks/use-message-action-guard.ts b/web/default/src/features/playground/hooks/use-message-action-guard.ts index d82544d3..78fc7763 100644 --- a/web/default/src/features/playground/hooks/use-message-action-guard.ts +++ b/web/default/src/features/playground/hooks/use-message-action-guard.ts @@ -19,6 +19,7 @@ For commercial licensing, please contact support@quantumnous.com import { useCallback } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' + import { MESSAGE_ACTION_LABELS } from '../constants' /** diff --git a/web/default/src/features/playground/lib/state/playground-state-utils.ts b/web/default/src/features/playground/lib/state/playground-state-utils.ts index e758e053..5313dde5 100644 --- a/web/default/src/features/playground/lib/state/playground-state-utils.ts +++ b/web/default/src/features/playground/lib/state/playground-state-utils.ts @@ -18,7 +18,11 @@ For commercial licensing, please contact support@quantumnous.com */ import { DEFAULT_CONFIG, DEFAULT_PARAMETER_ENABLED } from '../../constants' import type { Message, ParameterEnabled, PlaygroundConfig } from '../../types' -import { loadConfig, loadMessages, loadParameterEnabled } from '../storage/storage' +import { + loadConfig, + loadMessages, + loadParameterEnabled, +} from '../storage/storage' export type MessageStateUpdater = | Message[] diff --git a/web/default/src/features/pricing/api.ts b/web/default/src/features/pricing/api.ts index 96cd5971..a6a8d316 100644 --- a/web/default/src/features/pricing/api.ts +++ b/web/default/src/features/pricing/api.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { api } from '@/lib/api' + import type { PricingData } from './types' // ---------------------------------------------------------------------------- diff --git a/web/default/src/features/pricing/components/dynamic-pricing-breakdown.tsx b/web/default/src/features/pricing/components/dynamic-pricing-breakdown.tsx index 7f479e98..214007bf 100644 --- a/web/default/src/features/pricing/components/dynamic-pricing-breakdown.tsx +++ b/web/default/src/features/pricing/components/dynamic-pricing-breakdown.tsx @@ -16,13 +16,15 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useMemo } from 'react' import { Tag as TagIcon } from 'lucide-react' +import { useMemo } from 'react' import { useTranslation } from 'react-i18next' -import { useSystemConfigStore } from '@/stores/system-config-store' -import { cn } from '@/lib/utils' -import { Badge } from '@/components/ui/badge' + import { StaticDataTable } from '@/components/data-table' +import { Badge } from '@/components/ui/badge' +import { cn } from '@/lib/utils' +import { useSystemConfigStore } from '@/stores/system-config-store' + import { BILLING_PRICING_VARS, MATCH_CONTAINS, diff --git a/web/default/src/features/pricing/components/empty-state.tsx b/web/default/src/features/pricing/components/empty-state.tsx index 9054f224..5b6219ae 100644 --- a/web/default/src/features/pricing/components/empty-state.tsx +++ b/web/default/src/features/pricing/components/empty-state.tsx @@ -18,6 +18,7 @@ For commercial licensing, please contact support@quantumnous.com */ import { Search } from 'lucide-react' import { useTranslation } from 'react-i18next' + import { Button } from '@/components/ui/button' export interface EmptyStateProps { diff --git a/web/default/src/features/pricing/components/loading-skeleton.tsx b/web/default/src/features/pricing/components/loading-skeleton.tsx index bfdfe344..bf20d4d7 100644 --- a/web/default/src/features/pricing/components/loading-skeleton.tsx +++ b/web/default/src/features/pricing/components/loading-skeleton.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { Skeleton } from '@/components/ui/skeleton' + import { VIEW_MODES, type ViewMode } from '../constants' export interface LoadingSkeletonProps { diff --git a/web/default/src/features/pricing/components/model-card-grid.tsx b/web/default/src/features/pricing/components/model-card-grid.tsx index 173d1aba..9faf91b5 100644 --- a/web/default/src/features/pricing/components/model-card-grid.tsx +++ b/web/default/src/features/pricing/components/model-card-grid.tsx @@ -16,12 +16,14 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useMemo, useState } from 'react' import { useQuery } from '@tanstack/react-query' import { ChevronLeft, ChevronRight } from 'lucide-react' +import { useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' + import { Button } from '@/components/ui/button' import { getPerfMetricsSummary } from '@/features/performance-metrics/api' + import { DEFAULT_PRICING_PAGE_SIZE, DEFAULT_TOKEN_UNIT } from '../constants' import type { PricingModel, TokenUnit } from '../types' import { ModelCard } from './model-card' diff --git a/web/default/src/features/pricing/components/model-card.tsx b/web/default/src/features/pricing/components/model-card.tsx index e9412279..ef08e9ce 100644 --- a/web/default/src/features/pricing/components/model-card.tsx +++ b/web/default/src/features/pricing/components/model-card.tsx @@ -16,13 +16,15 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { memo } from 'react' import { ChevronRight, Copy } from 'lucide-react' +import { memo } from 'react' import { useTranslation } from 'react-i18next' + +import { StatusBadge } from '@/components/status-badge' +import { useCopyToClipboard } from '@/hooks/use-copy-to-clipboard' import { getLobeIcon } from '@/lib/lobe-icon' import { cn } from '@/lib/utils' -import { useCopyToClipboard } from '@/hooks/use-copy-to-clipboard' -import { StatusBadge } from '@/components/status-badge' + import { DEFAULT_TOKEN_UNIT } from '../constants' import { getDynamicDisplayGroupRatio, diff --git a/web/default/src/features/pricing/components/model-details-api.tsx b/web/default/src/features/pricing/components/model-details-api.tsx index ac29dc08..328752d5 100644 --- a/web/default/src/features/pricing/components/model-details-api.tsx +++ b/web/default/src/features/pricing/components/model-details-api.tsx @@ -16,7 +16,6 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useMemo, useState } from 'react' import { ChevronRight, Gauge, @@ -25,11 +24,10 @@ import { Sigma, Zap, } from 'lucide-react' +import { useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' import type { BundledLanguage } from 'shiki/bundle/web' -import { useStatus } from '@/hooks/use-status' -import { Badge } from '@/components/ui/badge' -import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs' + import { CodeBlock, CodeBlockCopyButton, @@ -38,6 +36,10 @@ import { StaticDataTable, staticDataTableClassNames as tableStyles, } from '@/components/data-table' +import { Badge } from '@/components/ui/badge' +import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs' +import { useStatus } from '@/hooks/use-status' + import { buildRateLimits, buildSupportedParameters, diff --git a/web/default/src/features/pricing/components/model-details-apps.tsx b/web/default/src/features/pricing/components/model-details-apps.tsx index 78c6e6a5..d01b30cc 100644 --- a/web/default/src/features/pricing/components/model-details-apps.tsx +++ b/web/default/src/features/pricing/components/model-details-apps.tsx @@ -16,19 +16,21 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useMemo } from 'react' import { ArrowDownRight, ArrowUpRight, ExternalLink, Trophy, } from 'lucide-react' +import { useMemo } from 'react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + import { StaticDataTable, staticDataTableClassNames as tableStyles, } from '@/components/data-table' +import { cn } from '@/lib/utils' + import { buildAppRankings, formatTokenVolume, diff --git a/web/default/src/features/pricing/components/model-details-charts.tsx b/web/default/src/features/pricing/components/model-details-charts.tsx index 2b709017..348c4e41 100644 --- a/web/default/src/features/pricing/components/model-details-charts.tsx +++ b/web/default/src/features/pricing/components/model-details-charts.tsx @@ -16,15 +16,17 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useMemo } from 'react' import { VChart } from '@visactor/react-vchart' +import { useMemo } from 'react' import { useTranslation } from 'react-i18next' + +import { useThemeCustomization } from '@/context/theme-customization-provider' +import { getSuccessRateColor } from '@/features/performance-metrics/lib/format' import { useThemeRadiusPx } from '@/lib/theme-radius' import { useChartTheme } from '@/lib/use-chart-theme' import { cn } from '@/lib/utils' import { VCHART_OPTION } from '@/lib/vchart' -import { useThemeCustomization } from '@/context/theme-customization-provider' -import { getSuccessRateColor } from '@/features/performance-metrics/lib/format' + import type { LatencyTimePoint, UptimeDayPoint } from '../lib/mock-stats' function formatHourLabel(iso: string): string { @@ -230,7 +232,8 @@ export function UptimeTrendChart(props: { size: 5, stroke: '#ffffff', lineWidth: 1.5, - fill: (datum: { uptime: number }) => getSuccessRateColor(datum.uptime), + fill: (datum: { uptime: number }) => + getSuccessRateColor(datum.uptime), }, }, tooltip: { diff --git a/web/default/src/features/pricing/components/model-details-performance.tsx b/web/default/src/features/pricing/components/model-details-performance.tsx index 19915a18..0be5d040 100644 --- a/web/default/src/features/pricing/components/model-details-performance.tsx +++ b/web/default/src/features/pricing/components/model-details-performance.tsx @@ -16,11 +16,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useMemo } from 'react' import { useQuery } from '@tanstack/react-query' import { AlertTriangle, HeartPulse, Timer } from 'lucide-react' +import { useMemo } from 'react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + import { StaticDataTable, staticDataTableClassNames as tableStyles, @@ -34,6 +34,8 @@ import { getSuccessRateTextClass, } from '@/features/performance-metrics/lib/format' import type { PerformanceGroup } from '@/features/performance-metrics/types' +import { cn } from '@/lib/utils' + import { type UptimeDayPoint } from '../lib/mock-stats' import type { PricingModel } from '../types' import { LatencyTrendChart, UptimeTrendChart } from './model-details-charts' diff --git a/web/default/src/features/pricing/components/model-details-uptime-sparkline.tsx b/web/default/src/features/pricing/components/model-details-uptime-sparkline.tsx index a0dfcdf7..cbca6909 100644 --- a/web/default/src/features/pricing/components/model-details-uptime-sparkline.tsx +++ b/web/default/src/features/pricing/components/model-details-uptime-sparkline.tsx @@ -16,10 +16,10 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useMemo } from 'react' import { Activity, AlertCircle, CheckCircle2 } from 'lucide-react' +import { useMemo } from 'react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + import { Tooltip, TooltipContent, @@ -30,6 +30,8 @@ import { getSuccessRateDotClass, getSuccessRateTextClass, } from '@/features/performance-metrics/lib/format' +import { cn } from '@/lib/utils' + import { aggregateUptime, type UptimeDayPoint } from '../lib/mock-stats' // --------------------------------------------------------------------------- diff --git a/web/default/src/features/pricing/components/model-details.tsx b/web/default/src/features/pricing/components/model-details.tsx index da80df8e..062e44db 100644 --- a/web/default/src/features/pricing/components/model-details.tsx +++ b/web/default/src/features/pricing/components/model-details.tsx @@ -16,7 +16,6 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useMemo } from 'react' import { useQuery } from '@tanstack/react-query' import { useNavigate, useParams, useSearch } from '@tanstack/react-router' import { @@ -31,9 +30,14 @@ import { Sparkles, Timer, } from 'lucide-react' +import { useMemo } from 'react' import { useTranslation } from 'react-i18next' -import { getLobeIcon } from '@/lib/lobe-icon' -import { cn } from '@/lib/utils' + +import { CopyButton } from '@/components/copy-button' +import { StaticDataTable } from '@/components/data-table' +import { sideDrawerContentClassName } from '@/components/drawer-layout' +import { GroupBadge } from '@/components/group-badge' +import { PublicLayout } from '@/components/layout' import { Button } from '@/components/ui/button' import { Sheet, @@ -44,11 +48,6 @@ import { } from '@/components/ui/sheet' import { Skeleton } from '@/components/ui/skeleton' import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs' -import { CopyButton } from '@/components/copy-button' -import { StaticDataTable } from '@/components/data-table' -import { sideDrawerContentClassName } from '@/components/drawer-layout' -import { GroupBadge } from '@/components/group-badge' -import { PublicLayout } from '@/components/layout' import { getPerfMetrics } from '@/features/performance-metrics/api' import { formatLatency, @@ -56,6 +55,9 @@ import { formatUptimePct, getSuccessRateTextClass, } from '@/features/performance-metrics/lib/format' +import { getLobeIcon } from '@/lib/lobe-icon' +import { cn } from '@/lib/utils' + import { DEFAULT_TOKEN_UNIT, QUOTA_TYPE_VALUES } from '../constants' import { usePricingData } from '../hooks/use-pricing-data' import { diff --git a/web/default/src/features/pricing/components/model-perf-badge.tsx b/web/default/src/features/pricing/components/model-perf-badge.tsx index 010fd83d..f214367a 100644 --- a/web/default/src/features/pricing/components/model-perf-badge.tsx +++ b/web/default/src/features/pricing/components/model-perf-badge.tsx @@ -18,8 +18,9 @@ For commercial licensing, please contact support@quantumnous.com */ import { memo } from 'react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + import { getSuccessRateDotClass } from '@/features/performance-metrics/lib/format' +import { cn } from '@/lib/utils' export type ModelPerfBadgeData = { avg_latency_ms: number diff --git a/web/default/src/features/pricing/components/pricing-columns.tsx b/web/default/src/features/pricing/components/pricing-columns.tsx index b34879c7..c999f3cf 100644 --- a/web/default/src/features/pricing/components/pricing-columns.tsx +++ b/web/default/src/features/pricing/components/pricing-columns.tsx @@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com */ import { type ColumnDef } from '@tanstack/react-table' import { useTranslation } from 'react-i18next' -import { getLobeIcon } from '@/lib/lobe-icon' + import { BadgeCell, BadgeListCell, @@ -26,6 +26,8 @@ import { } from '@/components/data-table' import { GroupBadge } from '@/components/group-badge' import { StatusBadge } from '@/components/status-badge' +import { getLobeIcon } from '@/lib/lobe-icon' + import { DEFAULT_TOKEN_UNIT, QUOTA_TYPE_VALUES } from '../constants' import { getDynamicDisplayGroupRatio, diff --git a/web/default/src/features/pricing/components/pricing-sidebar.tsx b/web/default/src/features/pricing/components/pricing-sidebar.tsx index 99b161e9..d0cf5e24 100644 --- a/web/default/src/features/pricing/components/pricing-sidebar.tsx +++ b/web/default/src/features/pricing/components/pricing-sidebar.tsx @@ -16,11 +16,10 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import type { ReactNode } from 'react' import { ChevronDown, RotateCcw } from 'lucide-react' +import type { ReactNode } from 'react' import { useTranslation } from 'react-i18next' -import { getLobeIcon } from '@/lib/lobe-icon' -import { cn } from '@/lib/utils' + import { Badge } from '@/components/ui/badge' import { Button } from '@/components/ui/button' import { @@ -28,6 +27,9 @@ import { CollapsibleContent, CollapsibleTrigger, } from '@/components/ui/collapsible' +import { getLobeIcon } from '@/lib/lobe-icon' +import { cn } from '@/lib/utils' + import { ENDPOINT_TYPES, FILTER_ALL, diff --git a/web/default/src/features/pricing/components/pricing-table.tsx b/web/default/src/features/pricing/components/pricing-table.tsx index 4cc38409..e6aa9d36 100644 --- a/web/default/src/features/pricing/components/pricing-table.tsx +++ b/web/default/src/features/pricing/components/pricing-table.tsx @@ -16,15 +16,17 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useCallback } from 'react' import { type Row, type PaginationState } from '@tanstack/react-table' +import { useState, useCallback } from 'react' import { useTranslation } from 'react-i18next' + import { DataTablePagination, DataTableRow, DataTableView, useDataTable, } from '@/components/data-table' + import { DEFAULT_PRICING_PAGE_SIZE, DEFAULT_TOKEN_UNIT } from '../constants' import type { PricingModel, TokenUnit } from '../types' import { usePricingColumns } from './pricing-columns' diff --git a/web/default/src/features/pricing/components/pricing-toolbar.tsx b/web/default/src/features/pricing/components/pricing-toolbar.tsx index 07cf0809..35c06e93 100644 --- a/web/default/src/features/pricing/components/pricing-toolbar.tsx +++ b/web/default/src/features/pricing/components/pricing-toolbar.tsx @@ -16,10 +16,15 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useCallback, useState } from 'react' import { ArrowUpDown, Check, Filter, Grid2X2, Table2 } from 'lucide-react' +import { useCallback, useState } from 'react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + +import { + sideDrawerContentClassName, + sideDrawerFormClassName, + sideDrawerHeaderClassName, +} from '@/components/drawer-layout' import { Badge } from '@/components/ui/badge' import { Button } from '@/components/ui/button' import { @@ -40,11 +45,8 @@ import { TooltipContent, TooltipTrigger, } from '@/components/ui/tooltip' -import { - sideDrawerContentClassName, - sideDrawerFormClassName, - sideDrawerHeaderClassName, -} from '@/components/drawer-layout' +import { cn } from '@/lib/utils' + import { VIEW_MODES, getSortLabels, diff --git a/web/default/src/features/pricing/components/search-bar.tsx b/web/default/src/features/pricing/components/search-bar.tsx index 25e0f1ca..2c040afd 100644 --- a/web/default/src/features/pricing/components/search-bar.tsx +++ b/web/default/src/features/pricing/components/search-bar.tsx @@ -16,11 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useRef } from 'react' import { Search, X } from 'lucide-react' +import { useEffect, useRef } from 'react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + import { Button } from '@/components/ui/button' +import { cn } from '@/lib/utils' export interface SearchBarProps { value: string diff --git a/web/default/src/features/pricing/constants.ts b/web/default/src/features/pricing/constants.ts index baee2650..24225e55 100644 --- a/web/default/src/features/pricing/constants.ts +++ b/web/default/src/features/pricing/constants.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { type TFunction } from 'i18next' + import type { TokenUnit } from './types' // ---------------------------------------------------------------------------- diff --git a/web/default/src/features/pricing/hooks/use-filters.ts b/web/default/src/features/pricing/hooks/use-filters.ts index 3a72070f..18415b8a 100644 --- a/web/default/src/features/pricing/hooks/use-filters.ts +++ b/web/default/src/features/pricing/hooks/use-filters.ts @@ -16,8 +16,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useMemo, useCallback, useState } from 'react' import { useSearch } from '@tanstack/react-router' +import { useMemo, useCallback, useState } from 'react' + import { FILTER_ALL, SORT_OPTIONS, diff --git a/web/default/src/features/pricing/hooks/use-pricing-data.ts b/web/default/src/features/pricing/hooks/use-pricing-data.ts index 914f6e63..cca13adf 100644 --- a/web/default/src/features/pricing/hooks/use-pricing-data.ts +++ b/web/default/src/features/pricing/hooks/use-pricing-data.ts @@ -16,9 +16,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useMemo } from 'react' import { useQuery } from '@tanstack/react-query' +import { useMemo } from 'react' + import { useStatus } from '@/hooks/use-status' + import { getPricing } from '../api' export function usePricingData() { diff --git a/web/default/src/features/pricing/index.tsx b/web/default/src/features/pricing/index.tsx index fdcf2933..f1019de0 100644 --- a/web/default/src/features/pricing/index.tsx +++ b/web/default/src/features/pricing/index.tsx @@ -18,8 +18,10 @@ For commercial licensing, please contact support@quantumnous.com */ import { useCallback, useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' + import { PublicLayout } from '@/components/layout' import { PageTransition } from '@/components/page-transition' + import { LoadingSkeleton, EmptyState, diff --git a/web/default/src/features/pricing/lib/dynamic-price.ts b/web/default/src/features/pricing/lib/dynamic-price.ts index 616c4c18..581b443b 100644 --- a/web/default/src/features/pricing/lib/dynamic-price.ts +++ b/web/default/src/features/pricing/lib/dynamic-price.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { formatBillingCurrencyFromUSD } from '@/lib/currency' + import { TOKEN_UNIT_DIVISORS } from '../constants' import type { PricingModel, TokenUnit } from '../types' import { diff --git a/web/default/src/features/pricing/lib/price.ts b/web/default/src/features/pricing/lib/price.ts index decbd597..534ccdf3 100644 --- a/web/default/src/features/pricing/lib/price.ts +++ b/web/default/src/features/pricing/lib/price.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { formatCurrencyFromUSD } from '@/lib/currency' + import { QUOTA_TYPE_VALUES, TOKEN_UNIT_DIVISORS } from '../constants' import type { PricingModel, TokenUnit, PriceType } from '../types' diff --git a/web/default/src/features/profile/api.ts b/web/default/src/features/profile/api.ts index 82bc1d85..d453b25a 100644 --- a/web/default/src/features/profile/api.ts +++ b/web/default/src/features/profile/api.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { api } from '@/lib/api' + import type { ApiResponse, UserProfile, diff --git a/web/default/src/features/profile/components/checkin-calendar-card.tsx b/web/default/src/features/profile/components/checkin-calendar-card.tsx index 2730e7c1..561196dd 100644 --- a/web/default/src/features/profile/components/checkin-calendar-card.tsx +++ b/web/default/src/features/profile/components/checkin-calendar-card.tsx @@ -16,7 +16,6 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useState, useMemo, useCallback } from 'react' import { useQuery } from '@tanstack/react-query' import { CalendarDays, @@ -26,11 +25,12 @@ import { ChevronUp, Sparkles, } from 'lucide-react' +import { useEffect, useState, useMemo, useCallback } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { formatQuotaWithCurrency } from '@/lib/currency' -import dayjs from '@/lib/dayjs' -import { cn } from '@/lib/utils' + +import { Dialog } from '@/components/dialog' +import { Turnstile } from '@/components/turnstile' import { Button } from '@/components/ui/button' import { Card } from '@/components/ui/card' import { Skeleton } from '@/components/ui/skeleton' @@ -40,8 +40,10 @@ import { TooltipTrigger, TooltipProvider, } from '@/components/ui/tooltip' -import { Dialog } from '@/components/dialog' -import { Turnstile } from '@/components/turnstile' +import { formatQuotaWithCurrency } from '@/lib/currency' +import dayjs from '@/lib/dayjs' +import { cn } from '@/lib/utils' + import { getCheckinStatus, performCheckin } from '../api' import type { CheckinRecord } from '../types' diff --git a/web/default/src/features/profile/components/dialogs/access-token-dialog.tsx b/web/default/src/features/profile/components/dialogs/access-token-dialog.tsx index 349f97a7..550166ca 100644 --- a/web/default/src/features/profile/components/dialogs/access-token-dialog.tsx +++ b/web/default/src/features/profile/components/dialogs/access-token-dialog.tsx @@ -16,14 +16,16 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect } from 'react' import { RefreshCw, Loader2 } from 'lucide-react' +import { useEffect } from 'react' import { useTranslation } from 'react-i18next' + +import { CopyButton } from '@/components/copy-button' +import { Dialog } from '@/components/dialog' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' -import { CopyButton } from '@/components/copy-button' -import { Dialog } from '@/components/dialog' + import { useAccessToken } from '../../hooks' // ============================================================================ diff --git a/web/default/src/features/profile/components/dialogs/change-password-dialog.tsx b/web/default/src/features/profile/components/dialogs/change-password-dialog.tsx index d4dec76c..c8574e31 100644 --- a/web/default/src/features/profile/components/dialogs/change-password-dialog.tsx +++ b/web/default/src/features/profile/components/dialogs/change-password-dialog.tsx @@ -16,14 +16,16 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState } from 'react' import { Loader2 } from 'lucide-react' +import { useState } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { Button } from '@/components/ui/button' -import { Label } from '@/components/ui/label' + import { Dialog } from '@/components/dialog' import { PasswordInput } from '@/components/password-input' +import { Button } from '@/components/ui/button' +import { Label } from '@/components/ui/label' + import { updateUserProfile } from '../../api' // ============================================================================ diff --git a/web/default/src/features/profile/components/dialogs/delete-account-dialog.tsx b/web/default/src/features/profile/components/dialogs/delete-account-dialog.tsx index 090f18a1..b7732c15 100644 --- a/web/default/src/features/profile/components/dialogs/delete-account-dialog.tsx +++ b/web/default/src/features/profile/components/dialogs/delete-account-dialog.tsx @@ -16,18 +16,20 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState } from 'react' import { useNavigate } from '@tanstack/react-router' import { AlertTriangle, Loader2 } from 'lucide-react' +import { useState } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { useAuthStore } from '@/stores/auth-store' -import { api } from '@/lib/api' + +import { Dialog } from '@/components/dialog' import { Alert, AlertDescription } from '@/components/ui/alert' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' -import { Dialog } from '@/components/dialog' +import { api } from '@/lib/api' +import { useAuthStore } from '@/stores/auth-store' + import { deleteUserAccount } from '../../api' // ============================================================================ diff --git a/web/default/src/features/profile/components/dialogs/email-bind-dialog.tsx b/web/default/src/features/profile/components/dialogs/email-bind-dialog.tsx index bc064edf..e1daf58c 100644 --- a/web/default/src/features/profile/components/dialogs/email-bind-dialog.tsx +++ b/web/default/src/features/profile/components/dialogs/email-bind-dialog.tsx @@ -16,15 +16,17 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState } from 'react' import { Loader2 } from 'lucide-react' +import { useState } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { useCountdown } from '@/hooks/use-countdown' + +import { Dialog } from '@/components/dialog' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' -import { Dialog } from '@/components/dialog' +import { useCountdown } from '@/hooks/use-countdown' + import { sendEmailVerification, bindEmail } from '../../api' // ============================================================================ diff --git a/web/default/src/features/profile/components/dialogs/telegram-bind-dialog.tsx b/web/default/src/features/profile/components/dialogs/telegram-bind-dialog.tsx index 3424ee37..e066e7d1 100644 --- a/web/default/src/features/profile/components/dialogs/telegram-bind-dialog.tsx +++ b/web/default/src/features/profile/components/dialogs/telegram-bind-dialog.tsx @@ -18,8 +18,9 @@ For commercial licensing, please contact support@quantumnous.com */ import { Send } from 'lucide-react' import { useTranslation } from 'react-i18next' -import { Alert, AlertDescription } from '@/components/ui/alert' + import { Dialog } from '@/components/dialog' +import { Alert, AlertDescription } from '@/components/ui/alert' // ============================================================================ // Telegram Bind Dialog Component diff --git a/web/default/src/features/profile/components/dialogs/two-fa-backup-dialog.tsx b/web/default/src/features/profile/components/dialogs/two-fa-backup-dialog.tsx index 961569b0..11d4664e 100644 --- a/web/default/src/features/profile/components/dialogs/two-fa-backup-dialog.tsx +++ b/web/default/src/features/profile/components/dialogs/two-fa-backup-dialog.tsx @@ -16,17 +16,18 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState } from 'react' import { RefreshCw, Loader2 } from 'lucide-react' +import { useState } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { regenerate2FABackupCodes } from '@/lib/api' + +import { CopyButton } from '@/components/copy-button' +import { Dialog } from '@/components/dialog' import { Alert, AlertDescription } from '@/components/ui/alert' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' -import { CopyButton } from '@/components/copy-button' -import { Dialog } from '@/components/dialog' +import { regenerate2FABackupCodes } from '@/lib/api' // ============================================================================ // Two-FA Backup Codes Dialog Component diff --git a/web/default/src/features/profile/components/dialogs/two-fa-disable-dialog.tsx b/web/default/src/features/profile/components/dialogs/two-fa-disable-dialog.tsx index ad2ad7c0..c2536ea3 100644 --- a/web/default/src/features/profile/components/dialogs/two-fa-disable-dialog.tsx +++ b/web/default/src/features/profile/components/dialogs/two-fa-disable-dialog.tsx @@ -16,17 +16,18 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState } from 'react' import { AlertTriangle, Loader2 } from 'lucide-react' +import { useState } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { disable2FA } from '@/lib/api' + +import { Dialog } from '@/components/dialog' import { Alert, AlertDescription } from '@/components/ui/alert' import { Button } from '@/components/ui/button' import { Checkbox } from '@/components/ui/checkbox' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' -import { Dialog } from '@/components/dialog' +import { disable2FA } from '@/lib/api' // ============================================================================ // Two-FA Disable Dialog Component diff --git a/web/default/src/features/profile/components/dialogs/two-fa-setup-dialog.tsx b/web/default/src/features/profile/components/dialogs/two-fa-setup-dialog.tsx index f0080cdd..a4ebcd10 100644 --- a/web/default/src/features/profile/components/dialogs/two-fa-setup-dialog.tsx +++ b/web/default/src/features/profile/components/dialogs/two-fa-setup-dialog.tsx @@ -16,18 +16,20 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useEffect, useCallback } from 'react' import { Loader2 } from 'lucide-react' import { QRCodeSVG } from 'qrcode.react' +import { useState, useEffect, useCallback } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { setup2FA, enable2FA } from '@/lib/api' + +import { CopyButton } from '@/components/copy-button' +import { Dialog } from '@/components/dialog' import { Alert, AlertDescription } from '@/components/ui/alert' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' -import { CopyButton } from '@/components/copy-button' -import { Dialog } from '@/components/dialog' +import { setup2FA, enable2FA } from '@/lib/api' + import type { TwoFASetupData } from '../../types' // ============================================================================ diff --git a/web/default/src/features/profile/components/dialogs/wechat-bind-dialog.tsx b/web/default/src/features/profile/components/dialogs/wechat-bind-dialog.tsx index c56c24fb..b179b439 100644 --- a/web/default/src/features/profile/components/dialogs/wechat-bind-dialog.tsx +++ b/web/default/src/features/profile/components/dialogs/wechat-bind-dialog.tsx @@ -18,8 +18,9 @@ For commercial licensing, please contact support@quantumnous.com */ import { QrCode } from 'lucide-react' import { useTranslation } from 'react-i18next' -import { Alert, AlertDescription } from '@/components/ui/alert' + import { Dialog } from '@/components/dialog' +import { Alert, AlertDescription } from '@/components/ui/alert' // ============================================================================ // WeChat Bind Dialog Component diff --git a/web/default/src/features/profile/components/language-preferences-card.tsx b/web/default/src/features/profile/components/language-preferences-card.tsx index de810baa..fdbd6106 100644 --- a/web/default/src/features/profile/components/language-preferences-card.tsx +++ b/web/default/src/features/profile/components/language-preferences-card.tsx @@ -16,15 +16,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useMemo, useState } from 'react' -import { - INTERFACE_LANGUAGE_OPTIONS, - normalizeInterfaceLanguage, -} from '@/i18n/languages' import { Languages, Loader2 } from 'lucide-react' +import { useEffect, useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { useAuthStore } from '@/stores/auth-store' + import { Select, SelectContent, @@ -34,6 +30,12 @@ import { SelectValue, } from '@/components/ui/select' import { TitledCard } from '@/components/ui/titled-card' +import { + INTERFACE_LANGUAGE_OPTIONS, + normalizeInterfaceLanguage, +} from '@/i18n/languages' +import { useAuthStore } from '@/stores/auth-store' + import { updateUserLanguage } from '../api' import { parseUserSettings } from '../lib' import type { UserProfile } from '../types' diff --git a/web/default/src/features/profile/components/passkey-card.tsx b/web/default/src/features/profile/components/passkey-card.tsx index 8f2a4c04..42390fb2 100644 --- a/web/default/src/features/profile/components/passkey-card.tsx +++ b/web/default/src/features/profile/components/passkey-card.tsx @@ -16,11 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useCallback, useMemo, useState } from 'react' import { AlertTriangle, KeyRound, Loader2, ShieldAlert } from 'lucide-react' +import { useCallback, useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import dayjs from '@/lib/dayjs' + +import { StatusBadge } from '@/components/status-badge' import { AlertDialog, AlertDialogAction, @@ -41,7 +42,6 @@ import { CardTitle, } from '@/components/ui/card' import { Skeleton } from '@/components/ui/skeleton' -import { StatusBadge } from '@/components/status-badge' import { usePasskeyManagement } from '@/features/auth/passkey' import { SecureVerificationDialog, @@ -49,6 +49,7 @@ import { type VerificationMethod, type VerificationMethods, } from '@/features/auth/secure-verification' +import dayjs from '@/lib/dayjs' interface PasskeyCardProps { loading: boolean diff --git a/web/default/src/features/profile/components/profile-header.tsx b/web/default/src/features/profile/components/profile-header.tsx index 7127f351..cf54ec1c 100644 --- a/web/default/src/features/profile/components/profile-header.tsx +++ b/web/default/src/features/profile/components/profile-header.tsx @@ -18,13 +18,15 @@ For commercial licensing, please contact support@quantumnous.com */ import { Activity, BarChart3, WalletCards } from 'lucide-react' import { useTranslation } from 'react-i18next' -import { getUserAvatarFallback, getUserAvatarStyle } from '@/lib/avatar' -import { formatCompactNumber, formatQuota } from '@/lib/format' -import { getRoleLabel } from '@/lib/roles' + +import { StatusBadge } from '@/components/status-badge' import { Avatar, AvatarFallback } from '@/components/ui/avatar' import { Card, CardContent } from '@/components/ui/card' import { Skeleton } from '@/components/ui/skeleton' -import { StatusBadge } from '@/components/status-badge' +import { getUserAvatarFallback, getUserAvatarStyle } from '@/lib/avatar' +import { formatCompactNumber, formatQuota } from '@/lib/format' +import { getRoleLabel } from '@/lib/roles' + import { getDisplayName } from '../lib' import type { UserProfile } from '../types' diff --git a/web/default/src/features/profile/components/profile-security-card.tsx b/web/default/src/features/profile/components/profile-security-card.tsx index 137cfaf4..5b9a3b87 100644 --- a/web/default/src/features/profile/components/profile-security-card.tsx +++ b/web/default/src/features/profile/components/profile-security-card.tsx @@ -18,10 +18,12 @@ For commercial licensing, please contact support@quantumnous.com */ import { Shield, Key, Trash2 } from 'lucide-react' import { useTranslation } from 'react-i18next' -import { useDialogs } from '@/hooks/use-dialog' + import { Card, CardContent, CardHeader } from '@/components/ui/card' import { Skeleton } from '@/components/ui/skeleton' import { TitledCard } from '@/components/ui/titled-card' +import { useDialogs } from '@/hooks/use-dialog' + import type { UserProfile } from '../types' import { AccessTokenDialog } from './dialogs/access-token-dialog' import { ChangePasswordDialog } from './dialogs/change-password-dialog' diff --git a/web/default/src/features/profile/components/profile-settings-card.tsx b/web/default/src/features/profile/components/profile-settings-card.tsx index 86349a80..997f74f4 100644 --- a/web/default/src/features/profile/components/profile-settings-card.tsx +++ b/web/default/src/features/profile/components/profile-settings-card.tsx @@ -16,13 +16,15 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState } from 'react' import { Link2, Settings } from 'lucide-react' +import { useState } from 'react' import { useTranslation } from 'react-i18next' + import { Card, CardContent, CardHeader } from '@/components/ui/card' import { Skeleton } from '@/components/ui/skeleton' import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs' import { TitledCard } from '@/components/ui/titled-card' + import type { UserProfile } from '../types' import { AccountBindingsTab } from './tabs/account-bindings-tab' import { NotificationTab } from './tabs/notification-tab' diff --git a/web/default/src/features/profile/components/sidebar-modules-card.tsx b/web/default/src/features/profile/components/sidebar-modules-card.tsx index 72a4e719..ae5e7e1e 100644 --- a/web/default/src/features/profile/components/sidebar-modules-card.tsx +++ b/web/default/src/features/profile/components/sidebar-modules-card.tsx @@ -16,12 +16,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useCallback, useEffect, useState } from 'react' import { LayoutDashboard } from 'lucide-react' +import { useCallback, useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { useAuthStore } from '@/stores/auth-store' -import { api } from '@/lib/api' + import { Button } from '@/components/ui/button' import { Card, @@ -31,6 +30,8 @@ import { CardTitle, } from '@/components/ui/card' import { Switch } from '@/components/ui/switch' +import { api } from '@/lib/api' +import { useAuthStore } from '@/stores/auth-store' type SidebarModuleConfig = { enabled: boolean diff --git a/web/default/src/features/profile/components/tabs/account-bindings-tab.tsx b/web/default/src/features/profile/components/tabs/account-bindings-tab.tsx index d4b30d65..55cb2d00 100644 --- a/web/default/src/features/profile/components/tabs/account-bindings-tab.tsx +++ b/web/default/src/features/profile/components/tabs/account-bindings-tab.tsx @@ -16,25 +16,27 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useMemo, useState, useCallback } from 'react' import { Mail, Shield, Send, Link2, Unlink } from 'lucide-react' +import { useEffect, useMemo, useState, useCallback } from 'react' import { useTranslation } from 'react-i18next' import { SiGithub, SiWechat, SiLinux } from 'react-icons/si' import { toast } from 'sonner' + import { IconDiscord } from '@/assets/brand-icons' +import { ConfirmDialog } from '@/components/confirm-dialog' +import { StatusBadge } from '@/components/status-badge' +import { Button } from '@/components/ui/button' +import { Separator } from '@/components/ui/separator' +import { OAUTH_BIND_STORAGE_KEY } from '@/features/auth/constants' +import { useDialogs } from '@/hooks/use-dialog' +import { useStatus } from '@/hooks/use-status' import { handleGitHubOAuth, handleOIDCOAuth, handleDiscordOAuth, handleLinuxDOOAuth, } from '@/lib/oauth' -import { useDialogs } from '@/hooks/use-dialog' -import { useStatus } from '@/hooks/use-status' -import { Button } from '@/components/ui/button' -import { Separator } from '@/components/ui/separator' -import { ConfirmDialog } from '@/components/confirm-dialog' -import { StatusBadge } from '@/components/status-badge' -import { OAUTH_BIND_STORAGE_KEY } from '@/features/auth/constants' + import { getSelfOAuthBindings, unbindCustomOAuth, diff --git a/web/default/src/features/profile/components/tabs/notification-tab.tsx b/web/default/src/features/profile/components/tabs/notification-tab.tsx index 8e2c9a0d..90ea37b0 100644 --- a/web/default/src/features/profile/components/tabs/notification-tab.tsx +++ b/web/default/src/features/profile/components/tabs/notification-tab.tsx @@ -16,17 +16,19 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useEffect, useCallback } from 'react' import { Bell, Loader2, Mail, Server, Webhook } from 'lucide-react' +import { useState, useEffect, useCallback } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { ROLE } from '@/lib/roles' + +import { PasswordInput } from '@/components/password-input' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' import { Switch } from '@/components/ui/switch' import { ToggleGroup, ToggleGroupItem } from '@/components/ui/toggle-group' -import { PasswordInput } from '@/components/password-input' +import { ROLE } from '@/lib/roles' + import { updateUserSettings } from '../../api' import { DEFAULT_QUOTA_WARNING_THRESHOLD, diff --git a/web/default/src/features/profile/components/two-fa-card.tsx b/web/default/src/features/profile/components/two-fa-card.tsx index 6388d5cd..e67085e3 100644 --- a/web/default/src/features/profile/components/two-fa-card.tsx +++ b/web/default/src/features/profile/components/two-fa-card.tsx @@ -18,7 +18,8 @@ For commercial licensing, please contact support@quantumnous.com */ import { Shield, AlertTriangle, RefreshCw } from 'lucide-react' import { useTranslation } from 'react-i18next' -import { useDialogs } from '@/hooks/use-dialog' + +import { StatusBadge } from '@/components/status-badge' import { Button } from '@/components/ui/button' import { Card, @@ -28,7 +29,8 @@ import { CardTitle, } from '@/components/ui/card' import { Skeleton } from '@/components/ui/skeleton' -import { StatusBadge } from '@/components/status-badge' +import { useDialogs } from '@/hooks/use-dialog' + import { useTwoFA } from '../hooks' import { TwoFABackupDialog } from './dialogs/two-fa-backup-dialog' import { TwoFADisableDialog } from './dialogs/two-fa-disable-dialog' diff --git a/web/default/src/features/profile/hooks/use-access-token.ts b/web/default/src/features/profile/hooks/use-access-token.ts index 726ffbac..33fbadf8 100644 --- a/web/default/src/features/profile/hooks/use-access-token.ts +++ b/web/default/src/features/profile/hooks/use-access-token.ts @@ -16,10 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useCallback } from 'react' import i18next from 'i18next' +import { useState, useCallback } from 'react' import { toast } from 'sonner' + import { useCopyToClipboard } from '@/hooks/use-copy-to-clipboard' + import { generateAccessToken } from '../api' // ============================================================================ diff --git a/web/default/src/features/profile/hooks/use-profile.ts b/web/default/src/features/profile/hooks/use-profile.ts index ad4203ae..0b61a703 100644 --- a/web/default/src/features/profile/hooks/use-profile.ts +++ b/web/default/src/features/profile/hooks/use-profile.ts @@ -16,9 +16,10 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useEffect, useCallback } from 'react' import i18next from 'i18next' +import { useState, useEffect, useCallback } from 'react' import { toast } from 'sonner' + import { getUserProfile, updateUserProfile, updateUserSettings } from '../api' import type { UserProfile, diff --git a/web/default/src/features/profile/hooks/use-two-fa.ts b/web/default/src/features/profile/hooks/use-two-fa.ts index cf3b5a80..62bf6105 100644 --- a/web/default/src/features/profile/hooks/use-two-fa.ts +++ b/web/default/src/features/profile/hooks/use-two-fa.ts @@ -17,7 +17,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useState, useEffect, useCallback } from 'react' + import { get2FAStatus } from '@/lib/api' + import type { TwoFAStatus } from '../types' // ============================================================================ diff --git a/web/default/src/features/profile/index.tsx b/web/default/src/features/profile/index.tsx index f66d9540..f65a8888 100644 --- a/web/default/src/features/profile/index.tsx +++ b/web/default/src/features/profile/index.tsx @@ -16,13 +16,14 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useAuthStore } from '@/stores/auth-store' -import { useStatus } from '@/hooks/use-status' import { Main } from '@/components/layout' import { CardStaggerContainer, CardStaggerItem, } from '@/components/page-transition' +import { useStatus } from '@/hooks/use-status' +import { useAuthStore } from '@/stores/auth-store' + import { CheckinCalendarCard } from './components/checkin-calendar-card' import { LanguagePreferencesCard } from './components/language-preferences-card' import { PasskeyCard } from './components/passkey-card' diff --git a/web/default/src/features/rankings/api.ts b/web/default/src/features/rankings/api.ts index e3ad4b13..6252ed06 100644 --- a/web/default/src/features/rankings/api.ts +++ b/web/default/src/features/rankings/api.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { api } from '@/lib/api' + import type { RankingPeriod, RankingsSnapshot } from './types' type RankingsResponse = { diff --git a/web/default/src/features/rankings/components/entity-links.tsx b/web/default/src/features/rankings/components/entity-links.tsx index 2c0501be..6e238551 100644 --- a/web/default/src/features/rankings/components/entity-links.tsx +++ b/web/default/src/features/rankings/components/entity-links.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { Link } from '@tanstack/react-router' + import { cn } from '@/lib/utils' type EntityLinkBaseProps = { diff --git a/web/default/src/features/rankings/components/market-share-section.tsx b/web/default/src/features/rankings/components/market-share-section.tsx index 9e4acb26..ddc400fc 100644 --- a/web/default/src/features/rankings/components/market-share-section.tsx +++ b/web/default/src/features/rankings/components/market-share-section.tsx @@ -16,12 +16,14 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useMemo } from 'react' import { VChart } from '@visactor/react-vchart' import { PieChart } from 'lucide-react' +import { useMemo } from 'react' import { useTranslation } from 'react-i18next' + import { useChartTheme } from '@/lib/use-chart-theme' import { VCHART_OPTION } from '@/lib/vchart' + import { formatShare, formatTokens } from '../lib/format' import type { RankingPeriod, VendorRanking, VendorShareSeries } from '../types' import { VendorLink } from './entity-links' diff --git a/web/default/src/features/rankings/components/model-leaderboard.tsx b/web/default/src/features/rankings/components/model-leaderboard.tsx index b2c6d2af..2f23f1d5 100644 --- a/web/default/src/features/rankings/components/model-leaderboard.tsx +++ b/web/default/src/features/rankings/components/model-leaderboard.tsx @@ -17,7 +17,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useTranslation } from 'react-i18next' + import { getLobeIcon } from '@/lib/lobe-icon' + import { formatTokens } from '../lib/format' import type { ModelRanking } from '../types' import { ModelLink, VendorLink } from './entity-links' diff --git a/web/default/src/features/rankings/components/models-section.tsx b/web/default/src/features/rankings/components/models-section.tsx index e28fa6a5..3555494a 100644 --- a/web/default/src/features/rankings/components/models-section.tsx +++ b/web/default/src/features/rankings/components/models-section.tsx @@ -16,12 +16,14 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useMemo } from 'react' import { VChart } from '@visactor/react-vchart' import { BarChart3, Trophy } from 'lucide-react' +import { useMemo } from 'react' import { useTranslation } from 'react-i18next' + import { useChartTheme } from '@/lib/use-chart-theme' import { VCHART_OPTION } from '@/lib/vchart' + import { formatTokens } from '../lib/format' import type { ModelHistorySeries, ModelRanking, RankingPeriod } from '../types' import { ModelLeaderboard } from './model-leaderboard' diff --git a/web/default/src/features/rankings/components/pulse-section.tsx b/web/default/src/features/rankings/components/pulse-section.tsx index 58802920..8c501208 100644 --- a/web/default/src/features/rankings/components/pulse-section.tsx +++ b/web/default/src/features/rankings/components/pulse-section.tsx @@ -23,8 +23,10 @@ import { TrendingUp, } from 'lucide-react' import { useTranslation } from 'react-i18next' + import { getLobeIcon } from '@/lib/lobe-icon' import { cn } from '@/lib/utils' + import type { RankingMover } from '../types' import { ModelLink, VendorLink } from './entity-links' diff --git a/web/default/src/features/rankings/components/rankings-hero.tsx b/web/default/src/features/rankings/components/rankings-hero.tsx index f5aa0717..77ff6618 100644 --- a/web/default/src/features/rankings/components/rankings-hero.tsx +++ b/web/default/src/features/rankings/components/rankings-hero.tsx @@ -17,7 +17,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useTranslation } from 'react-i18next' + import { cn } from '@/lib/utils' + import type { RankingPeriod } from '../types' const PERIODS: { id: RankingPeriod; labelKey: string }[] = [ diff --git a/web/default/src/features/rankings/hooks/use-rankings.ts b/web/default/src/features/rankings/hooks/use-rankings.ts index 71658fdb..39b327d0 100644 --- a/web/default/src/features/rankings/hooks/use-rankings.ts +++ b/web/default/src/features/rankings/hooks/use-rankings.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useQuery } from '@tanstack/react-query' + import { getRankings } from '../api' import type { RankingPeriod } from '../types' diff --git a/web/default/src/features/rankings/index.tsx b/web/default/src/features/rankings/index.tsx index 98056e9c..519c8d4f 100644 --- a/web/default/src/features/rankings/index.tsx +++ b/web/default/src/features/rankings/index.tsx @@ -18,9 +18,11 @@ For commercial licensing, please contact support@quantumnous.com */ import { useNavigate, useSearch } from '@tanstack/react-router' import { useTranslation } from 'react-i18next' -import { Skeleton } from '@/components/ui/skeleton' + import { PublicLayout } from '@/components/layout' import { PageTransition } from '@/components/page-transition' +import { Skeleton } from '@/components/ui/skeleton' + import { MarketShareSection, ModelsSection, diff --git a/web/default/src/features/redemption-codes/api.ts b/web/default/src/features/redemption-codes/api.ts index 957df8d8..1bfe3357 100644 --- a/web/default/src/features/redemption-codes/api.ts +++ b/web/default/src/features/redemption-codes/api.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { api } from '@/lib/api' + import type { Redemption, ApiResponse, diff --git a/web/default/src/features/redemption-codes/components/data-table-bulk-actions.tsx b/web/default/src/features/redemption-codes/components/data-table-bulk-actions.tsx index 904f9655..66e69aff 100644 --- a/web/default/src/features/redemption-codes/components/data-table-bulk-actions.tsx +++ b/web/default/src/features/redemption-codes/components/data-table-bulk-actions.tsx @@ -16,20 +16,22 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useMemo } from 'react' import { type Table } from '@tanstack/react-table' import { Trash2 } from 'lucide-react' +import { useState, useMemo } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' + +import { ConfirmDialog } from '@/components/confirm-dialog' +import { CopyButton } from '@/components/copy-button' +import { DataTableBulkActions as BulkActionsToolbar } from '@/components/data-table' import { Button } from '@/components/ui/button' import { Tooltip, TooltipContent, TooltipTrigger, } from '@/components/ui/tooltip' -import { ConfirmDialog } from '@/components/confirm-dialog' -import { CopyButton } from '@/components/copy-button' -import { DataTableBulkActions as BulkActionsToolbar } from '@/components/data-table' + import { deleteInvalidRedemptions } from '../api' import { type Redemption } from '../types' import { useRedemptions } from './redemptions-provider' diff --git a/web/default/src/features/redemption-codes/components/data-table-row-actions.tsx b/web/default/src/features/redemption-codes/components/data-table-row-actions.tsx index 2cba0e3e..b0dfa1c8 100644 --- a/web/default/src/features/redemption-codes/components/data-table-row-actions.tsx +++ b/web/default/src/features/redemption-codes/components/data-table-row-actions.tsx @@ -17,26 +17,23 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import type { Row } from '@tanstack/react-table' -import { - Trash2, - Edit, - Power, - PowerOff, -} from 'lucide-react' +import { Trash2, Edit, Power, PowerOff } from 'lucide-react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' + +import { DataTableRowActionMenu } from '@/components/data-table/core/row-action-menu' import { Button } from '@/components/ui/button' import { DropdownMenuItem, DropdownMenuSeparator, DropdownMenuShortcut, } from '@/components/ui/dropdown-menu' -import { DataTableRowActionMenu } from '@/components/data-table/core/row-action-menu' import { Tooltip, TooltipContent, TooltipTrigger, } from '@/components/ui/tooltip' + import { updateRedemptionStatus } from '../api' import { REDEMPTION_STATUS, SUCCESS_MESSAGES } from '../constants' import { isRedemptionExpired } from '../lib' diff --git a/web/default/src/features/redemption-codes/components/redemptions-columns.tsx b/web/default/src/features/redemption-codes/components/redemptions-columns.tsx index 8f3ad20d..73da30b2 100644 --- a/web/default/src/features/redemption-codes/components/redemptions-columns.tsx +++ b/web/default/src/features/redemption-codes/components/redemptions-columns.tsx @@ -18,16 +18,18 @@ For commercial licensing, please contact support@quantumnous.com */ import { type ColumnDef } from '@tanstack/react-table' import { useTranslation } from 'react-i18next' -import { formatQuota, formatTimestampToDate } from '@/lib/format' + +import { MaskedValueDisplay } from '@/components/masked-value-display' +import { StatusBadge } from '@/components/status-badge' +import { TableId } from '@/components/table-id' import { Checkbox } from '@/components/ui/checkbox' import { Tooltip, TooltipContent, TooltipTrigger, } from '@/components/ui/tooltip' -import { MaskedValueDisplay } from '@/components/masked-value-display' -import { StatusBadge } from '@/components/status-badge' -import { TableId } from '@/components/table-id' +import { formatQuota, formatTimestampToDate } from '@/lib/format' + import { REDEMPTION_FILTER_EXPIRED, REDEMPTION_STATUSES } from '../constants' import { isRedemptionExpired, isTimestampExpired } from '../lib' import { type Redemption } from '../types' diff --git a/web/default/src/features/redemption-codes/components/redemptions-delete-dialog.tsx b/web/default/src/features/redemption-codes/components/redemptions-delete-dialog.tsx index 286df506..0355355f 100644 --- a/web/default/src/features/redemption-codes/components/redemptions-delete-dialog.tsx +++ b/web/default/src/features/redemption-codes/components/redemptions-delete-dialog.tsx @@ -19,6 +19,7 @@ For commercial licensing, please contact support@quantumnous.com import { useState } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' + import { AlertDialog, AlertDialogAction, @@ -29,6 +30,7 @@ import { AlertDialogHeader, AlertDialogTitle, } from '@/components/ui/alert-dialog' + import { deleteRedemption } from '../api' import { SUCCESS_MESSAGES } from '../constants' import { useRedemptions } from './redemptions-provider' diff --git a/web/default/src/features/redemption-codes/components/redemptions-mutate-drawer.tsx b/web/default/src/features/redemption-codes/components/redemptions-mutate-drawer.tsx index d26b28ae..47f7a387 100644 --- a/web/default/src/features/redemption-codes/components/redemptions-mutate-drawer.tsx +++ b/web/default/src/features/redemption-codes/components/redemptions-mutate-drawer.tsx @@ -16,14 +16,20 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ +import { zodResolver } from '@hookform/resolvers/zod' import { type FormEvent, useEffect, useState } from 'react' import { useForm } from 'react-hook-form' -import { zodResolver } from '@hookform/resolvers/zod' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { getCurrencyDisplay, getCurrencyLabel } from '@/lib/currency' -import { formatQuota, parseQuotaFromDollars } from '@/lib/format' -import { addTimeToDate } from '@/lib/time' + +import { DateTimePicker } from '@/components/datetime-picker' +import { + SideDrawerSection, + sideDrawerContentClassName, + sideDrawerFooterClassName, + sideDrawerFormClassName, + sideDrawerHeaderClassName, +} from '@/components/drawer-layout' import { Button } from '@/components/ui/button' import { Form, @@ -44,14 +50,10 @@ import { SheetHeader, SheetTitle, } from '@/components/ui/sheet' -import { DateTimePicker } from '@/components/datetime-picker' -import { - SideDrawerSection, - sideDrawerContentClassName, - sideDrawerFooterClassName, - sideDrawerFormClassName, - sideDrawerHeaderClassName, -} from '@/components/drawer-layout' +import { getCurrencyDisplay, getCurrencyLabel } from '@/lib/currency' +import { formatQuota, parseQuotaFromDollars } from '@/lib/format' +import { addTimeToDate } from '@/lib/time' + import { createRedemption, updateRedemption, getRedemption } from '../api' import { SUCCESS_MESSAGES } from '../constants' import { diff --git a/web/default/src/features/redemption-codes/components/redemptions-primary-buttons.tsx b/web/default/src/features/redemption-codes/components/redemptions-primary-buttons.tsx index 807aac50..39fa8aae 100644 --- a/web/default/src/features/redemption-codes/components/redemptions-primary-buttons.tsx +++ b/web/default/src/features/redemption-codes/components/redemptions-primary-buttons.tsx @@ -18,7 +18,9 @@ For commercial licensing, please contact support@quantumnous.com */ import { Plus } from 'lucide-react' import { useTranslation } from 'react-i18next' + import { Button } from '@/components/ui/button' + import { useRedemptions } from './redemptions-provider' export function RedemptionsPrimaryButtons() { diff --git a/web/default/src/features/redemption-codes/components/redemptions-provider.tsx b/web/default/src/features/redemption-codes/components/redemptions-provider.tsx index 42dc09bd..fbd511db 100644 --- a/web/default/src/features/redemption-codes/components/redemptions-provider.tsx +++ b/web/default/src/features/redemption-codes/components/redemptions-provider.tsx @@ -17,7 +17,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import React, { useState } from 'react' + import useDialogState from '@/hooks/use-dialog' + import { type Redemption, type RedemptionsDialogType } from '../types' type RedemptionsContextType = { diff --git a/web/default/src/features/redemption-codes/components/redemptions-table.tsx b/web/default/src/features/redemption-codes/components/redemptions-table.tsx index 59b2a4c1..ed68f1db 100644 --- a/web/default/src/features/redemption-codes/components/redemptions-table.tsx +++ b/web/default/src/features/redemption-codes/components/redemptions-table.tsx @@ -16,18 +16,20 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useMemo } from 'react' import { useQuery } from '@tanstack/react-query' import { getRouteApi } from '@tanstack/react-router' -import { useMediaQuery } from '@/hooks' +import { useMemo } from 'react' import { useTranslation } from 'react-i18next' -import { useTableUrlState } from '@/hooks/use-table-url-state' + import { DISABLED_ROW_DESKTOP, DISABLED_ROW_MOBILE, DataTablePage, useDataTable, } from '@/components/data-table' +import { useMediaQuery } from '@/hooks' +import { useTableUrlState } from '@/hooks/use-table-url-state' + import { getRedemptions, searchRedemptions } from '../api' import { REDEMPTION_STATUS, getRedemptionStatusOptions } from '../constants' import { isRedemptionExpired } from '../lib' diff --git a/web/default/src/features/redemption-codes/constants.ts b/web/default/src/features/redemption-codes/constants.ts index 794c76c1..ef20a2b4 100644 --- a/web/default/src/features/redemption-codes/constants.ts +++ b/web/default/src/features/redemption-codes/constants.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { type TFunction } from 'i18next' + import { type StatusBadgeProps } from '@/components/status-badge' // ============================================================================ diff --git a/web/default/src/features/redemption-codes/index.tsx b/web/default/src/features/redemption-codes/index.tsx index eac6286c..a2fc859e 100644 --- a/web/default/src/features/redemption-codes/index.tsx +++ b/web/default/src/features/redemption-codes/index.tsx @@ -17,7 +17,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useTranslation } from 'react-i18next' + import { SectionPageLayout } from '@/components/layout' + import { RedemptionsDialogs } from './components/redemptions-dialogs' import { RedemptionsPrimaryButtons } from './components/redemptions-primary-buttons' import { RedemptionsProvider } from './components/redemptions-provider' diff --git a/web/default/src/features/redemption-codes/lib/redemption-form.ts b/web/default/src/features/redemption-codes/lib/redemption-form.ts index 97403327..fa4c3059 100644 --- a/web/default/src/features/redemption-codes/lib/redemption-form.ts +++ b/web/default/src/features/redemption-codes/lib/redemption-form.ts @@ -16,9 +16,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { z } from 'zod' import type { TFunction } from 'i18next' +import { z } from 'zod' + import { parseQuotaFromDollars, quotaUnitsToDollars } from '@/lib/format' + import { REDEMPTION_VALIDATION, getRedemptionFormErrorMessages, diff --git a/web/default/src/features/setup/api.ts b/web/default/src/features/setup/api.ts index b55bae4d..42bcacd7 100644 --- a/web/default/src/features/setup/api.ts +++ b/web/default/src/features/setup/api.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { api } from '@/lib/api' + import type { SetupFormValues, SetupResponse } from './types' export async function getSetupStatus(): Promise { diff --git a/web/default/src/features/setup/components/admin-step.tsx b/web/default/src/features/setup/components/admin-step.tsx index 24c822bd..3f559787 100644 --- a/web/default/src/features/setup/components/admin-step.tsx +++ b/web/default/src/features/setup/components/admin-step.tsx @@ -16,9 +16,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import type { UseFormReturn } from 'react-hook-form' import { ShieldCheck } from 'lucide-react' +import type { UseFormReturn } from 'react-hook-form' import { useTranslation } from 'react-i18next' + +import { PasswordInput } from '@/components/password-input' import { Alert, AlertDescription } from '@/components/ui/alert' import { FormControl, @@ -28,7 +30,7 @@ import { FormMessage, } from '@/components/ui/form' import { Input } from '@/components/ui/input' -import { PasswordInput } from '@/components/password-input' + import type { SetupFormValues } from '../types' interface AdminStepProps { diff --git a/web/default/src/features/setup/components/complete-step.tsx b/web/default/src/features/setup/components/complete-step.tsx index 924ed8ed..c9bf8fe5 100644 --- a/web/default/src/features/setup/components/complete-step.tsx +++ b/web/default/src/features/setup/components/complete-step.tsx @@ -18,8 +18,10 @@ For commercial licensing, please contact support@quantumnous.com */ import { CheckCircle2 } from 'lucide-react' import { useTranslation } from 'react-i18next' -import { Separator } from '@/components/ui/separator' + import { StatusBadge } from '@/components/status-badge' +import { Separator } from '@/components/ui/separator' + import type { SetupFormValues, SetupStatus } from '../types' interface CompleteStepProps { diff --git a/web/default/src/features/setup/components/database-step.tsx b/web/default/src/features/setup/components/database-step.tsx index 8780193e..eac5f86d 100644 --- a/web/default/src/features/setup/components/database-step.tsx +++ b/web/default/src/features/setup/components/database-step.tsx @@ -18,8 +18,10 @@ For commercial licensing, please contact support@quantumnous.com */ import { Database, HardDrive, Server } from 'lucide-react' import { useTranslation } from 'react-i18next' -import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert' + import { StatusBadge } from '@/components/status-badge' +import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert' + import type { SetupStatus } from '../types' interface DatabaseStepProps { diff --git a/web/default/src/features/setup/components/step-navigation.tsx b/web/default/src/features/setup/components/step-navigation.tsx index 6f1bbba9..e72cf171 100644 --- a/web/default/src/features/setup/components/step-navigation.tsx +++ b/web/default/src/features/setup/components/step-navigation.tsx @@ -18,6 +18,7 @@ For commercial licensing, please contact support@quantumnous.com */ import { CheckCircle2, Loader2 } from 'lucide-react' import { useTranslation } from 'react-i18next' + import { Button } from '@/components/ui/button' interface StepNavigationProps { diff --git a/web/default/src/features/setup/components/usage-mode-step.tsx b/web/default/src/features/setup/components/usage-mode-step.tsx index 4a7dda19..a712faef 100644 --- a/web/default/src/features/setup/components/usage-mode-step.tsx +++ b/web/default/src/features/setup/components/usage-mode-step.tsx @@ -16,11 +16,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ +import { Building2, Home, Presentation } from 'lucide-react' import type { ComponentType } from 'react' import type { UseFormReturn } from 'react-hook-form' -import { Building2, Home, Presentation } from 'lucide-react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + import { FormControl, FormField, @@ -30,6 +30,8 @@ import { } from '@/components/ui/form' import { Label } from '@/components/ui/label' import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group' +import { cn } from '@/lib/utils' + import type { SetupFormValues, SetupUsageMode } from '../types' interface UsageModeStepProps { diff --git a/web/default/src/features/setup/setup-wizard.tsx b/web/default/src/features/setup/setup-wizard.tsx index bc0b9827..9fbab3f8 100644 --- a/web/default/src/features/setup/setup-wizard.tsx +++ b/web/default/src/features/setup/setup-wizard.tsx @@ -16,14 +16,16 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useMemo, useState } from 'react' -import { useForm } from 'react-hook-form' import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query' import { useNavigate } from '@tanstack/react-router' +import { useEffect, useMemo, useState } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { cn } from '@/lib/utils' -import { useSystemConfig } from '@/hooks/use-system-config' + +import { ErrorState } from '@/components/error-state' +import { LanguageSwitcher } from '@/components/language-switcher' +import { LoadingState } from '@/components/loading-state' import { Card, CardContent, @@ -34,9 +36,9 @@ import { } from '@/components/ui/card' import { Form } from '@/components/ui/form' import { Skeleton } from '@/components/ui/skeleton' -import { ErrorState } from '@/components/error-state' -import { LanguageSwitcher } from '@/components/language-switcher' -import { LoadingState } from '@/components/loading-state' +import { useSystemConfig } from '@/hooks/use-system-config' +import { cn } from '@/lib/utils' + import { buildSetupPayload, getSetupStatus, submitSetup } from './api' import { AdminStep } from './components/admin-step' import { CompleteStep } from './components/complete-step' diff --git a/web/default/src/features/subscriptions/api.ts b/web/default/src/features/subscriptions/api.ts index 08347cba..21da6776 100644 --- a/web/default/src/features/subscriptions/api.ts +++ b/web/default/src/features/subscriptions/api.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { api } from '@/lib/api' + import type { ApiResponse, PlanRecord, diff --git a/web/default/src/features/subscriptions/components/data-table-row-actions.tsx b/web/default/src/features/subscriptions/components/data-table-row-actions.tsx index 7ec3e765..a37ee38c 100644 --- a/web/default/src/features/subscriptions/components/data-table-row-actions.tsx +++ b/web/default/src/features/subscriptions/components/data-table-row-actions.tsx @@ -19,12 +19,14 @@ For commercial licensing, please contact support@quantumnous.com import type { Row } from '@tanstack/react-table' import { Pencil, Power, PowerOff } from 'lucide-react' import { useTranslation } from 'react-i18next' + import { Button } from '@/components/ui/button' import { Tooltip, TooltipContent, TooltipTrigger, } from '@/components/ui/tooltip' + import type { PlanRecord } from '../types' import { useSubscriptions } from './subscriptions-provider' diff --git a/web/default/src/features/subscriptions/components/dialogs/subscription-purchase-dialog.tsx b/web/default/src/features/subscriptions/components/dialogs/subscription-purchase-dialog.tsx index cfe4a994..1c127c1d 100644 --- a/web/default/src/features/subscriptions/components/dialogs/subscription-purchase-dialog.tsx +++ b/web/default/src/features/subscriptions/components/dialogs/subscription-purchase-dialog.tsx @@ -16,13 +16,13 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useEffect } from 'react' import { Crown, CalendarClock, Package } from 'lucide-react' +import { useState, useEffect } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { DEFAULT_CURRENCY_CONFIG } from '@/stores/system-config-store' -import { formatQuota } from '@/lib/format' -import { useSystemConfig } from '@/hooks/use-system-config' + +import { Dialog } from '@/components/dialog' +import { GroupBadge } from '@/components/group-badge' import { Alert, AlertDescription } from '@/components/ui/alert' import { Button } from '@/components/ui/button' import { @@ -34,8 +34,10 @@ import { SelectValue, } from '@/components/ui/select' import { Separator } from '@/components/ui/separator' -import { Dialog } from '@/components/dialog' -import { GroupBadge } from '@/components/group-badge' +import { useSystemConfig } from '@/hooks/use-system-config' +import { formatQuota } from '@/lib/format' +import { DEFAULT_CURRENCY_CONFIG } from '@/stores/system-config-store' + import { paySubscriptionStripe, paySubscriptionCreem, diff --git a/web/default/src/features/subscriptions/components/dialogs/toggle-status-dialog.tsx b/web/default/src/features/subscriptions/components/dialogs/toggle-status-dialog.tsx index 08013ada..40f671ef 100644 --- a/web/default/src/features/subscriptions/components/dialogs/toggle-status-dialog.tsx +++ b/web/default/src/features/subscriptions/components/dialogs/toggle-status-dialog.tsx @@ -19,7 +19,9 @@ For commercial licensing, please contact support@quantumnous.com import { useState } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' + import { ConfirmDialog } from '@/components/confirm-dialog' + import { patchPlanStatus } from '../../api' import { useSubscriptions } from '../subscriptions-provider' diff --git a/web/default/src/features/subscriptions/components/dialogs/user-subscriptions-dialog.tsx b/web/default/src/features/subscriptions/components/dialogs/user-subscriptions-dialog.tsx index e197452d..2b2bf90e 100644 --- a/web/default/src/features/subscriptions/components/dialogs/user-subscriptions-dialog.tsx +++ b/web/default/src/features/subscriptions/components/dialogs/user-subscriptions-dialog.tsx @@ -16,10 +16,20 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useCallback, useEffect, useMemo, useState } from 'react' import { Plus } from 'lucide-react' +import { useCallback, useEffect, useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' + +import { ConfirmDialog } from '@/components/confirm-dialog' +import { StaticDataTable } from '@/components/data-table' +import { + sideDrawerContentClassName, + sideDrawerFormClassName, + sideDrawerHeaderClassName, +} from '@/components/drawer-layout' +import { StatusBadge } from '@/components/status-badge' +import { TableId } from '@/components/table-id' import { Button } from '@/components/ui/button' import { Select, @@ -36,15 +46,8 @@ import { SheetTitle, SheetDescription, } from '@/components/ui/sheet' -import { ConfirmDialog } from '@/components/confirm-dialog' -import { StaticDataTable } from '@/components/data-table' -import { - sideDrawerContentClassName, - sideDrawerFormClassName, - sideDrawerHeaderClassName, -} from '@/components/drawer-layout' -import { StatusBadge } from '@/components/status-badge' -import { TableId } from '@/components/table-id' +import { formatQuota } from '@/lib/format' + import { getAdminPlans, getUserSubscriptions, @@ -52,7 +55,6 @@ import { invalidateUserSubscription, deleteUserSubscription, } from '../../api' -import { formatQuota } from '@/lib/format' import { formatTimestamp } from '../../lib' import type { PlanRecord, UserSubscriptionRecord } from '../../types' diff --git a/web/default/src/features/subscriptions/components/subscriptions-columns.tsx b/web/default/src/features/subscriptions/components/subscriptions-columns.tsx index 980a56cc..a23148ba 100644 --- a/web/default/src/features/subscriptions/components/subscriptions-columns.tsx +++ b/web/default/src/features/subscriptions/components/subscriptions-columns.tsx @@ -16,14 +16,16 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useMemo } from 'react' import { type ColumnDef } from '@tanstack/react-table' +import { useMemo } from 'react' import { useTranslation } from 'react-i18next' -import { formatQuota } from '@/lib/format' + import { BadgeCell } from '@/components/data-table' import { GroupBadge } from '@/components/group-badge' import { StatusBadge } from '@/components/status-badge' import { TableId } from '@/components/table-id' +import { formatQuota } from '@/lib/format' + import { formatDuration, formatResetPeriod } from '../lib' import type { PlanRecord } from '../types' import { DataTableRowActions } from './data-table-row-actions' diff --git a/web/default/src/features/subscriptions/components/subscriptions-mutate-drawer.tsx b/web/default/src/features/subscriptions/components/subscriptions-mutate-drawer.tsx index 8425fb85..4f2dd177 100644 --- a/web/default/src/features/subscriptions/components/subscriptions-mutate-drawer.tsx +++ b/web/default/src/features/subscriptions/components/subscriptions-mutate-drawer.tsx @@ -16,12 +16,21 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useState } from 'react' -import { useForm, type Resolver } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' import { CalendarClock, CreditCard, RefreshCw, Settings2 } from 'lucide-react' +import { useEffect, useState } from 'react' +import { useForm, type Resolver } from 'react-hook-form' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' + +import { + SideDrawerSection, + sideDrawerContentClassName, + sideDrawerFooterClassName, + sideDrawerFormClassName, + sideDrawerHeaderClassName, + sideDrawerSwitchItemClassName, +} from '@/components/drawer-layout' import { Button } from '@/components/ui/button' import { Form, @@ -51,14 +60,8 @@ import { SheetTitle, } from '@/components/ui/sheet' import { Switch } from '@/components/ui/switch' -import { - SideDrawerSection, - sideDrawerContentClassName, - sideDrawerFooterClassName, - sideDrawerFormClassName, - sideDrawerHeaderClassName, - sideDrawerSwitchItemClassName, -} from '@/components/drawer-layout' +import { getCurrencyDisplay, getCurrencyLabel } from '@/lib/currency' + import { createPlan, updatePlan, @@ -66,7 +69,6 @@ import { createWaffoPancakeSubscriptionProduct, listWaffoPancakeSubscriptionProductOptions, } from '../api' -import { getCurrencyDisplay, getCurrencyLabel } from '@/lib/currency' import { getDurationUnitOptions, getResetPeriodOptions } from '../constants' import { getPlanFormSchema, @@ -457,7 +459,9 @@ export function SubscriptionsMutateDrawer({ - {t('Downgrade to this group after the subscription expires')} + {t( + 'Downgrade to this group after the subscription expires' + )} diff --git a/web/default/src/features/subscriptions/components/subscriptions-primary-buttons.tsx b/web/default/src/features/subscriptions/components/subscriptions-primary-buttons.tsx index 437e7ae9..448def03 100644 --- a/web/default/src/features/subscriptions/components/subscriptions-primary-buttons.tsx +++ b/web/default/src/features/subscriptions/components/subscriptions-primary-buttons.tsx @@ -18,7 +18,9 @@ For commercial licensing, please contact support@quantumnous.com */ import { Plus } from 'lucide-react' import { useTranslation } from 'react-i18next' + import { Button } from '@/components/ui/button' + import { useSubscriptions } from './subscriptions-provider' export function SubscriptionsPrimaryButtons() { diff --git a/web/default/src/features/subscriptions/components/subscriptions-provider.tsx b/web/default/src/features/subscriptions/components/subscriptions-provider.tsx index 454d5c39..03093ddf 100644 --- a/web/default/src/features/subscriptions/components/subscriptions-provider.tsx +++ b/web/default/src/features/subscriptions/components/subscriptions-provider.tsx @@ -17,11 +17,13 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import React, { useState } from 'react' -import useDialogState from '@/hooks/use-dialog' + import { getOptionValue, useSystemOptions, } from '@/features/system-settings/hooks/use-system-options' +import useDialogState from '@/hooks/use-dialog' + import { type PlanRecord, type SubscriptionsDialogType } from '../types' const CURRENT_COMPLIANCE_TERMS_VERSION = 'v1' diff --git a/web/default/src/features/subscriptions/components/subscriptions-table.tsx b/web/default/src/features/subscriptions/components/subscriptions-table.tsx index 3e5eb759..ec371a1a 100644 --- a/web/default/src/features/subscriptions/components/subscriptions-table.tsx +++ b/web/default/src/features/subscriptions/components/subscriptions-table.tsx @@ -16,10 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useMemo } from 'react' import { useQuery } from '@tanstack/react-query' +import { useMemo } from 'react' import { useTranslation } from 'react-i18next' + import { DataTablePage, useDataTable } from '@/components/data-table' + import { getAdminPlans } from '../api' import { useSubscriptionsColumns } from './subscriptions-columns' import { useSubscriptions } from './subscriptions-provider' diff --git a/web/default/src/features/subscriptions/index.tsx b/web/default/src/features/subscriptions/index.tsx index 0bb8d4aa..c15e0944 100644 --- a/web/default/src/features/subscriptions/index.tsx +++ b/web/default/src/features/subscriptions/index.tsx @@ -18,8 +18,10 @@ For commercial licensing, please contact support@quantumnous.com */ import { Info } from 'lucide-react' import { useTranslation } from 'react-i18next' -import { Alert, AlertDescription } from '@/components/ui/alert' + import { SectionPageLayout } from '@/components/layout' +import { Alert, AlertDescription } from '@/components/ui/alert' + import { SubscriptionsDialogs } from './components/subscriptions-dialogs' import { SubscriptionsPrimaryButtons } from './components/subscriptions-primary-buttons' import { diff --git a/web/default/src/features/subscriptions/lib/format.ts b/web/default/src/features/subscriptions/lib/format.ts index 3d035bfc..8154edd8 100644 --- a/web/default/src/features/subscriptions/lib/format.ts +++ b/web/default/src/features/subscriptions/lib/format.ts @@ -17,7 +17,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import type { TFunction } from 'i18next' + import dayjs from '@/lib/dayjs' + import type { SubscriptionPlan } from '../types' export function formatDuration( diff --git a/web/default/src/features/subscriptions/lib/plan-form.ts b/web/default/src/features/subscriptions/lib/plan-form.ts index 381f26bc..feaaeb2a 100644 --- a/web/default/src/features/subscriptions/lib/plan-form.ts +++ b/web/default/src/features/subscriptions/lib/plan-form.ts @@ -16,9 +16,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { z } from 'zod' import type { TFunction } from 'i18next' +import { z } from 'zod' + import { parseQuotaFromDollars, quotaUnitsToDollars } from '@/lib/format' + import type { SubscriptionPlan, PlanPayload } from '../types' export function getPlanFormSchema(t: TFunction) { diff --git a/web/default/src/features/system-info/api.ts b/web/default/src/features/system-info/api.ts index 326d4aaa..d571295c 100644 --- a/web/default/src/features/system-info/api.ts +++ b/web/default/src/features/system-info/api.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { api } from '@/lib/api' + import type { SystemInstanceListResponse } from './types' export async function listSystemInstances() { diff --git a/web/default/src/features/system-info/components/system-instances-panel.tsx b/web/default/src/features/system-info/components/system-instances-panel.tsx index 5e546cdf..5348614d 100644 --- a/web/default/src/features/system-info/components/system-instances-panel.tsx +++ b/web/default/src/features/system-info/components/system-instances-panel.tsx @@ -20,8 +20,7 @@ import { useQuery } from '@tanstack/react-query' import { AlertTriangle, RefreshCw, ServerCog } from 'lucide-react' import type { ReactNode } from 'react' import { useTranslation } from 'react-i18next' -import { formatTimestampRelative, formatTimestampToDate } from '@/lib/format' -import { cn } from '@/lib/utils' + import { ErrorState } from '@/components/error-state' import { Badge } from '@/components/ui/badge' import { Button } from '@/components/ui/button' @@ -48,6 +47,9 @@ import { TooltipProvider, TooltipTrigger, } from '@/components/ui/tooltip' +import { formatTimestampRelative, formatTimestampToDate } from '@/lib/format' +import { cn } from '@/lib/utils' + import { listSystemInstances } from '../api' import type { SystemInstance, SystemInstanceStatus } from '../types' @@ -225,7 +227,9 @@ function SystemInstancesList(props: SystemInstancesTableProps) { {t('Role')} {t('CPU')} - {t('Memory')} + + {t('Memory')} + {t('Storage')} @@ -320,7 +324,10 @@ function SystemInstancesList(props: SystemInstancesTableProps) { - + {formatTimestampToDate(instance.started_at)} {formatTimestampRelative( diff --git a/web/default/src/features/system-info/components/system-tasks-panel.tsx b/web/default/src/features/system-info/components/system-tasks-panel.tsx index f3c439e0..0cd6f499 100644 --- a/web/default/src/features/system-info/components/system-tasks-panel.tsx +++ b/web/default/src/features/system-info/components/system-tasks-panel.tsx @@ -19,8 +19,7 @@ For commercial licensing, please contact support@quantumnous.com import { useQuery } from '@tanstack/react-query' import { ListChecks, RefreshCw } from 'lucide-react' import { useTranslation } from 'react-i18next' -import { formatTimestampRelative, formatTimestampToDate } from '@/lib/format' -import { cn } from '@/lib/utils' + import { ErrorState } from '@/components/error-state' import { Badge } from '@/components/ui/badge' import { Button } from '@/components/ui/button' @@ -39,6 +38,8 @@ import type { SystemTask, SystemTaskStatus, } from '@/features/system-settings/types' +import { formatTimestampRelative, formatTimestampToDate } from '@/lib/format' +import { cn } from '@/lib/utils' const TASK_LIMIT = 20 const ACTIVE_POLL_INTERVAL_MS = 8000 @@ -51,7 +52,8 @@ const STATUS_VARIANT: Record = { } const STATUS_CLASS_NAME: Record = { - pending: 'bg-amber-50 text-amber-700 dark:bg-amber-500/15 dark:text-amber-300', + pending: + 'bg-amber-50 text-amber-700 dark:bg-amber-500/15 dark:text-amber-300', running: 'bg-sky-50 text-sky-700 dark:bg-sky-500/15 dark:text-sky-300 [&_span]:bg-sky-500', succeeded: @@ -173,11 +175,11 @@ function SystemTasksTable(props: SystemTasksTableProps) {
- + {task.locked_by || '-'} {formatTimestampRelative( @@ -187,7 +189,7 @@ function SystemTasksTable(props: SystemTasksTableProps) { )} {task.error || '-'} diff --git a/web/default/src/features/system-info/index.tsx b/web/default/src/features/system-info/index.tsx index edc1dbb7..4b1a6f95 100644 --- a/web/default/src/features/system-info/index.tsx +++ b/web/default/src/features/system-info/index.tsx @@ -17,8 +17,10 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useTranslation } from 'react-i18next' + import { SectionPageLayout } from '@/components/layout' import { Badge } from '@/components/ui/badge' + import { SystemInstancesPanel } from './components/system-instances-panel' import { SystemTasksPanel } from './components/system-tasks-panel' diff --git a/web/default/src/features/system-settings/api.ts b/web/default/src/features/system-settings/api.ts index f7d7463a..9e9c9a7f 100644 --- a/web/default/src/features/system-settings/api.ts +++ b/web/default/src/features/system-settings/api.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { api } from '@/lib/api' + import type { ConfirmPaymentComplianceResponse, FetchUpstreamRatiosRequest, diff --git a/web/default/src/features/system-settings/auth/basic-auth-section.tsx b/web/default/src/features/system-settings/auth/basic-auth-section.tsx index 8d53ea1a..624571d6 100644 --- a/web/default/src/features/system-settings/auth/basic-auth-section.tsx +++ b/web/default/src/features/system-settings/auth/basic-auth-section.tsx @@ -16,11 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useMemo } from 'react' -import * as z from 'zod' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' +import { useMemo } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' +import * as z from 'zod' + import { Form, FormControl, @@ -32,6 +33,7 @@ import { } from '@/components/ui/form' import { Switch } from '@/components/ui/switch' import { Textarea } from '@/components/ui/textarea' + import { SettingsForm, SettingsSwitchContent, diff --git a/web/default/src/features/system-settings/auth/bot-protection-section.tsx b/web/default/src/features/system-settings/auth/bot-protection-section.tsx index 44943705..33161393 100644 --- a/web/default/src/features/system-settings/auth/bot-protection-section.tsx +++ b/web/default/src/features/system-settings/auth/bot-protection-section.tsx @@ -16,11 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect } from 'react' -import * as z from 'zod' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' +import { useEffect } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' +import * as z from 'zod' + import { Form, FormControl, @@ -32,6 +33,7 @@ import { } from '@/components/ui/form' import { Input } from '@/components/ui/input' import { Switch } from '@/components/ui/switch' + import { SettingsForm, SettingsSwitchContent, diff --git a/web/default/src/features/system-settings/auth/custom-oauth/api.ts b/web/default/src/features/system-settings/auth/custom-oauth/api.ts index ab1fad98..877f87b7 100644 --- a/web/default/src/features/system-settings/auth/custom-oauth/api.ts +++ b/web/default/src/features/system-settings/auth/custom-oauth/api.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { api } from '@/lib/api' + import type { CustomOAuthProvider, DiscoveryResponse } from './types' // ============================================================================ diff --git a/web/default/src/features/system-settings/auth/custom-oauth/components/discovery-button.tsx b/web/default/src/features/system-settings/auth/custom-oauth/components/discovery-button.tsx index 718b8808..b26eb8af 100644 --- a/web/default/src/features/system-settings/auth/custom-oauth/components/discovery-button.tsx +++ b/web/default/src/features/system-settings/auth/custom-oauth/components/discovery-button.tsx @@ -16,11 +16,13 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import type { UseFormReturn } from 'react-hook-form' import { Search } from 'lucide-react' +import type { UseFormReturn } from 'react-hook-form' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' + import { Button } from '@/components/ui/button' + import { useDiscoverEndpoints } from '../hooks/use-custom-oauth-mutations' import type { CustomOAuthFormValues } from '../types' diff --git a/web/default/src/features/system-settings/auth/custom-oauth/components/preset-selector.tsx b/web/default/src/features/system-settings/auth/custom-oauth/components/preset-selector.tsx index 70293102..b39a54a7 100644 --- a/web/default/src/features/system-settings/auth/custom-oauth/components/preset-selector.tsx +++ b/web/default/src/features/system-settings/auth/custom-oauth/components/preset-selector.tsx @@ -19,6 +19,7 @@ For commercial licensing, please contact support@quantumnous.com import { useState } from 'react' import type { UseFormReturn } from 'react-hook-form' import { useTranslation } from 'react-i18next' + import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' import { @@ -29,6 +30,7 @@ import { SelectTrigger, SelectValue, } from '@/components/ui/select' + import { SettingsControlGroup } from '../../../components/settings-form-layout' import { OAUTH_PRESETS, type CustomOAuthFormValues } from '../types' diff --git a/web/default/src/features/system-settings/auth/custom-oauth/components/provider-form-dialog.tsx b/web/default/src/features/system-settings/auth/custom-oauth/components/provider-form-dialog.tsx index 5685769a..aa850e30 100644 --- a/web/default/src/features/system-settings/auth/custom-oauth/components/provider-form-dialog.tsx +++ b/web/default/src/features/system-settings/auth/custom-oauth/components/provider-form-dialog.tsx @@ -16,10 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ +import { zodResolver } from '@hookform/resolvers/zod' import { useEffect } from 'react' import { type Resolver, useForm } from 'react-hook-form' -import { zodResolver } from '@hookform/resolvers/zod' import { useTranslation } from 'react-i18next' + +import { Dialog } from '@/components/dialog' import { Button } from '@/components/ui/button' import { Form, @@ -42,7 +44,7 @@ import { import { Separator } from '@/components/ui/separator' import { Switch } from '@/components/ui/switch' import { Textarea } from '@/components/ui/textarea' -import { Dialog } from '@/components/dialog' + import { SettingsForm, SettingsSwitchContent, diff --git a/web/default/src/features/system-settings/auth/custom-oauth/components/provider-table.tsx b/web/default/src/features/system-settings/auth/custom-oauth/components/provider-table.tsx index 9a611ebe..86704e97 100644 --- a/web/default/src/features/system-settings/auth/custom-oauth/components/provider-table.tsx +++ b/web/default/src/features/system-settings/auth/custom-oauth/components/provider-table.tsx @@ -16,15 +16,17 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState } from 'react' import { Plus } from 'lucide-react' +import { useState } from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/components/ui/button' + import { ConfirmDialog } from '@/components/confirm-dialog' import { BadgeCell } from '@/components/data-table/core/badge-cell' import { StaticDataTable } from '@/components/data-table/static/static-data-table' import { StaticRowActions } from '@/components/data-table/static/static-row-actions' import { StatusBadge } from '@/components/status-badge' +import { Button } from '@/components/ui/button' + import { useDeleteProvider } from '../hooks/use-custom-oauth-mutations' import type { CustomOAuthProvider } from '../types' diff --git a/web/default/src/features/system-settings/auth/custom-oauth/custom-oauth-section.tsx b/web/default/src/features/system-settings/auth/custom-oauth/custom-oauth-section.tsx index 39517cd9..d32f08d4 100644 --- a/web/default/src/features/system-settings/auth/custom-oauth/custom-oauth-section.tsx +++ b/web/default/src/features/system-settings/auth/custom-oauth/custom-oauth-section.tsx @@ -18,6 +18,7 @@ For commercial licensing, please contact support@quantumnous.com */ import { useState } from 'react' import { useTranslation } from 'react-i18next' + import { SettingsSection } from '../../components/settings-section' import { ProviderFormDialog } from './components/provider-form-dialog' import { ProviderTable } from './components/provider-table' diff --git a/web/default/src/features/system-settings/auth/custom-oauth/hooks/use-custom-oauth-mutations.ts b/web/default/src/features/system-settings/auth/custom-oauth/hooks/use-custom-oauth-mutations.ts index 05440b37..bef5ede0 100644 --- a/web/default/src/features/system-settings/auth/custom-oauth/hooks/use-custom-oauth-mutations.ts +++ b/web/default/src/features/system-settings/auth/custom-oauth/hooks/use-custom-oauth-mutations.ts @@ -19,6 +19,7 @@ For commercial licensing, please contact support@quantumnous.com import { useMutation, useQueryClient } from '@tanstack/react-query' import i18next from 'i18next' import { toast } from 'sonner' + import { createCustomOAuthProvider, updateCustomOAuthProvider, diff --git a/web/default/src/features/system-settings/auth/custom-oauth/hooks/use-custom-oauth-providers.ts b/web/default/src/features/system-settings/auth/custom-oauth/hooks/use-custom-oauth-providers.ts index 0670687c..e5a921db 100644 --- a/web/default/src/features/system-settings/auth/custom-oauth/hooks/use-custom-oauth-providers.ts +++ b/web/default/src/features/system-settings/auth/custom-oauth/hooks/use-custom-oauth-providers.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useQuery } from '@tanstack/react-query' + import { getCustomOAuthProviders } from '../api' export function useCustomOAuthProviders() { diff --git a/web/default/src/features/system-settings/auth/oauth-section.tsx b/web/default/src/features/system-settings/auth/oauth-section.tsx index 741d3123..fa929ee0 100644 --- a/web/default/src/features/system-settings/auth/oauth-section.tsx +++ b/web/default/src/features/system-settings/auth/oauth-section.tsx @@ -16,13 +16,14 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useMemo, useRef, useState } from 'react' -import * as z from 'zod' -import axios from 'axios' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' +import axios from 'axios' +import { useEffect, useMemo, useRef, useState } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' +import * as z from 'zod' + import { Form, FormControl, @@ -35,6 +36,7 @@ import { import { Input } from '@/components/ui/input' import { Switch } from '@/components/ui/switch' import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs' + import { FormDirtyIndicator } from '../components/form-dirty-indicator' import { FormNavigationGuard } from '../components/form-navigation-guard' import { diff --git a/web/default/src/features/system-settings/auth/passkey-section.tsx b/web/default/src/features/system-settings/auth/passkey-section.tsx index ec889ee9..c2296196 100644 --- a/web/default/src/features/system-settings/auth/passkey-section.tsx +++ b/web/default/src/features/system-settings/auth/passkey-section.tsx @@ -16,12 +16,13 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useMemo, useRef } from 'react' -import * as z from 'zod' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' +import { useEffect, useMemo, useRef } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' +import * as z from 'zod' + import { Form, FormControl, @@ -42,6 +43,7 @@ import { } from '@/components/ui/select' import { Switch } from '@/components/ui/switch' import { Textarea } from '@/components/ui/textarea' + import { SettingsForm, SettingsSwitchContent, diff --git a/web/default/src/features/system-settings/billing/section-registry.tsx b/web/default/src/features/system-settings/billing/section-registry.tsx index 1a1dc8a2..cc609476 100644 --- a/web/default/src/features/system-settings/billing/section-registry.tsx +++ b/web/default/src/features/system-settings/billing/section-registry.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { parseCurrencyDisplayType } from '@/lib/currency' + import { CheckinSettingsSection } from '../general/checkin-settings-section' import { PricingSection } from '../general/pricing-section' import { QuotaSettingsSection } from '../general/quota-settings-section' diff --git a/web/default/src/features/system-settings/components/form-dirty-indicator.tsx b/web/default/src/features/system-settings/components/form-dirty-indicator.tsx index 364910bb..5fc021ee 100644 --- a/web/default/src/features/system-settings/components/form-dirty-indicator.tsx +++ b/web/default/src/features/system-settings/components/form-dirty-indicator.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useTranslation } from 'react-i18next' + import { SettingsPageTitleStatusPortal } from './settings-page-context' type FormDirtyIndicatorProps = { diff --git a/web/default/src/features/system-settings/components/form-navigation-guard.tsx b/web/default/src/features/system-settings/components/form-navigation-guard.tsx index 634e432b..9e72921c 100644 --- a/web/default/src/features/system-settings/components/form-navigation-guard.tsx +++ b/web/default/src/features/system-settings/components/form-navigation-guard.tsx @@ -16,9 +16,10 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useEffect } from 'react' import { useBlocker } from '@tanstack/react-router' +import { useState, useEffect } from 'react' import { useTranslation } from 'react-i18next' + import { ConfirmDialog } from '@/components/confirm-dialog' type FormNavigationGuardProps = { diff --git a/web/default/src/features/system-settings/components/settings-accordion.tsx b/web/default/src/features/system-settings/components/settings-accordion.tsx index 31222b43..6ef06c8f 100644 --- a/web/default/src/features/system-settings/components/settings-accordion.tsx +++ b/web/default/src/features/system-settings/components/settings-accordion.tsx @@ -16,12 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { cn } from '@/lib/utils' import { AccordionItem, AccordionTrigger, AccordionContent, } from '@/components/ui/accordion' +import { cn } from '@/lib/utils' type SettingsAccordionProps = { value: string diff --git a/web/default/src/features/system-settings/components/settings-card.tsx b/web/default/src/features/system-settings/components/settings-card.tsx index 0ca322cb..be358a80 100644 --- a/web/default/src/features/system-settings/components/settings-card.tsx +++ b/web/default/src/features/system-settings/components/settings-card.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { memo } from 'react' + import { Card, CardContent, diff --git a/web/default/src/features/system-settings/components/settings-form-layout.tsx b/web/default/src/features/system-settings/components/settings-form-layout.tsx index 67bb7d93..8cd5472f 100644 --- a/web/default/src/features/system-settings/components/settings-form-layout.tsx +++ b/web/default/src/features/system-settings/components/settings-form-layout.tsx @@ -17,10 +17,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import type { ComponentProps, ReactNode } from 'react' -import { cn } from '@/lib/utils' + import { FormItem } from '@/components/ui/form' import { Label } from '@/components/ui/label' import { Switch } from '@/components/ui/switch' +import { cn } from '@/lib/utils' type SettingsFormGridProps = { children: ReactNode diff --git a/web/default/src/features/system-settings/components/settings-page-context.tsx b/web/default/src/features/system-settings/components/settings-page-context.tsx index 2cdb73e4..edd6117d 100644 --- a/web/default/src/features/system-settings/components/settings-page-context.tsx +++ b/web/default/src/features/system-settings/components/settings-page-context.tsx @@ -16,6 +16,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ +import { RotateCcw, Save } from 'lucide-react' import { createContext, useContext, @@ -23,9 +24,9 @@ import { type ReactNode, type RefObject, } from 'react' -import { RotateCcw, Save } from 'lucide-react' import { createPortal } from 'react-dom' import { useTranslation } from 'react-i18next' + import { Button } from '@/components/ui/button' type SettingsPageContextValue = { diff --git a/web/default/src/features/system-settings/components/settings-page.tsx b/web/default/src/features/system-settings/components/settings-page.tsx index 9ae87b39..5c4c8c6b 100644 --- a/web/default/src/features/system-settings/components/settings-page.tsx +++ b/web/default/src/features/system-settings/components/settings-page.tsx @@ -16,10 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useMemo, useState, type ReactNode } from 'react' import { useParams } from '@tanstack/react-router' +import { useMemo, useState, type ReactNode } from 'react' import { useTranslation } from 'react-i18next' + import { SectionPageLayout } from '@/components/layout' + import { useSystemOptions, getOptionValue } from '../hooks/use-system-options' import type { SystemOption } from '../types' import { SettingsPageProvider } from './settings-page-context' diff --git a/web/default/src/features/system-settings/components/settings-section.tsx b/web/default/src/features/system-settings/components/settings-section.tsx index b0eb2cb9..6e2d7e38 100644 --- a/web/default/src/features/system-settings/components/settings-section.tsx +++ b/web/default/src/features/system-settings/components/settings-section.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { cn } from '@/lib/utils' + import { useSuppressSettingsSectionHeader } from './settings-page-context' type SettingsSectionProps = { diff --git a/web/default/src/features/system-settings/content/announcements-section.tsx b/web/default/src/features/system-settings/content/announcements-section.tsx index 473cd610..f5352047 100644 --- a/web/default/src/features/system-settings/content/announcements-section.tsx +++ b/web/default/src/features/system-settings/content/announcements-section.tsx @@ -16,14 +16,19 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useMemo, useState } from 'react' -import * as z from 'zod' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' import { Plus, Trash2, Save } from 'lucide-react' +import { useEffect, useMemo, useState } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import dayjs from '@/lib/dayjs' +import * as z from 'zod' + +import { StaticDataTable } from '@/components/data-table/static/static-data-table' +import { StaticRowActions } from '@/components/data-table/static/static-row-actions' +import { DateTimePicker } from '@/components/datetime-picker' +import { Dialog } from '@/components/dialog' +import { StatusBadge } from '@/components/status-badge' import { AlertDialog, AlertDialogAction, @@ -55,11 +60,8 @@ import { SelectValue, } from '@/components/ui/select' import { Textarea } from '@/components/ui/textarea' -import { StaticDataTable } from '@/components/data-table/static/static-data-table' -import { StaticRowActions } from '@/components/data-table/static/static-row-actions' -import { DateTimePicker } from '@/components/datetime-picker' -import { Dialog } from '@/components/dialog' -import { StatusBadge } from '@/components/status-badge' +import dayjs from '@/lib/dayjs' + import { SettingsSwitchField } from '../components/settings-form-layout' import { SettingsSection } from '../components/settings-section' import { useUpdateOption } from '../hooks/use-update-option' @@ -521,16 +523,16 @@ export function AnnouncementsSection({ {t('Type')} ({ - value: option.value, - label: ( -
-
- {option.label} -
- ), - }))} + value: option.value, + label: ( +
+
+ {option.label} +
+ ), + }))} onValueChange={field.onChange} value={field.value} > @@ -519,10 +521,9 @@ export function ApiInfoSection({ enabled, data }: ApiInfoSectionProps) { {deleteTarget === 'single' ? t('This API shortcut will be removed from the list.') - : t( - '{{count}} API shortcuts will be removed from the list.', - { count: selectedIds.length } - )} + : t('{{count}} API shortcuts will be removed from the list.', { + count: selectedIds.length, + })} diff --git a/web/default/src/features/system-settings/content/chat-dialog.tsx b/web/default/src/features/system-settings/content/chat-dialog.tsx index 1ebffbd5..dd0d252e 100644 --- a/web/default/src/features/system-settings/content/chat-dialog.tsx +++ b/web/default/src/features/system-settings/content/chat-dialog.tsx @@ -16,11 +16,13 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect } from 'react' -import * as z from 'zod' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' +import { useEffect } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' +import * as z from 'zod' + +import { Dialog } from '@/components/dialog' import { Button } from '@/components/ui/button' import { Form, @@ -32,7 +34,6 @@ import { FormMessage, } from '@/components/ui/form' import { Input } from '@/components/ui/input' -import { Dialog } from '@/components/dialog' const createChatDialogSchema = (t: (key: string) => string) => z.object({ diff --git a/web/default/src/features/system-settings/content/chat-settings-section.tsx b/web/default/src/features/system-settings/content/chat-settings-section.tsx index bc030657..d4532e96 100644 --- a/web/default/src/features/system-settings/content/chat-settings-section.tsx +++ b/web/default/src/features/system-settings/content/chat-settings-section.tsx @@ -16,11 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useRef, useState } from 'react' -import * as z from 'zod' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' +import { useEffect, useRef, useState } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' +import * as z from 'zod' + import { Form, FormControl, @@ -32,6 +33,7 @@ import { } from '@/components/ui/form' import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs' import { Textarea } from '@/components/ui/textarea' + import { SettingsForm } from '../components/settings-form-layout' import { SettingsPageFormActions } from '../components/settings-page-context' import { SettingsSection } from '../components/settings-section' diff --git a/web/default/src/features/system-settings/content/chat-settings-visual-editor.tsx b/web/default/src/features/system-settings/content/chat-settings-visual-editor.tsx index a29e9bd4..fc396903 100644 --- a/web/default/src/features/system-settings/content/chat-settings-visual-editor.tsx +++ b/web/default/src/features/system-settings/content/chat-settings-visual-editor.tsx @@ -16,13 +16,15 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useMemo } from 'react' import { Plus, Search } from 'lucide-react' +import { useState, useMemo } from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/components/ui/button' -import { Input } from '@/components/ui/input' + import { StaticDataTable } from '@/components/data-table/static/static-data-table' import { StaticRowActions } from '@/components/data-table/static/static-row-actions' +import { Button } from '@/components/ui/button' +import { Input } from '@/components/ui/input' + import { safeJsonParseWithValidation } from '../utils/json-parser' import { isArray } from '../utils/json-validators' import { ChatDialog, type ChatEntryData } from './chat-dialog' diff --git a/web/default/src/features/system-settings/content/dashboard-section.tsx b/web/default/src/features/system-settings/content/dashboard-section.tsx index e21f6ebb..a36c3dab 100644 --- a/web/default/src/features/system-settings/content/dashboard-section.tsx +++ b/web/default/src/features/system-settings/content/dashboard-section.tsx @@ -16,11 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect } from 'react' -import * as z from 'zod' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' +import { useEffect } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' +import * as z from 'zod' + import { Form, FormControl, @@ -40,6 +41,7 @@ import { SelectValue, } from '@/components/ui/select' import { Switch } from '@/components/ui/switch' + import { SettingsForm, SettingsSwitchContent, diff --git a/web/default/src/features/system-settings/content/drawing-settings-section.tsx b/web/default/src/features/system-settings/content/drawing-settings-section.tsx index 672afde6..16822099 100644 --- a/web/default/src/features/system-settings/content/drawing-settings-section.tsx +++ b/web/default/src/features/system-settings/content/drawing-settings-section.tsx @@ -16,11 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect } from 'react' -import * as z from 'zod' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' +import { useEffect } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' +import * as z from 'zod' + import { Form, FormControl, @@ -30,6 +31,7 @@ import { FormMessage, } from '@/components/ui/form' import { Switch } from '@/components/ui/switch' + import { SettingsForm, SettingsSwitchContent, diff --git a/web/default/src/features/system-settings/content/faq-section.tsx b/web/default/src/features/system-settings/content/faq-section.tsx index 5572d924..48426077 100644 --- a/web/default/src/features/system-settings/content/faq-section.tsx +++ b/web/default/src/features/system-settings/content/faq-section.tsx @@ -16,13 +16,17 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useState } from 'react' -import * as z from 'zod' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' import { Plus, Trash2, Save } from 'lucide-react' +import { useEffect, useState } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' +import * as z from 'zod' + +import { StaticDataTable } from '@/components/data-table/static/static-data-table' +import { StaticRowActions } from '@/components/data-table/static/static-row-actions' +import { Dialog } from '@/components/dialog' import { AlertDialog, AlertDialogAction, @@ -46,9 +50,7 @@ import { } from '@/components/ui/form' import { Input } from '@/components/ui/input' import { Textarea } from '@/components/ui/textarea' -import { StaticDataTable } from '@/components/data-table/static/static-data-table' -import { StaticRowActions } from '@/components/data-table/static/static-row-actions' -import { Dialog } from '@/components/dialog' + import { SettingsSwitchField } from '../components/settings-form-layout' import { SettingsSection } from '../components/settings-section' import { useUpdateOption } from '../hooks/use-update-option' diff --git a/web/default/src/features/system-settings/content/json-toggle-section.tsx b/web/default/src/features/system-settings/content/json-toggle-section.tsx index 4b79b1a6..0b7e990f 100644 --- a/web/default/src/features/system-settings/content/json-toggle-section.tsx +++ b/web/default/src/features/system-settings/content/json-toggle-section.tsx @@ -16,11 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useMemo, useRef } from 'react' -import * as z from 'zod' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' +import { useEffect, useMemo, useRef } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' +import * as z from 'zod' + import { Form, FormControl, @@ -32,6 +33,7 @@ import { } from '@/components/ui/form' import { Switch } from '@/components/ui/switch' import { Textarea } from '@/components/ui/textarea' + import { SettingsAccordion } from '../components/settings-accordion' import { SettingsForm, diff --git a/web/default/src/features/system-settings/content/uptime-kuma-section.tsx b/web/default/src/features/system-settings/content/uptime-kuma-section.tsx index be95bea5..966dc6a9 100644 --- a/web/default/src/features/system-settings/content/uptime-kuma-section.tsx +++ b/web/default/src/features/system-settings/content/uptime-kuma-section.tsx @@ -16,13 +16,17 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useState } from 'react' -import * as z from 'zod' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' import { Plus, Trash2, Save } from 'lucide-react' +import { useEffect, useState } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' +import * as z from 'zod' + +import { StaticDataTable } from '@/components/data-table/static/static-data-table' +import { StaticRowActions } from '@/components/data-table/static/static-row-actions' +import { Dialog } from '@/components/dialog' import { AlertDialog, AlertDialogAction, @@ -45,9 +49,7 @@ import { FormMessage, } from '@/components/ui/form' import { Input } from '@/components/ui/input' -import { StaticDataTable } from '@/components/data-table/static/static-data-table' -import { StaticRowActions } from '@/components/data-table/static/static-row-actions' -import { Dialog } from '@/components/dialog' + import { SettingsSwitchField } from '../components/settings-form-layout' import { SettingsSection } from '../components/settings-section' import { useUpdateOption } from '../hooks/use-update-option' diff --git a/web/default/src/features/system-settings/general/channel-affinity/api.ts b/web/default/src/features/system-settings/general/channel-affinity/api.ts index 8dc88ccd..ca36ec4e 100644 --- a/web/default/src/features/system-settings/general/channel-affinity/api.ts +++ b/web/default/src/features/system-settings/general/channel-affinity/api.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { api } from '@/lib/api' + import type { CacheStats } from './types' export async function getCacheStats(): Promise<{ diff --git a/web/default/src/features/system-settings/general/channel-affinity/cache-stats-dialog.tsx b/web/default/src/features/system-settings/general/channel-affinity/cache-stats-dialog.tsx index 633b197b..57fbf05f 100644 --- a/web/default/src/features/system-settings/general/channel-affinity/cache-stats-dialog.tsx +++ b/web/default/src/features/system-settings/general/channel-affinity/cache-stats-dialog.tsx @@ -19,8 +19,10 @@ For commercial licensing, please contact support@quantumnous.com import { useEffect, useMemo, useState, useRef } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { formatTimestampToDate } from '@/lib/format' + import { Dialog } from '@/components/dialog' +import { formatTimestampToDate } from '@/lib/format' + import { getAffinityUsageCache } from './api' function formatRate(hit: number, total: number): string { diff --git a/web/default/src/features/system-settings/general/channel-affinity/index.tsx b/web/default/src/features/system-settings/general/channel-affinity/index.tsx index 7aebcc64..40e0b925 100644 --- a/web/default/src/features/system-settings/general/channel-affinity/index.tsx +++ b/web/default/src/features/system-settings/general/channel-affinity/index.tsx @@ -16,10 +16,14 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useCallback, useEffect, useState, type ReactNode } from 'react' import { Edit, FileText, Plus, RefreshCw, Trash2, X } from 'lucide-react' +import { useCallback, useEffect, useState, type ReactNode } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' + +import { StaticDataTable } from '@/components/data-table' +import { Dialog } from '@/components/dialog' +import { StatusBadge, StatusBadgeList } from '@/components/status-badge' import { Alert, AlertDescription } from '@/components/ui/alert' import { Button } from '@/components/ui/button' import { @@ -32,9 +36,7 @@ import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' import { Separator } from '@/components/ui/separator' import { Textarea } from '@/components/ui/textarea' -import { StaticDataTable } from '@/components/data-table' -import { Dialog } from '@/components/dialog' -import { StatusBadge, StatusBadgeList } from '@/components/status-badge' + import { SettingsSwitchField } from '../../components/settings-form-layout' import { SettingsPageActionsPortal } from '../../components/settings-page-context' import { SettingsSection } from '../../components/settings-section' @@ -254,43 +256,48 @@ export function ChannelAffinitySection(props: Props) { try { const updates: { key: string; value: string }[] = [] - if (enabled !== props.defaultValues['channel_affinity_setting.enabled']) - {updates.push({ + if (enabled !== props.defaultValues['channel_affinity_setting.enabled']) { + updates.push({ key: 'channel_affinity_setting.enabled', value: String(enabled), - })} + }) + } if ( switchOnSuccess !== props.defaultValues['channel_affinity_setting.switch_on_success'] - ) - {updates.push({ + ) { + updates.push({ key: 'channel_affinity_setting.switch_on_success', value: String(switchOnSuccess), - })} + }) + } if ( keepOnChannelDisabled !== props.defaultValues['channel_affinity_setting.keep_on_channel_disabled'] - ) - {updates.push({ + ) { + updates.push({ key: 'channel_affinity_setting.keep_on_channel_disabled', value: String(keepOnChannelDisabled), - })} + }) + } if ( maxEntries !== props.defaultValues['channel_affinity_setting.max_entries'] - ) - {updates.push({ + ) { + updates.push({ key: 'channel_affinity_setting.max_entries', value: String(maxEntries), - })} + }) + } if ( defaultTtl !== props.defaultValues['channel_affinity_setting.default_ttl_seconds'] - ) - {updates.push({ + ) { + updates.push({ key: 'channel_affinity_setting.default_ttl_seconds', value: String(defaultTtl), - })} + }) + } const origRules = props.defaultValues['channel_affinity_setting.rules'] const origSerialized = (() => { diff --git a/web/default/src/features/system-settings/general/channel-affinity/rule-editor-dialog.tsx b/web/default/src/features/system-settings/general/channel-affinity/rule-editor-dialog.tsx index c6544790..77e76ae2 100644 --- a/web/default/src/features/system-settings/general/channel-affinity/rule-editor-dialog.tsx +++ b/web/default/src/features/system-settings/general/channel-affinity/rule-editor-dialog.tsx @@ -16,11 +16,13 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ +import { Plus, Trash2 } from 'lucide-react' import { useEffect, useRef, useState } from 'react' import { useForm } from 'react-hook-form' -import { Plus, Trash2 } from 'lucide-react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' + +import { Dialog } from '@/components/dialog' import { Button } from '@/components/ui/button' import { Collapsible, @@ -39,7 +41,7 @@ import { } from '@/components/ui/select' import { Separator } from '@/components/ui/separator' import { Textarea } from '@/components/ui/textarea' -import { Dialog } from '@/components/dialog' + import { SettingsSwitchField } from '../../components/settings-form-layout' import { RULE_TEMPLATES } from './constants' import type { AffinityRule, KeySource } from './types' diff --git a/web/default/src/features/system-settings/general/checkin-settings-section.tsx b/web/default/src/features/system-settings/general/checkin-settings-section.tsx index da70eaf2..4885efd6 100644 --- a/web/default/src/features/system-settings/general/checkin-settings-section.tsx +++ b/web/default/src/features/system-settings/general/checkin-settings-section.tsx @@ -16,11 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { z } from 'zod' -import { useForm, type Resolver } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' +import { useForm, type Resolver } from 'react-hook-form' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' +import { z } from 'zod' + import { Form, FormControl, @@ -32,6 +33,7 @@ import { } from '@/components/ui/form' import { Input } from '@/components/ui/input' import { Switch } from '@/components/ui/switch' + import { SettingsForm, SettingsSwitchContent, diff --git a/web/default/src/features/system-settings/general/pricing-section.tsx b/web/default/src/features/system-settings/general/pricing-section.tsx index 6a99f0d1..db23ff7c 100644 --- a/web/default/src/features/system-settings/general/pricing-section.tsx +++ b/web/default/src/features/system-settings/general/pricing-section.tsx @@ -16,11 +16,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import * as z from 'zod' -import type { Resolver } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' +import type { Resolver } from 'react-hook-form' import { useTranslation } from 'react-i18next' -import { DEFAULT_CURRENCY_CONFIG } from '@/stores/system-config-store' +import * as z from 'zod' + import { Form, FormControl, @@ -40,6 +40,8 @@ import { SelectValue, } from '@/components/ui/select' import { Switch } from '@/components/ui/switch' +import { DEFAULT_CURRENCY_CONFIG } from '@/stores/system-config-store' + import { FormDirtyIndicator } from '../components/form-dirty-indicator' import { FormNavigationGuard } from '../components/form-navigation-guard' import { diff --git a/web/default/src/features/system-settings/general/quota-settings-section.tsx b/web/default/src/features/system-settings/general/quota-settings-section.tsx index a8a83700..2b5e0763 100644 --- a/web/default/src/features/system-settings/general/quota-settings-section.tsx +++ b/web/default/src/features/system-settings/general/quota-settings-section.tsx @@ -16,11 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import type { ChangeEvent } from 'react' -import * as z from 'zod' -import type { Resolver } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' +import type { ChangeEvent } from 'react' +import type { Resolver } from 'react-hook-form' import { useTranslation } from 'react-i18next' +import * as z from 'zod' + import { Alert, AlertDescription } from '@/components/ui/alert' import { Form, @@ -33,6 +34,7 @@ import { } from '@/components/ui/form' import { Input } from '@/components/ui/input' import { Switch } from '@/components/ui/switch' + import { FormDirtyIndicator } from '../components/form-dirty-indicator' import { FormNavigationGuard } from '../components/form-navigation-guard' import { diff --git a/web/default/src/features/system-settings/general/system-behavior-section.tsx b/web/default/src/features/system-settings/general/system-behavior-section.tsx index 9b6b1964..5a44c89b 100644 --- a/web/default/src/features/system-settings/general/system-behavior-section.tsx +++ b/web/default/src/features/system-settings/general/system-behavior-section.tsx @@ -16,10 +16,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import * as z from 'zod' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' +import * as z from 'zod' + import { Form, FormControl, @@ -28,6 +29,7 @@ import { FormLabel, } from '@/components/ui/form' import { Switch } from '@/components/ui/switch' + import { SettingsForm, SettingsSwitchContent, diff --git a/web/default/src/features/system-settings/general/system-info-section.tsx b/web/default/src/features/system-settings/general/system-info-section.tsx index fa36d7f4..70fcdf29 100644 --- a/web/default/src/features/system-settings/general/system-info-section.tsx +++ b/web/default/src/features/system-settings/general/system-info-section.tsx @@ -16,10 +16,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import * as z from 'zod' -import type { Resolver } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' +import type { Resolver } from 'react-hook-form' import { useTranslation } from 'react-i18next' +import * as z from 'zod' + import { Form, FormControl, @@ -39,6 +40,7 @@ import { SelectValue, } from '@/components/ui/select' import { Textarea } from '@/components/ui/textarea' + import { FormDirtyIndicator } from '../components/form-dirty-indicator' import { FormNavigationGuard } from '../components/form-navigation-guard' import { diff --git a/web/default/src/features/system-settings/hooks/use-form-dirty-guard.ts b/web/default/src/features/system-settings/hooks/use-form-dirty-guard.ts index 916a1225..60714695 100644 --- a/web/default/src/features/system-settings/hooks/use-form-dirty-guard.ts +++ b/web/default/src/features/system-settings/hooks/use-form-dirty-guard.ts @@ -16,8 +16,8 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect } from 'react' import { useBlocker } from '@tanstack/react-router' +import { useEffect } from 'react' /** * @deprecated Use FormNavigationGuard component instead for better UX diff --git a/web/default/src/features/system-settings/hooks/use-safe-json-state.ts b/web/default/src/features/system-settings/hooks/use-safe-json-state.ts index 5edf0f6a..9cec30c3 100644 --- a/web/default/src/features/system-settings/hooks/use-safe-json-state.ts +++ b/web/default/src/features/system-settings/hooks/use-safe-json-state.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useMemo } from 'react' + import { safeJsonParse, safeJsonParseWithValidation, diff --git a/web/default/src/features/system-settings/hooks/use-settings-form.ts b/web/default/src/features/system-settings/hooks/use-settings-form.ts index 4db564ee..adb508cd 100644 --- a/web/default/src/features/system-settings/hooks/use-settings-form.ts +++ b/web/default/src/features/system-settings/hooks/use-settings-form.ts @@ -16,6 +16,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ +import i18next from 'i18next' import { useEffect, useMemo, useRef } from 'react' import { useForm, @@ -23,7 +24,6 @@ import { type FieldValues, type FieldNamesMarkedBoolean, } from 'react-hook-form' -import i18next from 'i18next' import { toast } from 'sonner' type SettingsFormOptions = UseFormProps & { diff --git a/web/default/src/features/system-settings/hooks/use-system-options.ts b/web/default/src/features/system-settings/hooks/use-system-options.ts index 7430e4a1..1ee7c1f8 100644 --- a/web/default/src/features/system-settings/hooks/use-system-options.ts +++ b/web/default/src/features/system-settings/hooks/use-system-options.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useQuery } from '@tanstack/react-query' + import { getSystemOptions } from '../api' export function useSystemOptions() { diff --git a/web/default/src/features/system-settings/hooks/use-update-option.ts b/web/default/src/features/system-settings/hooks/use-update-option.ts index 2f732072..670ccf9c 100644 --- a/web/default/src/features/system-settings/hooks/use-update-option.ts +++ b/web/default/src/features/system-settings/hooks/use-update-option.ts @@ -19,6 +19,7 @@ For commercial licensing, please contact support@quantumnous.com import { useMutation, useQueryClient } from '@tanstack/react-query' import i18next from 'i18next' import { toast } from 'sonner' + import { updateSystemOption } from '../api' import type { UpdateOptionRequest } from '../types' diff --git a/web/default/src/features/system-settings/integrations/amount-discount-dialog.tsx b/web/default/src/features/system-settings/integrations/amount-discount-dialog.tsx index 0a95a55e..8219d796 100644 --- a/web/default/src/features/system-settings/integrations/amount-discount-dialog.tsx +++ b/web/default/src/features/system-settings/integrations/amount-discount-dialog.tsx @@ -16,11 +16,13 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useMemo } from 'react' -import * as z from 'zod' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' +import { useEffect, useMemo } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' +import * as z from 'zod' + +import { Dialog } from '@/components/dialog' import { Button } from '@/components/ui/button' import { Form, @@ -32,7 +34,6 @@ import { FormMessage, } from '@/components/ui/form' import { Input } from '@/components/ui/input' -import { Dialog } from '@/components/dialog' const createAmountDiscountDialogSchema = (t: (key: string) => string) => z.object({ diff --git a/web/default/src/features/system-settings/integrations/amount-discount-visual-editor.tsx b/web/default/src/features/system-settings/integrations/amount-discount-visual-editor.tsx index c0b90928..bfa2f640 100644 --- a/web/default/src/features/system-settings/integrations/amount-discount-visual-editor.tsx +++ b/web/default/src/features/system-settings/integrations/amount-discount-visual-editor.tsx @@ -16,13 +16,15 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useMemo } from 'react' import { Pencil, Plus, Trash2 } from 'lucide-react' +import { useState, useMemo } from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/components/ui/button' + import { StaticDataTable } from '@/components/data-table/static/static-data-table' import { StaticRowActions } from '@/components/data-table/static/static-row-actions' import { StatusBadge } from '@/components/status-badge' +import { Button } from '@/components/ui/button' + import { safeJsonParseWithValidation } from '../utils/json-parser' import { isObjectRecord } from '../utils/json-validators' import { diff --git a/web/default/src/features/system-settings/integrations/amount-options-visual-editor.tsx b/web/default/src/features/system-settings/integrations/amount-options-visual-editor.tsx index d8612352..12b69c0e 100644 --- a/web/default/src/features/system-settings/integrations/amount-options-visual-editor.tsx +++ b/web/default/src/features/system-settings/integrations/amount-options-visual-editor.tsx @@ -16,13 +16,15 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useMemo } from 'react' import { Plus, X } from 'lucide-react' +import { useState, useMemo } from 'react' import { useTranslation } from 'react-i18next' + +import { StatusBadge } from '@/components/status-badge' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' -import { StatusBadge } from '@/components/status-badge' + import { safeJsonParseWithValidation } from '../utils/json-parser' import { isArray } from '../utils/json-validators' diff --git a/web/default/src/features/system-settings/integrations/creem-product-dialog.tsx b/web/default/src/features/system-settings/integrations/creem-product-dialog.tsx index d33a26fb..a9a9fcf4 100644 --- a/web/default/src/features/system-settings/integrations/creem-product-dialog.tsx +++ b/web/default/src/features/system-settings/integrations/creem-product-dialog.tsx @@ -16,11 +16,13 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect } from 'react' -import * as z from 'zod' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' +import { useEffect } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' +import * as z from 'zod' + +import { Dialog } from '@/components/dialog' import { Button } from '@/components/ui/button' import { Form, @@ -40,8 +42,8 @@ import { SelectTrigger, SelectValue, } from '@/components/ui/select' -import { Dialog } from '@/components/dialog' import type { CreemProduct } from '@/features/wallet/types' + import { safeNumberFieldProps } from '../utils/numeric-field' const creemProductDialogSchema = z.object({ diff --git a/web/default/src/features/system-settings/integrations/creem-products-visual-editor.tsx b/web/default/src/features/system-settings/integrations/creem-products-visual-editor.tsx index 1a09bfe9..4623b7fa 100644 --- a/web/default/src/features/system-settings/integrations/creem-products-visual-editor.tsx +++ b/web/default/src/features/system-settings/integrations/creem-products-visual-editor.tsx @@ -16,17 +16,19 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useMemo } from 'react' import { Pencil, Plus, Search, Trash2 } from 'lucide-react' +import { useState, useMemo } from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/components/ui/button' -import { Input } from '@/components/ui/input' + import { StaticDataTable } from '@/components/data-table/static/static-data-table' import { StaticRowActions } from '@/components/data-table/static/static-row-actions' +import { Button } from '@/components/ui/button' +import { Input } from '@/components/ui/input' import { formatCreemPrice, formatQuotaShort, } from '@/features/wallet/lib/format' + import { safeJsonParseWithValidation } from '../utils/json-parser' import { isArray } from '../utils/json-validators' import { diff --git a/web/default/src/features/system-settings/integrations/email-settings-section.tsx b/web/default/src/features/system-settings/integrations/email-settings-section.tsx index 0a9103bc..67cb1e25 100644 --- a/web/default/src/features/system-settings/integrations/email-settings-section.tsx +++ b/web/default/src/features/system-settings/integrations/email-settings-section.tsx @@ -16,10 +16,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import * as z from 'zod' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' +import * as z from 'zod' + import { Form, FormControl, @@ -33,6 +34,7 @@ import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group' import { Switch } from '@/components/ui/switch' + import { SettingsForm, SettingsSwitchContent, diff --git a/web/default/src/features/system-settings/integrations/ionet-deployment-settings-section.tsx b/web/default/src/features/system-settings/integrations/ionet-deployment-settings-section.tsx index fe05863b..a0b29daf 100644 --- a/web/default/src/features/system-settings/integrations/ionet-deployment-settings-section.tsx +++ b/web/default/src/features/system-settings/integrations/ionet-deployment-settings-section.tsx @@ -16,13 +16,14 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState } from 'react' -import { z } from 'zod' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' import { CheckCircle2, Loader2, XCircle } from 'lucide-react' +import { useState } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' +import { z } from 'zod' + import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert' import { Button } from '@/components/ui/button' import { @@ -37,6 +38,7 @@ import { import { Input } from '@/components/ui/input' import { Switch } from '@/components/ui/switch' import { testDeploymentConnectionWithKey } from '@/features/models/api' + import { SettingsForm, SettingsSwitchContent, diff --git a/web/default/src/features/system-settings/integrations/monitoring-settings-section.tsx b/web/default/src/features/system-settings/integrations/monitoring-settings-section.tsx index cef3352e..5805cac1 100644 --- a/web/default/src/features/system-settings/integrations/monitoring-settings-section.tsx +++ b/web/default/src/features/system-settings/integrations/monitoring-settings-section.tsx @@ -16,12 +16,13 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useMemo, useRef } from 'react' -import * as z from 'zod' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' +import { useEffect, useMemo, useRef } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' +import * as z from 'zod' + import { Form, FormControl, @@ -41,6 +42,7 @@ import { SelectValue, } from '@/components/ui/select' import { Switch } from '@/components/ui/switch' + import { SettingsForm, SettingsSwitchContent, @@ -102,7 +104,8 @@ const normalizeDefaults = ( 'perf_metrics_setting.enabled': defaults['perf_metrics_setting.enabled'], 'perf_metrics_setting.flush_interval': defaults['perf_metrics_setting.flush_interval'], - 'perf_metrics_setting.bucket_time': defaults['perf_metrics_setting.bucket_time'], + 'perf_metrics_setting.bucket_time': + defaults['perf_metrics_setting.bucket_time'], 'perf_metrics_setting.retention_days': defaults['perf_metrics_setting.retention_days'], }) diff --git a/web/default/src/features/system-settings/integrations/payment-method-dialog.tsx b/web/default/src/features/system-settings/integrations/payment-method-dialog.tsx index 9826a865..c300ee22 100644 --- a/web/default/src/features/system-settings/integrations/payment-method-dialog.tsx +++ b/web/default/src/features/system-settings/integrations/payment-method-dialog.tsx @@ -16,11 +16,14 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect } from 'react' -import * as z from 'zod' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' +import { useEffect } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' +import * as z from 'zod' + +import { Dialog } from '@/components/dialog' +import { ReactIconByName } from '@/components/react-icon-by-name' import { Button } from '@/components/ui/button' import { Combobox } from '@/components/ui/combobox' import { @@ -33,8 +36,6 @@ import { FormMessage, } from '@/components/ui/form' import { Input } from '@/components/ui/input' -import { Dialog } from '@/components/dialog' -import { ReactIconByName } from '@/components/react-icon-by-name' const createPaymentMethodDialogSchema = (t: (key: string) => string) => z.object({ diff --git a/web/default/src/features/system-settings/integrations/payment-methods-visual-editor.tsx b/web/default/src/features/system-settings/integrations/payment-methods-visual-editor.tsx index beac6ca3..39d60468 100644 --- a/web/default/src/features/system-settings/integrations/payment-methods-visual-editor.tsx +++ b/web/default/src/features/system-settings/integrations/payment-methods-visual-editor.tsx @@ -16,8 +16,8 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useMemo } from 'react' import { Lightbulb, Pencil, Plus, Search, Trash2 } from 'lucide-react' +import { useState, useMemo } from 'react' import { useTranslation } from 'react-i18next' import { StaticDataTable } from '@/components/data-table/static/static-data-table' diff --git a/web/default/src/features/system-settings/integrations/payment-settings-section.tsx b/web/default/src/features/system-settings/integrations/payment-settings-section.tsx index 915cf64b..1de5c1d3 100644 --- a/web/default/src/features/system-settings/integrations/payment-settings-section.tsx +++ b/web/default/src/features/system-settings/integrations/payment-settings-section.tsx @@ -16,15 +16,16 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import * as React from 'react' -import * as z from 'zod' -import { useForm, type Resolver } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' import { useMutation, useQueryClient } from '@tanstack/react-query' import { Code2, Eye, ShieldAlert } from 'lucide-react' +import * as React from 'react' +import { useForm, type Resolver } from 'react-hook-form' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { cn } from '@/lib/utils' +import * as z from 'zod' + +import { RiskAcknowledgementDialog } from '@/components/risk-acknowledgement-dialog' import { Alert, AlertAction, @@ -45,7 +46,8 @@ import { Input } from '@/components/ui/input' import { Switch } from '@/components/ui/switch' import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs' import { Textarea } from '@/components/ui/textarea' -import { RiskAcknowledgementDialog } from '@/components/risk-acknowledgement-dialog' +import { cn } from '@/lib/utils' + import { confirmPaymentCompliance } from '../api' import { SettingsForm, diff --git a/web/default/src/features/system-settings/integrations/waffo-pancake-settings-section.tsx b/web/default/src/features/system-settings/integrations/waffo-pancake-settings-section.tsx index 82ad963a..cf8b9a8b 100644 --- a/web/default/src/features/system-settings/integrations/waffo-pancake-settings-section.tsx +++ b/web/default/src/features/system-settings/integrations/waffo-pancake-settings-section.tsx @@ -20,6 +20,7 @@ import * as React from 'react' import type { SetStateAction } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' + import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' @@ -31,6 +32,7 @@ import { SelectValue, } from '@/components/ui/select' import { Textarea } from '@/components/ui/textarea' + import { removeTrailingSlash } from './utils' import { type CatalogStore, diff --git a/web/default/src/features/system-settings/integrations/waffo-settings-section.tsx b/web/default/src/features/system-settings/integrations/waffo-settings-section.tsx index da6a324d..76763ac5 100644 --- a/web/default/src/features/system-settings/integrations/waffo-settings-section.tsx +++ b/web/default/src/features/system-settings/integrations/waffo-settings-section.tsx @@ -16,19 +16,21 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { type ChangeEvent, useRef, type SetStateAction, useState } from 'react' import { Plus } from 'lucide-react' +import { type ChangeEvent, useRef, type SetStateAction, useState } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' + +import { StaticDataTable } from '@/components/data-table/static/static-data-table' +import { StaticRowActions } from '@/components/data-table/static/static-row-actions' +import { Dialog } from '@/components/dialog' import { Alert, AlertDescription } from '@/components/ui/alert' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' import { Separator } from '@/components/ui/separator' import { Textarea } from '@/components/ui/textarea' -import { StaticDataTable } from '@/components/data-table/static/static-data-table' -import { StaticRowActions } from '@/components/data-table/static/static-row-actions' -import { Dialog } from '@/components/dialog' + import { SettingsSwitchField } from '../components/settings-form-layout' export interface WaffoSettingsValues { @@ -98,8 +100,9 @@ export function WaffoSettingsSection({ } const saveMethod = () => { - if (!methodForm.name.trim()) - {return toast.error(t('Payment method name is required'))} + if (!methodForm.name.trim()) { + return toast.error(t('Payment method name is required')) + } if (editingIdx === -1) { onPayMethodsChange((prev) => [...prev, methodForm]) } else { @@ -129,8 +132,7 @@ export function WaffoSettingsSection({ reader.addEventListener('load', () => { setMethodForm((previous) => ({ ...previous, - icon: - typeof reader.result === 'string' ? reader.result : '', + icon: typeof reader.result === 'string' ? reader.result : '', })) }) reader.readAsDataURL(file) diff --git a/web/default/src/features/system-settings/integrations/worker-settings-section.tsx b/web/default/src/features/system-settings/integrations/worker-settings-section.tsx index c2ef093d..c0fa88cd 100644 --- a/web/default/src/features/system-settings/integrations/worker-settings-section.tsx +++ b/web/default/src/features/system-settings/integrations/worker-settings-section.tsx @@ -16,10 +16,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import * as z from 'zod' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' +import * as z from 'zod' + import { Form, FormControl, @@ -31,6 +32,7 @@ import { } from '@/components/ui/form' import { Input } from '@/components/ui/input' import { Switch } from '@/components/ui/switch' + import { SettingsForm, SettingsSwitchContent, diff --git a/web/default/src/features/system-settings/maintenance/header-navigation-section.tsx b/web/default/src/features/system-settings/maintenance/header-navigation-section.tsx index f51b8193..43f00852 100644 --- a/web/default/src/features/system-settings/maintenance/header-navigation-section.tsx +++ b/web/default/src/features/system-settings/maintenance/header-navigation-section.tsx @@ -16,11 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useMemo } from 'react' -import * as z from 'zod' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' +import { useEffect, useMemo } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' +import * as z from 'zod' + import { Form, FormControl, @@ -30,6 +31,7 @@ import { FormMessage, } from '@/components/ui/form' import { Switch } from '@/components/ui/switch' + import { SettingsControlChildren, SettingsForm, diff --git a/web/default/src/features/system-settings/maintenance/log-settings-section.tsx b/web/default/src/features/system-settings/maintenance/log-settings-section.tsx index 3b3f1950..6767224d 100644 --- a/web/default/src/features/system-settings/maintenance/log-settings-section.tsx +++ b/web/default/src/features/system-settings/maintenance/log-settings-section.tsx @@ -16,15 +16,14 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useCallback, useEffect, useMemo, useState } from 'react' -import * as z from 'zod' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' +import { useCallback, useEffect, useMemo, useState } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { api } from '@/lib/api' -import dayjs from '@/lib/dayjs' -import { formatTimestampToDate } from '@/lib/format' +import * as z from 'zod' + +import { DateTimePicker } from '@/components/datetime-picker' import { Alert, AlertDescription } from '@/components/ui/alert' import { AlertDialog, @@ -59,7 +58,10 @@ import { } from '@/components/ui/select' import { Separator } from '@/components/ui/separator' import { Switch } from '@/components/ui/switch' -import { DateTimePicker } from '@/components/datetime-picker' +import { api } from '@/lib/api' +import dayjs from '@/lib/dayjs' +import { formatTimestampToDate } from '@/lib/format' + import { getCurrentLogCleanupTask, getSystemTask, @@ -157,9 +159,7 @@ export function LogSettingsSection({ null ) const [showConfirmDialog, setShowConfirmDialog] = useState(false) - const [serverLogInfo, setServerLogInfo] = useState( - null - ) + const [serverLogInfo, setServerLogInfo] = useState(null) const [serverLogCleanupMode, setServerLogCleanupMode] = useState('by_count') const [serverLogCleanupValue, setServerLogCleanupValue] = useState(10) const [serverLogCleanupLoading, setServerLogCleanupLoading] = useState(false) diff --git a/web/default/src/features/system-settings/maintenance/notice-section.tsx b/web/default/src/features/system-settings/maintenance/notice-section.tsx index c988de80..642a5b3b 100644 --- a/web/default/src/features/system-settings/maintenance/notice-section.tsx +++ b/web/default/src/features/system-settings/maintenance/notice-section.tsx @@ -16,11 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect } from 'react' -import * as z from 'zod' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' +import { useEffect } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' +import * as z from 'zod' + import { Form, FormControl, @@ -30,6 +31,7 @@ import { FormMessage, } from '@/components/ui/form' import { Textarea } from '@/components/ui/textarea' + import { SettingsForm } from '../components/settings-form-layout' import { SettingsPageFormActions } from '../components/settings-page-context' import { SettingsSection } from '../components/settings-section' diff --git a/web/default/src/features/system-settings/maintenance/performance-section.tsx b/web/default/src/features/system-settings/maintenance/performance-section.tsx index 6ef488a3..8fe3121b 100644 --- a/web/default/src/features/system-settings/maintenance/performance-section.tsx +++ b/web/default/src/features/system-settings/maintenance/performance-section.tsx @@ -16,13 +16,14 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useCallback, useEffect, useMemo, useRef, useState } from 'react' -import * as z from 'zod' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' +import { useCallback, useEffect, useMemo, useRef, useState } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { api } from '@/lib/api' +import * as z from 'zod' + +import { StatusBadge } from '@/components/status-badge' import { Alert, AlertDescription } from '@/components/ui/alert' import { AlertDialog, @@ -49,7 +50,8 @@ import { Input } from '@/components/ui/input' import { Progress } from '@/components/ui/progress' import { Separator } from '@/components/ui/separator' import { Switch } from '@/components/ui/switch' -import { StatusBadge } from '@/components/status-badge' +import { api } from '@/lib/api' + import { SettingsForm, SettingsSwitchContent, diff --git a/web/default/src/features/system-settings/maintenance/sidebar-modules-section.tsx b/web/default/src/features/system-settings/maintenance/sidebar-modules-section.tsx index 78b81cc0..cc4c9b34 100644 --- a/web/default/src/features/system-settings/maintenance/sidebar-modules-section.tsx +++ b/web/default/src/features/system-settings/maintenance/sidebar-modules-section.tsx @@ -19,6 +19,7 @@ For commercial licensing, please contact support@quantumnous.com import { useEffect, useMemo } from 'react' import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' + import { Form, FormControl, @@ -27,6 +28,7 @@ import { FormLabel, } from '@/components/ui/form' import { Switch } from '@/components/ui/switch' + import { SettingsControlChildren, SettingsForm, @@ -51,7 +53,9 @@ type SidebarModulesSectionProps = { type SidebarFormValues = SidebarModulesAdminConfig const toTitleCase = (value: string) => - value.replaceAll(/[_-]+/g, ' ').replaceAll(/\b\w/g, (char) => char.toUpperCase()) + value + .replaceAll(/[_-]+/g, ' ') + .replaceAll(/\b\w/g, (char) => char.toUpperCase()) export function SidebarModulesSection({ config, diff --git a/web/default/src/features/system-settings/maintenance/update-checker-section.tsx b/web/default/src/features/system-settings/maintenance/update-checker-section.tsx index 23cce007..6f2f39cf 100644 --- a/web/default/src/features/system-settings/maintenance/update-checker-section.tsx +++ b/web/default/src/features/system-settings/maintenance/update-checker-section.tsx @@ -16,14 +16,16 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState } from 'react' import { ExternalLinkIcon, RefreshCcwIcon } from 'lucide-react' +import { useState } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { formatTimestamp, formatTimestampToDate } from '@/lib/format' + +import { Dialog } from '@/components/dialog' import { Button } from '@/components/ui/button' import { Markdown } from '@/components/ui/markdown' -import { Dialog } from '@/components/dialog' +import { formatTimestamp, formatTimestampToDate } from '@/lib/format' + import { SettingsSection } from '../components/settings-section' type ReleaseInfo = { diff --git a/web/default/src/features/system-settings/models/channel-selector-dialog.tsx b/web/default/src/features/system-settings/models/channel-selector-dialog.tsx index 11b7427d..99a91f9a 100644 --- a/web/default/src/features/system-settings/models/channel-selector-dialog.tsx +++ b/web/default/src/features/system-settings/models/channel-selector-dialog.tsx @@ -16,10 +16,18 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useCallback, useEffect, useMemo, useState } from 'react' import { type ColumnDef, type RowSelectionState } from '@tanstack/react-table' import { Search } from 'lucide-react' +import { useCallback, useEffect, useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' + +import { + DataTablePagination, + DataTableView, + useDataTable, +} from '@/components/data-table' +import { Dialog } from '@/components/dialog' +import { StatusBadge } from '@/components/status-badge' import { Button } from '@/components/ui/button' import { Checkbox } from '@/components/ui/checkbox' import { Input } from '@/components/ui/input' @@ -31,13 +39,7 @@ import { SelectTrigger, SelectValue, } from '@/components/ui/select' -import { - DataTablePagination, - DataTableView, - useDataTable, -} from '@/components/data-table' -import { Dialog } from '@/components/dialog' -import { StatusBadge } from '@/components/status-badge' + import type { UpstreamChannel } from '../types' import { CHANNEL_STATUS_CONFIG, diff --git a/web/default/src/features/system-settings/models/claude-settings-card.tsx b/web/default/src/features/system-settings/models/claude-settings-card.tsx index 83279dec..f6077be3 100644 --- a/web/default/src/features/system-settings/models/claude-settings-card.tsx +++ b/web/default/src/features/system-settings/models/claude-settings-card.tsx @@ -16,12 +16,13 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useRef } from 'react' -import * as z from 'zod' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' +import { useEffect, useRef } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' +import * as z from 'zod' + import { Form, FormControl, @@ -34,6 +35,7 @@ import { import { Input } from '@/components/ui/input' import { Switch } from '@/components/ui/switch' import { Textarea } from '@/components/ui/textarea' + import { SettingsForm, SettingsSwitchContent, diff --git a/web/default/src/features/system-settings/models/conflict-confirm-dialog.tsx b/web/default/src/features/system-settings/models/conflict-confirm-dialog.tsx index 0b9619cd..a743dda8 100644 --- a/web/default/src/features/system-settings/models/conflict-confirm-dialog.tsx +++ b/web/default/src/features/system-settings/models/conflict-confirm-dialog.tsx @@ -17,6 +17,8 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useTranslation } from 'react-i18next' + +import { StaticDataTable } from '@/components/data-table' import { AlertDialog, AlertDialogAction, @@ -27,7 +29,6 @@ import { AlertDialogHeader, AlertDialogTitle, } from '@/components/ui/alert-dialog' -import { StaticDataTable } from '@/components/data-table' export type ConflictItem = { channel: string diff --git a/web/default/src/features/system-settings/models/gemini-settings-card.tsx b/web/default/src/features/system-settings/models/gemini-settings-card.tsx index 6c927e04..64ae2162 100644 --- a/web/default/src/features/system-settings/models/gemini-settings-card.tsx +++ b/web/default/src/features/system-settings/models/gemini-settings-card.tsx @@ -16,12 +16,13 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useMemo, useRef } from 'react' -import * as z from 'zod' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' +import { useEffect, useMemo, useRef } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' +import * as z from 'zod' + import { Form, FormControl, @@ -34,6 +35,7 @@ import { import { Input } from '@/components/ui/input' import { Switch } from '@/components/ui/switch' import { Textarea } from '@/components/ui/textarea' + import { SettingsForm, SettingsSwitchContent, diff --git a/web/default/src/features/system-settings/models/global-settings-card.tsx b/web/default/src/features/system-settings/models/global-settings-card.tsx index cdc92232..8eb01815 100644 --- a/web/default/src/features/system-settings/models/global-settings-card.tsx +++ b/web/default/src/features/system-settings/models/global-settings-card.tsx @@ -16,12 +16,14 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect } from 'react' -import * as z from 'zod' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' +import { useEffect } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' +import * as z from 'zod' + +import { StatusBadge } from '@/components/status-badge' import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert' import { Button } from '@/components/ui/button' import { @@ -37,7 +39,7 @@ import { Input } from '@/components/ui/input' import { Separator } from '@/components/ui/separator' import { Switch } from '@/components/ui/switch' import { Textarea } from '@/components/ui/textarea' -import { StatusBadge } from '@/components/status-badge' + import { SettingsForm, SettingsSwitchContent, diff --git a/web/default/src/features/system-settings/models/grok-settings-card.tsx b/web/default/src/features/system-settings/models/grok-settings-card.tsx index c288e789..6a9023e0 100644 --- a/web/default/src/features/system-settings/models/grok-settings-card.tsx +++ b/web/default/src/features/system-settings/models/grok-settings-card.tsx @@ -16,12 +16,13 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useMemo, useRef } from 'react' -import * as z from 'zod' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' +import { useEffect, useMemo, useRef } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' +import * as z from 'zod' + import { Form, FormControl, @@ -33,6 +34,7 @@ import { } from '@/components/ui/form' import { Input } from '@/components/ui/input' import { Switch } from '@/components/ui/switch' + import { SettingsForm, SettingsSwitchContent, diff --git a/web/default/src/features/system-settings/models/group-ratio-form.tsx b/web/default/src/features/system-settings/models/group-ratio-form.tsx index c727adcf..b55fc5ab 100644 --- a/web/default/src/features/system-settings/models/group-ratio-form.tsx +++ b/web/default/src/features/system-settings/models/group-ratio-form.tsx @@ -16,10 +16,16 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ +import { Code2, Eye, HelpCircle } from 'lucide-react' import { memo, useCallback, useState } from 'react' import { type UseFormReturn } from 'react-hook-form' -import { Code2, Eye, HelpCircle } from 'lucide-react' import { useTranslation } from 'react-i18next' + +import { + sideDrawerContentClassName, + sideDrawerFormClassName, + sideDrawerHeaderClassName, +} from '@/components/drawer-layout' import { Accordion, AccordionContent, @@ -45,11 +51,7 @@ import { } from '@/components/ui/sheet' import { Switch } from '@/components/ui/switch' import { Textarea } from '@/components/ui/textarea' -import { - sideDrawerContentClassName, - sideDrawerFormClassName, - sideDrawerHeaderClassName, -} from '@/components/drawer-layout' + import { SettingsForm, SettingsSwitchContent, diff --git a/web/default/src/features/system-settings/models/group-ratio-visual-editor.tsx b/web/default/src/features/system-settings/models/group-ratio-visual-editor.tsx index 7f278312..64652972 100644 --- a/web/default/src/features/system-settings/models/group-ratio-visual-editor.tsx +++ b/web/default/src/features/system-settings/models/group-ratio-visual-editor.tsx @@ -16,8 +16,8 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useMemo, useEffect, useCallback, memo } from 'react' import { Plus, Trash2, GripVertical, ChevronDown } from 'lucide-react' +import { useState, useMemo, useEffect, useCallback, memo } from 'react' import { useTranslation } from 'react-i18next' import { StaticDataTable } from '@/components/data-table/static/static-data-table' diff --git a/web/default/src/features/system-settings/models/group-special-usable-editor.tsx b/web/default/src/features/system-settings/models/group-special-usable-editor.tsx index 3fa607a7..ae9648c5 100644 --- a/web/default/src/features/system-settings/models/group-special-usable-editor.tsx +++ b/web/default/src/features/system-settings/models/group-special-usable-editor.tsx @@ -16,9 +16,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useCallback, useMemo, useState } from 'react' import { ChevronDown, ChevronUp, Plus, Trash2 } from 'lucide-react' +import { useCallback, useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' + +import { StatusBadge } from '@/components/status-badge' import { Button } from '@/components/ui/button' import { Card, @@ -41,7 +43,6 @@ import { SelectTrigger, SelectValue, } from '@/components/ui/select' -import { StatusBadge } from '@/components/status-badge' const OP_ADD = 'add' as const const OP_REMOVE = 'remove' as const diff --git a/web/default/src/features/system-settings/models/model-pricing-core.ts b/web/default/src/features/system-settings/models/model-pricing-core.ts index 4f5be4e7..d3d20a3b 100644 --- a/web/default/src/features/system-settings/models/model-pricing-core.ts +++ b/web/default/src/features/system-settings/models/model-pricing-core.ts @@ -17,7 +17,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import * as z from 'zod' + import { combineBillingExpr } from '@/features/pricing/lib/billing-expr' + import { formatPricingNumber } from './pricing-format' export const createModelPricingSchema = (t: (key: string) => string) => diff --git a/web/default/src/features/system-settings/models/model-pricing-inputs.tsx b/web/default/src/features/system-settings/models/model-pricing-inputs.tsx index c79ef90f..585c4656 100644 --- a/web/default/src/features/system-settings/models/model-pricing-inputs.tsx +++ b/web/default/src/features/system-settings/models/model-pricing-inputs.tsx @@ -17,12 +17,14 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + import { InputGroup, InputGroupAddon, InputGroupInput, } from '@/components/ui/input-group' +import { cn } from '@/lib/utils' + import { SettingsControlGroup, SettingsSwitchField, diff --git a/web/default/src/features/system-settings/models/model-pricing-sheet.tsx b/web/default/src/features/system-settings/models/model-pricing-sheet.tsx index bd8ed0b9..4c0178f9 100644 --- a/web/default/src/features/system-settings/models/model-pricing-sheet.tsx +++ b/web/default/src/features/system-settings/models/model-pricing-sheet.tsx @@ -16,6 +16,8 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ +import { zodResolver } from '@hookform/resolvers/zod' +import { AlertTriangle, Save } from 'lucide-react' import { forwardRef, useCallback, @@ -25,10 +27,9 @@ import { useState, } from 'react' import { useForm } from 'react-hook-form' -import { zodResolver } from '@hookform/resolvers/zod' -import { AlertTriangle, Save } from 'lucide-react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + +import { sideDrawerContentClassName } from '@/components/drawer-layout' import { Alert, AlertDescription } from '@/components/ui/alert' import { Button } from '@/components/ui/button' import { @@ -60,7 +61,8 @@ import { SheetTitle, } from '@/components/ui/sheet' import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs' -import { sideDrawerContentClassName } from '@/components/drawer-layout' +import { cn } from '@/lib/utils' + import { EMPTY_LANE_ENABLED, EMPTY_LANE_PRICES, diff --git a/web/default/src/features/system-settings/models/model-pricing-snapshots.ts b/web/default/src/features/system-settings/models/model-pricing-snapshots.ts index 4668f278..afc53533 100644 --- a/web/default/src/features/system-settings/models/model-pricing-snapshots.ts +++ b/web/default/src/features/system-settings/models/model-pricing-snapshots.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { splitBillingExprAndRequestRules } from '@/features/pricing/lib/billing-expr' + import { safeJsonParse } from '../utils/json-parser' import { formatPricingNumber } from './pricing-format' diff --git a/web/default/src/features/system-settings/models/model-ratio-form.tsx b/web/default/src/features/system-settings/models/model-ratio-form.tsx index 9a9c345d..64d38218 100644 --- a/web/default/src/features/system-settings/models/model-ratio-form.tsx +++ b/web/default/src/features/system-settings/models/model-ratio-form.tsx @@ -16,10 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ +import { Code2, Eye, RotateCcw, Save } from 'lucide-react' import { memo, useCallback, useRef, useState } from 'react' import { type UseFormReturn } from 'react-hook-form' -import { Code2, Eye, RotateCcw, Save } from 'lucide-react' import { useTranslation } from 'react-i18next' + +import { JsonCodeEditor } from '@/components/json-code-editor' import { Button } from '@/components/ui/button' import { Form, @@ -31,7 +33,7 @@ import { FormMessage, } from '@/components/ui/form' import { Switch } from '@/components/ui/switch' -import { JsonCodeEditor } from '@/components/json-code-editor' + import { SettingsForm, SettingsSwitchContent, diff --git a/web/default/src/features/system-settings/models/model-ratio-table-columns.tsx b/web/default/src/features/system-settings/models/model-ratio-table-columns.tsx index b6dcbfa1..df4aa9dc 100644 --- a/web/default/src/features/system-settings/models/model-ratio-table-columns.tsx +++ b/web/default/src/features/system-settings/models/model-ratio-table-columns.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import type { ColumnDef } from '@tanstack/react-table' + import { DataTableColumnHeader } from '@/components/data-table/core/column-header' import { StaticRowActions } from '@/components/data-table/static/static-row-actions' import { StatusBadge } from '@/components/status-badge' diff --git a/web/default/src/features/system-settings/models/model-ratio-visual-editor.tsx b/web/default/src/features/system-settings/models/model-ratio-visual-editor.tsx index c0265c5c..099b2bfc 100644 --- a/web/default/src/features/system-settings/models/model-ratio-visual-editor.tsx +++ b/web/default/src/features/system-settings/models/model-ratio-visual-editor.tsx @@ -16,6 +16,15 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ +import { + type ColumnFiltersState, + type OnChangeFn, + type PaginationState, + type RowSelectionState, + type VisibilityState, + type SortingState, +} from '@tanstack/react-table' +import { Copy, Plus } from 'lucide-react' import { useState, useMemo, @@ -26,19 +35,9 @@ import { useImperativeHandle, useRef, } from 'react' -import { - type ColumnFiltersState, - type OnChangeFn, - type PaginationState, - type RowSelectionState, - type VisibilityState, - type SortingState, -} from '@tanstack/react-table' -import { useMediaQuery } from '@/hooks' -import { Copy, Plus } from 'lucide-react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { Button } from '@/components/ui/button' + import { DataTableBulkActions, DataTableToolbar, @@ -47,7 +46,10 @@ import { DataTableView, useDataTable, } from '@/components/data-table' +import { Button } from '@/components/ui/button' import { combineBillingExpr } from '@/features/pricing/lib/billing-expr' +import { useMediaQuery } from '@/hooks' + import { safeJsonParse } from '../utils/json-parser' import { ModelPricingEditorPanel, diff --git a/web/default/src/features/system-settings/models/ratio-settings-card.tsx b/web/default/src/features/system-settings/models/ratio-settings-card.tsx index e533cd99..25e4b519 100644 --- a/web/default/src/features/system-settings/models/ratio-settings-card.tsx +++ b/web/default/src/features/system-settings/models/ratio-settings-card.tsx @@ -16,15 +16,17 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useCallback, useEffect, useMemo, useRef, useState } from 'react' -import * as z from 'zod' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' import { useMutation, useQueryClient } from '@tanstack/react-query' +import { useCallback, useEffect, useMemo, useRef, useState } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs' +import * as z from 'zod' + import { ConfirmDialog } from '@/components/confirm-dialog' +import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs' + import { resetModelRatios } from '../api' import { SettingsPageTitleStatusPortal } from '../components/settings-page-context' import { SettingsSection } from '../components/settings-section' diff --git a/web/default/src/features/system-settings/models/routing-reliability-section.tsx b/web/default/src/features/system-settings/models/routing-reliability-section.tsx index 99a39bb2..efc8092a 100644 --- a/web/default/src/features/system-settings/models/routing-reliability-section.tsx +++ b/web/default/src/features/system-settings/models/routing-reliability-section.tsx @@ -16,13 +16,13 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useMemo, useRef } from 'react' -import * as z from 'zod' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' +import { useMemo, useRef } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { parseHttpStatusCodeRules } from '@/lib/http-status-code-rules' +import * as z from 'zod' + import { Form, FormControl, @@ -44,6 +44,8 @@ import { import { Separator } from '@/components/ui/separator' import { Switch } from '@/components/ui/switch' import { Textarea } from '@/components/ui/textarea' +import { parseHttpStatusCodeRules } from '@/lib/http-status-code-rules' + import { SettingsForm, SettingsSwitchContent, @@ -364,7 +366,9 @@ export function RoutingReliabilitySection({ {t('Scheduled channel tests')} - {t('Automatically probe all channels in the background')} + {t( + 'Automatically probe all channels in the background' + )} @@ -457,7 +461,9 @@ export function RoutingReliabilitySection({ {t('Re-enable on success')} - {t('Bring channels back online after successful checks')} + {t( + 'Bring channels back online after successful checks' + )} @@ -476,9 +482,7 @@ export function RoutingReliabilitySection({
-

- {t('Auto-disable rules')} -

+

{t('Auto-disable rules')}

. For commercial licensing, please contact support@quantumnous.com */ +import { ChevronDown, Copy, Plus, Trash2 } from 'lucide-react' import { memo, useCallback, @@ -28,10 +29,9 @@ import { type InputHTMLAttributes, type MouseEvent as ReactMouseEvent, } from 'react' -import { ChevronDown, Copy, Plus, Trash2 } from 'lucide-react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { cn } from '@/lib/utils' + import { Alert, AlertDescription } from '@/components/ui/alert' import { Badge } from '@/components/ui/badge' import { Button } from '@/components/ui/button' @@ -99,6 +99,7 @@ import { normalizeVisualTier, tryParseVisualConfig, } from '@/features/pricing/lib/tier-expr' +import { cn } from '@/lib/utils' const PRICE_SUFFIX = '$/1M tokens' const CACHE_PRICE_VARS = BILLING_EXTRA_VARS.filter( diff --git a/web/default/src/features/system-settings/models/tool-price-settings.tsx b/web/default/src/features/system-settings/models/tool-price-settings.tsx index afa59e1f..b0173f9d 100644 --- a/web/default/src/features/system-settings/models/tool-price-settings.tsx +++ b/web/default/src/features/system-settings/models/tool-price-settings.tsx @@ -16,15 +16,17 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { memo, useCallback, useEffect, useMemo, useState } from 'react' import { Code2, Copy, Eye, Plus, Trash2 } from 'lucide-react' +import { memo, useCallback, useEffect, useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' + +import { StaticDataTable } from '@/components/data-table' import { Alert, AlertDescription } from '@/components/ui/alert' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Textarea } from '@/components/ui/textarea' -import { StaticDataTable } from '@/components/data-table' + import { useUpdateOption } from '../hooks/use-update-option' const OPTION_KEY = 'tool_price_setting.prices' diff --git a/web/default/src/features/system-settings/models/upstream-ratio-sync-columns.tsx b/web/default/src/features/system-settings/models/upstream-ratio-sync-columns.tsx index a88e3735..13374b78 100644 --- a/web/default/src/features/system-settings/models/upstream-ratio-sync-columns.tsx +++ b/web/default/src/features/system-settings/models/upstream-ratio-sync-columns.tsx @@ -16,10 +16,13 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useMemo } from 'react' import { type ColumnDef } from '@tanstack/react-table' import { AlertTriangle } from 'lucide-react' +import { useMemo } from 'react' import { useTranslation } from 'react-i18next' + +import { BadgeCell } from '@/components/data-table' +import { StatusBadge } from '@/components/status-badge' import { Checkbox } from '@/components/ui/checkbox' import { Tooltip, @@ -27,8 +30,7 @@ import { TooltipProvider, TooltipTrigger, } from '@/components/ui/tooltip' -import { BadgeCell } from '@/components/data-table' -import { StatusBadge } from '@/components/status-badge' + import type { RatioType } from '../types' import { getOrderedRatioTypes, diff --git a/web/default/src/features/system-settings/models/upstream-ratio-sync-table.tsx b/web/default/src/features/system-settings/models/upstream-ratio-sync-table.tsx index a6e2176f..317c7ce5 100644 --- a/web/default/src/features/system-settings/models/upstream-ratio-sync-table.tsx +++ b/web/default/src/features/system-settings/models/upstream-ratio-sync-table.tsx @@ -16,9 +16,15 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useCallback, useMemo, useState } from 'react' import { Loader2, Search } from 'lucide-react' +import { useCallback, useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' + +import { + DataTablePagination, + DataTableView, + useDataTable, +} from '@/components/data-table' import { Input } from '@/components/ui/input' import { Select, @@ -28,11 +34,7 @@ import { SelectTrigger, SelectValue, } from '@/components/ui/select' -import { - DataTablePagination, - DataTableView, - useDataTable, -} from '@/components/data-table' + import type { DifferencesMap, RatioType } from '../types' import { RATIO_TYPE_OPTIONS } from './constants' import { useUpstreamRatioSyncColumns } from './upstream-ratio-sync-columns' diff --git a/web/default/src/features/system-settings/models/upstream-ratio-sync.tsx b/web/default/src/features/system-settings/models/upstream-ratio-sync.tsx index 38bafa86..4d80f136 100644 --- a/web/default/src/features/system-settings/models/upstream-ratio-sync.tsx +++ b/web/default/src/features/system-settings/models/upstream-ratio-sync.tsx @@ -16,12 +16,14 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useCallback, useEffect, useMemo, useState } from 'react' import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query' import { CheckSquare, RefreshCcw } from 'lucide-react' +import { useCallback, useEffect, useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' + import { Button } from '@/components/ui/button' + import { fetchUpstreamRatios, getUpstreamChannels, diff --git a/web/default/src/features/system-settings/operations/index.tsx b/web/default/src/features/system-settings/operations/index.tsx index acc9f678..5ea7070a 100644 --- a/web/default/src/features/system-settings/operations/index.tsx +++ b/web/default/src/features/system-settings/operations/index.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useStatus } from '@/hooks/use-status' + import { SettingsPage } from '../components/settings-page' import type { OperationsSettings } from '../types' import { diff --git a/web/default/src/features/system-settings/request-limits/rate-limit-dialog.tsx b/web/default/src/features/system-settings/request-limits/rate-limit-dialog.tsx index 38526d01..abf2abed 100644 --- a/web/default/src/features/system-settings/request-limits/rate-limit-dialog.tsx +++ b/web/default/src/features/system-settings/request-limits/rate-limit-dialog.tsx @@ -16,11 +16,13 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect } from 'react' -import * as z from 'zod' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' +import { useEffect } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' +import * as z from 'zod' + +import { Dialog } from '@/components/dialog' import { Button } from '@/components/ui/button' import { Form, @@ -32,7 +34,6 @@ import { FormMessage, } from '@/components/ui/form' import { Input } from '@/components/ui/input' -import { Dialog } from '@/components/dialog' const rateLimitDialogSchema = z.object({ groupName: z.string().min(1, 'Group name is required'), diff --git a/web/default/src/features/system-settings/request-limits/rate-limit-section.tsx b/web/default/src/features/system-settings/request-limits/rate-limit-section.tsx index 864aabf5..98cefedf 100644 --- a/web/default/src/features/system-settings/request-limits/rate-limit-section.tsx +++ b/web/default/src/features/system-settings/request-limits/rate-limit-section.tsx @@ -16,12 +16,13 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useState } from 'react' -import * as z from 'zod' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' import { Code2, Palette } from 'lucide-react' +import { useEffect, useState } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' +import * as z from 'zod' + import { Button } from '@/components/ui/button' import { Form, @@ -35,6 +36,7 @@ import { import { Input } from '@/components/ui/input' import { Switch } from '@/components/ui/switch' import { Textarea } from '@/components/ui/textarea' + import { SettingsForm, SettingsSwitchContent, diff --git a/web/default/src/features/system-settings/request-limits/rate-limit-visual-editor.tsx b/web/default/src/features/system-settings/request-limits/rate-limit-visual-editor.tsx index aacf5c49..78c5479a 100644 --- a/web/default/src/features/system-settings/request-limits/rate-limit-visual-editor.tsx +++ b/web/default/src/features/system-settings/request-limits/rate-limit-visual-editor.tsx @@ -16,13 +16,15 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useMemo } from 'react' import { Plus, Search } from 'lucide-react' +import { useState, useMemo } from 'react' import { useTranslation } from 'react-i18next' -import { Button } from '@/components/ui/button' -import { Input } from '@/components/ui/input' + import { StaticDataTable } from '@/components/data-table/static/static-data-table' import { StaticRowActions } from '@/components/data-table/static/static-row-actions' +import { Button } from '@/components/ui/button' +import { Input } from '@/components/ui/input' + import { safeJsonParseWithValidation } from '../utils/json-parser' import { isObjectRecord } from '../utils/json-validators' import { RateLimitDialog, type RateLimitEntryData } from './rate-limit-dialog' diff --git a/web/default/src/features/system-settings/request-limits/sensitive-words-section.tsx b/web/default/src/features/system-settings/request-limits/sensitive-words-section.tsx index cd969fe1..a3ddaa6d 100644 --- a/web/default/src/features/system-settings/request-limits/sensitive-words-section.tsx +++ b/web/default/src/features/system-settings/request-limits/sensitive-words-section.tsx @@ -16,11 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect } from 'react' -import * as z from 'zod' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' +import { useEffect } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' +import * as z from 'zod' + import { Form, FormControl, @@ -32,6 +33,7 @@ import { } from '@/components/ui/form' import { Switch } from '@/components/ui/switch' import { Textarea } from '@/components/ui/textarea' + import { SettingsForm, SettingsSwitchContent, diff --git a/web/default/src/features/system-settings/request-limits/ssrf-section.tsx b/web/default/src/features/system-settings/request-limits/ssrf-section.tsx index d7309604..6e7160dd 100644 --- a/web/default/src/features/system-settings/request-limits/ssrf-section.tsx +++ b/web/default/src/features/system-settings/request-limits/ssrf-section.tsx @@ -16,12 +16,13 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useMemo, useRef } from 'react' -import * as z from 'zod' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' +import { useEffect, useMemo, useRef } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' +import * as z from 'zod' + import { Form, FormControl, @@ -42,6 +43,7 @@ import { } from '@/components/ui/select' import { Switch } from '@/components/ui/switch' import { Textarea } from '@/components/ui/textarea' + import { SettingsForm, SettingsSwitchContent, diff --git a/web/default/src/features/system-settings/request-limits/token-limit-section.tsx b/web/default/src/features/system-settings/request-limits/token-limit-section.tsx index 93731cd7..61bc33ca 100644 --- a/web/default/src/features/system-settings/request-limits/token-limit-section.tsx +++ b/web/default/src/features/system-settings/request-limits/token-limit-section.tsx @@ -21,6 +21,7 @@ import { useEffect } from 'react' import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' import * as z from 'zod' + import { Form, FormControl, @@ -31,6 +32,7 @@ import { FormMessage, } from '@/components/ui/form' import { Input } from '@/components/ui/input' + import { SettingsForm } from '../components/settings-form-layout' import { SettingsPageFormActions } from '../components/settings-page-context' import { SettingsSection } from '../components/settings-section' diff --git a/web/default/src/features/system-settings/utils/route-config.ts b/web/default/src/features/system-settings/utils/route-config.ts index b74d59e3..960e1cf8 100644 --- a/web/default/src/features/system-settings/utils/route-config.ts +++ b/web/default/src/features/system-settings/utils/route-config.ts @@ -16,8 +16,8 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import * as z from 'zod' import { redirect } from '@tanstack/react-router' +import * as z from 'zod' /** * Create search schema for settings routes with section parameter diff --git a/web/default/src/features/system-settings/utils/section-registry.ts b/web/default/src/features/system-settings/utils/section-registry.ts index 7df1a8c1..20ba800b 100644 --- a/web/default/src/features/system-settings/utils/section-registry.ts +++ b/web/default/src/features/system-settings/utils/section-registry.ts @@ -16,8 +16,8 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import type { ReactNode } from 'react' import type { TFunction } from 'i18next' +import type { ReactNode } from 'react' /** * Section definition for settings pages diff --git a/web/default/src/features/usage-logs/api.ts b/web/default/src/features/usage-logs/api.ts index 720c5813..79b59c0b 100644 --- a/web/default/src/features/usage-logs/api.ts +++ b/web/default/src/features/usage-logs/api.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { api } from '@/lib/api' + import { buildQueryParams } from './lib/utils' import type { GetLogsParams, diff --git a/web/default/src/features/usage-logs/components/columns/column-helpers.tsx b/web/default/src/features/usage-logs/components/columns/column-helpers.tsx index 25a4bd7b..4ed34748 100644 --- a/web/default/src/features/usage-logs/components/columns/column-helpers.tsx +++ b/web/default/src/features/usage-logs/components/columns/column-helpers.tsx @@ -16,20 +16,22 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -/* eslint-disable react-refresh/only-export-components */ -import { useState } from 'react' import type { ColumnDef } from '@tanstack/react-table' import { Zap } from 'lucide-react' -import { formatTimestampToDate, formatTokens } from '@/lib/format' -import { cn } from '@/lib/utils' +/* eslint-disable react-refresh/only-export-components */ +import { useState } from 'react' + +import { DataTableColumnHeader } from '@/components/data-table' +import { StatusBadge } from '@/components/status-badge' import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from '@/components/ui/tooltip' -import { DataTableColumnHeader } from '@/components/data-table' -import { StatusBadge } from '@/components/status-badge' +import { formatTimestampToDate, formatTokens } from '@/lib/format' +import { cn } from '@/lib/utils' + import { formatDuration } from '../../lib/format' import { FailReasonDialog } from '../dialogs/fail-reason-dialog' diff --git a/web/default/src/features/usage-logs/components/columns/common-logs-columns.tsx b/web/default/src/features/usage-logs/components/columns/common-logs-columns.tsx index 7ef4e1c7..15c547f9 100644 --- a/web/default/src/features/usage-logs/components/columns/common-logs-columns.tsx +++ b/web/default/src/features/usage-logs/components/columns/common-logs-columns.tsx @@ -16,18 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState } from 'react' import { type ColumnDef } from '@tanstack/react-table' import { CircleAlert, GitBranch, Sparkles, KeyRound } from 'lucide-react' +import { useState } from 'react' import { useTranslation } from 'react-i18next' -import { getUserAvatarFallback, getUserAvatarStyle } from '@/lib/avatar' -import { formatBillingCurrencyFromUSD } from '@/lib/currency' -import { - formatUseTime, - formatLogQuota, - formatTimestampToDate, -} from '@/lib/format' -import { cn } from '@/lib/utils' + +import { StatusBadge, type StatusBadgeProps } from '@/components/status-badge' import { Avatar, AvatarFallback } from '@/components/ui/avatar' import { Popover, @@ -40,7 +34,15 @@ import { TooltipProvider, TooltipTrigger, } from '@/components/ui/tooltip' -import { StatusBadge, type StatusBadgeProps } from '@/components/status-badge' +import { getUserAvatarFallback, getUserAvatarStyle } from '@/lib/avatar' +import { formatBillingCurrencyFromUSD } from '@/lib/currency' +import { + formatUseTime, + formatLogQuota, + formatTimestampToDate, +} from '@/lib/format' +import { cn } from '@/lib/utils' + import { LOG_TYPE_ALL_VALUE } from '../../constants' import type { UsageLog } from '../../data/schema' import { @@ -328,8 +330,9 @@ export function useCommonLogsColumns(isAdmin: boolean): ColumnDef[] { ? rawUseChannel.map(String).filter(Boolean) : [] const hasRetryChain = useChannel.length > 1 - const channelChain = - hasRetryChain ? useChannel.join(' → ') : undefined + const channelChain = hasRetryChain + ? useChannel.join(' → ') + : undefined const channelDisplay = log.channel_name ? `${log.channel_name} #${log.channel}` : `#${log.channel}` diff --git a/web/default/src/features/usage-logs/components/columns/drawing-logs-columns.tsx b/web/default/src/features/usage-logs/components/columns/drawing-logs-columns.tsx index 3f01b20c..2b108513 100644 --- a/web/default/src/features/usage-logs/components/columns/drawing-logs-columns.tsx +++ b/web/default/src/features/usage-logs/components/columns/drawing-logs-columns.tsx @@ -16,7 +16,6 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState } from 'react' import type { ColumnDef } from '@tanstack/react-table' import { Blend, @@ -36,9 +35,12 @@ import { ZoomIn, type LucideIcon, } from 'lucide-react' +import { useState } from 'react' import { useTranslation } from 'react-i18next' -import { formatTimestampToDate } from '@/lib/format' + import { StatusBadge } from '@/components/status-badge' +import { formatTimestampToDate } from '@/lib/format' + import { MJ_TASK_TYPES } from '../../constants' import { mjTaskTypeMapper, diff --git a/web/default/src/features/usage-logs/components/columns/task-logs-columns.tsx b/web/default/src/features/usage-logs/components/columns/task-logs-columns.tsx index 985d308c..24836e62 100644 --- a/web/default/src/features/usage-logs/components/columns/task-logs-columns.tsx +++ b/web/default/src/features/usage-logs/components/columns/task-logs-columns.tsx @@ -16,16 +16,18 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -/* eslint-disable react-refresh/only-export-components */ -import { useState, useMemo } from 'react' import type { ColumnDef } from '@tanstack/react-table' import { Music } from 'lucide-react' +/* eslint-disable react-refresh/only-export-components */ +import { useState, useMemo } from 'react' import { useTranslation } from 'react-i18next' + +import { StatusBadge } from '@/components/status-badge' +import { Avatar, AvatarFallback } from '@/components/ui/avatar' import { getUserAvatarFallback, getUserAvatarStyle } from '@/lib/avatar' import { formatTimestampToDate } from '@/lib/format' import { cn } from '@/lib/utils' -import { Avatar, AvatarFallback } from '@/components/ui/avatar' -import { StatusBadge } from '@/components/status-badge' + import { TASK_ACTIONS, TASK_STATUS } from '../../constants' import { taskActionMapper, taskStatusMapper } from '../../lib/mappers' import type { TaskLog } from '../../types' diff --git a/web/default/src/features/usage-logs/components/common-logs-filter-bar.tsx b/web/default/src/features/usage-logs/components/common-logs-filter-bar.tsx index a077b2e1..c6a0b3c3 100644 --- a/web/default/src/features/usage-logs/components/common-logs-filter-bar.tsx +++ b/web/default/src/features/usage-logs/components/common-logs-filter-bar.tsx @@ -16,13 +16,13 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useCallback, useMemo } from 'react' import { useQueryClient, useIsFetching } from '@tanstack/react-query' import { useNavigate, getRouteApi } from '@tanstack/react-router' import type { Table } from '@tanstack/react-table' import { Eye, EyeOff } from 'lucide-react' +import { useState, useCallback, useMemo } from 'react' import { useTranslation } from 'react-i18next' -import { useIsAdmin } from '@/hooks/use-admin' + import { Button } from '@/components/ui/button' import { Select, @@ -37,6 +37,8 @@ import { TooltipContent, TooltipTrigger, } from '@/components/ui/tooltip' +import { useIsAdmin } from '@/hooks/use-admin' + import { LOG_TYPE_ALL_VALUE, LOG_TYPE_FILTERS } from '../constants' import { buildSearchParams } from '../lib/filter' import { getDefaultTimeRange } from '../lib/utils' diff --git a/web/default/src/features/usage-logs/components/common-logs-header-actions.tsx b/web/default/src/features/usage-logs/components/common-logs-header-actions.tsx index 5a4a4485..934766f8 100644 --- a/web/default/src/features/usage-logs/components/common-logs-header-actions.tsx +++ b/web/default/src/features/usage-logs/components/common-logs-header-actions.tsx @@ -18,12 +18,14 @@ For commercial licensing, please contact support@quantumnous.com */ import { Eye, EyeOff } from 'lucide-react' import { useTranslation } from 'react-i18next' + import { Button } from '@/components/ui/button' import { Tooltip, TooltipContent, TooltipTrigger, } from '@/components/ui/tooltip' + import { CommonLogsStats } from './common-logs-stats' import { useUsageLogsContext } from './usage-logs-provider' diff --git a/web/default/src/features/usage-logs/components/common-logs-stats.tsx b/web/default/src/features/usage-logs/components/common-logs-stats.tsx index 9e51b974..5219c09a 100644 --- a/web/default/src/features/usage-logs/components/common-logs-stats.tsx +++ b/web/default/src/features/usage-logs/components/common-logs-stats.tsx @@ -19,10 +19,12 @@ For commercial licensing, please contact support@quantumnous.com import { useQuery } from '@tanstack/react-query' import { getRouteApi } from '@tanstack/react-router' import { useTranslation } from 'react-i18next' + +import { Skeleton } from '@/components/ui/skeleton' +import { useIsAdmin } from '@/hooks/use-admin' import { formatLogQuota } from '@/lib/format' import { cn } from '@/lib/utils' -import { useIsAdmin } from '@/hooks/use-admin' -import { Skeleton } from '@/components/ui/skeleton' + import { getLogStats, getUserLogStats } from '../api' import { DEFAULT_LOG_STATS } from '../constants' import { buildApiParams } from '../lib/utils' diff --git a/web/default/src/features/usage-logs/components/compact-date-time-range-picker.tsx b/web/default/src/features/usage-logs/components/compact-date-time-range-picker.tsx index 52acf969..409dd1eb 100644 --- a/web/default/src/features/usage-logs/components/compact-date-time-range-picker.tsx +++ b/web/default/src/features/usage-logs/components/compact-date-time-range-picker.tsx @@ -16,11 +16,10 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useMemo, useState } from 'react' import { CalendarDays } from 'lucide-react' +import { useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' -import dayjs from '@/lib/dayjs' -import { cn } from '@/lib/utils' + import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { @@ -28,6 +27,8 @@ import { PopoverContent, PopoverTrigger, } from '@/components/ui/popover' +import dayjs from '@/lib/dayjs' +import { cn } from '@/lib/utils' interface CompactDateTimeRangePickerProps { start?: Date diff --git a/web/default/src/features/usage-logs/components/dialogs/audio-preview-dialog.tsx b/web/default/src/features/usage-logs/components/dialogs/audio-preview-dialog.tsx index 371fe133..01bdf558 100644 --- a/web/default/src/features/usage-logs/components/dialogs/audio-preview-dialog.tsx +++ b/web/default/src/features/usage-logs/components/dialogs/audio-preview-dialog.tsx @@ -16,14 +16,15 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useRef, useEffect } from 'react' import { ExternalLink, Copy, Music } from 'lucide-react' +import { useState, useRef, useEffect } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { Button } from '@/components/ui/button' -import { ScrollArea } from '@/components/ui/scroll-area' + import { Dialog } from '@/components/dialog' import { StatusBadge } from '@/components/status-badge' +import { Button } from '@/components/ui/button' +import { ScrollArea } from '@/components/ui/scroll-area' export interface AudioClip { clip_id?: string diff --git a/web/default/src/features/usage-logs/components/dialogs/details-dialog.tsx b/web/default/src/features/usage-logs/components/dialogs/details-dialog.tsx index 2904e0ea..37ab7a38 100644 --- a/web/default/src/features/usage-logs/components/dialogs/details-dialog.tsx +++ b/web/default/src/features/usage-logs/components/dialogs/details-dialog.tsx @@ -32,15 +32,17 @@ import { LogIn, } from 'lucide-react' import { useTranslation } from 'react-i18next' + +import { Dialog } from '@/components/dialog' +import { StatusBadge, type StatusBadgeProps } from '@/components/status-badge' +import { Button } from '@/components/ui/button' +import { Label } from '@/components/ui/label' +import { DynamicPricingBreakdown } from '@/features/pricing/components/dynamic-pricing-breakdown' +import { useCopyToClipboard } from '@/hooks/use-copy-to-clipboard' import { formatBillingCurrencyFromUSD } from '@/lib/currency' import { formatLogQuota, formatTokens, formatUseTime } from '@/lib/format' import { cn } from '@/lib/utils' -import { useCopyToClipboard } from '@/hooks/use-copy-to-clipboard' -import { Button } from '@/components/ui/button' -import { Label } from '@/components/ui/label' -import { Dialog } from '@/components/dialog' -import { StatusBadge, type StatusBadgeProps } from '@/components/status-badge' -import { DynamicPricingBreakdown } from '@/features/pricing/components/dynamic-pricing-breakdown' + import type { UsageLog } from '../../data/schema' import { parseLogOther, diff --git a/web/default/src/features/usage-logs/components/dialogs/fail-reason-dialog.tsx b/web/default/src/features/usage-logs/components/dialogs/fail-reason-dialog.tsx index 02503fcd..5409f8a3 100644 --- a/web/default/src/features/usage-logs/components/dialogs/fail-reason-dialog.tsx +++ b/web/default/src/features/usage-logs/components/dialogs/fail-reason-dialog.tsx @@ -18,11 +18,12 @@ For commercial licensing, please contact support@quantumnous.com */ import { Copy, Check } from 'lucide-react' import { useTranslation } from 'react-i18next' -import { useCopyToClipboard } from '@/hooks/use-copy-to-clipboard' + +import { Dialog } from '@/components/dialog' import { Button } from '@/components/ui/button' import { Label } from '@/components/ui/label' import { ScrollArea } from '@/components/ui/scroll-area' -import { Dialog } from '@/components/dialog' +import { useCopyToClipboard } from '@/hooks/use-copy-to-clipboard' interface FailReasonDialogProps { failReason: string diff --git a/web/default/src/features/usage-logs/components/dialogs/image-dialog.tsx b/web/default/src/features/usage-logs/components/dialogs/image-dialog.tsx index 50d83ce5..9a908296 100644 --- a/web/default/src/features/usage-logs/components/dialogs/image-dialog.tsx +++ b/web/default/src/features/usage-logs/components/dialogs/image-dialog.tsx @@ -18,9 +18,10 @@ For commercial licensing, please contact support@quantumnous.com */ import { useState } from 'react' import { useTranslation } from 'react-i18next' + +import { Dialog } from '@/components/dialog' import { ScrollArea } from '@/components/ui/scroll-area' import { Skeleton } from '@/components/ui/skeleton' -import { Dialog } from '@/components/dialog' interface ImageDialogProps { imageUrl: string diff --git a/web/default/src/features/usage-logs/components/dialogs/prompt-dialog.tsx b/web/default/src/features/usage-logs/components/dialogs/prompt-dialog.tsx index f820672c..0e77614f 100644 --- a/web/default/src/features/usage-logs/components/dialogs/prompt-dialog.tsx +++ b/web/default/src/features/usage-logs/components/dialogs/prompt-dialog.tsx @@ -18,11 +18,12 @@ For commercial licensing, please contact support@quantumnous.com */ import { Copy, Check } from 'lucide-react' import { useTranslation } from 'react-i18next' -import { useCopyToClipboard } from '@/hooks/use-copy-to-clipboard' + +import { Dialog } from '@/components/dialog' import { Button } from '@/components/ui/button' import { Label } from '@/components/ui/label' import { ScrollArea } from '@/components/ui/scroll-area' -import { Dialog } from '@/components/dialog' +import { useCopyToClipboard } from '@/hooks/use-copy-to-clipboard' interface PromptDialogProps { prompt: string diff --git a/web/default/src/features/usage-logs/components/dialogs/user-info-dialog.tsx b/web/default/src/features/usage-logs/components/dialogs/user-info-dialog.tsx index 6adb0e94..cf057f9b 100644 --- a/web/default/src/features/usage-logs/components/dialogs/user-info-dialog.tsx +++ b/web/default/src/features/usage-logs/components/dialogs/user-info-dialog.tsx @@ -16,13 +16,15 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useCallback, useEffect, useState } from 'react' import { Loader2 } from 'lucide-react' +import { useCallback, useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { formatQuota, formatCompactNumber } from '@/lib/format' -import { Label } from '@/components/ui/label' + import { Dialog } from '@/components/dialog' +import { Label } from '@/components/ui/label' +import { formatQuota, formatCompactNumber } from '@/lib/format' + import { getUserInfo } from '../../api' import type { UserInfo } from '../../types' diff --git a/web/default/src/features/usage-logs/components/logs-filter-toolbar.tsx b/web/default/src/features/usage-logs/components/logs-filter-toolbar.tsx index 792838d3..de441aef 100644 --- a/web/default/src/features/usage-logs/components/logs-filter-toolbar.tsx +++ b/web/default/src/features/usage-logs/components/logs-filter-toolbar.tsx @@ -16,12 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, type ComponentProps, type ReactNode } from 'react' import type { Table } from '@tanstack/react-table' -import { useMediaQuery } from '@/hooks' import { ChevronDown, Loader2 } from 'lucide-react' +import { useState, type ComponentProps, type ReactNode } from 'react' import { useTranslation } from 'react-i18next' -import { cn } from '@/lib/utils' + +import { DataTableViewOptions } from '@/components/data-table' import { Badge } from '@/components/ui/badge' import { Button } from '@/components/ui/button' import { @@ -34,7 +34,8 @@ import { DrawerTrigger, } from '@/components/ui/drawer' import { Input } from '@/components/ui/input' -import { DataTableViewOptions } from '@/components/data-table' +import { useMediaQuery } from '@/hooks' +import { cn } from '@/lib/utils' interface LogsFilterToolbarProps { table: Table diff --git a/web/default/src/features/usage-logs/components/task-logs-filter-bar.tsx b/web/default/src/features/usage-logs/components/task-logs-filter-bar.tsx index f31cb8fe..efd7553e 100644 --- a/web/default/src/features/usage-logs/components/task-logs-filter-bar.tsx +++ b/web/default/src/features/usage-logs/components/task-logs-filter-bar.tsx @@ -16,12 +16,14 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useEffect, useCallback } from 'react' import { useQueryClient, useIsFetching } from '@tanstack/react-query' import { useNavigate, getRouteApi } from '@tanstack/react-router' import { type Table } from '@tanstack/react-table' +import { useState, useEffect, useCallback } from 'react' import { useTranslation } from 'react-i18next' + import { useIsAdmin } from '@/hooks/use-admin' + import { buildSearchParams } from '../lib/filter' import { getDefaultTimeRange } from '../lib/utils' import type { DrawingLogFilters, LogCategory, TaskLogFilters } from '../types' diff --git a/web/default/src/features/usage-logs/components/usage-logs-mobile-card.tsx b/web/default/src/features/usage-logs/components/usage-logs-mobile-card.tsx index 56d5b84e..203c0ab2 100644 --- a/web/default/src/features/usage-logs/components/usage-logs-mobile-card.tsx +++ b/web/default/src/features/usage-logs/components/usage-logs-mobile-card.tsx @@ -19,8 +19,12 @@ For commercial licensing, please contact support@quantumnous.com import { flexRender, type Cell, type Table } from '@tanstack/react-table' import { Database } from 'lucide-react' import { useTranslation } from 'react-i18next' -import { formatTimestampToDate } from '@/lib/format' -import { cn } from '@/lib/utils' + +import { + dotColorMap, + textColorMap, + type StatusVariant, +} from '@/components/status-badge' import { Empty, EmptyDescription, @@ -29,11 +33,9 @@ import { EmptyTitle, } from '@/components/ui/empty' import { Skeleton } from '@/components/ui/skeleton' -import { - dotColorMap, - textColorMap, - type StatusVariant, -} from '@/components/status-badge' +import { formatTimestampToDate } from '@/lib/format' +import { cn } from '@/lib/utils' + import { LOG_TYPE_ENUM } from '../constants' import { getLogTypeConfig } from '../lib/utils' import type { LogCategory } from '../types' diff --git a/web/default/src/features/usage-logs/components/usage-logs-provider.tsx b/web/default/src/features/usage-logs/components/usage-logs-provider.tsx index f75d40fb..0897d6ba 100644 --- a/web/default/src/features/usage-logs/components/usage-logs-provider.tsx +++ b/web/default/src/features/usage-logs/components/usage-logs-provider.tsx @@ -18,6 +18,7 @@ For commercial licensing, please contact support@quantumnous.com */ /* eslint-disable react-refresh/only-export-components */ import { createContext, useContext, useState, type ReactNode } from 'react' + import type { ChannelAffinityInfo } from '../types' interface UsageLogsContextValue { diff --git a/web/default/src/features/usage-logs/components/usage-logs-table.tsx b/web/default/src/features/usage-logs/components/usage-logs-table.tsx index 63e5d636..46337ecf 100644 --- a/web/default/src/features/usage-logs/components/usage-logs-table.tsx +++ b/web/default/src/features/usage-logs/components/usage-logs-table.tsx @@ -19,17 +19,19 @@ For commercial licensing, please contact support@quantumnous.com import { useQuery } from '@tanstack/react-query' import { getRouteApi } from '@tanstack/react-router' import { type ColumnDef } from '@tanstack/react-table' -import { useMediaQuery } from '@/hooks' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { cn } from '@/lib/utils' -import { useIsAdmin } from '@/hooks/use-admin' -import { useTableUrlState } from '@/hooks/use-table-url-state' + import { DataTablePage, DataTableRow, useDataTable, } from '@/components/data-table' +import { useMediaQuery } from '@/hooks' +import { useIsAdmin } from '@/hooks/use-admin' +import { useTableUrlState } from '@/hooks/use-table-url-state' +import { cn } from '@/lib/utils' + import { DEFAULT_LOGS_DATA, LOG_TYPE_ALL_VALUE, diff --git a/web/default/src/features/usage-logs/constants.ts b/web/default/src/features/usage-logs/constants.ts index 8e48b3f2..a2dff48b 100644 --- a/web/default/src/features/usage-logs/constants.ts +++ b/web/default/src/features/usage-logs/constants.ts @@ -20,6 +20,7 @@ For commercial licensing, please contact support@quantumnous.com * Shared constants for usage logs feature */ import type { StatusBadgeProps } from '@/components/status-badge' + import type { LogStatistics, LogCategory } from './types' // ============================================================================ diff --git a/web/default/src/features/usage-logs/index.tsx b/web/default/src/features/usage-logs/index.tsx index 53bc5dfe..25b1e339 100644 --- a/web/default/src/features/usage-logs/index.tsx +++ b/web/default/src/features/usage-logs/index.tsx @@ -16,14 +16,16 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useCallback, useMemo } from 'react' import { getRouteApi, useNavigate } from '@tanstack/react-router' +import { useCallback, useMemo } from 'react' import { useTranslation } from 'react-i18next' -import { useSidebarConfig } from '@/hooks/use-sidebar-config' -import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs' + import { SectionPageLayout } from '@/components/layout' import type { NavGroup } from '@/components/layout/types' +import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs' import { CacheStatsDialog } from '@/features/system-settings/general/channel-affinity/cache-stats-dialog' +import { useSidebarConfig } from '@/hooks/use-sidebar-config' + import { UserInfoDialog } from './components/dialogs/user-info-dialog' import { UsageLogsProvider, diff --git a/web/default/src/features/usage-logs/lib/columns.ts b/web/default/src/features/usage-logs/lib/columns.ts index 97a6d1d8..ed230046 100644 --- a/web/default/src/features/usage-logs/lib/columns.ts +++ b/web/default/src/features/usage-logs/lib/columns.ts @@ -20,6 +20,7 @@ For commercial licensing, please contact support@quantumnous.com * Column definitions factory */ import type { ColumnDef } from '@tanstack/react-table' + import { useCommonLogsColumns } from '../components/columns/common-logs-columns' import { useDrawingLogsColumns } from '../components/columns/drawing-logs-columns' import { useTaskLogsColumns } from '../components/columns/task-logs-columns' diff --git a/web/default/src/features/usage-logs/lib/format.ts b/web/default/src/features/usage-logs/lib/format.ts index 443cada6..526ca217 100644 --- a/web/default/src/features/usage-logs/lib/format.ts +++ b/web/default/src/features/usage-logs/lib/format.ts @@ -23,6 +23,7 @@ import { parseTiersFromExpr, type ParsedTier, } from '@/features/pricing/lib/billing-expr' + import type { UsageLog } from '../data/schema' import type { LogOtherData } from '../types' diff --git a/web/default/src/features/users/api.ts b/web/default/src/features/users/api.ts index bceaf14d..325ea93f 100644 --- a/web/default/src/features/users/api.ts +++ b/web/default/src/features/users/api.ts @@ -16,8 +16,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { api } from '@/lib/api' import type { PermissionCatalog } from '@/lib/admin-permissions' +import { api } from '@/lib/api' + import type { User, GetUsersParams, diff --git a/web/default/src/features/users/components/data-table-bulk-actions.tsx b/web/default/src/features/users/components/data-table-bulk-actions.tsx index a055cd19..d0e0530d 100644 --- a/web/default/src/features/users/components/data-table-bulk-actions.tsx +++ b/web/default/src/features/users/components/data-table-bulk-actions.tsx @@ -17,7 +17,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { type Table } from '@tanstack/react-table' + import { DataTableBulkActions as BulkActionsToolbar } from '@/components/data-table' + import { type User } from '../types' interface DataTableBulkActionsProps { diff --git a/web/default/src/features/users/components/data-table-row-actions.tsx b/web/default/src/features/users/components/data-table-row-actions.tsx index d1719409..adf8b5cd 100644 --- a/web/default/src/features/users/components/data-table-row-actions.tsx +++ b/web/default/src/features/users/components/data-table-row-actions.tsx @@ -16,7 +16,6 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState } from 'react' import type { Row } from '@tanstack/react-table' import { Pencil, @@ -30,22 +29,25 @@ import { Link2, CreditCard, } from 'lucide-react' +import { useState } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' + +import { ConfirmDialog } from '@/components/confirm-dialog' +import { DataTableRowActionMenu } from '@/components/data-table/core/row-action-menu' import { Button } from '@/components/ui/button' import { DropdownMenuItem, DropdownMenuSeparator, DropdownMenuShortcut, } from '@/components/ui/dropdown-menu' -import { DataTableRowActionMenu } from '@/components/data-table/core/row-action-menu' import { Tooltip, TooltipContent, TooltipTrigger, } from '@/components/ui/tooltip' -import { ConfirmDialog } from '@/components/confirm-dialog' import { UserSubscriptionsDialog } from '@/features/subscriptions/components/dialogs/user-subscriptions-dialog' + import { manageUser, resetUserPasskey, resetUserTwoFA } from '../api' import { USER_STATUS, @@ -155,7 +157,10 @@ export function DataTableRowActions({ row }: DataTableRowActionsProps) { {t('Edit')} - + {isDisabled ? ( handleManage('enable')}> {t('Enable')} @@ -175,88 +180,88 @@ export function DataTableRowActions({ row }: DataTableRowActionsProps) { )} - {isAdmin && !isRoot && ( - handleManage('demote')}> - {t('Demote')} - - - - - )} - - {!isAdmin && ( - handleManage('promote')}> - {t('Promote')} - - - - - )} - - { - event.preventDefault() - setBindingDialogOpen(true) - }} - > - {t('Manage Bindings')} + {isAdmin && !isRoot && ( + handleManage('demote')}> + {t('Demote')} - + + )} - { - event.preventDefault() - setSubscriptionsDialogOpen(true) - }} - > - {t('Manage Subscriptions')} + {!isAdmin && ( + handleManage('promote')}> + {t('Promote')} - + + )} - + { + event.preventDefault() + setBindingDialogOpen(true) + }} + > + {t('Manage Bindings')} + + + + - { - event.preventDefault() - setResetPasskeyOpen(true) - }} - disabled={isRoot} - > - {t('Reset Passkey')} - - - - + { + event.preventDefault() + setSubscriptionsDialogOpen(true) + }} + > + {t('Manage Subscriptions')} + + + + - { - event.preventDefault() - setResetTwoFAOpen(true) - }} - disabled={isRoot} - > - {t('Reset 2FA')} - - - - + - + { + event.preventDefault() + setResetPasskeyOpen(true) + }} + disabled={isRoot} + > + {t('Reset Passkey')} + + + + - - {t('Delete')} - - - - + { + event.preventDefault() + setResetTwoFAOpen(true) + }} + disabled={isRoot} + > + {t('Reset 2FA')} + + + + + + + + + {t('Delete')} + + + + . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useEffect, useCallback, useMemo } from 'react' import { Mail, Globe, @@ -28,10 +27,14 @@ import { Eye, EyeOff, } from 'lucide-react' +import { useState, useEffect, useCallback, useMemo } from 'react' import { useTranslation } from 'react-i18next' import { SiGithub, SiDiscord } from 'react-icons/si' import { toast } from 'sonner' -import { api } from '@/lib/api' + +import { ConfirmDialog } from '@/components/confirm-dialog' +import { Dialog } from '@/components/dialog' +import { StatusBadge } from '@/components/status-badge' import { Button } from '@/components/ui/button' import { ScrollArea } from '@/components/ui/scroll-area' import { Separator } from '@/components/ui/separator' @@ -41,9 +44,8 @@ import { TooltipProvider, TooltipTrigger, } from '@/components/ui/tooltip' -import { ConfirmDialog } from '@/components/confirm-dialog' -import { Dialog } from '@/components/dialog' -import { StatusBadge } from '@/components/status-badge' +import { api } from '@/lib/api' + import { getUser, getUserOAuthBindings, diff --git a/web/default/src/features/users/components/user-quota-dialog.tsx b/web/default/src/features/users/components/user-quota-dialog.tsx index e23dedd2..fdfe1584 100644 --- a/web/default/src/features/users/components/user-quota-dialog.tsx +++ b/web/default/src/features/users/components/user-quota-dialog.tsx @@ -19,13 +19,15 @@ For commercial licensing, please contact support@quantumnous.com import { useState } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { getCurrencyDisplay, getCurrencyLabel } from '@/lib/currency' -import { formatQuota, parseQuotaFromDollars } from '@/lib/format' -import { cn } from '@/lib/utils' + +import { Dialog } from '@/components/dialog' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' -import { Dialog } from '@/components/dialog' +import { getCurrencyDisplay, getCurrencyLabel } from '@/lib/currency' +import { formatQuota, parseQuotaFromDollars } from '@/lib/format' +import { cn } from '@/lib/utils' + import { adjustUserQuota } from '../api' import type { QuotaAdjustMode } from '../types' diff --git a/web/default/src/features/users/components/users-columns.tsx b/web/default/src/features/users/components/users-columns.tsx index 389cea0e..d1845d85 100644 --- a/web/default/src/features/users/components/users-columns.tsx +++ b/web/default/src/features/users/components/users-columns.tsx @@ -18,8 +18,12 @@ For commercial licensing, please contact support@quantumnous.com */ import { type ColumnDef } from '@tanstack/react-table' import { useTranslation } from 'react-i18next' -import { formatQuota, formatTimestamp } from '@/lib/format' -import { cn } from '@/lib/utils' + +import { BadgeCell } from '@/components/data-table' +import { GroupBadge } from '@/components/group-badge' +import { LongText } from '@/components/long-text' +import { StatusBadge } from '@/components/status-badge' +import { TableId } from '@/components/table-id' import { Checkbox } from '@/components/ui/checkbox' import { Progress } from '@/components/ui/progress' import { @@ -27,11 +31,9 @@ import { TooltipContent, TooltipTrigger, } from '@/components/ui/tooltip' -import { BadgeCell } from '@/components/data-table' -import { GroupBadge } from '@/components/group-badge' -import { LongText } from '@/components/long-text' -import { StatusBadge } from '@/components/status-badge' -import { TableId } from '@/components/table-id' +import { formatQuota, formatTimestamp } from '@/lib/format' +import { cn } from '@/lib/utils' + import { USER_STATUS, USER_STATUSES, diff --git a/web/default/src/features/users/components/users-delete-dialog.tsx b/web/default/src/features/users/components/users-delete-dialog.tsx index 72c26cff..f4980e4d 100644 --- a/web/default/src/features/users/components/users-delete-dialog.tsx +++ b/web/default/src/features/users/components/users-delete-dialog.tsx @@ -19,7 +19,9 @@ For commercial licensing, please contact support@quantumnous.com import { useState } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' + import { ConfirmDialog } from '@/components/confirm-dialog' + import { deleteUser } from '../api' import { ERROR_MESSAGES } from '../constants' import { getUserActionMessage } from '../lib' diff --git a/web/default/src/features/users/components/users-mutate-drawer.tsx b/web/default/src/features/users/components/users-mutate-drawer.tsx index 41744aa5..8409f572 100644 --- a/web/default/src/features/users/components/users-mutate-drawer.tsx +++ b/web/default/src/features/users/components/users-mutate-drawer.tsx @@ -16,24 +16,21 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useState } from 'react' -import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' import { useQuery } from '@tanstack/react-query' import { Pencil } from 'lucide-react' +import { useEffect, useState } from 'react' +import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' + import { - ADMIN_PERMISSION_ACTIONS, - ADMIN_PERMISSION_RESOURCES, - EMPTY_PERMISSION_CATALOG, - hasPermission, - normalizeAdminPermissions, -} from '@/lib/admin-permissions' -import { getCurrencyDisplay, getCurrencyLabel } from '@/lib/currency' -import { formatQuota, parseQuotaFromDollars } from '@/lib/format' -import { ROLE } from '@/lib/roles' -import { useAuthStore } from '@/stores/auth-store' + SideDrawerSection, + sideDrawerContentClassName, + sideDrawerFooterClassName, + sideDrawerFormClassName, + sideDrawerHeaderClassName, +} from '@/components/drawer-layout' import { Button } from '@/components/ui/button' import { Checkbox } from '@/components/ui/checkbox' import { @@ -66,12 +63,17 @@ import { } from '@/components/ui/sheet' import { Textarea } from '@/components/ui/textarea' import { - SideDrawerSection, - sideDrawerContentClassName, - sideDrawerFooterClassName, - sideDrawerFormClassName, - sideDrawerHeaderClassName, -} from '@/components/drawer-layout' + ADMIN_PERMISSION_ACTIONS, + ADMIN_PERMISSION_RESOURCES, + EMPTY_PERMISSION_CATALOG, + hasPermission, + normalizeAdminPermissions, +} from '@/lib/admin-permissions' +import { getCurrencyDisplay, getCurrencyLabel } from '@/lib/currency' +import { formatQuota, parseQuotaFromDollars } from '@/lib/format' +import { ROLE } from '@/lib/roles' +import { useAuthStore } from '@/stores/auth-store' + import { createUser, updateUser, @@ -451,88 +453,93 @@ export function UsersMutateDrawer({ {canEditAdminPermissions && targetIsAdmin && permissionCatalog.resources.length > 0 && ( - -

- {t('Admin Permissions')} -

-

- {t( - 'Default administrator permissions can be overridden for this user.' - )} -

- { - const selected = normalizeAdminPermissions( - field.value, - permissionCatalog - ) - return ( - -
- {permissionCatalog.resources.map((resource) => ( -
-
- {t(resource.label_key)} -
-
- {resource.actions.map((option) => ( - - ))} -
-
- ))} -
- -
- ) - }} - /> - {currentUser && ( + +

+ {t('Admin Permissions')} +

- {hasPermission( - currentUser, - ADMIN_PERMISSION_RESOURCES.CHANNEL, - ADMIN_PERMISSION_ACTIONS.SENSITIVE_WRITE - ) - ? t('Your account can edit sensitive channel settings.') - : t('Your account cannot edit sensitive channel settings.')} + {t( + 'Default administrator permissions can be overridden for this user.' + )}

- )} -
- )} + { + const selected = normalizeAdminPermissions( + field.value, + permissionCatalog + ) + return ( + +
+ {permissionCatalog.resources.map((resource) => ( +
+
+ {t(resource.label_key)} +
+
+ {resource.actions.map((option) => ( + + ))} +
+
+ ))} +
+ +
+ ) + }} + /> + {currentUser && ( +

+ {hasPermission( + currentUser, + ADMIN_PERMISSION_RESOURCES.CHANNEL, + ADMIN_PERMISSION_ACTIONS.SENSITIVE_WRITE + ) + ? t( + 'Your account can edit sensitive channel settings.' + ) + : t( + 'Your account cannot edit sensitive channel settings.' + )} +

+ )} +
+ )} {/* Binding Information (Read-only) */} {isUpdate && ( diff --git a/web/default/src/features/users/components/users-primary-buttons.tsx b/web/default/src/features/users/components/users-primary-buttons.tsx index 16b0b82b..bf80a3c9 100644 --- a/web/default/src/features/users/components/users-primary-buttons.tsx +++ b/web/default/src/features/users/components/users-primary-buttons.tsx @@ -18,7 +18,9 @@ For commercial licensing, please contact support@quantumnous.com */ import { Plus } from 'lucide-react' import { useTranslation } from 'react-i18next' + import { Button } from '@/components/ui/button' + import { useUsers } from './users-provider' export function UsersPrimaryButtons() { diff --git a/web/default/src/features/users/components/users-provider.tsx b/web/default/src/features/users/components/users-provider.tsx index 4dcb3cfa..9b21ced9 100644 --- a/web/default/src/features/users/components/users-provider.tsx +++ b/web/default/src/features/users/components/users-provider.tsx @@ -17,7 +17,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import React, { useState } from 'react' + import useDialogState from '@/hooks/use-dialog' + import { type User, type UsersDialogType } from '../types' type UsersContextType = { diff --git a/web/default/src/features/users/components/users-table.tsx b/web/default/src/features/users/components/users-table.tsx index 1dd9b716..33838a7d 100644 --- a/web/default/src/features/users/components/users-table.tsx +++ b/web/default/src/features/users/components/users-table.tsx @@ -18,16 +18,18 @@ For commercial licensing, please contact support@quantumnous.com */ import { useQuery } from '@tanstack/react-query' import { getRouteApi } from '@tanstack/react-router' -import { useMediaQuery } from '@/hooks' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { useTableUrlState } from '@/hooks/use-table-url-state' + import { DISABLED_ROW_DESKTOP, DISABLED_ROW_MOBILE, DataTablePage, useDataTable, } from '@/components/data-table' +import { useMediaQuery } from '@/hooks' +import { useTableUrlState } from '@/hooks/use-table-url-state' + import { getUsers, searchUsers } from '../api' import { USER_STATUS, diff --git a/web/default/src/features/users/constants.ts b/web/default/src/features/users/constants.ts index 71c2c340..a48fa4fe 100644 --- a/web/default/src/features/users/constants.ts +++ b/web/default/src/features/users/constants.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { Shield, User, Users } from 'lucide-react' + import type { User as UserType } from './types' // ============================================================================ diff --git a/web/default/src/features/users/index.tsx b/web/default/src/features/users/index.tsx index 51bb70f9..dc6d8f7b 100644 --- a/web/default/src/features/users/index.tsx +++ b/web/default/src/features/users/index.tsx @@ -17,7 +17,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useTranslation } from 'react-i18next' + import { SectionPageLayout } from '@/components/layout' + import { UsersDeleteDialog } from './components/users-delete-dialog' import { UsersMutateDrawer } from './components/users-mutate-drawer' import { UsersPrimaryButtons } from './components/users-primary-buttons' diff --git a/web/default/src/features/users/lib/user-form.ts b/web/default/src/features/users/lib/user-form.ts index 916bff76..bc6c7894 100644 --- a/web/default/src/features/users/lib/user-form.ts +++ b/web/default/src/features/users/lib/user-form.ts @@ -17,13 +17,15 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { z } from 'zod' -import { quotaUnitsToDollars } from '@/lib/format' + import { type PermissionCatalog, type AdminPermissionMatrix, normalizeAdminPermissions, } from '@/lib/admin-permissions' +import { quotaUnitsToDollars } from '@/lib/format' import { ROLE } from '@/lib/roles' + import { DEFAULT_GROUP } from '../constants' import { type UserFormData, type User } from '../types' @@ -39,7 +41,9 @@ export const userFormSchema = z.object({ quota_dollars: z.number().min(0).optional(), group: z.string().optional(), remark: z.string().optional(), - admin_permissions: z.record(z.string(), z.record(z.string(), z.boolean())).optional(), + admin_permissions: z + .record(z.string(), z.record(z.string(), z.boolean())) + .optional(), }) export type UserFormValues = z.infer diff --git a/web/default/src/features/users/types.ts b/web/default/src/features/users/types.ts index 1cbd2096..a6f12514 100644 --- a/web/default/src/features/users/types.ts +++ b/web/default/src/features/users/types.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { z } from 'zod' + import type { AdminPermissionMatrix } from '@/lib/admin-permissions' // ============================================================================ @@ -58,7 +59,9 @@ export const userSchema = z.object({ last_login_at: z.number().optional(), DeletedAt: z.any().nullable().optional(), remark: z.string().optional(), - admin_permissions: z.record(z.string(), z.record(z.string(), z.boolean())).optional(), + admin_permissions: z + .record(z.string(), z.record(z.string(), z.boolean())) + .optional(), }) export type User = z.infer diff --git a/web/default/src/features/wallet/api.ts b/web/default/src/features/wallet/api.ts index 949f9d2a..7cd0460a 100644 --- a/web/default/src/features/wallet/api.ts +++ b/web/default/src/features/wallet/api.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { api } from '@/lib/api' + import type { RedemptionRequest, PaymentRequest, diff --git a/web/default/src/features/wallet/components/affiliate-rewards-card.tsx b/web/default/src/features/wallet/components/affiliate-rewards-card.tsx index b3af98e1..b621e0bb 100644 --- a/web/default/src/features/wallet/components/affiliate-rewards-card.tsx +++ b/web/default/src/features/wallet/components/affiliate-rewards-card.tsx @@ -18,12 +18,14 @@ For commercial licensing, please contact support@quantumnous.com */ import { Share2 } from 'lucide-react' import { useTranslation } from 'react-i18next' -import { formatQuota } from '@/lib/format' + +import { CopyButton } from '@/components/copy-button' import { Button } from '@/components/ui/button' import { Card, CardContent } from '@/components/ui/card' import { Input } from '@/components/ui/input' import { Skeleton } from '@/components/ui/skeleton' -import { CopyButton } from '@/components/copy-button' +import { formatQuota } from '@/lib/format' + import type { UserWalletData } from '../types' interface AffiliateRewardsCardProps { diff --git a/web/default/src/features/wallet/components/creem-products-section.tsx b/web/default/src/features/wallet/components/creem-products-section.tsx index a3daef2a..37c90670 100644 --- a/web/default/src/features/wallet/components/creem-products-section.tsx +++ b/web/default/src/features/wallet/components/creem-products-section.tsx @@ -17,9 +17,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useTranslation } from 'react-i18next' -import { formatNumber } from '@/lib/format' + import { Card, CardContent } from '@/components/ui/card' import { Skeleton } from '@/components/ui/skeleton' +import { formatNumber } from '@/lib/format' + import { formatCreemPrice } from '../lib/format' import type { CreemProduct } from '../types' diff --git a/web/default/src/features/wallet/components/dialogs/billing-history-dialog.tsx b/web/default/src/features/wallet/components/dialogs/billing-history-dialog.tsx index d0b31491..59f7cbdc 100644 --- a/web/default/src/features/wallet/components/dialogs/billing-history-dialog.tsx +++ b/web/default/src/features/wallet/components/dialogs/billing-history-dialog.tsx @@ -16,12 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState } from 'react' import { Search, Copy, Check, ChevronLeft, ChevronRight } from 'lucide-react' +import { useState } from 'react' import { useTranslation } from 'react-i18next' -import { formatCurrencyFromUSD } from '@/lib/currency' -import { formatNumber } from '@/lib/format' -import { useCopyToClipboard } from '@/hooks/use-copy-to-clipboard' + +import { Dialog } from '@/components/dialog' +import { StatusBadge } from '@/components/status-badge' import { AlertDialog, AlertDialogAction, @@ -44,8 +44,10 @@ import { SelectValue, } from '@/components/ui/select' import { Skeleton } from '@/components/ui/skeleton' -import { Dialog } from '@/components/dialog' -import { StatusBadge } from '@/components/status-badge' +import { useCopyToClipboard } from '@/hooks/use-copy-to-clipboard' +import { formatCurrencyFromUSD } from '@/lib/currency' +import { formatNumber } from '@/lib/format' + import { useBillingHistory } from '../../hooks/use-billing-history' import { getStatusConfig, diff --git a/web/default/src/features/wallet/components/dialogs/creem-confirm-dialog.tsx b/web/default/src/features/wallet/components/dialogs/creem-confirm-dialog.tsx index 72aaaec9..01a38074 100644 --- a/web/default/src/features/wallet/components/dialogs/creem-confirm-dialog.tsx +++ b/web/default/src/features/wallet/components/dialogs/creem-confirm-dialog.tsx @@ -18,9 +18,11 @@ For commercial licensing, please contact support@quantumnous.com */ import { Loader2 } from 'lucide-react' import { useTranslation } from 'react-i18next' -import { formatNumber } from '@/lib/format' -import { Button } from '@/components/ui/button' + import { Dialog } from '@/components/dialog' +import { Button } from '@/components/ui/button' +import { formatNumber } from '@/lib/format' + import { formatCreemPrice } from '../../lib/format' import type { CreemProduct } from '../../types' diff --git a/web/default/src/features/wallet/components/dialogs/payment-confirm-dialog.tsx b/web/default/src/features/wallet/components/dialogs/payment-confirm-dialog.tsx index 91b4a884..30fd955b 100644 --- a/web/default/src/features/wallet/components/dialogs/payment-confirm-dialog.tsx +++ b/web/default/src/features/wallet/components/dialogs/payment-confirm-dialog.tsx @@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com */ import { Loader2 } from 'lucide-react' import { useTranslation } from 'react-i18next' -import { formatLocalCurrencyAmount } from '@/lib/currency' + import { AlertDialog, AlertDialogAction, @@ -30,6 +30,8 @@ import { AlertDialogTitle, } from '@/components/ui/alert-dialog' import { Skeleton } from '@/components/ui/skeleton' +import { formatLocalCurrencyAmount } from '@/lib/currency' + import { DEFAULT_DISCOUNT_RATE } from '../../constants' import { formatCurrency, getPaymentIcon } from '../../lib' import type { PaymentMethod } from '../../types' diff --git a/web/default/src/features/wallet/components/dialogs/transfer-dialog.tsx b/web/default/src/features/wallet/components/dialogs/transfer-dialog.tsx index 5ea9b418..7d8ac2ee 100644 --- a/web/default/src/features/wallet/components/dialogs/transfer-dialog.tsx +++ b/web/default/src/features/wallet/components/dialogs/transfer-dialog.tsx @@ -16,14 +16,16 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useEffect } from 'react' import { Loader2 } from 'lucide-react' +import { useState, useEffect } from 'react' import { useTranslation } from 'react-i18next' -import { formatQuota } from '@/lib/format' + +import { Dialog } from '@/components/dialog' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' -import { Dialog } from '@/components/dialog' +import { formatQuota } from '@/lib/format' + import { QUOTA_PER_DOLLAR } from '../../constants' interface TransferDialogProps { diff --git a/web/default/src/features/wallet/components/recharge-form-card.tsx b/web/default/src/features/wallet/components/recharge-form-card.tsx index 817d211f..5ca6cb1d 100644 --- a/web/default/src/features/wallet/components/recharge-form-card.tsx +++ b/web/default/src/features/wallet/components/recharge-form-card.tsx @@ -16,11 +16,10 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useEffect } from 'react' import { Gift, ExternalLink, Loader2, Receipt, WalletCards } from 'lucide-react' +import { useState, useEffect } from 'react' import { useTranslation } from 'react-i18next' -import { formatNumber } from '@/lib/format' -import { cn } from '@/lib/utils' + import { Alert, AlertDescription } from '@/components/ui/alert' import { Button } from '@/components/ui/button' import { Card, CardContent, CardHeader } from '@/components/ui/card' @@ -34,6 +33,9 @@ import { TooltipProvider, TooltipTrigger, } from '@/components/ui/tooltip' +import { formatNumber } from '@/lib/format' +import { cn } from '@/lib/utils' + import { formatCurrency, getDiscountLabel, diff --git a/web/default/src/features/wallet/components/subscription-plans-card.tsx b/web/default/src/features/wallet/components/subscription-plans-card.tsx index be9156fa..302fc0d2 100644 --- a/web/default/src/features/wallet/components/subscription-plans-card.tsx +++ b/web/default/src/features/wallet/components/subscription-plans-card.tsx @@ -16,12 +16,16 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useEffect, useMemo, useCallback } from 'react' import { Crown, RefreshCw, Sparkles, Check } from 'lucide-react' +import { useState, useEffect, useMemo, useCallback } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' -import { formatQuota } from '@/lib/format' -import { cn } from '@/lib/utils' + +import { + StatusBadge, + dotColorMap, + textColorMap, +} from '@/components/status-badge' import { Button } from '@/components/ui/button' import { Card, CardContent, CardHeader } from '@/components/ui/card' import { Progress } from '@/components/ui/progress' @@ -41,11 +45,6 @@ import { TooltipContent, TooltipTrigger, } from '@/components/ui/tooltip' -import { - StatusBadge, - dotColorMap, - textColorMap, -} from '@/components/status-badge' import { getPublicPlans, getSelfSubscriptionFull, @@ -57,6 +56,9 @@ import type { PlanRecord, UserSubscriptionRecord, } from '@/features/subscriptions/types' +import { formatQuota } from '@/lib/format' +import { cn } from '@/lib/utils' + import type { PaymentMethod, TopupInfo } from '../types' interface SubscriptionPlansCardProps { diff --git a/web/default/src/features/wallet/components/wallet-stats-card.tsx b/web/default/src/features/wallet/components/wallet-stats-card.tsx index cecdee6a..3a520d69 100644 --- a/web/default/src/features/wallet/components/wallet-stats-card.tsx +++ b/web/default/src/features/wallet/components/wallet-stats-card.tsx @@ -18,8 +18,10 @@ For commercial licensing, please contact support@quantumnous.com */ import { Activity, BarChart3, WalletCards } from 'lucide-react' import { useTranslation } from 'react-i18next' -import { formatQuota } from '@/lib/format' + import { Skeleton } from '@/components/ui/skeleton' +import { formatQuota } from '@/lib/format' + import type { UserWalletData } from '../types' interface WalletStatsCardProps { diff --git a/web/default/src/features/wallet/hooks/use-affiliate.ts b/web/default/src/features/wallet/hooks/use-affiliate.ts index 21c8bf44..de2b67e3 100644 --- a/web/default/src/features/wallet/hooks/use-affiliate.ts +++ b/web/default/src/features/wallet/hooks/use-affiliate.ts @@ -16,11 +16,13 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useEffect, useCallback } from 'react' import i18next from 'i18next' +import { useState, useEffect, useCallback } from 'react' import { toast } from 'sonner' -import { getSelf } from '@/lib/api' + import { useCopyToClipboard } from '@/hooks/use-copy-to-clipboard' +import { getSelf } from '@/lib/api' + import { getAffiliateCode, transferAffiliateQuota } from '../api' import { generateAffiliateLink } from '../lib' diff --git a/web/default/src/features/wallet/hooks/use-billing-history.ts b/web/default/src/features/wallet/hooks/use-billing-history.ts index 5dda9913..48aead6a 100644 --- a/web/default/src/features/wallet/hooks/use-billing-history.ts +++ b/web/default/src/features/wallet/hooks/use-billing-history.ts @@ -16,10 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useEffect, useCallback } from 'react' import i18next from 'i18next' +import { useState, useEffect, useCallback } from 'react' import { toast } from 'sonner' + import { useIsAdmin } from '@/hooks/use-admin' + import { getUserBillingHistory, getAllBillingHistory, diff --git a/web/default/src/features/wallet/hooks/use-creem-payment.ts b/web/default/src/features/wallet/hooks/use-creem-payment.ts index 4605f575..53b9c7c6 100644 --- a/web/default/src/features/wallet/hooks/use-creem-payment.ts +++ b/web/default/src/features/wallet/hooks/use-creem-payment.ts @@ -16,9 +16,10 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useCallback } from 'react' import i18next from 'i18next' +import { useState, useCallback } from 'react' import { toast } from 'sonner' + import { requestCreemPayment, isApiSuccess } from '../api' /** diff --git a/web/default/src/features/wallet/hooks/use-payment.ts b/web/default/src/features/wallet/hooks/use-payment.ts index 0c1aed60..0733d0c3 100644 --- a/web/default/src/features/wallet/hooks/use-payment.ts +++ b/web/default/src/features/wallet/hooks/use-payment.ts @@ -16,9 +16,10 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useCallback } from 'react' import i18next from 'i18next' +import { useState, useCallback } from 'react' import { toast } from 'sonner' + import { calculateAmount, calculateStripeAmount, diff --git a/web/default/src/features/wallet/hooks/use-redemption.ts b/web/default/src/features/wallet/hooks/use-redemption.ts index 30211536..e43c0b3f 100644 --- a/web/default/src/features/wallet/hooks/use-redemption.ts +++ b/web/default/src/features/wallet/hooks/use-redemption.ts @@ -16,11 +16,13 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useCallback } from 'react' import i18next from 'i18next' +import { useState, useCallback } from 'react' import { toast } from 'sonner' + import { getSelf } from '@/lib/api' import { formatQuota } from '@/lib/format' + import { redeemTopupCode } from '../api' // ============================================================================ diff --git a/web/default/src/features/wallet/hooks/use-topup-info.ts b/web/default/src/features/wallet/hooks/use-topup-info.ts index 6aa17efe..8fb4b1ab 100644 --- a/web/default/src/features/wallet/hooks/use-topup-info.ts +++ b/web/default/src/features/wallet/hooks/use-topup-info.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useState, useEffect, useCallback } from 'react' + import { getTopupInfo } from '../api' import { generatePresetAmounts, diff --git a/web/default/src/features/wallet/hooks/use-waffo-pancake-payment.ts b/web/default/src/features/wallet/hooks/use-waffo-pancake-payment.ts index b8acb939..3c80a412 100644 --- a/web/default/src/features/wallet/hooks/use-waffo-pancake-payment.ts +++ b/web/default/src/features/wallet/hooks/use-waffo-pancake-payment.ts @@ -16,9 +16,10 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useCallback } from 'react' import i18next from 'i18next' +import { useState, useCallback } from 'react' import { toast } from 'sonner' + import { requestWaffoPancakePayment, isApiSuccess } from '../api' function getCheckoutUrl(data: unknown): string | null { diff --git a/web/default/src/features/wallet/hooks/use-waffo-payment.ts b/web/default/src/features/wallet/hooks/use-waffo-payment.ts index e467db77..a024228a 100644 --- a/web/default/src/features/wallet/hooks/use-waffo-payment.ts +++ b/web/default/src/features/wallet/hooks/use-waffo-payment.ts @@ -16,9 +16,10 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useCallback } from 'react' import i18next from 'i18next' +import { useState, useCallback } from 'react' import { toast } from 'sonner' + import { requestWaffoPayment, isApiSuccess } from '../api' function getPaymentUrl(data: unknown): string | null { diff --git a/web/default/src/features/wallet/index.tsx b/web/default/src/features/wallet/index.tsx index 67eb8959..048e0332 100644 --- a/web/default/src/features/wallet/index.tsx +++ b/web/default/src/features/wallet/index.tsx @@ -18,10 +18,12 @@ For commercial licensing, please contact support@quantumnous.com */ import { useState, useEffect, useCallback, useMemo } from 'react' import { useTranslation } from 'react-i18next' -import { getSelf } from '@/lib/api' + +import { SectionPageLayout } from '@/components/layout' import { useStatus } from '@/hooks/use-status' import { useSystemConfig } from '@/hooks/use-system-config' -import { SectionPageLayout } from '@/components/layout' +import { getSelf } from '@/lib/api' + import { AffiliateRewardsCard } from './components/affiliate-rewards-card' import { BillingHistoryDialog } from './components/dialogs/billing-history-dialog' import { CreemConfirmDialog } from './components/dialogs/creem-confirm-dialog' diff --git a/web/default/src/features/wallet/lib/billing.ts b/web/default/src/features/wallet/lib/billing.ts index 77bf98c6..75366b1b 100644 --- a/web/default/src/features/wallet/lib/billing.ts +++ b/web/default/src/features/wallet/lib/billing.ts @@ -16,8 +16,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { formatTimestampToDate } from '@/lib/format' import type { StatusBadgeProps } from '@/components/status-badge' +import { formatTimestampToDate } from '@/lib/format' + import type { TopupStatus } from '../types' // ============================================================================ diff --git a/web/default/src/features/wallet/lib/ui.tsx b/web/default/src/features/wallet/lib/ui.tsx index 41a75eb6..5182e027 100644 --- a/web/default/src/features/wallet/lib/ui.tsx +++ b/web/default/src/features/wallet/lib/ui.tsx @@ -16,11 +16,13 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { type ReactNode } from 'react' import i18next from 'i18next' import { CreditCard, Landmark } from 'lucide-react' +import { type ReactNode } from 'react' import { SiAlipay, SiWechat, SiStripe } from 'react-icons/si' + import { ReactIconByName } from '@/components/react-icon-by-name' + import { PAYMENT_TYPES, PAYMENT_ICON_COLORS } from '../constants' // ============================================================================ diff --git a/web/default/src/hooks/use-admin.ts b/web/default/src/hooks/use-admin.ts index 7dc9f260..13a5ff1e 100644 --- a/web/default/src/hooks/use-admin.ts +++ b/web/default/src/hooks/use-admin.ts @@ -16,11 +16,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ +import { ROLE } from '@/lib/roles' /** * Hook for checking admin privileges */ import { useAuthStore } from '@/stores/auth-store' -import { ROLE } from '@/lib/roles' /** * Check if current user has admin privileges diff --git a/web/default/src/hooks/use-copy-to-clipboard.ts b/web/default/src/hooks/use-copy-to-clipboard.ts index 02092a1a..307a3c6e 100644 --- a/web/default/src/hooks/use-copy-to-clipboard.ts +++ b/web/default/src/hooks/use-copy-to-clipboard.ts @@ -19,6 +19,7 @@ For commercial licensing, please contact support@quantumnous.com import { useState, useCallback, useRef, useEffect } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' + import { copyToClipboard as copyToClipboardUtil } from '@/lib/copy-to-clipboard' type UseCopyToClipboardOptions = { diff --git a/web/default/src/hooks/use-notifications.ts b/web/default/src/hooks/use-notifications.ts index 7a5b08db..17e305dc 100644 --- a/web/default/src/hooks/use-notifications.ts +++ b/web/default/src/hooks/use-notifications.ts @@ -16,11 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useState, useMemo } from 'react' import { useQuery } from '@tanstack/react-query' -import { useNotificationStore } from '@/stores/notification-store' -import { getNotice } from '@/lib/api' +import { useState, useMemo } from 'react' + import { useStatus } from '@/hooks/use-status' +import { getNotice } from '@/lib/api' +import { useNotificationStore } from '@/stores/notification-store' function hashString(input: string): string { let hash = 0 diff --git a/web/default/src/hooks/use-sidebar-config.ts b/web/default/src/hooks/use-sidebar-config.ts index 93e3e9ff..a026e43d 100644 --- a/web/default/src/hooks/use-sidebar-config.ts +++ b/web/default/src/hooks/use-sidebar-config.ts @@ -17,9 +17,10 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useMemo } from 'react' -import { useAuthStore } from '@/stores/auth-store' -import { useStatus } from '@/hooks/use-status' + import type { NavGroup, NavItem } from '@/components/layout/types' +import { useStatus } from '@/hooks/use-status' +import { useAuthStore } from '@/stores/auth-store' type SidebarSectionConfig = { enabled: boolean diff --git a/web/default/src/hooks/use-sidebar-data.ts b/web/default/src/hooks/use-sidebar-data.ts index 60cc3352..40a0615a 100644 --- a/web/default/src/hooks/use-sidebar-data.ts +++ b/web/default/src/hooks/use-sidebar-data.ts @@ -35,8 +35,9 @@ import { Wallet, } from 'lucide-react' import { useTranslation } from 'react-i18next' -import { ROLE } from '@/lib/roles' + import { type SidebarData } from '@/components/layout/types' +import { ROLE } from '@/lib/roles' /** * Root navigation groups for the application sidebar. diff --git a/web/default/src/hooks/use-sidebar-view.ts b/web/default/src/hooks/use-sidebar-view.ts index 3cf47a61..77b04173 100644 --- a/web/default/src/hooks/use-sidebar-view.ts +++ b/web/default/src/hooks/use-sidebar-view.ts @@ -16,13 +16,15 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useMemo } from 'react' import { useLocation } from '@tanstack/react-router' +import { useMemo } from 'react' import { useTranslation } from 'react-i18next' -import { useAuthStore } from '@/stores/auth-store' -import { ROLE } from '@/lib/roles' + import { resolveSidebarView } from '@/components/layout/lib/sidebar-view-registry' import type { NavGroup, ResolvedSidebarView } from '@/components/layout/types' +import { ROLE } from '@/lib/roles' +import { useAuthStore } from '@/stores/auth-store' + import { useSidebarConfig } from './use-sidebar-config' import { useSidebarData } from './use-sidebar-data' diff --git a/web/default/src/hooks/use-status.ts b/web/default/src/hooks/use-status.ts index 904cc205..723ea547 100644 --- a/web/default/src/hooks/use-status.ts +++ b/web/default/src/hooks/use-status.ts @@ -17,9 +17,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useQuery } from '@tanstack/react-query' -import { useSystemConfigStore } from '@/stores/system-config-store' -import { getStatus } from '@/lib/api' + import type { SystemStatus } from '@/features/auth/types' +import { getStatus } from '@/lib/api' +import { useSystemConfigStore } from '@/stores/system-config-store' + import { mapStatusDataToConfig } from './use-system-config' // Get initial cache from localStorage diff --git a/web/default/src/hooks/use-system-config.ts b/web/default/src/hooks/use-system-config.ts index 256bd7d5..23f92a63 100644 --- a/web/default/src/hooks/use-system-config.ts +++ b/web/default/src/hooks/use-system-config.ts @@ -17,6 +17,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useEffect, useCallback } from 'react' + +import { DEFAULT_SYSTEM_NAME, DEFAULT_LOGO } from '@/lib/constants' +import { applyFaviconToDom } from '@/lib/dom-utils' import { useSystemConfigStore, type CurrencyConfig, @@ -24,8 +27,6 @@ import { type SystemConfig, DEFAULT_CURRENCY_CONFIG, } from '@/stores/system-config-store' -import { DEFAULT_SYSTEM_NAME, DEFAULT_LOGO } from '@/lib/constants' -import { applyFaviconToDom } from '@/lib/dom-utils' interface UseSystemConfigOptions { /** Automatically fetch config from backend (use only in root component) */ diff --git a/web/default/src/hooks/use-table-url-state.ts b/web/default/src/hooks/use-table-url-state.ts index 159041c8..04528e23 100644 --- a/web/default/src/hooks/use-table-url-state.ts +++ b/web/default/src/hooks/use-table-url-state.ts @@ -16,12 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useMemo, useState } from 'react' import type { ColumnFiltersState, OnChangeFn, PaginationState, } from '@tanstack/react-table' +import { useEffect, useMemo, useState } from 'react' type SearchRecord = Record diff --git a/web/default/src/hooks/use-top-nav-links.ts b/web/default/src/hooks/use-top-nav-links.ts index a7996101..5a5baa2d 100644 --- a/web/default/src/hooks/use-top-nav-links.ts +++ b/web/default/src/hooks/use-top-nav-links.ts @@ -18,9 +18,10 @@ For commercial licensing, please contact support@quantumnous.com */ import { useMemo } from 'react' import { useTranslation } from 'react-i18next' -import { useAuthStore } from '@/stores/auth-store' -import { parseHeaderNavModulesFromStatus } from '@/lib/nav-modules' + import { useStatus } from '@/hooks/use-status' +import { parseHeaderNavModulesFromStatus } from '@/lib/nav-modules' +import { useAuthStore } from '@/stores/auth-store' export type TopNavLink = { title: string diff --git a/web/default/src/hooks/use-user-display.ts b/web/default/src/hooks/use-user-display.ts index 1955ef71..002c00e7 100644 --- a/web/default/src/hooks/use-user-display.ts +++ b/web/default/src/hooks/use-user-display.ts @@ -18,8 +18,9 @@ For commercial licensing, please contact support@quantumnous.com */ import { useMemo } from 'react' import { useTranslation } from 'react-i18next' -import type { AuthUser } from '@/stores/auth-store' + import { getRoleLabel } from '@/lib/roles' +import type { AuthUser } from '@/stores/auth-store' /** * Custom hook to format user display information diff --git a/web/default/src/i18n/config.ts b/web/default/src/i18n/config.ts index c6a249cd..11b541a2 100644 --- a/web/default/src/i18n/config.ts +++ b/web/default/src/i18n/config.ts @@ -19,6 +19,7 @@ For commercial licensing, please contact support@quantumnous.com import i18n from 'i18next' import LanguageDetector from 'i18next-browser-languagedetector' import { initReactI18next } from 'react-i18next' + import en from './locales/en.json' import fr from './locales/fr.json' import ja from './locales/ja.json' diff --git a/web/default/src/lib/admin-permissions.ts b/web/default/src/lib/admin-permissions.ts index 424a80d4..95ddf816 100644 --- a/web/default/src/lib/admin-permissions.ts +++ b/web/default/src/lib/admin-permissions.ts @@ -1,6 +1,7 @@ -import { ROLE } from './roles' import type { AuthUser } from '@/stores/auth-store' +import { ROLE } from './roles' + export type AdminPermissionMatrix = Record> export type AdminCapabilities = AdminPermissionMatrix diff --git a/web/default/src/lib/api.ts b/web/default/src/lib/api.ts index f6cc8805..1e50b16c 100644 --- a/web/default/src/lib/api.ts +++ b/web/default/src/lib/api.ts @@ -19,6 +19,7 @@ For commercial licensing, please contact support@quantumnous.com import axios, { type AxiosRequestConfig } from 'axios' import { t } from 'i18next' import { toast } from 'sonner' + import { useAuthStore } from '@/stores/auth-store' declare module 'axios' { diff --git a/web/default/src/lib/format.ts b/web/default/src/lib/format.ts index 6850bc6a..64aa7a2d 100644 --- a/web/default/src/lib/format.ts +++ b/web/default/src/lib/format.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import dayjs from '@/lib/dayjs' + import { formatCurrencyFromUSD, formatQuotaWithCurrency, diff --git a/web/default/src/lib/use-chart-theme.ts b/web/default/src/lib/use-chart-theme.ts index 2eb155cf..b1ec4705 100644 --- a/web/default/src/lib/use-chart-theme.ts +++ b/web/default/src/lib/use-chart-theme.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { useEffect, useRef, useState } from 'react' + import { useTheme } from '@/context/theme-provider' /** diff --git a/web/default/src/main.tsx b/web/default/src/main.tsx index cd420d83..caf9307c 100644 --- a/web/default/src/main.tsx +++ b/web/default/src/main.tsx @@ -16,30 +16,33 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { StrictMode } from 'react' -import ReactDOM from 'react-dom/client' -import { AxiosError } from 'axios' import { QueryCache, QueryClient, QueryClientProvider, } from '@tanstack/react-query' import { RouterProvider, createRouter } from '@tanstack/react-router' +import { AxiosError } from 'axios' import i18next from 'i18next' +import { StrictMode } from 'react' +import ReactDOM from 'react-dom/client' import { toast } from 'sonner' -import { useAuthStore } from '@/stores/auth-store' + import { getStatus } from '@/lib/api' import { installBuildMetadata } from '@/lib/build-metadata' -import '@/lib/dayjs' import { applyFaviconToDom } from '@/lib/dom-utils' +import '@/lib/dayjs' import { initializeFrontendCache } from '@/lib/frontend-cache' import { handleServerError } from '@/lib/handle-server-error' +import { useAuthStore } from '@/stores/auth-store' + import { DirectionProvider } from './context/direction-provider' import { FontProvider } from './context/font-provider' import { ThemeProvider } from './context/theme-provider' import './i18n/config' // Generated Routes import { routeTree } from './routeTree.gen' + // Styles import './styles/index.css' diff --git a/web/default/src/routes/(auth)/forgot-password.tsx b/web/default/src/routes/(auth)/forgot-password.tsx index 3e52d9f5..2cb898ca 100644 --- a/web/default/src/routes/(auth)/forgot-password.tsx +++ b/web/default/src/routes/(auth)/forgot-password.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute } from '@tanstack/react-router' + import { ForgotPassword } from '@/features/auth/forgot-password' export const Route = createFileRoute('/(auth)/forgot-password')({ diff --git a/web/default/src/routes/(auth)/oauth.tsx b/web/default/src/routes/(auth)/oauth.tsx index ffefdcb4..6256017c 100644 --- a/web/default/src/routes/(auth)/oauth.tsx +++ b/web/default/src/routes/(auth)/oauth.tsx @@ -16,13 +16,14 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect } from 'react' import { createFileRoute, useNavigate, useSearch } from '@tanstack/react-router' import i18next from 'i18next' +import { useEffect } from 'react' import { toast } from 'sonner' -import { useAuthStore, type AuthUser } from '@/stores/auth-store' -import { getSelf } from '@/lib/api' + import { wechatLoginByCode } from '@/features/auth/api' +import { getSelf } from '@/lib/api' +import { useAuthStore, type AuthUser } from '@/stores/auth-store' function OAuthComponent() { const navigate = useNavigate() diff --git a/web/default/src/routes/(auth)/otp.tsx b/web/default/src/routes/(auth)/otp.tsx index 4027422d..3142140a 100644 --- a/web/default/src/routes/(auth)/otp.tsx +++ b/web/default/src/routes/(auth)/otp.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute } from '@tanstack/react-router' + import { Otp } from '@/features/auth/otp' export const Route = createFileRoute('/(auth)/otp')({ diff --git a/web/default/src/routes/(auth)/reset.tsx b/web/default/src/routes/(auth)/reset.tsx index 1d230f25..8122c145 100644 --- a/web/default/src/routes/(auth)/reset.tsx +++ b/web/default/src/routes/(auth)/reset.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute, useSearch } from '@tanstack/react-router' + import { ResetPasswordConfirm, type ResetPasswordSearchParams, diff --git a/web/default/src/routes/(auth)/sign-in.tsx b/web/default/src/routes/(auth)/sign-in.tsx index 21672817..ca3b095a 100644 --- a/web/default/src/routes/(auth)/sign-in.tsx +++ b/web/default/src/routes/(auth)/sign-in.tsx @@ -16,10 +16,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { z } from 'zod' import { createFileRoute, redirect } from '@tanstack/react-router' -import { useAuthStore } from '@/stores/auth-store' +import { z } from 'zod' + import { SignIn } from '@/features/auth/sign-in' +import { useAuthStore } from '@/stores/auth-store' const searchSchema = z.object({ redirect: z.string().optional(), diff --git a/web/default/src/routes/(auth)/sign-up.tsx b/web/default/src/routes/(auth)/sign-up.tsx index 8ad53308..f14db208 100644 --- a/web/default/src/routes/(auth)/sign-up.tsx +++ b/web/default/src/routes/(auth)/sign-up.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute } from '@tanstack/react-router' + import { SignUp } from '@/features/auth/sign-up' export const Route = createFileRoute('/(auth)/sign-up')({ diff --git a/web/default/src/routes/(auth)/user/reset.tsx b/web/default/src/routes/(auth)/user/reset.tsx index f2bb788c..879893a9 100644 --- a/web/default/src/routes/(auth)/user/reset.tsx +++ b/web/default/src/routes/(auth)/user/reset.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute, useSearch } from '@tanstack/react-router' + import { ResetPasswordConfirm, type ResetPasswordSearchParams, diff --git a/web/default/src/routes/(errors)/401.tsx b/web/default/src/routes/(errors)/401.tsx index 88889d50..e03e6a39 100644 --- a/web/default/src/routes/(errors)/401.tsx +++ b/web/default/src/routes/(errors)/401.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute } from '@tanstack/react-router' + import { UnauthorisedError } from '@/features/errors/unauthorized-error' export const Route = createFileRoute('/(errors)/401')({ diff --git a/web/default/src/routes/(errors)/403.tsx b/web/default/src/routes/(errors)/403.tsx index 10664692..31361b19 100644 --- a/web/default/src/routes/(errors)/403.tsx +++ b/web/default/src/routes/(errors)/403.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute } from '@tanstack/react-router' + import { ForbiddenError } from '@/features/errors/forbidden' export const Route = createFileRoute('/(errors)/403')({ diff --git a/web/default/src/routes/(errors)/404.tsx b/web/default/src/routes/(errors)/404.tsx index 7e1c05a3..572f763b 100644 --- a/web/default/src/routes/(errors)/404.tsx +++ b/web/default/src/routes/(errors)/404.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute } from '@tanstack/react-router' + import { NotFoundError } from '@/features/errors/not-found-error' export const Route = createFileRoute('/(errors)/404')({ diff --git a/web/default/src/routes/(errors)/500.tsx b/web/default/src/routes/(errors)/500.tsx index 0d69aad8..d781bccb 100644 --- a/web/default/src/routes/(errors)/500.tsx +++ b/web/default/src/routes/(errors)/500.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute } from '@tanstack/react-router' + import { GeneralError } from '@/features/errors/general-error' export const Route = createFileRoute('/(errors)/500')({ diff --git a/web/default/src/routes/(errors)/503.tsx b/web/default/src/routes/(errors)/503.tsx index 23936adf..94e73aa0 100644 --- a/web/default/src/routes/(errors)/503.tsx +++ b/web/default/src/routes/(errors)/503.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute } from '@tanstack/react-router' + import { MaintenanceError } from '@/features/errors/maintenance-error' export const Route = createFileRoute('/(errors)/503')({ diff --git a/web/default/src/routes/__root.tsx b/web/default/src/routes/__root.tsx index b212c9de..3ed4fbb6 100644 --- a/web/default/src/routes/__root.tsx +++ b/web/default/src/routes/__root.tsx @@ -16,23 +16,24 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect } from 'react' import { type QueryClient } from '@tanstack/react-query' +import { ReactQueryDevtools } from '@tanstack/react-query-devtools' import { createRootRouteWithContext, Outlet, redirect, } from '@tanstack/react-router' -import { ReactQueryDevtools } from '@tanstack/react-query-devtools' import { TanStackRouterDevtools } from '@tanstack/react-router-devtools' -import { ThemeCustomizationProvider } from '@/context/theme-customization-provider' -import { useSystemConfig } from '@/hooks/use-system-config' -import { Toaster } from '@/components/ui/sonner' +import { useEffect } from 'react' + import { NavigationProgress } from '@/components/navigation-progress' +import { Toaster } from '@/components/ui/sonner' +import { ThemeCustomizationProvider } from '@/context/theme-customization-provider' import { saveAffiliateCode } from '@/features/auth/lib/storage' import { GeneralError } from '@/features/errors/general-error' import { NotFoundError } from '@/features/errors/not-found-error' import { getSetupStatus } from '@/features/setup/api' +import { useSystemConfig } from '@/hooks/use-system-config' function RootComponent() { // Load system configuration (logo, system name, etc.) from backend diff --git a/web/default/src/routes/_authenticated/channels/index.tsx b/web/default/src/routes/_authenticated/channels/index.tsx index ec515bb6..872e1499 100644 --- a/web/default/src/routes/_authenticated/channels/index.tsx +++ b/web/default/src/routes/_authenticated/channels/index.tsx @@ -16,11 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import z from 'zod' import { createFileRoute, redirect } from '@tanstack/react-router' -import { useAuthStore } from '@/stores/auth-store' -import { ROLE } from '@/lib/roles' +import z from 'zod' + import { Channels } from '@/features/channels' +import { ROLE } from '@/lib/roles' +import { useAuthStore } from '@/stores/auth-store' const channelsSearchSchema = z.object({ page: z.number().optional().catch(1), diff --git a/web/default/src/routes/_authenticated/chat/$chatId.tsx b/web/default/src/routes/_authenticated/chat/$chatId.tsx index 7f84f1d4..4c8f1a05 100644 --- a/web/default/src/routes/_authenticated/chat/$chatId.tsx +++ b/web/default/src/routes/_authenticated/chat/$chatId.tsx @@ -16,10 +16,11 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useMemo } from 'react' import { Link, createFileRoute, redirect } from '@tanstack/react-router' import { Loader2, MessageCircleWarning } from 'lucide-react' +import { useMemo } from 'react' import { useTranslation } from 'react-i18next' + import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert' import { Button } from '@/components/ui/button' import { useActiveChatKey } from '@/features/chat/hooks/use-active-chat-key' diff --git a/web/default/src/routes/_authenticated/chat2link.tsx b/web/default/src/routes/_authenticated/chat2link.tsx index bd804671..1108a139 100644 --- a/web/default/src/routes/_authenticated/chat2link.tsx +++ b/web/default/src/routes/_authenticated/chat2link.tsx @@ -16,11 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useMemo } from 'react' import { createFileRoute, useNavigate } from '@tanstack/react-router' import { Loader2 } from 'lucide-react' +import { useEffect, useMemo } from 'react' import { useTranslation } from 'react-i18next' import { toast } from 'sonner' + import { useActiveChatKey } from '@/features/chat/hooks/use-active-chat-key' import { useChatPresets } from '@/features/chat/hooks/use-chat-presets' import { resolveChatUrl } from '@/features/chat/lib/chat-links' diff --git a/web/default/src/routes/_authenticated/dashboard/$section.tsx b/web/default/src/routes/_authenticated/dashboard/$section.tsx index 994f2874..3b334ed8 100644 --- a/web/default/src/routes/_authenticated/dashboard/$section.tsx +++ b/web/default/src/routes/_authenticated/dashboard/$section.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute, redirect } from '@tanstack/react-router' + import { Dashboard } from '@/features/dashboard' import { DASHBOARD_SECTION_IDS, diff --git a/web/default/src/routes/_authenticated/dashboard/index.tsx b/web/default/src/routes/_authenticated/dashboard/index.tsx index cd135a10..b27bcfe3 100644 --- a/web/default/src/routes/_authenticated/dashboard/index.tsx +++ b/web/default/src/routes/_authenticated/dashboard/index.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute, redirect } from '@tanstack/react-router' + import { DASHBOARD_DEFAULT_SECTION } from '@/features/dashboard/section-registry' export const Route = createFileRoute('/_authenticated/dashboard/')({ diff --git a/web/default/src/routes/_authenticated/errors/$error.tsx b/web/default/src/routes/_authenticated/errors/$error.tsx index a948f544..2f6ef8a5 100644 --- a/web/default/src/routes/_authenticated/errors/$error.tsx +++ b/web/default/src/routes/_authenticated/errors/$error.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute } from '@tanstack/react-router' + import { ConfigDrawer } from '@/components/config-drawer' import { Header } from '@/components/layout' import { ProfileDropdown } from '@/components/profile-dropdown' diff --git a/web/default/src/routes/_authenticated/keys/index.tsx b/web/default/src/routes/_authenticated/keys/index.tsx index 051ce08a..14d885cd 100644 --- a/web/default/src/routes/_authenticated/keys/index.tsx +++ b/web/default/src/routes/_authenticated/keys/index.tsx @@ -16,8 +16,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import z from 'zod' import { createFileRoute } from '@tanstack/react-router' +import z from 'zod' + import { ApiKeys } from '@/features/keys' import { API_KEY_STATUS_OPTIONS } from '@/features/keys/constants' diff --git a/web/default/src/routes/_authenticated/models/$section.tsx b/web/default/src/routes/_authenticated/models/$section.tsx index aa5c138c..dfeb2802 100644 --- a/web/default/src/routes/_authenticated/models/$section.tsx +++ b/web/default/src/routes/_authenticated/models/$section.tsx @@ -16,15 +16,16 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import z from 'zod' import { createFileRoute, redirect } from '@tanstack/react-router' -import { useAuthStore } from '@/stores/auth-store' -import { ROLE } from '@/lib/roles' +import z from 'zod' + import { Models } from '@/features/models' import { MODELS_SECTION_IDS, MODELS_DEFAULT_SECTION, } from '@/features/models/section-registry' +import { ROLE } from '@/lib/roles' +import { useAuthStore } from '@/stores/auth-store' const modelsSearchSchema = z.object({ page: z.number().optional().catch(1), diff --git a/web/default/src/routes/_authenticated/models/index.tsx b/web/default/src/routes/_authenticated/models/index.tsx index 5da76b48..4485e883 100644 --- a/web/default/src/routes/_authenticated/models/index.tsx +++ b/web/default/src/routes/_authenticated/models/index.tsx @@ -17,9 +17,10 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute, redirect } from '@tanstack/react-router' -import { useAuthStore } from '@/stores/auth-store' -import { ROLE } from '@/lib/roles' + import { MODELS_DEFAULT_SECTION } from '@/features/models/section-registry' +import { ROLE } from '@/lib/roles' +import { useAuthStore } from '@/stores/auth-store' export const Route = createFileRoute('/_authenticated/models/')({ beforeLoad: () => { diff --git a/web/default/src/routes/_authenticated/playground/index.tsx b/web/default/src/routes/_authenticated/playground/index.tsx index 6a6aa4d4..f69ca162 100644 --- a/web/default/src/routes/_authenticated/playground/index.tsx +++ b/web/default/src/routes/_authenticated/playground/index.tsx @@ -17,9 +17,10 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute, redirect } from '@tanstack/react-router' -import { isSidebarModuleEnabled } from '@/lib/nav-modules' + import { Main } from '@/components/layout' import { Playground } from '@/features/playground' +import { isSidebarModuleEnabled } from '@/lib/nav-modules' export const Route = createFileRoute('/_authenticated/playground/')({ beforeLoad: () => { diff --git a/web/default/src/routes/_authenticated/profile/index.tsx b/web/default/src/routes/_authenticated/profile/index.tsx index 35fd6cc7..5d83c773 100644 --- a/web/default/src/routes/_authenticated/profile/index.tsx +++ b/web/default/src/routes/_authenticated/profile/index.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute } from '@tanstack/react-router' + import { Profile } from '@/features/profile' export const Route = createFileRoute('/_authenticated/profile/')({ diff --git a/web/default/src/routes/_authenticated/redemption-codes/index.tsx b/web/default/src/routes/_authenticated/redemption-codes/index.tsx index 295378d4..a9018d1c 100644 --- a/web/default/src/routes/_authenticated/redemption-codes/index.tsx +++ b/web/default/src/routes/_authenticated/redemption-codes/index.tsx @@ -16,12 +16,13 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import z from 'zod' import { createFileRoute, redirect } from '@tanstack/react-router' -import { useAuthStore } from '@/stores/auth-store' -import { ROLE } from '@/lib/roles' +import z from 'zod' + import { Redemptions } from '@/features/redemption-codes' import { REDEMPTION_STATUS_VALUES } from '@/features/redemption-codes/constants' +import { ROLE } from '@/lib/roles' +import { useAuthStore } from '@/stores/auth-store' const redemptionsSearchSchema = z.object({ page: z.number().optional().catch(1), diff --git a/web/default/src/routes/_authenticated/route.tsx b/web/default/src/routes/_authenticated/route.tsx index 5b7ce1c2..8a7115e9 100644 --- a/web/default/src/routes/_authenticated/route.tsx +++ b/web/default/src/routes/_authenticated/route.tsx @@ -17,9 +17,10 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute, redirect } from '@tanstack/react-router' -import { useAuthStore } from '@/stores/auth-store' -import { getSelf } from '@/lib/api' + import { AuthenticatedLayout } from '@/components/layout' +import { getSelf } from '@/lib/api' +import { useAuthStore } from '@/stores/auth-store' // 内存中的验证标记,避免同一会话中重复验证 let sessionVerified = false diff --git a/web/default/src/routes/_authenticated/subscriptions/index.tsx b/web/default/src/routes/_authenticated/subscriptions/index.tsx index ade24664..550708d2 100644 --- a/web/default/src/routes/_authenticated/subscriptions/index.tsx +++ b/web/default/src/routes/_authenticated/subscriptions/index.tsx @@ -17,9 +17,10 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute, redirect } from '@tanstack/react-router' -import { useAuthStore } from '@/stores/auth-store' -import { ROLE } from '@/lib/roles' + import { Subscriptions } from '@/features/subscriptions' +import { ROLE } from '@/lib/roles' +import { useAuthStore } from '@/stores/auth-store' export const Route = createFileRoute('/_authenticated/subscriptions/')({ beforeLoad: () => { diff --git a/web/default/src/routes/_authenticated/system-info/index.tsx b/web/default/src/routes/_authenticated/system-info/index.tsx index f62c3f30..324a0302 100644 --- a/web/default/src/routes/_authenticated/system-info/index.tsx +++ b/web/default/src/routes/_authenticated/system-info/index.tsx @@ -17,9 +17,10 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute, redirect } from '@tanstack/react-router' -import { useAuthStore } from '@/stores/auth-store' -import { ROLE } from '@/lib/roles' + import { SystemInfo } from '@/features/system-info' +import { ROLE } from '@/lib/roles' +import { useAuthStore } from '@/stores/auth-store' export const Route = createFileRoute('/_authenticated/system-info/')({ beforeLoad: () => { diff --git a/web/default/src/routes/_authenticated/system-settings/auth/$section.tsx b/web/default/src/routes/_authenticated/system-settings/auth/$section.tsx index 07adabc4..fa604555 100644 --- a/web/default/src/routes/_authenticated/system-settings/auth/$section.tsx +++ b/web/default/src/routes/_authenticated/system-settings/auth/$section.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute, redirect } from '@tanstack/react-router' + import { AuthSettings } from '@/features/system-settings/auth' import { AUTH_DEFAULT_SECTION, diff --git a/web/default/src/routes/_authenticated/system-settings/auth/index.tsx b/web/default/src/routes/_authenticated/system-settings/auth/index.tsx index 516bb2ef..089d6657 100644 --- a/web/default/src/routes/_authenticated/system-settings/auth/index.tsx +++ b/web/default/src/routes/_authenticated/system-settings/auth/index.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute, redirect } from '@tanstack/react-router' + import { AUTH_DEFAULT_SECTION } from '@/features/system-settings/auth/section-registry.tsx' export const Route = createFileRoute('/_authenticated/system-settings/auth/')({ diff --git a/web/default/src/routes/_authenticated/system-settings/billing/$section.tsx b/web/default/src/routes/_authenticated/system-settings/billing/$section.tsx index 6408b4a4..a94e57d5 100644 --- a/web/default/src/routes/_authenticated/system-settings/billing/$section.tsx +++ b/web/default/src/routes/_authenticated/system-settings/billing/$section.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute, redirect } from '@tanstack/react-router' + import { BillingSettings } from '@/features/system-settings/billing' import { BILLING_DEFAULT_SECTION, diff --git a/web/default/src/routes/_authenticated/system-settings/billing/index.tsx b/web/default/src/routes/_authenticated/system-settings/billing/index.tsx index 52c5ba0a..8ffe3634 100644 --- a/web/default/src/routes/_authenticated/system-settings/billing/index.tsx +++ b/web/default/src/routes/_authenticated/system-settings/billing/index.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute, redirect } from '@tanstack/react-router' + import { BILLING_DEFAULT_SECTION } from '@/features/system-settings/billing/section-registry.tsx' export const Route = createFileRoute( diff --git a/web/default/src/routes/_authenticated/system-settings/content/$section.tsx b/web/default/src/routes/_authenticated/system-settings/content/$section.tsx index 494bcf0d..0e28d0ee 100644 --- a/web/default/src/routes/_authenticated/system-settings/content/$section.tsx +++ b/web/default/src/routes/_authenticated/system-settings/content/$section.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute, redirect } from '@tanstack/react-router' + import { ContentSettings } from '@/features/system-settings/content' import { CONTENT_DEFAULT_SECTION, diff --git a/web/default/src/routes/_authenticated/system-settings/content/index.tsx b/web/default/src/routes/_authenticated/system-settings/content/index.tsx index f116b35d..c22a6123 100644 --- a/web/default/src/routes/_authenticated/system-settings/content/index.tsx +++ b/web/default/src/routes/_authenticated/system-settings/content/index.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute, redirect } from '@tanstack/react-router' + import { CONTENT_DEFAULT_SECTION } from '@/features/system-settings/content/section-registry.tsx' export const Route = createFileRoute( diff --git a/web/default/src/routes/_authenticated/system-settings/models/$section.tsx b/web/default/src/routes/_authenticated/system-settings/models/$section.tsx index 3697c252..7db9e39f 100644 --- a/web/default/src/routes/_authenticated/system-settings/models/$section.tsx +++ b/web/default/src/routes/_authenticated/system-settings/models/$section.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute, redirect } from '@tanstack/react-router' + import { ModelSettings } from '@/features/system-settings/models' import { MODELS_DEFAULT_SECTION, diff --git a/web/default/src/routes/_authenticated/system-settings/models/index.tsx b/web/default/src/routes/_authenticated/system-settings/models/index.tsx index 83318b50..bc113887 100644 --- a/web/default/src/routes/_authenticated/system-settings/models/index.tsx +++ b/web/default/src/routes/_authenticated/system-settings/models/index.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute, redirect } from '@tanstack/react-router' + import { MODELS_DEFAULT_SECTION } from '@/features/system-settings/models/section-registry.tsx' export const Route = createFileRoute('/_authenticated/system-settings/models/')( diff --git a/web/default/src/routes/_authenticated/system-settings/operations/$section.tsx b/web/default/src/routes/_authenticated/system-settings/operations/$section.tsx index 887fd9f0..1fe4ec2a 100644 --- a/web/default/src/routes/_authenticated/system-settings/operations/$section.tsx +++ b/web/default/src/routes/_authenticated/system-settings/operations/$section.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute, redirect } from '@tanstack/react-router' + import { OperationsSettings } from '@/features/system-settings/operations' import { OPERATIONS_DEFAULT_SECTION, diff --git a/web/default/src/routes/_authenticated/system-settings/operations/index.tsx b/web/default/src/routes/_authenticated/system-settings/operations/index.tsx index 4705e9d2..70d2b7e3 100644 --- a/web/default/src/routes/_authenticated/system-settings/operations/index.tsx +++ b/web/default/src/routes/_authenticated/system-settings/operations/index.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute, redirect } from '@tanstack/react-router' + import { OPERATIONS_DEFAULT_SECTION } from '@/features/system-settings/operations/section-registry.tsx' export const Route = createFileRoute( diff --git a/web/default/src/routes/_authenticated/system-settings/route.tsx b/web/default/src/routes/_authenticated/system-settings/route.tsx index bb24d15f..081b81a9 100644 --- a/web/default/src/routes/_authenticated/system-settings/route.tsx +++ b/web/default/src/routes/_authenticated/system-settings/route.tsx @@ -17,9 +17,10 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute, redirect } from '@tanstack/react-router' -import { useAuthStore } from '@/stores/auth-store' -import { ROLE } from '@/lib/roles' + import { SystemSettings } from '@/features/system-settings' +import { ROLE } from '@/lib/roles' +import { useAuthStore } from '@/stores/auth-store' export const Route = createFileRoute('/_authenticated/system-settings')({ beforeLoad: () => { diff --git a/web/default/src/routes/_authenticated/system-settings/security/$section.tsx b/web/default/src/routes/_authenticated/system-settings/security/$section.tsx index c65ab22a..0858686e 100644 --- a/web/default/src/routes/_authenticated/system-settings/security/$section.tsx +++ b/web/default/src/routes/_authenticated/system-settings/security/$section.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute, redirect } from '@tanstack/react-router' + import { SecuritySettings } from '@/features/system-settings/security' import { SECURITY_DEFAULT_SECTION, diff --git a/web/default/src/routes/_authenticated/system-settings/security/index.tsx b/web/default/src/routes/_authenticated/system-settings/security/index.tsx index be727ff6..40a1d925 100644 --- a/web/default/src/routes/_authenticated/system-settings/security/index.tsx +++ b/web/default/src/routes/_authenticated/system-settings/security/index.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute, redirect } from '@tanstack/react-router' + import { SECURITY_DEFAULT_SECTION } from '@/features/system-settings/security/section-registry.tsx' export const Route = createFileRoute( diff --git a/web/default/src/routes/_authenticated/system-settings/site/$section.tsx b/web/default/src/routes/_authenticated/system-settings/site/$section.tsx index b01ec4f5..20c57fbd 100644 --- a/web/default/src/routes/_authenticated/system-settings/site/$section.tsx +++ b/web/default/src/routes/_authenticated/system-settings/site/$section.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute, redirect } from '@tanstack/react-router' + import { SiteSettings } from '@/features/system-settings/site' import { SITE_DEFAULT_SECTION, diff --git a/web/default/src/routes/_authenticated/system-settings/site/index.tsx b/web/default/src/routes/_authenticated/system-settings/site/index.tsx index 476d9e2b..edd4b594 100644 --- a/web/default/src/routes/_authenticated/system-settings/site/index.tsx +++ b/web/default/src/routes/_authenticated/system-settings/site/index.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute, redirect } from '@tanstack/react-router' + import { SITE_DEFAULT_SECTION } from '@/features/system-settings/site/section-registry.tsx' export const Route = createFileRoute('/_authenticated/system-settings/site/')({ diff --git a/web/default/src/routes/_authenticated/usage-logs/$section.tsx b/web/default/src/routes/_authenticated/usage-logs/$section.tsx index 28a1a3b7..6361def3 100644 --- a/web/default/src/routes/_authenticated/usage-logs/$section.tsx +++ b/web/default/src/routes/_authenticated/usage-logs/$section.tsx @@ -16,8 +16,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import z from 'zod' import { createFileRoute, redirect } from '@tanstack/react-router' +import z from 'zod' + import { UsageLogs } from '@/features/usage-logs' import { isUsageLogsSectionId, @@ -26,13 +27,10 @@ import { const logTypeValues = ['0', '1', '2', '3', '4', '5', '6', '7'] as const const logTypeSearchSchema = z - .preprocess( - (value) => { - if (value == null || value === '') return undefined - return Array.isArray(value) ? value : [value] - }, - z.array(z.enum(logTypeValues)).optional() - ) + .preprocess((value) => { + if (value == null || value === '') return undefined + return Array.isArray(value) ? value : [value] + }, z.array(z.enum(logTypeValues)).optional()) .catch([]) const usageLogsSearchSchema = z.object({ diff --git a/web/default/src/routes/_authenticated/usage-logs/index.tsx b/web/default/src/routes/_authenticated/usage-logs/index.tsx index 3724788e..502a762c 100644 --- a/web/default/src/routes/_authenticated/usage-logs/index.tsx +++ b/web/default/src/routes/_authenticated/usage-logs/index.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute, redirect } from '@tanstack/react-router' + import { USAGE_LOGS_DEFAULT_SECTION } from '@/features/usage-logs/section-registry' export const Route = createFileRoute('/_authenticated/usage-logs/')({ diff --git a/web/default/src/routes/_authenticated/users/index.tsx b/web/default/src/routes/_authenticated/users/index.tsx index 5d2e4781..4b0486dd 100644 --- a/web/default/src/routes/_authenticated/users/index.tsx +++ b/web/default/src/routes/_authenticated/users/index.tsx @@ -16,11 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import z from 'zod' import { createFileRoute, redirect } from '@tanstack/react-router' -import { useAuthStore } from '@/stores/auth-store' -import { ROLE } from '@/lib/roles' +import z from 'zod' + import { Users } from '@/features/users' +import { ROLE } from '@/lib/roles' +import { useAuthStore } from '@/stores/auth-store' const usersSearchSchema = z.object({ page: z.number().optional().catch(1), diff --git a/web/default/src/routes/_authenticated/wallet/index.tsx b/web/default/src/routes/_authenticated/wallet/index.tsx index 5e0e37b2..6feec0e5 100644 --- a/web/default/src/routes/_authenticated/wallet/index.tsx +++ b/web/default/src/routes/_authenticated/wallet/index.tsx @@ -16,8 +16,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { z } from 'zod' import { createFileRoute } from '@tanstack/react-router' +import { z } from 'zod' + import { Wallet } from '@/features/wallet' const walletSearchSchema = z.object({ diff --git a/web/default/src/routes/about/index.tsx b/web/default/src/routes/about/index.tsx index 0c2e47c3..29ea2a55 100644 --- a/web/default/src/routes/about/index.tsx +++ b/web/default/src/routes/about/index.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute } from '@tanstack/react-router' + import { About } from '@/features/about' export const Route = createFileRoute('/about/')({ diff --git a/web/default/src/routes/console/topup.tsx b/web/default/src/routes/console/topup.tsx index 8e728a2c..057c4352 100644 --- a/web/default/src/routes/console/topup.tsx +++ b/web/default/src/routes/console/topup.tsx @@ -16,8 +16,8 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import z from 'zod' import { createFileRoute, redirect } from '@tanstack/react-router' +import z from 'zod' const topupSearchSchema = z.record(z.string(), z.unknown()).catch({}) diff --git a/web/default/src/routes/index.tsx b/web/default/src/routes/index.tsx index 0255e357..1fe03393 100644 --- a/web/default/src/routes/index.tsx +++ b/web/default/src/routes/index.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute } from '@tanstack/react-router' + import { Home } from '@/features/home' export const Route = createFileRoute('/')({ diff --git a/web/default/src/routes/oauth/$provider.tsx b/web/default/src/routes/oauth/$provider.tsx index 98e546eb..b35bfdaf 100644 --- a/web/default/src/routes/oauth/$provider.tsx +++ b/web/default/src/routes/oauth/$provider.tsx @@ -16,20 +16,21 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useEffect, useState } from 'react' -import type { AxiosRequestConfig } from 'axios' import { createFileRoute, useNavigate, useParams, useSearch, } from '@tanstack/react-router' +import type { AxiosRequestConfig } from 'axios' import i18next from 'i18next' +import { useEffect, useState } from 'react' import { toast } from 'sonner' -import { useAuthStore, type AuthUser } from '@/stores/auth-store' -import { api, getSelf } from '@/lib/api' + import { OAuthCallbackScreen } from '@/features/auth/components/oauth-callback-screen' import { OAUTH_BIND_STORAGE_KEY } from '@/features/auth/constants' +import { api, getSelf } from '@/lib/api' +import { useAuthStore, type AuthUser } from '@/stores/auth-store' type OAuthRequestConfig = AxiosRequestConfig & { skipBusinessError?: boolean diff --git a/web/default/src/routes/pricing/$modelId/index.tsx b/web/default/src/routes/pricing/$modelId/index.tsx index e09ccaf4..3eb46a78 100644 --- a/web/default/src/routes/pricing/$modelId/index.tsx +++ b/web/default/src/routes/pricing/$modelId/index.tsx @@ -16,11 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import z from 'zod' import { createFileRoute, redirect } from '@tanstack/react-router' -import { useAuthStore } from '@/stores/auth-store' -import { getFreshModuleAccess } from '@/lib/nav-modules' +import z from 'zod' + import { ModelDetails } from '@/features/pricing/components/model-details' +import { getFreshModuleAccess } from '@/lib/nav-modules' +import { useAuthStore } from '@/stores/auth-store' const modelDetailsSearchSchema = z.object({ search: z.string().optional(), diff --git a/web/default/src/routes/pricing/index.tsx b/web/default/src/routes/pricing/index.tsx index 66afcb86..3af5e4f9 100644 --- a/web/default/src/routes/pricing/index.tsx +++ b/web/default/src/routes/pricing/index.tsx @@ -16,11 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import z from 'zod' import { createFileRoute, redirect } from '@tanstack/react-router' -import { useAuthStore } from '@/stores/auth-store' -import { getFreshModuleAccess } from '@/lib/nav-modules' +import z from 'zod' + import { Pricing } from '@/features/pricing' +import { getFreshModuleAccess } from '@/lib/nav-modules' +import { useAuthStore } from '@/stores/auth-store' const pricingSearchSchema = z.object({ search: z.string().optional(), diff --git a/web/default/src/routes/privacy-policy.tsx b/web/default/src/routes/privacy-policy.tsx index 583874b1..c062c517 100644 --- a/web/default/src/routes/privacy-policy.tsx +++ b/web/default/src/routes/privacy-policy.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute } from '@tanstack/react-router' + import { PrivacyPolicy } from '@/features/legal' export const Route = createFileRoute('/privacy-policy')({ diff --git a/web/default/src/routes/rankings/index.tsx b/web/default/src/routes/rankings/index.tsx index 71a307d3..4e1ea6d2 100644 --- a/web/default/src/routes/rankings/index.tsx +++ b/web/default/src/routes/rankings/index.tsx @@ -16,11 +16,12 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import z from 'zod' import { createFileRoute, redirect } from '@tanstack/react-router' -import { useAuthStore } from '@/stores/auth-store' -import { getFreshModuleAccess } from '@/lib/nav-modules' +import z from 'zod' + import { Rankings } from '@/features/rankings' +import { getFreshModuleAccess } from '@/lib/nav-modules' +import { useAuthStore } from '@/stores/auth-store' const rankingsSearchSchema = z.object({ period: z diff --git a/web/default/src/routes/setup/index.tsx b/web/default/src/routes/setup/index.tsx index b2de2865..89339306 100644 --- a/web/default/src/routes/setup/index.tsx +++ b/web/default/src/routes/setup/index.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute, redirect } from '@tanstack/react-router' + import { SetupWizard } from '@/features/setup' import { getSetupStatus } from '@/features/setup/api' diff --git a/web/default/src/routes/user-agreement.tsx b/web/default/src/routes/user-agreement.tsx index 7d1cac9f..cfc1ae28 100644 --- a/web/default/src/routes/user-agreement.tsx +++ b/web/default/src/routes/user-agreement.tsx @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { createFileRoute } from '@tanstack/react-router' + import { UserAgreement } from '@/features/legal' export const Route = createFileRoute('/user-agreement')({ diff --git a/web/default/src/stores/auth-store.ts b/web/default/src/stores/auth-store.ts index 20981a76..49165c0e 100644 --- a/web/default/src/stores/auth-store.ts +++ b/web/default/src/stores/auth-store.ts @@ -17,6 +17,7 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import { create } from 'zustand' + import type { AdminCapabilities } from '@/lib/admin-permissions' export type UserPermissions = { diff --git a/web/default/src/stores/system-config-store.ts b/web/default/src/stores/system-config-store.ts index 76997ef8..570fc45a 100644 --- a/web/default/src/stores/system-config-store.ts +++ b/web/default/src/stores/system-config-store.ts @@ -18,6 +18,7 @@ For commercial licensing, please contact support@quantumnous.com */ import { create } from 'zustand' import { persist } from 'zustand/middleware' + import { DEFAULT_SYSTEM_NAME, DEFAULT_LOGO } from '@/lib/constants' export type CurrencyDisplayType = 'USD' | 'CNY' | 'TOKENS' | 'CUSTOM' diff --git a/web/default/src/styles/theme.css b/web/default/src/styles/theme.css index 45857453..8a2d174b 100644 --- a/web/default/src/styles/theme.css +++ b/web/default/src/styles/theme.css @@ -215,11 +215,7 @@ For commercial licensing, please contact support@quantumnous.com --skeleton-base: oklch(0.335 0 0); --skeleton-highlight: oklch(0.44 0 0); --table-row: var(--background); - --table-header: color-mix( - in oklch, - var(--foreground) 6%, - var(--background) - ); + --table-header: color-mix(in oklch, var(--foreground) 6%, var(--background)); --table-header-hover: color-mix( in oklch, var(--foreground) 9%,