Skip to content

Commit d51638c

Browse files
mjunaidcaclaude
andcommitted
fix(workers): Show public workspace UI for default org users
Users in taskflow-default-org-id (the public/shared workspace) now see a friendly prompt to create a private organization instead of the team management table. This prevents showing all platform users as "team members". Changes: - Detect if user's tenant_id is the default org - Skip API call to /workers for default org users - Show "Create Private Organization" CTA card instead 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent be0a00d commit d51638c

1 file changed

Lines changed: 55 additions & 2 deletions

File tree

apps/web/src/app/workers/page.tsx

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,11 @@ interface OrgMember {
4545
has_project_access: boolean
4646
}
4747

48+
// The default org contains all platform users - don't show team management for it
49+
const DEFAULT_ORG_ID = "taskflow-default-org-id"
50+
4851
export default function WorkersPage() {
49-
const { isLoading: authLoading, isAuthenticated } = useAuth()
52+
const { isLoading: authLoading, isAuthenticated, user } = useAuth()
5053
const [orgMembers, setOrgMembers] = useState<OrgMember[]>([])
5154
const [projects, setProjects] = useState<ProjectRead[]>([])
5255
const [loading, setLoading] = useState(true)
@@ -55,12 +58,21 @@ export default function WorkersPage() {
5558
const [unassignedCount, setUnassignedCount] = useState(0)
5659
const [totalMembers, setTotalMembers] = useState(0)
5760

61+
// Check if user is in the default public org
62+
const isDefaultOrg = user?.tenant_id === DEFAULT_ORG_ID
63+
5864
useEffect(() => {
5965
// Wait for auth to be ready before making API calls
6066
if (authLoading || !isAuthenticated) {
6167
return
6268
}
6369

70+
// Don't fetch workers for default org - it contains all platform users
71+
if (isDefaultOrg) {
72+
setLoading(false)
73+
return
74+
}
75+
6476
async function fetchData() {
6577
try {
6678
setLoading(true)
@@ -83,7 +95,7 @@ export default function WorkersPage() {
8395
}
8496

8597
fetchData()
86-
}, [authLoading, isAuthenticated])
98+
}, [authLoading, isAuthenticated, isDefaultOrg])
8799

88100
const handleAddToProject = async (userId: string, projectId: number) => {
89101
try {
@@ -127,6 +139,47 @@ export default function WorkersPage() {
127139
}
128140
}
129141

142+
// Show different UI for default org (public workspace)
143+
if (isDefaultOrg) {
144+
return (
145+
<div className="space-y-6">
146+
<div>
147+
<h1 className="text-xl sm:text-2xl md:text-3xl font-bold tracking-tight">Team</h1>
148+
<p className="text-muted-foreground mt-1 text-sm sm:text-base">
149+
Create a private workspace to collaborate with your team
150+
</p>
151+
</div>
152+
153+
<Card className="card-elevated">
154+
<CardHeader className="text-center pb-2">
155+
<div className="mx-auto mb-4 h-16 w-16 rounded-full bg-primary/10 flex items-center justify-center">
156+
<Users className="h-8 w-8 text-primary" />
157+
</div>
158+
<CardTitle className="text-xl">You&apos;re in the Public Workspace</CardTitle>
159+
<CardDescription className="text-base max-w-md mx-auto">
160+
The public workspace is shared by all TaskFlow users. To manage a private team, create your own organization.
161+
</CardDescription>
162+
</CardHeader>
163+
<CardContent className="flex flex-col items-center gap-4 pt-4">
164+
<Button asChild size="lg">
165+
<a
166+
href={`${process.env.NEXT_PUBLIC_SSO_URL || "http://localhost:3001"}/account/organizations`}
167+
target="_blank"
168+
rel="noopener noreferrer"
169+
>
170+
<Plus className="mr-2 h-4 w-4" />
171+
Create Private Organization
172+
</a>
173+
</Button>
174+
<p className="text-sm text-muted-foreground text-center max-w-sm">
175+
Private organizations let you invite team members, manage access, and collaborate on projects together.
176+
</p>
177+
</CardContent>
178+
</Card>
179+
</div>
180+
)
181+
}
182+
130183
return (
131184
<div className="space-y-6">
132185
{/* Header */}

0 commit comments

Comments
 (0)