@bevel-software/platform-core-frontend 0.1.0
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.
- package/LICENSE +202 -0
- package/package.json +70 -0
- package/src/core/CoreAppShell.tsx +444 -0
- package/src/core/__tests__/ShellRoutes.test.tsx +95 -0
- package/src/core/events.ts +29 -0
- package/src/core/registry.ts +336 -0
- package/src/css-side-effect-imports.d.ts +7 -0
- package/src/html-extensions.ts +12 -0
- package/src/index.css +49 -0
- package/src/index.ts +23 -0
- package/src/lib/api.ts +57 -0
- package/src/lib/utils.ts +138 -0
- package/src/modules/access/__tests__/ManageAccessDialog.test.tsx +130 -0
- package/src/modules/access/__tests__/useFileAccess.test.tsx +253 -0
- package/src/modules/access/api.ts +205 -0
- package/src/modules/access/components/AccessRestrictedBanner.tsx +31 -0
- package/src/modules/access/components/ManageAccessDialog.tsx +1232 -0
- package/src/modules/access/components/NodeOwnersBanner.tsx +30 -0
- package/src/modules/access/hooks/useFileAccess.ts +151 -0
- package/src/modules/admin/components/AdminRolesPage.tsx +943 -0
- package/src/modules/admin/components/RolesCorruptedBanner.tsx +74 -0
- package/src/modules/admin/services/admin.api.ts +92 -0
- package/src/modules/admin/services/roles.api.ts +136 -0
- package/src/modules/admin/state/admin.context.tsx +223 -0
- package/src/modules/auth/components/LoginScreen.tsx +135 -0
- package/src/modules/auth/hooks/useAuthState.ts +59 -0
- package/src/modules/auth/services/auth.api.ts +24 -0
- package/src/modules/auth/services/microsoft-oauth.ts +57 -0
- package/src/modules/auth/state/auth.context.ts +18 -0
- package/src/modules/git/__tests__/BranchSwitcher.test.tsx +347 -0
- package/src/modules/git/__tests__/FileHistoryPanel.test.tsx +201 -0
- package/src/modules/git/__tests__/ProtectedBranchBanner.test.tsx +82 -0
- package/src/modules/git/__tests__/PullNeededBanner.test.tsx +441 -0
- package/src/modules/git/__tests__/git.api.test.ts +113 -0
- package/src/modules/git/__tests__/pr.api.test.ts +44 -0
- package/src/modules/git/__tests__/useAutoPullUpdates.test.tsx +212 -0
- package/src/modules/git/components/BranchSwitcher.tsx +527 -0
- package/src/modules/git/components/DiffView.tsx +30 -0
- package/src/modules/git/components/FileComparisonPanel.tsx +377 -0
- package/src/modules/git/components/FileHistoryPanel.tsx +320 -0
- package/src/modules/git/components/ProtectedBranchBanner.tsx +42 -0
- package/src/modules/git/components/PullNeededBanner.tsx +204 -0
- package/src/modules/git/components/PullRequestsForMe.tsx +244 -0
- package/src/modules/git/components/UnifiedDiffView.tsx +37 -0
- package/src/modules/git/hooks/__tests__/useGitState.deleteBranch.test.tsx +99 -0
- package/src/modules/git/hooks/useAutoPullUpdates.ts +121 -0
- package/src/modules/git/hooks/useGitState.ts +335 -0
- package/src/modules/git/services/__tests__/error-messages.test.ts +134 -0
- package/src/modules/git/services/error-messages.ts +257 -0
- package/src/modules/git/services/git.api.ts +163 -0
- package/src/modules/git/services/pr-prompts.ts +159 -0
- package/src/modules/git/services/pr.api.ts +39 -0
- package/src/modules/git/state/auto-update.context.ts +21 -0
- package/src/modules/git/state/git.context.ts +82 -0
- package/src/modules/layout/components/AppLayout.tsx +40 -0
- package/src/modules/layout/components/DemoBanner.tsx +57 -0
- package/src/modules/layout/components/MaintenanceOverlay.tsx +104 -0
- package/src/modules/layout/components/MobileChatLayout.tsx +153 -0
- package/src/modules/layout/components/ResizableThreePaneLayout.tsx +203 -0
- package/src/modules/layout/components/SlideOverlay.tsx +224 -0
- package/src/modules/layout/components/__tests__/MobileChatLayout.test.tsx +77 -0
- package/src/modules/layout/components/__tests__/ResizableThreePaneLayout.test.tsx +57 -0
- package/src/modules/layout/hooks/useMediaQuery.ts +23 -0
- package/src/modules/layout/state/__tests__/layout.context.test.tsx +39 -0
- package/src/modules/layout/state/layout.context.ts +46 -0
- package/src/modules/library/__tests__/DetailDialog.test.tsx +200 -0
- package/src/modules/library/__tests__/diff.test.ts +62 -0
- package/src/modules/library/__tests__/loadout.test.tsx +72 -0
- package/src/modules/library/__tests__/status.test.ts +117 -0
- package/src/modules/library/components/ChangeRequestDock.tsx +47 -0
- package/src/modules/library/components/CompareView.tsx +357 -0
- package/src/modules/library/components/DetailDialog.tsx +566 -0
- package/src/modules/library/components/GearIcon.tsx +12 -0
- package/src/modules/library/components/LibraryCard.tsx +132 -0
- package/src/modules/library/components/LibraryPage.tsx +254 -0
- package/src/modules/library/components/LoadoutSidebar.tsx +156 -0
- package/src/modules/library/components/StatusGem.tsx +21 -0
- package/src/modules/library/components/SuggestChange.tsx +171 -0
- package/src/modules/library/components/particles.ts +50 -0
- package/src/modules/library/hooks/useLibraryData.ts +119 -0
- package/src/modules/library/hooks/useSkillDetail.ts +74 -0
- package/src/modules/library/library.css +320 -0
- package/src/modules/library/services/library.api.ts +164 -0
- package/src/modules/library/state/loadout.tsx +129 -0
- package/src/modules/library/state/toast.tsx +42 -0
- package/src/modules/library/utils/diff.ts +102 -0
- package/src/modules/library/utils/status.ts +116 -0
- package/src/modules/pr/__tests__/PrApprovalBadge.test.tsx +93 -0
- package/src/modules/pr/__tests__/PrCancelButton.test.tsx +158 -0
- package/src/modules/pr/__tests__/PrCancelConfirmDialog.test.tsx +44 -0
- package/src/modules/pr/__tests__/PrMergeButton.test.tsx +360 -0
- package/src/modules/pr/__tests__/bucketize-comments.test.ts +85 -0
- package/src/modules/pr/__tests__/parsePatch.test.ts +104 -0
- package/src/modules/pr/__tests__/usePrViewerState.test.ts +72 -0
- package/src/modules/pr/components/OpenChangeRequestDialog.tsx +193 -0
- package/src/modules/pr/components/PrApprovalBadge.tsx +80 -0
- package/src/modules/pr/components/PrCancelButton.tsx +99 -0
- package/src/modules/pr/components/PrCancelConfirmDialog.tsx +119 -0
- package/src/modules/pr/components/PrCommentComposer.tsx +92 -0
- package/src/modules/pr/components/PrCommentThread.tsx +168 -0
- package/src/modules/pr/components/PrCommentsPanel.tsx +143 -0
- package/src/modules/pr/components/PrDiffPane.tsx +425 -0
- package/src/modules/pr/components/PrFileRow.tsx +164 -0
- package/src/modules/pr/components/PrFilesList.tsx +53 -0
- package/src/modules/pr/components/PrHeader.tsx +45 -0
- package/src/modules/pr/components/PrHeaderOverflowMenu.tsx +58 -0
- package/src/modules/pr/components/PrMergeButton.tsx +268 -0
- package/src/modules/pr/components/PrMergeConfirmDialog.tsx +112 -0
- package/src/modules/pr/components/PrRefreshFromTargetButton.tsx +110 -0
- package/src/modules/pr/components/PrViewer.tsx +364 -0
- package/src/modules/pr/hooks/usePrViewerState.ts +150 -0
- package/src/modules/pr/services/pr-approvals.api.ts +31 -0
- package/src/modules/pr/services/pr-cancel.api.ts +19 -0
- package/src/modules/pr/services/pr-comments.api.ts +45 -0
- package/src/modules/pr/services/pr-detail.api.ts +17 -0
- package/src/modules/pr/services/pr-merge.api.ts +53 -0
- package/src/modules/pr/services/pr-open.api.ts +30 -0
- package/src/modules/pr/state/pr-viewer.context.ts +34 -0
- package/src/modules/pr/utils/bucketize-comments.ts +55 -0
- package/src/modules/pr/utils/parsePatch.ts +57 -0
- package/src/modules/review/__tests__/review.api.test.ts +121 -0
- package/src/modules/review/components/BinaryChangePlaceholder.tsx +15 -0
- package/src/modules/review/components/DiffViewer.tsx +78 -0
- package/src/modules/review/components/MarkdownDiffViewer.tsx +263 -0
- package/src/modules/review/components/ReviewFileRow.tsx +114 -0
- package/src/modules/review/components/ReviewPanel.tsx +260 -0
- package/src/modules/review/components/ReviewPanelSurface.tsx +52 -0
- package/src/modules/review/components/__tests__/ReviewPanel.test.tsx +106 -0
- package/src/modules/review/hooks/__tests__/useReviewState.test.ts +88 -0
- package/src/modules/review/hooks/useReviewState.ts +256 -0
- package/src/modules/review/services/review.api.ts +72 -0
- package/src/modules/review/state/ReviewProvider.tsx +28 -0
- package/src/modules/review/state/review.context.ts +29 -0
- package/src/modules/secrets-vault/components/ConnectToolsPage.tsx +488 -0
- package/src/modules/secrets-vault/components/SecretsPage.tsx +276 -0
- package/src/modules/secrets-vault/components/ToolSecretsPanel.tsx +362 -0
- package/src/modules/secrets-vault/components/__tests__/SecretsPage.test.tsx +51 -0
- package/src/modules/secrets-vault/services/connect.api.ts +113 -0
- package/src/modules/secrets-vault/services/secrets.api.ts +82 -0
- package/src/modules/secrets-vault/services/tool-secrets.api.ts +116 -0
- package/src/modules/toolbar/components/AdminMenu.tsx +250 -0
- package/src/modules/toolbar/components/AppSwitcher.tsx +108 -0
- package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +548 -0
- package/src/modules/toolbar/components/Toolbar.tsx +123 -0
- package/src/modules/toolbar/components/__tests__/AppSwitcher.test.tsx +122 -0
- package/src/modules/toolbar/components/__tests__/Toolbar.test.tsx +353 -0
- package/src/modules/toolbar/services/external-api-keys.api.ts +65 -0
- package/src/modules/tools/ToolsExplorerPage.tsx +380 -0
- package/src/modules/workflow/hooks/useEventBusSubscription.ts +24 -0
- package/src/modules/workflow/hooks/useFileLock.ts +430 -0
- package/src/modules/workflow/services/lock.api.ts +139 -0
- package/src/modules/workflow/state/EventBusFocusBinder.tsx +25 -0
- package/src/modules/workflow/state/EventBusProvider.tsx +232 -0
- package/src/modules/workflow/state/event-bus.context.ts +75 -0
- package/src/modules/workspace/__tests__/testFixtures.ts +54 -0
- package/src/modules/workspace/__tests__/useWorkspaceState.test.ts +91 -0
- package/src/modules/workspace/components/EditorTabs.tsx +384 -0
- package/src/modules/workspace/components/FileExplorer.tsx +1068 -0
- package/src/modules/workspace/components/FileRoute.tsx +392 -0
- package/src/modules/workspace/components/FileViewer.tsx +906 -0
- package/src/modules/workspace/components/__tests__/EditorTabs.test.tsx +241 -0
- package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +666 -0
- package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +330 -0
- package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +492 -0
- package/src/modules/workspace/components/renderers/CsvRenderer.tsx +174 -0
- package/src/modules/workspace/components/renderers/DocxRenderer.tsx +87 -0
- package/src/modules/workspace/components/renderers/HtmlRenderer.tsx +231 -0
- package/src/modules/workspace/components/renderers/ImageRenderer.tsx +50 -0
- package/src/modules/workspace/components/renderers/KbMarkdownView.tsx +287 -0
- package/src/modules/workspace/components/renderers/MarkdownRenderer.tsx +252 -0
- package/src/modules/workspace/components/renderers/MermaidDiagram.tsx +268 -0
- package/src/modules/workspace/components/renderers/PdfRenderer.tsx +81 -0
- package/src/modules/workspace/components/renderers/TextRenderer.tsx +86 -0
- package/src/modules/workspace/components/renderers/ToolForm.tsx +404 -0
- package/src/modules/workspace/components/renderers/ToolRenderer.tsx +417 -0
- package/src/modules/workspace/components/renderers/XlsxRenderer.tsx +157 -0
- package/src/modules/workspace/components/renderers/__tests__/CsvRenderer.test.ts +57 -0
- package/src/modules/workspace/components/renderers/__tests__/KbMarkdownView.test.tsx +95 -0
- package/src/modules/workspace/components/renderers/__tests__/MarkdownRenderer.test.tsx +328 -0
- package/src/modules/workspace/components/renderers/__tests__/PdfRenderer.test.tsx +167 -0
- package/src/modules/workspace/components/renderers/__tests__/htmlSandbox.test.ts +318 -0
- package/src/modules/workspace/components/renderers/csvUtils.ts +76 -0
- package/src/modules/workspace/components/renderers/htmlSandbox.ts +332 -0
- package/src/modules/workspace/components/renderers/index.ts +39 -0
- package/src/modules/workspace/components/renderers/types.ts +27 -0
- package/src/modules/workspace/hooks/__tests__/useWorkspaceState.test.tsx +298 -0
- package/src/modules/workspace/hooks/useWorkspaceState.ts +1315 -0
- package/src/modules/workspace/routing/__tests__/kb-routes.test.tsx +99 -0
- package/src/modules/workspace/routing/kb-routes.ts +266 -0
- package/src/modules/workspace/services/__tests__/workspace.api.test.ts +72 -0
- package/src/modules/workspace/services/workspace.api.ts +185 -0
- package/src/modules/workspace/state/workspace.context.ts +235 -0
- package/src/modules/workspace/utils/__tests__/frontmatter.test.ts +107 -0
- package/src/modules/workspace/utils/diff.ts +53 -0
- package/src/modules/workspace/utils/fileTree.ts +179 -0
- package/src/modules/workspace/utils/frontmatter.ts +80 -0
- package/src/modules/workspace/utils/readDroppedEntries.ts +119 -0
- package/src/modules/workspace/utils/tab-persistence.ts +23 -0
- package/src/shared/components/Dialog.tsx +198 -0
- package/src/shared/components/PageShell.tsx +51 -0
- package/src/shared/components/useModalLayer.ts +35 -0
- package/src/shared/markdown/Markdown.tsx +62 -0
- package/src/test-setup.ts +59 -0
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Library module — game-feel visual layer (approved mock: mocks/mock-a2-game-library.html).
|
|
3
|
+
* Deliberately teal-accented (#0d9488), NOT brand purple: the user moved this
|
|
4
|
+
* view off the brand color on purpose. Everything here is scoped under `lib-`
|
|
5
|
+
* class names; layout is Tailwind in the components, this file holds only the
|
|
6
|
+
* pieces Tailwind can't express well: keyframes, glossy status gems, particle
|
|
7
|
+
* flight, gear chrome, 3D card tilt + glare, slot/dock animations, diff marks.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/* ── status gems ── */
|
|
11
|
+
.lib-gem {
|
|
12
|
+
width: 20px;
|
|
13
|
+
height: 20px;
|
|
14
|
+
border-radius: 50%;
|
|
15
|
+
display: inline-flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
font-size: 10px;
|
|
19
|
+
font-weight: 800;
|
|
20
|
+
flex-shrink: 0;
|
|
21
|
+
box-shadow:
|
|
22
|
+
0 2px 8px rgba(22, 35, 58, 0.18),
|
|
23
|
+
inset 0 2px 3px rgba(255, 255, 255, 0.6),
|
|
24
|
+
inset 0 -3px 4px rgba(0, 0, 0, 0.18);
|
|
25
|
+
}
|
|
26
|
+
.lib-gem-ok {
|
|
27
|
+
background: radial-gradient(circle at 35% 30%, #a7ffd9, #10b981 60%, #0a8f60);
|
|
28
|
+
color: #05402a;
|
|
29
|
+
}
|
|
30
|
+
.lib-gem-warn {
|
|
31
|
+
background: radial-gradient(circle at 35% 30%, #ffe3b0, #f59e0b 60%, #cc7a00);
|
|
32
|
+
color: #5a3400;
|
|
33
|
+
}
|
|
34
|
+
.lib-gem-err {
|
|
35
|
+
background: radial-gradient(circle at 35% 30%, #ffc3ca, #ef4444 60%, #c22738);
|
|
36
|
+
color: #4d0810;
|
|
37
|
+
}
|
|
38
|
+
.lib-gem-off {
|
|
39
|
+
background: radial-gradient(circle at 35% 30%, #f1f5f9, #c4cfdc 60%, #8fa0b3);
|
|
40
|
+
color: #42536b;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* ── cards: 3D tilt + glare + hover CTA ── */
|
|
44
|
+
.lib-grid {
|
|
45
|
+
perspective: 1200px;
|
|
46
|
+
}
|
|
47
|
+
.lib-card {
|
|
48
|
+
position: relative;
|
|
49
|
+
border-radius: 16px;
|
|
50
|
+
overflow: hidden;
|
|
51
|
+
cursor: pointer;
|
|
52
|
+
user-select: none;
|
|
53
|
+
background: #ffffff;
|
|
54
|
+
border: 1px solid #e2e8f0;
|
|
55
|
+
transform-style: preserve-3d;
|
|
56
|
+
will-change: transform;
|
|
57
|
+
transition:
|
|
58
|
+
transform 0.18s ease-out,
|
|
59
|
+
box-shadow 0.25s,
|
|
60
|
+
border-color 0.25s,
|
|
61
|
+
background 0.25s;
|
|
62
|
+
box-shadow: 0 2px 10px rgba(22, 35, 58, 0.06);
|
|
63
|
+
}
|
|
64
|
+
.lib-card:hover {
|
|
65
|
+
border-color: #7fd0c4;
|
|
66
|
+
box-shadow:
|
|
67
|
+
0 22px 40px rgba(22, 35, 58, 0.16),
|
|
68
|
+
0 0 0 1px rgba(13, 148, 136, 0.08);
|
|
69
|
+
z-index: 2;
|
|
70
|
+
}
|
|
71
|
+
.lib-card-glare {
|
|
72
|
+
position: absolute;
|
|
73
|
+
inset: 0;
|
|
74
|
+
border-radius: 16px;
|
|
75
|
+
pointer-events: none;
|
|
76
|
+
opacity: 0;
|
|
77
|
+
transition: opacity 0.2s;
|
|
78
|
+
background: radial-gradient(
|
|
79
|
+
320px circle at var(--lib-mx, 50%) var(--lib-my, 50%),
|
|
80
|
+
rgba(255, 255, 255, 0.65),
|
|
81
|
+
transparent 55%
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
.lib-card:hover .lib-card-glare {
|
|
85
|
+
opacity: 1;
|
|
86
|
+
}
|
|
87
|
+
/* green accent strip — skill cards only */
|
|
88
|
+
.lib-card-skill::before {
|
|
89
|
+
content: '';
|
|
90
|
+
position: absolute;
|
|
91
|
+
left: 14px;
|
|
92
|
+
right: 14px;
|
|
93
|
+
top: 0;
|
|
94
|
+
height: 2.5px;
|
|
95
|
+
border-radius: 99px;
|
|
96
|
+
background: linear-gradient(90deg, transparent, #10b981, transparent);
|
|
97
|
+
opacity: 0.9;
|
|
98
|
+
z-index: 1;
|
|
99
|
+
}
|
|
100
|
+
.lib-card-tool {
|
|
101
|
+
background: linear-gradient(165deg, #fbfcfe, #f3f6fa);
|
|
102
|
+
}
|
|
103
|
+
/* picked (in the loadout): teal-tinted */
|
|
104
|
+
.lib-card-picked,
|
|
105
|
+
.lib-card-tool.lib-card-picked {
|
|
106
|
+
background: linear-gradient(165deg, #e9f8f5, #d4f0ea);
|
|
107
|
+
border-color: #4cbcab;
|
|
108
|
+
box-shadow: 0 4px 18px rgba(13, 148, 136, 0.22);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.lib-hover-cta {
|
|
112
|
+
position: absolute;
|
|
113
|
+
left: 0;
|
|
114
|
+
right: 0;
|
|
115
|
+
bottom: 0;
|
|
116
|
+
padding: 12px 0 14px;
|
|
117
|
+
display: flex;
|
|
118
|
+
justify-content: center;
|
|
119
|
+
background: linear-gradient(transparent, rgba(255, 255, 255, 0.92) 55%);
|
|
120
|
+
opacity: 0;
|
|
121
|
+
transform: translateY(8px);
|
|
122
|
+
transition:
|
|
123
|
+
opacity 0.18s,
|
|
124
|
+
transform 0.18s;
|
|
125
|
+
pointer-events: none;
|
|
126
|
+
z-index: 2;
|
|
127
|
+
}
|
|
128
|
+
.lib-card:hover .lib-hover-cta {
|
|
129
|
+
opacity: 1;
|
|
130
|
+
transform: none;
|
|
131
|
+
}
|
|
132
|
+
.lib-card-picked .lib-hover-cta {
|
|
133
|
+
background: linear-gradient(transparent, rgba(222, 243, 238, 0.94) 55%);
|
|
134
|
+
}
|
|
135
|
+
.lib-hc-add {
|
|
136
|
+
font-size: 12px;
|
|
137
|
+
font-weight: 700;
|
|
138
|
+
border-radius: 99px;
|
|
139
|
+
padding: 5px 16px;
|
|
140
|
+
color: #0a8f60;
|
|
141
|
+
background: #e0f8ee;
|
|
142
|
+
box-shadow: inset 0 0 0 1px #a9e8cd;
|
|
143
|
+
}
|
|
144
|
+
.lib-hc-remove {
|
|
145
|
+
font-size: 12px;
|
|
146
|
+
font-weight: 700;
|
|
147
|
+
border-radius: 99px;
|
|
148
|
+
padding: 5px 16px;
|
|
149
|
+
color: #c53030;
|
|
150
|
+
background: #fdecec;
|
|
151
|
+
box-shadow: inset 0 0 0 1px #f3c4c4;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/* ── gear chrome on integration cards ── */
|
|
155
|
+
.lib-gears {
|
|
156
|
+
position: absolute;
|
|
157
|
+
inset: 0;
|
|
158
|
+
pointer-events: none;
|
|
159
|
+
color: #5b6b81;
|
|
160
|
+
opacity: 0.09;
|
|
161
|
+
transition: opacity 0.2s;
|
|
162
|
+
}
|
|
163
|
+
.lib-gears svg {
|
|
164
|
+
position: absolute;
|
|
165
|
+
width: 52px;
|
|
166
|
+
height: 52px;
|
|
167
|
+
animation: lib-spin 16s linear infinite;
|
|
168
|
+
animation-play-state: paused;
|
|
169
|
+
}
|
|
170
|
+
.lib-gears svg:nth-child(1) {
|
|
171
|
+
top: -20px;
|
|
172
|
+
left: -20px;
|
|
173
|
+
}
|
|
174
|
+
.lib-gears svg:nth-child(2) {
|
|
175
|
+
top: -20px;
|
|
176
|
+
right: -20px;
|
|
177
|
+
animation-direction: reverse;
|
|
178
|
+
}
|
|
179
|
+
.lib-gears svg:nth-child(3) {
|
|
180
|
+
bottom: -20px;
|
|
181
|
+
left: -20px;
|
|
182
|
+
animation-direction: reverse;
|
|
183
|
+
}
|
|
184
|
+
.lib-gears svg:nth-child(4) {
|
|
185
|
+
bottom: -20px;
|
|
186
|
+
right: -20px;
|
|
187
|
+
}
|
|
188
|
+
.lib-gears svg:nth-child(5) {
|
|
189
|
+
top: 50%;
|
|
190
|
+
left: 50%;
|
|
191
|
+
margin: -26px 0 0 -26px;
|
|
192
|
+
animation-duration: 30s;
|
|
193
|
+
}
|
|
194
|
+
.lib-card-tool:hover .lib-gears svg {
|
|
195
|
+
animation-play-state: running;
|
|
196
|
+
}
|
|
197
|
+
.lib-card-tool:hover .lib-gears {
|
|
198
|
+
opacity: 0.14;
|
|
199
|
+
}
|
|
200
|
+
@keyframes lib-spin {
|
|
201
|
+
to {
|
|
202
|
+
transform: rotate(360deg);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/* ── loadout slots ── */
|
|
207
|
+
.lib-slot {
|
|
208
|
+
animation: lib-slot-in 0.28s cubic-bezier(0.2, 1.4, 0.4, 1) both;
|
|
209
|
+
}
|
|
210
|
+
@keyframes lib-slot-in {
|
|
211
|
+
from {
|
|
212
|
+
opacity: 0;
|
|
213
|
+
transform: translateX(-22px) scale(0.95);
|
|
214
|
+
}
|
|
215
|
+
to {
|
|
216
|
+
opacity: 1;
|
|
217
|
+
transform: none;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
.lib-slot-leaving {
|
|
221
|
+
transition: all 0.18s ease-in;
|
|
222
|
+
opacity: 0;
|
|
223
|
+
transform: translateX(-18px) scale(0.95);
|
|
224
|
+
}
|
|
225
|
+
@keyframes lib-arrive {
|
|
226
|
+
0% {
|
|
227
|
+
box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
|
|
228
|
+
}
|
|
229
|
+
60% {
|
|
230
|
+
box-shadow: 0 0 0 7px rgba(16, 185, 129, 0);
|
|
231
|
+
}
|
|
232
|
+
100% {
|
|
233
|
+
box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
.lib-slot-arrive {
|
|
237
|
+
animation:
|
|
238
|
+
lib-slot-in 0.28s cubic-bezier(0.2, 1.4, 0.4, 1) both,
|
|
239
|
+
lib-arrive 0.5s ease-out 0.3s;
|
|
240
|
+
}
|
|
241
|
+
/* hover swaps the gem for the remove button */
|
|
242
|
+
.lib-slot .lib-slot-gem {
|
|
243
|
+
transition: opacity 0.15s;
|
|
244
|
+
}
|
|
245
|
+
.lib-slot:hover .lib-slot-gem {
|
|
246
|
+
opacity: 0;
|
|
247
|
+
}
|
|
248
|
+
.lib-slot .lib-slot-kick {
|
|
249
|
+
opacity: 0;
|
|
250
|
+
transition: all 0.15s;
|
|
251
|
+
}
|
|
252
|
+
.lib-slot:hover .lib-slot-kick {
|
|
253
|
+
opacity: 1;
|
|
254
|
+
}
|
|
255
|
+
.lib-count-pulse {
|
|
256
|
+
animation: lib-count-pulse 0.2s ease-out;
|
|
257
|
+
}
|
|
258
|
+
@keyframes lib-count-pulse {
|
|
259
|
+
50% {
|
|
260
|
+
transform: scale(1.35);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/* ── particle flight (card → loadout row) ── */
|
|
265
|
+
.lib-particle {
|
|
266
|
+
position: fixed;
|
|
267
|
+
top: 0;
|
|
268
|
+
left: 0;
|
|
269
|
+
width: 6px;
|
|
270
|
+
height: 6px;
|
|
271
|
+
border-radius: 50%;
|
|
272
|
+
pointer-events: none;
|
|
273
|
+
z-index: 70;
|
|
274
|
+
background: radial-gradient(circle at 35% 30%, #b8ffe8, #10b981);
|
|
275
|
+
box-shadow: 0 0 8px rgba(16, 185, 129, 0.85);
|
|
276
|
+
}
|
|
277
|
+
.lib-particle-tool {
|
|
278
|
+
background: radial-gradient(circle at 35% 30%, #b5f2ea, #0d9488);
|
|
279
|
+
box-shadow: 0 0 8px rgba(13, 148, 136, 0.85);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/* ── change-request dock (owners) ── */
|
|
283
|
+
.lib-cr-dock {
|
|
284
|
+
animation: lib-cr-in 0.25s cubic-bezier(0.2, 1.2, 0.35, 1);
|
|
285
|
+
}
|
|
286
|
+
@keyframes lib-cr-in {
|
|
287
|
+
from {
|
|
288
|
+
opacity: 0;
|
|
289
|
+
transform: translateY(-50%) translateX(16px);
|
|
290
|
+
}
|
|
291
|
+
to {
|
|
292
|
+
opacity: 1;
|
|
293
|
+
transform: translateY(-50%);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/* ── diff marks (compare + inline suggestions) ── */
|
|
298
|
+
.lib-line-removed {
|
|
299
|
+
background: #fdecec;
|
|
300
|
+
color: #b91c1c;
|
|
301
|
+
}
|
|
302
|
+
.lib-line-added {
|
|
303
|
+
background: #e0f8ee;
|
|
304
|
+
color: #067a52;
|
|
305
|
+
}
|
|
306
|
+
.lib-sug del {
|
|
307
|
+
color: #b91c1c;
|
|
308
|
+
background: #fdecec;
|
|
309
|
+
text-decoration: line-through;
|
|
310
|
+
padding: 0 3px;
|
|
311
|
+
border-radius: 3px;
|
|
312
|
+
}
|
|
313
|
+
.lib-sug ins {
|
|
314
|
+
color: #067a52;
|
|
315
|
+
background: #e0f8ee;
|
|
316
|
+
text-decoration: none;
|
|
317
|
+
padding: 0 3px;
|
|
318
|
+
border-radius: 3px;
|
|
319
|
+
font-weight: 600;
|
|
320
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { DEFAULT_BRANCH, type PullRequestSummary } from '@bevel-software/platform-shared';
|
|
2
|
+
import { authFetch } from '../../../lib/api';
|
|
3
|
+
import { handleApiResponse } from '../../git/services/git.api';
|
|
4
|
+
import { createBranch } from '../../git/services/git.api';
|
|
5
|
+
import { getOrCreateWorkspace, readFile, writeFile } from '../../workspace/services/workspace.api';
|
|
6
|
+
import { openChangeRequest } from '../../pr/services/pr-open.api';
|
|
7
|
+
import { postPrComment } from '../../pr/services/pr-comments.api';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Library data access. Skills come from the browser skill routes
|
|
11
|
+
* (`GET /api/skills`, `GET /api/skills/:name[?file=…]`) — the same
|
|
12
|
+
* default-branch, per-user-`canRead`-filtered catalog the agent sees.
|
|
13
|
+
* Change requests come from the workflow routes the pr module already talks
|
|
14
|
+
* to. Integration (tool) data is NOT here — the Library reuses
|
|
15
|
+
* `secrets-vault/services/tool-secrets.api.ts` directly.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/** The default-branch workspace id — derivable client-side (id = encodeURIComponent(branch)). */
|
|
19
|
+
export const DEFAULT_WORKSPACE_ID = encodeURIComponent(DEFAULT_BRANCH);
|
|
20
|
+
|
|
21
|
+
export interface LibrarySkillSummary {
|
|
22
|
+
/** Canonical id = the skill's folder name (e.g. `rfi`). */
|
|
23
|
+
name: string;
|
|
24
|
+
description: string;
|
|
25
|
+
version?: string;
|
|
26
|
+
/** Repo-root-relative skill folder, e.g. `Skills/rfi`. */
|
|
27
|
+
path: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface LibrarySkill extends LibrarySkillSummary {
|
|
31
|
+
/** The SKILL.md markdown body. */
|
|
32
|
+
body: string;
|
|
33
|
+
allowedTools?: string[];
|
|
34
|
+
/** Repo-root-relative bundled file paths (SKILL.md itself is not listed). */
|
|
35
|
+
files: string[];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface SkillFilePayload {
|
|
39
|
+
name: string;
|
|
40
|
+
file: string;
|
|
41
|
+
path: string;
|
|
42
|
+
content: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
type GetSkillPayload =
|
|
46
|
+
| { ok: true; kind: 'skill'; skill: LibrarySkill }
|
|
47
|
+
| { ok: true; kind: 'file'; file: SkillFilePayload }
|
|
48
|
+
| { ok: false; error: 'not_found' | 'forbidden' | 'invalid_file' };
|
|
49
|
+
|
|
50
|
+
export async function listSkills(): Promise<LibrarySkillSummary[]> {
|
|
51
|
+
const data = await handleApiResponse<{ skills: LibrarySkillSummary[] }>(
|
|
52
|
+
await authFetch('/api/skills'),
|
|
53
|
+
);
|
|
54
|
+
return data.skills;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export async function getSkill(name: string): Promise<LibrarySkill> {
|
|
58
|
+
const data = await handleApiResponse<GetSkillPayload>(
|
|
59
|
+
await authFetch(`/api/skills/${encodeURIComponent(name)}`),
|
|
60
|
+
);
|
|
61
|
+
if (!data.ok || data.kind !== 'skill') throw new Error("Couldn't load this skill.");
|
|
62
|
+
return data.skill;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** Content of a bundled skill file. `file` is relative to the skill folder. */
|
|
66
|
+
export async function getSkillFile(name: string, file: string): Promise<string> {
|
|
67
|
+
const data = await handleApiResponse<GetSkillPayload>(
|
|
68
|
+
await authFetch(`/api/skills/${encodeURIComponent(name)}?file=${encodeURIComponent(file)}`),
|
|
69
|
+
);
|
|
70
|
+
if (!data.ok || data.kind !== 'file') throw new Error("Couldn't load this file.");
|
|
71
|
+
return data.file.content;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** All open change requests (the Library filters them to a skill's folder). */
|
|
75
|
+
export async function listOpenChangeRequests(): Promise<PullRequestSummary[]> {
|
|
76
|
+
return handleApiResponse<PullRequestSummary[]>(
|
|
77
|
+
await authFetch('/api/workflow/change-requests'),
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** The caller's own change requests (any state; callers filter to open). */
|
|
82
|
+
export async function listMyChangeRequests(): Promise<PullRequestSummary[]> {
|
|
83
|
+
return handleApiResponse<PullRequestSummary[]>(
|
|
84
|
+
await authFetch('/api/workflow/change-requests/mine'),
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** Read a file from a branch's shared workspace (bootstraps the clone if needed). */
|
|
89
|
+
export async function readFileOnBranch(branch: string, repoRelativePath: string): Promise<string> {
|
|
90
|
+
const { workspace } = await getOrCreateWorkspace(branch);
|
|
91
|
+
return readFile(workspace.id, `${workspace.kbDirName}/${repoRelativePath}`);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** Keep only characters git branch segments accept; collapse the rest to '-'. */
|
|
95
|
+
function branchSegment(raw: string): string {
|
|
96
|
+
const cleaned = raw
|
|
97
|
+
.toLowerCase()
|
|
98
|
+
.replace(/[^a-z0-9._-]+/g, '-')
|
|
99
|
+
.replace(/^[-.]+/, '')
|
|
100
|
+
.replace(/[.]+$/, '');
|
|
101
|
+
return cleaned || 'user';
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** The one suggestion branch per user per skill (see mocks/README.md — suggestions are git). */
|
|
105
|
+
export function suggestionBranchFor(userEmail: string, skillName: string): string {
|
|
106
|
+
return `suggestions/${branchSegment(userEmail.split('@')[0])}/${branchSegment(skillName)}`;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export interface SuggestChangeInput {
|
|
110
|
+
skillName: string;
|
|
111
|
+
/** Repo-root-relative path of the file being suggested on. */
|
|
112
|
+
repoRelativePath: string;
|
|
113
|
+
/** Exact text to replace (must occur in the branch's current file content). */
|
|
114
|
+
find: string;
|
|
115
|
+
replace: string;
|
|
116
|
+
/** Optional "why" — lands in the change-request description / a comment. */
|
|
117
|
+
note?: string;
|
|
118
|
+
userEmail: string;
|
|
119
|
+
userName: string;
|
|
120
|
+
/** The caller's open suggestion change request for this skill, if any. */
|
|
121
|
+
existingCr?: PullRequestSummary | null;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* The real suggest-a-change flow: commit the edit to the user's suggestion
|
|
126
|
+
* branch (`suggestions/<user>/<skill>`, forked from the default branch) and
|
|
127
|
+
* make sure an open change request against the default branch exists for it.
|
|
128
|
+
* Save = share: `writeFile` on the branch workspace auto-commits and pushes,
|
|
129
|
+
* so the suggestion is durable the moment this resolves.
|
|
130
|
+
*/
|
|
131
|
+
export async function suggestChange(input: SuggestChangeInput): Promise<{ branch: string }> {
|
|
132
|
+
const branch = input.existingCr?.branch ?? suggestionBranchFor(input.userEmail, input.skillName);
|
|
133
|
+
|
|
134
|
+
if (!input.existingCr) {
|
|
135
|
+
try {
|
|
136
|
+
await createBranch(DEFAULT_WORKSPACE_ID, branch, DEFAULT_BRANCH);
|
|
137
|
+
} catch {
|
|
138
|
+
// Branch may already exist from an earlier (merged/cancelled) round —
|
|
139
|
+
// reuse it; the change request below is what makes it reviewable again.
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const { workspace } = await getOrCreateWorkspace(branch);
|
|
144
|
+
const wsPath = `${workspace.kbDirName}/${input.repoRelativePath}`;
|
|
145
|
+
const current = await readFile(workspace.id, wsPath);
|
|
146
|
+
if (!current.includes(input.find)) {
|
|
147
|
+
throw new Error('Select a plain stretch of text to suggest on.');
|
|
148
|
+
}
|
|
149
|
+
await writeFile(workspace.id, wsPath, current.replace(input.find, input.replace));
|
|
150
|
+
|
|
151
|
+
if (input.existingCr) {
|
|
152
|
+
if (input.note) {
|
|
153
|
+
await postPrComment(input.existingCr.number, { body: input.note });
|
|
154
|
+
}
|
|
155
|
+
} else {
|
|
156
|
+
await openChangeRequest({
|
|
157
|
+
sourceBranch: branch,
|
|
158
|
+
targetBranch: DEFAULT_BRANCH,
|
|
159
|
+
title: `Suggestions from ${input.userName} — ${input.skillName}`,
|
|
160
|
+
description: input.note || undefined,
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
return { branch };
|
|
164
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createContext,
|
|
3
|
+
useCallback,
|
|
4
|
+
useContext,
|
|
5
|
+
useMemo,
|
|
6
|
+
useRef,
|
|
7
|
+
useState,
|
|
8
|
+
type ReactNode,
|
|
9
|
+
} from 'react';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The loadout — the skills and integrations this user has explicitly
|
|
13
|
+
* activated (Hearthstone-deck-tracker sidebar in the approved mock).
|
|
14
|
+
*
|
|
15
|
+
* DELIBERATE STUB: there is no backend for per-user skill activation yet, so
|
|
16
|
+
* the loadout lives client-side in localStorage under
|
|
17
|
+
* `bevel-library-loadout-v1`. It survives reloads on this browser but does not
|
|
18
|
+
* roam across devices and nothing server-side consumes it yet. When a backend
|
|
19
|
+
* feature lands (e.g. the MCP session registering only loadout tools), this
|
|
20
|
+
* provider is the single place to swap the persistence.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
export const LOADOUT_STORAGE_KEY = 'bevel-library-loadout-v1';
|
|
24
|
+
|
|
25
|
+
export type LoadoutKind = 'skill' | 'integration';
|
|
26
|
+
|
|
27
|
+
interface LoadoutState {
|
|
28
|
+
skills: string[];
|
|
29
|
+
integrations: string[];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface LoadoutContextValue {
|
|
33
|
+
skills: string[];
|
|
34
|
+
integrations: string[];
|
|
35
|
+
total: number;
|
|
36
|
+
isIn(kind: LoadoutKind, id: string): boolean;
|
|
37
|
+
/** Toggle membership; returns true when the item was ADDED. */
|
|
38
|
+
toggle(kind: LoadoutKind, id: string): boolean;
|
|
39
|
+
remove(kind: LoadoutKind, id: string): void;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const LoadoutContext = createContext<LoadoutContextValue | null>(null);
|
|
43
|
+
|
|
44
|
+
function load(): LoadoutState {
|
|
45
|
+
try {
|
|
46
|
+
const raw = localStorage.getItem(LOADOUT_STORAGE_KEY);
|
|
47
|
+
if (!raw) return { skills: [], integrations: [] };
|
|
48
|
+
const parsed = JSON.parse(raw) as Partial<LoadoutState>;
|
|
49
|
+
return {
|
|
50
|
+
skills: Array.isArray(parsed.skills) ? parsed.skills.filter((s) => typeof s === 'string') : [],
|
|
51
|
+
integrations: Array.isArray(parsed.integrations)
|
|
52
|
+
? parsed.integrations.filter((s) => typeof s === 'string')
|
|
53
|
+
: [],
|
|
54
|
+
};
|
|
55
|
+
} catch {
|
|
56
|
+
return { skills: [], integrations: [] };
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function persist(state: LoadoutState): void {
|
|
61
|
+
try {
|
|
62
|
+
localStorage.setItem(LOADOUT_STORAGE_KEY, JSON.stringify(state));
|
|
63
|
+
} catch {
|
|
64
|
+
// Storage full/unavailable — the in-memory loadout still works this session.
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function LoadoutProvider({ children }: { children: ReactNode }) {
|
|
69
|
+
const [state, setState] = useState<LoadoutState>(load);
|
|
70
|
+
// Ref mirror so two mutations in one React batch (e.g. add skill + add
|
|
71
|
+
// integration from the same event) compose instead of clobbering each other.
|
|
72
|
+
const current = useRef(state);
|
|
73
|
+
|
|
74
|
+
const update = useCallback((next: LoadoutState) => {
|
|
75
|
+
current.current = next;
|
|
76
|
+
persist(next);
|
|
77
|
+
setState(next);
|
|
78
|
+
}, []);
|
|
79
|
+
|
|
80
|
+
const isIn = useCallback(
|
|
81
|
+
(kind: LoadoutKind, id: string) =>
|
|
82
|
+
(kind === 'skill' ? state.skills : state.integrations).includes(id),
|
|
83
|
+
[state],
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
const toggle = useCallback(
|
|
87
|
+
(kind: LoadoutKind, id: string): boolean => {
|
|
88
|
+
const prev = current.current;
|
|
89
|
+
const key = kind === 'skill' ? 'skills' : 'integrations';
|
|
90
|
+
const list = prev[key];
|
|
91
|
+
const added = !list.includes(id);
|
|
92
|
+
update({
|
|
93
|
+
...prev,
|
|
94
|
+
[key]: added ? [...list, id] : list.filter((x) => x !== id),
|
|
95
|
+
});
|
|
96
|
+
return added;
|
|
97
|
+
},
|
|
98
|
+
[update],
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
const remove = useCallback(
|
|
102
|
+
(kind: LoadoutKind, id: string) => {
|
|
103
|
+
const prev = current.current;
|
|
104
|
+
const key = kind === 'skill' ? 'skills' : 'integrations';
|
|
105
|
+
update({ ...prev, [key]: prev[key].filter((x) => x !== id) });
|
|
106
|
+
},
|
|
107
|
+
[update],
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
const value = useMemo<LoadoutContextValue>(
|
|
111
|
+
() => ({
|
|
112
|
+
skills: state.skills,
|
|
113
|
+
integrations: state.integrations,
|
|
114
|
+
total: state.skills.length + state.integrations.length,
|
|
115
|
+
isIn,
|
|
116
|
+
toggle,
|
|
117
|
+
remove,
|
|
118
|
+
}),
|
|
119
|
+
[state, isIn, toggle, remove],
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
return <LoadoutContext.Provider value={value}>{children}</LoadoutContext.Provider>;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export function useLoadout(): LoadoutContextValue {
|
|
126
|
+
const ctx = useContext(LoadoutContext);
|
|
127
|
+
if (!ctx) throw new Error('useLoadout must be used within LoadoutProvider');
|
|
128
|
+
return ctx;
|
|
129
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createContext,
|
|
3
|
+
useCallback,
|
|
4
|
+
useContext,
|
|
5
|
+
useRef,
|
|
6
|
+
useState,
|
|
7
|
+
type ReactNode,
|
|
8
|
+
} from 'react';
|
|
9
|
+
|
|
10
|
+
/** Bottom-center toast from the approved mock — one line, auto-dismissing. */
|
|
11
|
+
|
|
12
|
+
const ToastContext = createContext<(msg: string) => void>(() => {});
|
|
13
|
+
|
|
14
|
+
export function useLibraryToast(): (msg: string) => void {
|
|
15
|
+
return useContext(ToastContext);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function LibraryToastProvider({ children }: { children: ReactNode }) {
|
|
19
|
+
const [message, setMessage] = useState<string | null>(null);
|
|
20
|
+
const timer = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
21
|
+
|
|
22
|
+
const show = useCallback((msg: string) => {
|
|
23
|
+
setMessage(msg);
|
|
24
|
+
if (timer.current) clearTimeout(timer.current);
|
|
25
|
+
timer.current = setTimeout(() => setMessage(null), 2600);
|
|
26
|
+
}, []);
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<ToastContext.Provider value={show}>
|
|
30
|
+
{children}
|
|
31
|
+
<div
|
|
32
|
+
role="status"
|
|
33
|
+
aria-live="polite"
|
|
34
|
+
className={`fixed left-1/2 bottom-6 -translate-x-1/2 z-[80] pointer-events-none rounded-xl border border-[#7fd0c4] bg-white px-5 py-2.5 text-[12.5px] font-semibold text-[#0f766e] shadow-[0_10px_30px_rgba(22,35,58,0.18)] transition-transform duration-300 ${
|
|
35
|
+
message ? 'translate-y-0' : 'translate-y-24'
|
|
36
|
+
}`}
|
|
37
|
+
>
|
|
38
|
+
{message}
|
|
39
|
+
</div>
|
|
40
|
+
</ToastContext.Provider>
|
|
41
|
+
);
|
|
42
|
+
}
|