mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-24 22:49:00 +01:00
feat(ui): show the Cloud Slack invitation in the workspace sidebar (#22702)
## Thinking Path > - Teams use Paperclip to manage agents and their work. > - Hosted teams can have a private Slack channel with the Paperclip team. > - A workspace member needs to know whether they can open the channel or still need the owner's invitation. > - Cloud supplies that information for the selected organization. > - This change puts a Slack button in the sidebar footer. It opens a dialog with the next action. ## Linked Issues or Issue Description **Subsystem affected** Workspace sidebar and the Cloud onboarding browser journey. **Problem or motivation** After setup, a user can lose track of the invitation to their organization's private feedback channel. **Proposed solution** Show the invitation status in a dialog. Offer a channel link when Cloud confirms the connection. **Roadmap alignment** This extends the existing hosted workspace navigation. The roadmap has no separate item for this shortcut. ## What Changed - Both sidebar variants use the existing portfolio request to show the Slack shortcut when Cloud supplies invitation details. - The icon uses grayscale at rest and brand colors on hover or keyboard focus. The button has an accessible name and a tooltip. - The Cloud onboarding journey selects Codex and confirms feedback intent when the first-account welcome appears. - Storybook covers pending and connected channels. ## Verification - The sidebar suite passed 36 tests. The Cloud onboarding journey suite passed 10 tests covering both the current and previous gateway layouts. - The Storybook catalog regenerated successfully. - In a local browser run, a fresh user completed signup, connected a test model, hired an agent, opened its chat, and opened and dismissed the Slack invitation. The test used a local Slack fixture. - The incremental verifier selected broad CI coverage for the runner journey change. All applicable checks passed on `ea9779abda`. A GitHub runner shut down during a server test shard. The shard and final verification gate passed on retry. [CI run](https://github.com/paperclipai/paperclip/actions/runs/45276376121/attempts/2) · [Greptile review (5/5)](https://github.com/paperclipai/paperclip/pull/22702#issuecomment-7115303606) ## Risks An older Cloud service can omit the optional feedback field. In that case, the sidebar keeps the existing layout. Cloud controls the channel destination and the invitation state. ## Model Used OpenAI GPT-6 in Codex, with repository tools and browser verification. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Scott Tong <1504818+scotttong@users.noreply.github.com> Co-authored-by: Paperclip <noreply@paperclip.ing>
This commit is contained in:
11 files changed
+190
-57
No files matched your search
@@ -1,38 +0,0 @@
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { cloudApi } from "@/api/cloud";
|
||||
import { queryKeys } from "@/lib/queryKeys";
|
||||
import { cloudStackInviteUrl } from "@/lib/cloudLinks";
|
||||
import { useCloudInstance } from "./useCloudInstance";
|
||||
|
||||
/**
|
||||
* Where the signed-in user invites people on a Paperclip Cloud instance, or
|
||||
* null when no Cloud invite link should be offered.
|
||||
*
|
||||
* Mirrors the Members page: Cloud manages human invitations in the current
|
||||
* stack's People settings, and only that stack's owner or admin may invite
|
||||
* (company roles can differ from Cloud roles, so the company membership is
|
||||
* not enough). Resolves to null on self-hosted instances, while the stack
|
||||
* portfolio is still loading or has failed, for every other stack role, and
|
||||
* when the stack slug or cloud base URL is unknown.
|
||||
*
|
||||
* Callers must not substitute the in-app Invites tab when this is null on a
|
||||
* Cloud instance: that tab drives in-app invitations, a different flow from
|
||||
* Cloud People settings. Offer no shortcut instead.
|
||||
*/
|
||||
export function useCloudInviteUrl(): string | null {
|
||||
const cloud = useCloudInstance();
|
||||
const isCloud = Boolean(cloud);
|
||||
const cloudStacksQuery = useQuery({
|
||||
queryKey: queryKeys.cloud.stacks,
|
||||
queryFn: () => cloudApi.listStacks(),
|
||||
enabled: isCloud,
|
||||
staleTime: 30_000,
|
||||
});
|
||||
if (!cloud) return null;
|
||||
// Read from data, not `isError`: a cached stack list stays answerable while
|
||||
// a transient refetch fails. A no-data failure leaves the current stack
|
||||
// unknown,which falls through to `null` for every role below.
|
||||
const currentStack = cloudStacksQuery.data?.stacks.find((stack) => stack.isCurrent);
|
||||
if (currentStack?.role !== "owner" && currentStack?.role !== "admin") return null;
|
||||
return cloudStackInviteUrl(cloud.cloudBaseUrl, currentStack.stackSlug);
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { cloudApi } from "@/api/cloud";
|
||||
import type { CloudInstanceHealthStatus } from "@/api/health";
|
||||
import { queryKeys } from "@/lib/queryKeys";
|
||||
import { cloudStackInviteUrl } from "@/lib/cloudLinks";
|
||||
|
||||
/**
|
||||
* Resolve the current tenant's feedback and invitation shortcuts from one portfolio read.
|
||||
*
|
||||
* Cloud owns feedback availability. Its People settings link is limited to
|
||||
* stack owners and admins, matching the Members page's invitation shortcut.
|
||||
*/
|
||||
export function useCloudSidebarLinks(cloud: CloudInstanceHealthStatus | null) {
|
||||
const isCloud = Boolean(cloud);
|
||||
const cloudStacksQuery = useQuery({
|
||||
queryKey: queryKeys.cloud.stacks,
|
||||
queryFn: () => cloudApi.listStacks(),
|
||||
enabled: isCloud,
|
||||
staleTime: 30_000,
|
||||
});
|
||||
if (!cloud) return { inviteUrl: null, slackFeedback: undefined };
|
||||
// Read from data, not `isError`: a cached stack list stays answerable while
|
||||
// a transient refetch fails. A no-data failure leaves the current stack
|
||||
// unknown, so the invitation shortcut stays hidden.
|
||||
const currentStack = cloudStacksQuery.data?.stacks.find((stack) => stack.isCurrent);
|
||||
const inviteUrl = currentStack?.role === "owner" || currentStack?.role === "admin"
|
||||
? cloudStackInviteUrl(cloud.cloudBaseUrl, currentStack.stackSlug)
|
||||
: null;
|
||||
return { inviteUrl, slackFeedback: cloudStacksQuery.data?.slackFeedback };
|
||||
}
|
||||
@@ -35,7 +35,7 @@ export function canInviteCompanyMembers(
|
||||
* Whether the signed-in board may invite people to the selected company on a
|
||||
* self-hosted instance. Pass `enabled: false` on Cloud, where invitations live
|
||||
* in the stack's People settings and use a different rule
|
||||
* (see `useCloudInviteUrl`).
|
||||
* (see `useCloudSidebarLinks`).
|
||||
*/
|
||||
export function useCanInviteCompanyMembers(enabled = true): boolean {
|
||||
const company = useOptionalCompany();
|
||||
|
||||
Reference in new issue
Block a user