Commit ee2748f
authored
feat(admin): add KiloClaw instance link on user profile page (#1344)
## Summary
- Add a "View KiloClaw" button to the admin user profile page's KiloClaw
section that links directly to the user's active KiloClaw instance admin
page (`/admin/kiloclaw/[id]`).
- Extends the `getKiloClawState` tRPC procedure to also query
`kiloclaw_instances` for the user's active instance (where `destroyed_at
IS NULL`) and return the `activeInstanceId`.
- The link button appears consistently in all card states (subscription
present, earlybird-only, no subscription) whenever the user has an
active instance. Uses the same cross-link pattern as Gastown's "Inspect"
buttons (`Button variant="outline"` with `ExternalLink` icon).
## Verification
- [x] `tsgo --noEmit --incremental false` — passes with no errors
- [x] `oxlint` — passes with 0 warnings and 0 errors
- [x] Manual code review of both changed files for correctness
## Visual Changes
The "View KiloClaw" button appears in the KiloClaw card header on the
admin user profile page, next to the existing "Edit Trial End" button
(when applicable). It is only visible when the user has an active
KiloClaw instance.
| Before | After |
| ------ | ----- |
| KiloClaw card header has only "Edit Trial End" button (or no buttons)
| KiloClaw card header includes "View KiloClaw" button with external
link icon when active instance exists |
## Reviewer Notes
- The `activeInstanceId` query filters on `destroyed_at IS NULL` to only
return the user's currently active instance. This aligns with the unique
index on `kiloclaw_instances` (`UQ_kiloclaw_instances_active`).
- The link is added to both the "has subscription" and "no subscription"
card states since a user could have an active instance regardless of
subscription status.
- This mirrors the existing reverse link from KiloClaw instance detail
pages back to user profiles (`KiloclawInstanceDetail.tsx:1107`).4 files changed
Lines changed: 71 additions & 9 deletions
File tree
- kiloclaw
- src
- app/admin/components/UserAdmin
- routers
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
| |||
139 | 141 | | |
140 | 142 | | |
141 | 143 | | |
142 | | - | |
143 | | - | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
144 | 158 | | |
145 | 159 | | |
146 | 160 | | |
| |||
185 | 199 | | |
186 | 200 | | |
187 | 201 | | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
193 | 217 | | |
194 | 218 | | |
195 | 219 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
| 57 | + | |
56 | 58 | | |
57 | 59 | | |
58 | 60 | | |
| |||
133 | 135 | | |
134 | 136 | | |
135 | 137 | | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
136 | 166 | | |
137 | 167 | | |
138 | 168 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
469 | 469 | | |
470 | 470 | | |
471 | 471 | | |
472 | | - | |
| 472 | + | |
473 | 473 | | |
474 | 474 | | |
475 | 475 | | |
476 | 476 | | |
477 | 477 | | |
478 | 478 | | |
479 | 479 | | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
480 | 487 | | |
481 | 488 | | |
482 | 489 | | |
| |||
518 | 525 | | |
519 | 526 | | |
520 | 527 | | |
| 528 | + | |
521 | 529 | | |
522 | 530 | | |
523 | 531 | | |
| |||
0 commit comments