@allbluecn/admin-app 0.3.3 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/package.json +4 -3
  2. package/src/components/admin/admin-user-menu.tsx +4 -4
  3. package/src/components/admin/developer-log.tsx +7 -7
  4. package/src/components/ai-memory/memory-facts-panel.tsx +9 -9
  5. package/src/components/ai-prompts/preview-panel.tsx +1 -1
  6. package/src/components/ai-prompts/prompt-editor.tsx +8 -8
  7. package/src/components/ai-prompts/prompt-table.tsx +6 -6
  8. package/src/components/ai-prompts/section-editor.tsx +3 -3
  9. package/src/components/ai-prompts/variable-panel.tsx +2 -2
  10. package/src/components/ai-prompts/version-history.tsx +5 -5
  11. package/src/components/ai-provider/model-list-editor.tsx +2 -2
  12. package/src/components/ai-provider/provider-form.tsx +7 -7
  13. package/src/components/ai-provider/provider-table.tsx +6 -6
  14. package/src/components/auth/admin-login-form.tsx +6 -6
  15. package/src/components/auth/icon-input.tsx +2 -2
  16. package/src/components/auth/password-input.tsx +2 -2
  17. package/src/components/component/component-form-dialog.tsx +8 -8
  18. package/src/components/component/component-import-dialog.tsx +6 -6
  19. package/src/components/component/component-table.tsx +3 -3
  20. package/src/components/confirm-dialog.tsx +94 -0
  21. package/src/components/data-table/data-table-pagination.tsx +121 -0
  22. package/src/components/data-table/data-table.tsx +218 -0
  23. package/src/components/data-table/table-detail-layout.tsx +97 -0
  24. package/src/components/dependency/changelog-dialog.tsx +2 -2
  25. package/src/components/dependency/columns.tsx +3 -3
  26. package/src/components/dependency/dependency-table.tsx +7 -7
  27. package/src/components/dependency/edit-dialog.tsx +8 -8
  28. package/src/components/invitations/invitations-page.tsx +13 -13
  29. package/src/components/knowledge-public/bookmark-form-dialog.tsx +6 -6
  30. package/src/components/knowledge-public/compliance-form-dialog.tsx +6 -6
  31. package/src/components/knowledge-public/legal-form-dialog.tsx +7 -7
  32. package/src/components/layout/sidebar-02/app-sidebar.tsx +1 -1
  33. package/src/components/layout/sidebar-02/index.tsx +1 -1
  34. package/src/components/layout/sidebar-02/nav-main.tsx +2 -2
  35. package/src/components/layout/sidebar-02/nav-notifications.tsx +3 -3
  36. package/src/components/market/columns.tsx +4 -4
  37. package/src/components/market/market-app-form.tsx +6 -6
  38. package/src/components/market/market-app-list.tsx +4 -4
  39. package/src/components/monitoring/error-list.tsx +1 -1
  40. package/src/components/monitoring/metrics-stats.tsx +1 -1
  41. package/src/components/monitoring/request-log-table.tsx +1 -1
  42. package/src/components/notion-avatar.tsx +126 -0
  43. package/src/components/oauth-providers/provider-page.tsx +9 -9
  44. package/src/components/permissions/assign-dialog.tsx +5 -5
  45. package/src/components/permissions/create-role-dialog.tsx +6 -6
  46. package/src/components/ui/alert-dialog.tsx +185 -0
  47. package/src/components/ui/alert.tsx +75 -0
  48. package/src/components/ui/avatar.tsx +106 -0
  49. package/src/components/ui/badge.tsx +51 -0
  50. package/src/components/ui/button.tsx +57 -0
  51. package/src/components/ui/card.tsx +102 -0
  52. package/src/components/ui/checkbox.tsx +27 -0
  53. package/src/components/ui/collapsible.tsx +19 -0
  54. package/src/components/ui/dialog.tsx +155 -0
  55. package/src/components/ui/dropdown-menu.tsx +265 -0
  56. package/src/components/ui/field.tsx +236 -0
  57. package/src/components/ui/input-group.tsx +157 -0
  58. package/src/components/ui/input.tsx +19 -0
  59. package/src/components/ui/label.tsx +17 -0
  60. package/src/components/ui/pagination.tsx +130 -0
  61. package/src/components/ui/select.tsx +232 -0
  62. package/src/components/ui/separator.tsx +23 -0
  63. package/src/components/ui/sheet.tsx +134 -0
  64. package/src/components/ui/sidebar.tsx +721 -0
  65. package/src/components/ui/skeleton.tsx +13 -0
  66. package/src/components/ui/switch.tsx +30 -0
  67. package/src/components/ui/table.tsx +113 -0
  68. package/src/components/ui/textarea.tsx +17 -0
  69. package/src/components/ui/toast.tsx +308 -0
  70. package/src/components/ui/tooltip.tsx +64 -0
  71. package/src/components/user/columns.tsx +4 -4
  72. package/src/components/user/settings-activity-log.tsx +7 -7
  73. package/src/components/user/settings-profile/avatar-uploader.tsx +2 -2
  74. package/src/components/user/settings-profile/social-links.tsx +2 -2
  75. package/src/components/user/settings-profile.tsx +6 -6
  76. package/src/components/user/user-create-dialog.tsx +6 -6
  77. package/src/components/user/user-detail/error-boundary.tsx +1 -1
  78. package/src/components/user/user-detail/user-detail-dialogs.tsx +6 -6
  79. package/src/components/user/user-filters.tsx +3 -3
  80. package/src/components/user-avatar.tsx +82 -0
  81. package/src/hooks/use-mobile.ts +19 -0
  82. package/src/lib/datetime.ts +226 -0
  83. package/src/lib/sanitize.ts +18 -0
  84. package/src/providers/index.tsx +1 -1
  85. package/src/routes/__root.tsx +1 -1
  86. package/src/routes/_nav/audit/route.lazy.tsx +1 -1
  87. package/src/routes/_nav/compliance/route.lazy.tsx +3 -3
  88. package/src/routes/_nav/components/route.lazy.tsx +4 -4
  89. package/src/routes/_nav/knowledge-public/bookmarks/route.lazy.tsx +6 -6
  90. package/src/routes/_nav/knowledge-public/compliance/route.lazy.tsx +6 -6
  91. package/src/routes/_nav/knowledge-public/legal/route.lazy.tsx +6 -6
  92. package/src/routes/_nav/licenses/$licenseId/route.lazy.tsx +3 -3
  93. package/src/routes/_nav/licenses/new/route.lazy.tsx +5 -5
  94. package/src/routes/_nav/licenses/route.lazy.tsx +1 -1
  95. package/src/routes/_nav/monitoring/ai-usage/route.lazy.tsx +2 -2
  96. package/src/routes/_nav/monitoring/errors/route.lazy.tsx +1 -1
  97. package/src/routes/_nav/monitoring/health/route.lazy.tsx +3 -3
  98. package/src/routes/_nav/monitoring/logs/route.lazy.tsx +3 -3
  99. package/src/routes/_nav/monitoring/metrics/route.lazy.tsx +3 -3
  100. package/src/routes/_nav/monitoring/route.lazy.tsx +2 -2
  101. package/src/routes/_nav/monitoring/sentry/route.lazy.tsx +1 -1
  102. package/src/routes/_nav/permissions/route.lazy.tsx +4 -4
  103. package/src/routes/_nav/sso/route.lazy.tsx +2 -2
  104. package/src/routes/_nav/users/$userId/route.lazy.tsx +8 -8
  105. package/src/routes/_nav/users/-components/users-table.tsx +1 -1
  106. package/src/routes/_nav/users/route.lazy.tsx +1 -1
  107. package/src/routes/setup/route.lazy.tsx +2 -2
  108. package/src/server/dependency/helpers.ts +0 -1
  109. package/src/styles/globals.css +3 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allbluecn/admin-app",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "private": false,
5
5
  "license": "AGPL-3.0-or-later",
6
6
  "type": "module",
@@ -36,6 +36,8 @@
36
36
  "clsx": "^2.1.1",
37
37
  "cn": "^0.3.0",
38
38
  "date-fns": "^4.4.0",
39
+ "date-fns-tz": "^3.2.0",
40
+ "isomorphic-dompurify": "^3.22.0",
39
41
  "lucide-react": "^1.47.0",
40
42
  "motion": "^13.4.0",
41
43
  "next-themes": "^0.4.6",
@@ -75,8 +77,7 @@
75
77
  "typescript-eslint": "^8.70.1",
76
78
  "vite": "^8.3.3",
77
79
  "vitest": "5.0.0",
78
- "wrangler": "^4.99.0",
79
- "@allbluecn/ui": "0.1.0"
80
+ "wrangler": "^4.99.0"
80
81
  },
81
82
  "files": [
82
83
  "src",
@@ -17,17 +17,17 @@
17
17
 
18
18
  import { LogOut } from "lucide-react";
19
19
  import { m } from '@/paraglide/messages.js'
20
- import { Badge } from "@allbluecn/ui/badge";
20
+ import { Badge } from "@/components/ui/badge";
21
21
  import {
22
22
  SidebarMenu,
23
23
  SidebarMenuAction,
24
24
  SidebarMenuButton,
25
25
  SidebarMenuItem,
26
- } from "@allbluecn/ui/sidebar";
27
- import { Tooltip, TooltipContent, TooltipTrigger } from "@allbluecn/ui/tooltip";
26
+ } from "@/components/ui/sidebar";
27
+ import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
28
28
  import { useRouter, useMatches } from "@tanstack/react-router";
29
29
  import { signOut, useSession } from "@/lib/auth-client";
30
- import { UserAvatar } from "@allbluecn/ui/components/user-avatar";
30
+ import { UserAvatar } from "@/components/user-avatar";
31
31
  import type { AvatarConfig, ShapeType } from "@allbluecn/kernel";
32
32
 
33
33
  const ROLE_LABELS: Record<string, () => string> = {
@@ -4,7 +4,7 @@ import { Route } from '@/routes/_nav/developer-logs/route'
4
4
  import type { DeveloperLogEntry } from '@allbluecn/kernel'
5
5
  import { useQueryClient } from '@tanstack/react-query'
6
6
  import { useServerFn } from '@tanstack/react-start'
7
- import { toast } from '@allbluecn/ui/toast'
7
+ import { toast } from '@/components/ui/toast'
8
8
  import {
9
9
  Plus,
10
10
  Pencil,
@@ -19,12 +19,12 @@ import {
19
19
  DialogHeader,
20
20
  DialogTitle,
21
21
  DialogFooter,
22
- } from '@allbluecn/ui/dialog'
23
- import { ConfirmDialog } from '@allbluecn/ui/components/confirm-dialog'
24
- import { Input } from '@allbluecn/ui/input'
25
- import { Textarea } from '@allbluecn/ui/textarea'
26
- import { Label } from '@allbluecn/ui/label'
27
- import { Button } from '@allbluecn/ui/button'
22
+ } from '@/components/ui/dialog'
23
+ import { ConfirmDialog } from '@/components/confirm-dialog'
24
+ import { Input } from '@/components/ui/input'
25
+ import { Textarea } from '@/components/ui/textarea'
26
+ import { Label } from '@/components/ui/label'
27
+ import { Button } from '@/components/ui/button'
28
28
  import { createDeveloperLogFn, updateDeveloperLogFn, deleteDeveloperLogFn } from '@/server/serverFns/developer-logs'
29
29
  import { autoGenerateLogsFn, backfillLogDetailsFn } from '@/server/serverFns/developer-log-auto-generate'
30
30
 
@@ -26,21 +26,21 @@ import {
26
26
  } from "lucide-react"
27
27
 
28
28
  import { m } from "@/paraglide/messages.js"
29
- import { formatTimestamp } from "@allbluecn/ui/lib/datetime"
30
- import { toast } from "@allbluecn/ui/toast"
31
- import { Alert, AlertDescription, AlertTitle } from "@allbluecn/ui/alert"
32
- import { Badge } from "@allbluecn/ui/badge"
33
- import { Button } from "@allbluecn/ui/button"
34
- import { Card, CardContent } from "@allbluecn/ui/card"
35
- import { ConfirmDialog } from "@allbluecn/ui/components/confirm-dialog"
29
+ import { formatTimestamp } from "@/lib/datetime"
30
+ import { toast } from "@/components/ui/toast"
31
+ import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"
32
+ import { Badge } from "@/components/ui/badge"
33
+ import { Button } from "@/components/ui/button"
34
+ import { Card, CardContent } from "@/components/ui/card"
35
+ import { ConfirmDialog } from "@/components/confirm-dialog"
36
36
  import {
37
37
  Select,
38
38
  SelectContent,
39
39
  SelectItem,
40
40
  SelectTrigger,
41
41
  SelectValue,
42
- } from "@allbluecn/ui/select"
43
- import { DataTable, type AdminColumnDef } from "@allbluecn/ui/data-table"
42
+ } from "@/components/ui/select"
43
+ import { DataTable, type AdminColumnDef } from "@/components/data-table/data-table"
44
44
  import { listMemoryFactsFn } from "@/server/serverFns/ai-memory/list"
45
45
  import { deleteMemoryFactFn } from "@/server/serverFns/ai-memory/delete"
46
46
  import { clearMemoryFactsFn } from "@/server/serverFns/ai-memory/clear"
@@ -20,7 +20,7 @@ import { useCallback, useEffect, useRef, useState } from "react"
20
20
  import { AlertTriangle, Loader2 } from "lucide-react"
21
21
 
22
22
  import { m } from "@/paraglide/messages.js"
23
- import { Input } from "@allbluecn/ui/input"
23
+ import { Input } from "@/components/ui/input"
24
24
  import {
25
25
  PROMPT_PREVIEW_DEBOUNCE_MS,
26
26
  useDebouncedCallback,
@@ -25,18 +25,18 @@ import { Link } from "@tanstack/react-router"
25
25
  import { ArrowLeft, Loader2, Save, ShieldCheck } from "lucide-react"
26
26
 
27
27
  import { m } from "@/paraglide/messages.js"
28
- import { toast } from "@allbluecn/ui/toast"
29
- import { Badge } from "@allbluecn/ui/badge"
30
- import { Button } from "@allbluecn/ui/button"
31
- import { Field, FieldContent, FieldLabel } from "@allbluecn/ui/field"
32
- import { Input } from "@allbluecn/ui/input"
33
- import { Switch } from "@allbluecn/ui/switch"
34
- import { Textarea } from "@allbluecn/ui/textarea"
28
+ import { toast } from "@/components/ui/toast"
29
+ import { Badge } from "@/components/ui/badge"
30
+ import { Button } from "@/components/ui/button"
31
+ import { Field, FieldContent, FieldLabel } from "@/components/ui/field"
32
+ import { Input } from "@/components/ui/input"
33
+ import { Switch } from "@/components/ui/switch"
34
+ import { Textarea } from "@/components/ui/textarea"
35
35
  import {
36
36
  Tooltip,
37
37
  TooltipContent,
38
38
  TooltipTrigger,
39
- } from "@allbluecn/ui/tooltip"
39
+ } from "@/components/ui/tooltip"
40
40
  import { activatePromptTemplateFn } from "@/server/serverFns/ai-prompts/activate"
41
41
  import { getPromptTemplateFn } from "@/server/serverFns/ai-prompts/get"
42
42
  import { rollbackPromptTemplateFn } from "@/server/serverFns/ai-prompts/rollback"
@@ -19,14 +19,14 @@
19
19
  import { useMutation } from "@tanstack/react-query"
20
20
  import { Link, useRouter } from "@tanstack/react-router"
21
21
  import { Edit, ShieldCheck } from "lucide-react"
22
- import { formatTimestamp } from "@allbluecn/ui/lib/datetime"
22
+ import { formatTimestamp } from "@/lib/datetime"
23
23
 
24
24
  import { m } from "@/paraglide/messages.js"
25
- import { toast } from "@allbluecn/ui/toast"
26
- import { Badge } from "@allbluecn/ui/badge"
27
- import { Button } from "@allbluecn/ui/button"
28
- import { Switch } from "@allbluecn/ui/switch"
29
- import { DataTable, type AdminColumnDef } from "@allbluecn/ui/data-table"
25
+ import { toast } from "@/components/ui/toast"
26
+ import { Badge } from "@/components/ui/badge"
27
+ import { Button } from "@/components/ui/button"
28
+ import { Switch } from "@/components/ui/switch"
29
+ import { DataTable, type AdminColumnDef } from "@/components/data-table/data-table"
30
30
  import { activatePromptTemplateFn } from "@/server/serverFns/ai-prompts/activate"
31
31
  import type { PromptTemplateRow } from "./prompt-utils"
32
32
 
@@ -19,9 +19,9 @@
19
19
  import { ArrowDown, ArrowUp, Plus, Trash2 } from "lucide-react"
20
20
 
21
21
  import { m } from "@/paraglide/messages.js"
22
- import { Button } from "@allbluecn/ui/button"
23
- import { Input } from "@allbluecn/ui/input"
24
- import { Textarea } from "@allbluecn/ui/textarea"
22
+ import { Button } from "@/components/ui/button"
23
+ import { Input } from "@/components/ui/input"
24
+ import { Textarea } from "@/components/ui/textarea"
25
25
  import {
26
26
  appendSection,
27
27
  moveSection,
@@ -19,8 +19,8 @@
19
19
  import { AlertTriangle, Plus, Trash2 } from "lucide-react"
20
20
 
21
21
  import { m } from "@/paraglide/messages.js"
22
- import { Button } from "@allbluecn/ui/button"
23
- import { Input } from "@allbluecn/ui/input"
22
+ import { Button } from "@/components/ui/button"
23
+ import { Input } from "@/components/ui/input"
24
24
  import {
25
25
  addVariable,
26
26
  removeVariable,
@@ -18,17 +18,17 @@
18
18
  // apps/admin/src/components/ai-prompts/version-history.tsx
19
19
  import { useState } from "react"
20
20
  import { History, Loader2, RotateCcw } from "lucide-react"
21
- import { formatTimestamp } from "@allbluecn/ui/lib/datetime"
21
+ import { formatTimestamp } from "@/lib/datetime"
22
22
 
23
23
  import { m } from "@/paraglide/messages.js"
24
- import { Badge } from "@allbluecn/ui/badge"
25
- import { Button } from "@allbluecn/ui/button"
24
+ import { Badge } from "@/components/ui/badge"
25
+ import { Button } from "@/components/ui/button"
26
26
  import {
27
27
  Collapsible,
28
28
  CollapsibleContent,
29
29
  CollapsibleTrigger,
30
- } from "@allbluecn/ui/collapsible"
31
- import { ConfirmDialog } from "@allbluecn/ui/components/confirm-dialog"
30
+ } from "@/components/ui/collapsible"
31
+ import { ConfirmDialog } from "@/components/confirm-dialog"
32
32
  import type { PromptVersionSummary } from "./prompt-utils"
33
33
 
34
34
  interface VersionHistoryProps {
@@ -17,8 +17,8 @@
17
17
 
18
18
  // apps/admin/src/components/ai-provider/model-list-editor.tsx
19
19
  import { Plus, Trash2 } from "lucide-react"
20
- import { Button } from "@allbluecn/ui/button"
21
- import { Input } from "@allbluecn/ui/input"
20
+ import { Button } from "@/components/ui/button"
21
+ import { Input } from "@/components/ui/input"
22
22
  import { cn } from "@/lib/utils"
23
23
  import {
24
24
  MODEL_CAPABILITY_OPTIONS,
@@ -21,7 +21,7 @@ import { m } from '@/paraglide/messages.js'
21
21
  import { useMutation } from "@tanstack/react-query"
22
22
  import { Link, useNavigate, useRouter } from "@tanstack/react-router"
23
23
  import { ArrowLeft, Loader2, Save } from "lucide-react"
24
- import { toast } from '@allbluecn/ui/toast'
24
+ import { toast } from '@/components/ui/toast'
25
25
  import {
26
26
  ADAPTER_KINDS,
27
27
  PROVIDER_CATEGORIES,
@@ -29,17 +29,17 @@ import {
29
29
  type AdapterKind,
30
30
  type ProviderCategory,
31
31
  } from "@allbluecn/kernel"
32
- import { Button } from "@allbluecn/ui/button"
33
- import { Input } from "@allbluecn/ui/input"
34
- import { Textarea } from "@allbluecn/ui/textarea"
35
- import { Switch } from "@allbluecn/ui/switch"
32
+ import { Button } from "@/components/ui/button"
33
+ import { Input } from "@/components/ui/input"
34
+ import { Textarea } from "@/components/ui/textarea"
35
+ import { Switch } from "@/components/ui/switch"
36
36
  import {
37
37
  Select,
38
38
  SelectContent,
39
39
  SelectItem,
40
40
  SelectTrigger,
41
41
  SelectValue,
42
- } from "@allbluecn/ui/select"
42
+ } from "@/components/ui/select"
43
43
  import {
44
44
  Field,
45
45
  FieldContent,
@@ -49,7 +49,7 @@ import {
49
49
  FieldSet,
50
50
  FieldLegend,
51
51
  FieldSeparator,
52
- } from "@allbluecn/ui/field"
52
+ } from "@/components/ui/field"
53
53
  import { createAiProviderAdminFn } from "@/server/serverFns/ai-provider/create"
54
54
  import { updateAiProviderAdminFn } from "@/server/serverFns/ai-provider/update"
55
55
  import { ModelListEditor } from "./model-list-editor"
@@ -21,13 +21,13 @@ import { m } from '@/paraglide/messages.js'
21
21
  import { useMutation } from "@tanstack/react-query"
22
22
  import { Link, useRouter } from "@tanstack/react-router"
23
23
  import { Edit, Plus, RefreshCw, Trash2, Users } from "lucide-react"
24
- import { toast } from '@allbluecn/ui/toast'
24
+ import { toast } from '@/components/ui/toast'
25
25
  import { ADAPTER_KINDS, PROVIDER_BADGE_STYLES, type AiProviderRow } from "@allbluecn/kernel"
26
- import { Button } from "@allbluecn/ui/button"
27
- import { Switch } from "@allbluecn/ui/switch"
28
- import { Badge } from "@allbluecn/ui/badge"
29
- import { ConfirmDialog } from "@allbluecn/ui/components/confirm-dialog"
30
- import { DataTable, type AdminColumnDef } from "@allbluecn/ui/data-table"
26
+ import { Button } from "@/components/ui/button"
27
+ import { Switch } from "@/components/ui/switch"
28
+ import { Badge } from "@/components/ui/badge"
29
+ import { ConfirmDialog } from "@/components/confirm-dialog"
30
+ import { DataTable, type AdminColumnDef } from "@/components/data-table/data-table"
31
31
  import { ProviderIcon } from "./provider-icon"
32
32
  import { updateAiProviderAdminFn } from "@/server/serverFns/ai-provider/update"
33
33
  import { deleteAiProviderAdminFn } from "@/server/serverFns/ai-provider/delete"
@@ -19,12 +19,12 @@ import { LogOut, Mail, Users, BarChart3, Shield, Settings, ArrowRight, ArrowLeft
19
19
  import { m } from '@/paraglide/messages.js'
20
20
  import { useState } from "react";
21
21
  import { signIn, signOut } from "@/lib/auth-client";
22
- import { Button } from "@allbluecn/ui/button";
23
- import { Checkbox } from "@allbluecn/ui/checkbox";
24
- import { Field, FieldLabel } from "@allbluecn/ui/field";
25
- import { Card, CardContent } from "@allbluecn/ui/card";
26
- import { toast } from '@allbluecn/ui/toast';
27
- import { UserAvatar } from "@allbluecn/ui/components/user-avatar";
22
+ import { Button } from "@/components/ui/button";
23
+ import { Checkbox } from "@/components/ui/checkbox";
24
+ import { Field, FieldLabel } from "@/components/ui/field";
25
+ import { Card, CardContent } from "@/components/ui/card";
26
+ import { toast } from '@/components/ui/toast';
27
+ import { UserAvatar } from "@/components/user-avatar";
28
28
  import type { AvatarConfig, ShapeType } from "@allbluecn/kernel";
29
29
  import { AuthLayout, AuthLayoutLeft, AuthLayoutRight } from "@/components/auth/auth-layout";
30
30
  import { AuthHeader } from "@/components/auth/auth-header";
@@ -16,8 +16,8 @@
16
16
  // along with this program. If not, see <https://www.gnu.org/licenses/>.
17
17
 
18
18
 
19
- import { Input } from '@allbluecn/ui/input'
20
- import { Label } from '@allbluecn/ui/label'
19
+ import { Input } from '@/components/ui/input'
20
+ import { Label } from '@/components/ui/label'
21
21
  import type { LucideIcon } from 'lucide-react'
22
22
 
23
23
  interface IconInputProps extends React.InputHTMLAttributes<HTMLInputElement> {
@@ -17,8 +17,8 @@
17
17
 
18
18
  import { useState } from 'react'
19
19
  import { m } from '@/paraglide/messages.js'
20
- import { Input } from '@allbluecn/ui/input'
21
- import { Label } from '@allbluecn/ui/label'
20
+ import { Input } from '@/components/ui/input'
21
+ import { Label } from '@/components/ui/label'
22
22
  import { Lock } from 'lucide-react'
23
23
 
24
24
  interface PasswordInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type'> {
@@ -17,28 +17,28 @@
17
17
 
18
18
  import { useState, useEffect } from 'react'
19
19
  import { m } from '@/paraglide/messages.js'
20
- import { Button } from '@allbluecn/ui/button'
21
- import { Input } from '@allbluecn/ui/input'
22
- import { Label } from '@allbluecn/ui/label'
23
- import { Textarea } from '@allbluecn/ui/textarea'
24
- import { Switch } from '@allbluecn/ui/switch'
20
+ import { Button } from '@/components/ui/button'
21
+ import { Input } from '@/components/ui/input'
22
+ import { Label } from '@/components/ui/label'
23
+ import { Textarea } from '@/components/ui/textarea'
24
+ import { Switch } from '@/components/ui/switch'
25
25
  import {
26
26
  Select,
27
27
  SelectContent,
28
28
  SelectItem,
29
29
  SelectTrigger,
30
30
  SelectValue,
31
- } from '@allbluecn/ui/select'
31
+ } from '@/components/ui/select'
32
32
  import {
33
33
  Dialog,
34
34
  DialogContent,
35
35
  DialogFooter,
36
36
  DialogHeader,
37
37
  DialogTitle,
38
- } from '@allbluecn/ui/dialog'
38
+ } from '@/components/ui/dialog'
39
39
  import { ComponentPreview } from './component-preview'
40
40
  import { createComponentFn, updateComponentFn } from '@/server/serverFns/components/mutations'
41
- import { toast } from '@allbluecn/ui/toast'
41
+ import { toast } from '@/components/ui/toast'
42
42
  import type { ComponentItem } from './component-table'
43
43
 
44
44
  const CATEGORY_KEYS = ['base', 'block', 'template'] as const
@@ -16,16 +16,16 @@
16
16
  // along with this program. If not, see <https://www.gnu.org/licenses/>.
17
17
 
18
18
  import { useState } from 'react'
19
- import { Button } from '@allbluecn/ui/button'
20
- import { Input } from '@allbluecn/ui/input'
21
- import { Label } from '@allbluecn/ui/label'
19
+ import { Button } from '@/components/ui/button'
20
+ import { Input } from '@/components/ui/input'
21
+ import { Label } from '@/components/ui/label'
22
22
  import {
23
23
  Select,
24
24
  SelectContent,
25
25
  SelectItem,
26
26
  SelectTrigger,
27
27
  SelectValue,
28
- } from '@allbluecn/ui/select'
28
+ } from '@/components/ui/select'
29
29
  import {
30
30
  Dialog,
31
31
  DialogContent,
@@ -33,9 +33,9 @@ import {
33
33
  DialogFooter,
34
34
  DialogHeader,
35
35
  DialogTitle,
36
- } from '@allbluecn/ui/dialog'
36
+ } from '@/components/ui/dialog'
37
37
  import { importComponentFn } from '@/server/serverFns/components/import'
38
- import { toast } from '@allbluecn/ui/toast'
38
+ import { toast } from '@/components/ui/toast'
39
39
  import { Loader2, Sparkles } from 'lucide-react'
40
40
  import { cn } from '@/lib/utils'
41
41
 
@@ -17,8 +17,8 @@
17
17
 
18
18
  import { Edit, Trash2 } from 'lucide-react'
19
19
  import { m } from '@/paraglide/messages.js'
20
- import { Badge } from '@allbluecn/ui/badge'
21
- import { Button } from '@allbluecn/ui/button'
20
+ import { Badge } from '@/components/ui/badge'
21
+ import { Button } from '@/components/ui/button'
22
22
  import {
23
23
  Table,
24
24
  TableBody,
@@ -26,7 +26,7 @@ import {
26
26
  TableHead,
27
27
  TableHeader,
28
28
  TableRow,
29
- } from '@allbluecn/ui/table'
29
+ } from '@/components/ui/table'
30
30
  import { cn } from '@/lib/utils'
31
31
 
32
32
  export interface ComponentItem {
@@ -0,0 +1,94 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ // AllBlue - 理想之海
3
+ // Copyright (C) 2026 AllBlue Contributors
4
+
5
+ import type { ReactElement, ReactNode } from "react"
6
+ import {
7
+ AlertDialog,
8
+ AlertDialogAction,
9
+ AlertDialogCancel,
10
+ AlertDialogContent,
11
+ AlertDialogDescription,
12
+ AlertDialogFooter,
13
+ AlertDialogHeader,
14
+ AlertDialogTitle,
15
+ AlertDialogTrigger,
16
+ } from "./ui/alert-dialog"
17
+ import type { Button } from "./ui/button"
18
+
19
+ export interface ConfirmDialogProps {
20
+ /** 受控 open;不传则由 trigger 非受控驱动 */
21
+ open?: boolean
22
+ onOpenChange?: (open: boolean) => void
23
+ title: ReactNode
24
+ /** 传 null 渲染空描述(保持 aria-describedby 结构),缺省则不渲染 */
25
+ description?: ReactNode
26
+ cancelLabel: ReactNode
27
+ confirmLabel: ReactNode
28
+ /** 确认按钮点击回调;关闭时机由调用方自行控制(与既有内联实现一致,不自动关闭) */
29
+ onConfirm: () => void
30
+ confirmVariant?: React.ComponentProps<typeof Button>["variant"]
31
+ confirmClassName?: string
32
+ confirmDisabled?: boolean
33
+ cancelDisabled?: boolean
34
+ confirmTestId?: string
35
+ contentTestId?: string
36
+ contentClassName?: string
37
+ /** 可选触发器元素(作为 AlertDialogTrigger 的 render 元素) */
38
+ trigger?: ReactElement
39
+ }
40
+
41
+ /**
42
+ * 通用确认弹窗:收口各处内联的「双 state + 手写 AlertDialog」确认模式。
43
+ * 仅做骨架渲染,onConfirm 的异步/关闭时序完全由调用方决定,保证逐站点行为等价迁移。
44
+ */
45
+ export function ConfirmDialog({
46
+ open,
47
+ onOpenChange,
48
+ title,
49
+ description,
50
+ cancelLabel,
51
+ confirmLabel,
52
+ onConfirm,
53
+ confirmVariant,
54
+ confirmClassName,
55
+ confirmDisabled,
56
+ cancelDisabled,
57
+ confirmTestId,
58
+ contentTestId,
59
+ contentClassName,
60
+ trigger,
61
+ }: ConfirmDialogProps) {
62
+ const rootProps: { open?: boolean; onOpenChange?: (open: boolean) => void } = {}
63
+ if (open !== undefined) {
64
+ rootProps.open = open
65
+ rootProps.onOpenChange = onOpenChange
66
+ } else if (onOpenChange) {
67
+ rootProps.onOpenChange = onOpenChange
68
+ }
69
+ return (
70
+ <AlertDialog {...rootProps}>
71
+ {trigger ? <AlertDialogTrigger render={trigger} /> : null}
72
+ <AlertDialogContent data-testid={contentTestId} className={contentClassName}>
73
+ <AlertDialogHeader>
74
+ <AlertDialogTitle>{title}</AlertDialogTitle>
75
+ {description !== undefined ? (
76
+ <AlertDialogDescription>{description}</AlertDialogDescription>
77
+ ) : null}
78
+ </AlertDialogHeader>
79
+ <AlertDialogFooter>
80
+ <AlertDialogCancel disabled={cancelDisabled}>{cancelLabel}</AlertDialogCancel>
81
+ <AlertDialogAction
82
+ variant={confirmVariant}
83
+ className={confirmClassName}
84
+ disabled={confirmDisabled}
85
+ onClick={onConfirm}
86
+ data-testid={confirmTestId}
87
+ >
88
+ {confirmLabel}
89
+ </AlertDialogAction>
90
+ </AlertDialogFooter>
91
+ </AlertDialogContent>
92
+ </AlertDialog>
93
+ )
94
+ }
@@ -0,0 +1,121 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ // AllBlue - 理想之海
3
+ // Copyright (C) 2026 AllBlue Contributors
4
+ //
5
+ // This program is free software: you can redistribute it and/or modify
6
+ // it under the terms of the GNU Affero General Public License as published by
7
+ // the Free Software Foundation, either version 3 of the License, or
8
+ // (at your option) any later version.
9
+ //
10
+ // This program is distributed in the hope that it will be useful,
11
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ // GNU Affero General Public License for more details.
14
+ //
15
+ // You should have received a copy of the GNU Affero General Public License
16
+ // along with this program. If not, see <https://www.gnu.org/licenses/>.
17
+
18
+ import {
19
+ Pagination,
20
+ PaginationContent,
21
+ PaginationEllipsis,
22
+ PaginationItem,
23
+ PaginationLink,
24
+ PaginationNext,
25
+ PaginationPrevious,
26
+ } from "../ui/pagination";
27
+
28
+ // i18n 由消费方注入(包内不依赖 @/paraglide),文案与原 admin 实现逐字对应
29
+ export interface DataTablePaginationLabels {
30
+ total: string;
31
+ previous: string;
32
+ next: string;
33
+ }
34
+
35
+ interface DataTablePaginationProps {
36
+ page: number;
37
+ totalPages: number;
38
+ total: number;
39
+ onPageChange: (page: number) => void;
40
+ labels: DataTablePaginationLabels;
41
+ }
42
+
43
+ function getPageNumbers(current: number, total: number): (number | "ellipsis")[] {
44
+ if (total <= 5) {
45
+ return Array.from({ length: total }, (_, i) => i + 1);
46
+ }
47
+
48
+ const pages: (number | "ellipsis")[] = [1];
49
+
50
+ if (current > 3) {
51
+ pages.push("ellipsis");
52
+ }
53
+
54
+ const start = Math.max(2, current - 1);
55
+ const end = Math.min(total - 1, current + 1);
56
+
57
+ for (let i = start; i <= end; i++) {
58
+ pages.push(i);
59
+ }
60
+
61
+ if (current < total - 2) {
62
+ pages.push("ellipsis");
63
+ }
64
+
65
+ pages.push(total);
66
+
67
+ return pages;
68
+ }
69
+
70
+ export function DataTablePagination({
71
+ page,
72
+ totalPages,
73
+ total,
74
+ onPageChange,
75
+ labels,
76
+ }: DataTablePaginationProps) {
77
+ const pages = getPageNumbers(page, totalPages);
78
+
79
+ return (
80
+ <div className="flex items-center justify-between gap-4 px-2 py-4">
81
+ <div className="text-sm text-muted-foreground whitespace-nowrap shrink-0">
82
+ {labels.total}
83
+ </div>
84
+ <Pagination className="justify-end">
85
+ <PaginationContent>
86
+ <PaginationItem>
87
+ <PaginationPrevious
88
+ text={labels.previous}
89
+ onClick={() => page > 1 && onPageChange(page - 1)}
90
+ className={page <= 1 ? "pointer-events-none opacity-50" : "cursor-pointer"}
91
+ />
92
+ </PaginationItem>
93
+ {pages.map((p, i) =>
94
+ p === "ellipsis" ? (
95
+ <PaginationItem key={`ellipsis-${i}`}>
96
+ <PaginationEllipsis />
97
+ </PaginationItem>
98
+ ) : (
99
+ <PaginationItem key={p}>
100
+ <PaginationLink
101
+ isActive={p === page}
102
+ onClick={() => onPageChange(p)}
103
+ className="cursor-pointer"
104
+ >
105
+ {p}
106
+ </PaginationLink>
107
+ </PaginationItem>
108
+ )
109
+ )}
110
+ <PaginationItem>
111
+ <PaginationNext
112
+ text={labels.next}
113
+ onClick={() => page < totalPages && onPageChange(page + 1)}
114
+ className={page >= totalPages ? "pointer-events-none opacity-50" : "cursor-pointer"}
115
+ />
116
+ </PaginationItem>
117
+ </PaginationContent>
118
+ </Pagination>
119
+ </div>
120
+ );
121
+ }