@tscircuit/fake-snippets 0.0.115 → 0.0.117

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.
@@ -32,23 +32,25 @@ import { useUpdateOrgMutation } from "@/hooks/use-update-org-mutation"
32
32
  import { useListOrgMembers } from "@/hooks/use-list-org-members"
33
33
  import { useAddOrgMemberMutation } from "@/hooks/use-add-org-member-mutation"
34
34
  import { useRemoveOrgMemberMutation } from "@/hooks/use-remove-org-member-mutation"
35
- import { useOrgByGithubHandle } from "@/hooks/use-org-by-github-handle"
36
35
  import { useGlobalStore } from "@/hooks/use-global-store"
37
36
  import { Account } from "fake-snippets-api/lib/db/schema"
37
+ import { cn } from "@/lib/utils"
38
38
  import {
39
39
  Users,
40
- Crown,
41
40
  AlertTriangle,
42
41
  Loader2,
43
42
  PlusIcon,
44
43
  ArrowLeft,
45
44
  Building2,
46
45
  } from "lucide-react"
46
+ import { getMemberRole, getRoleDescription } from "@/lib/utils/member-role"
47
+ import { RoleBadge } from "@/components/ui/role-badge"
47
48
  import Header from "@/components/Header"
48
49
  import Footer from "@/components/Footer"
49
50
  import NotFoundPage from "@/pages/404"
50
51
  import { FullPageLoader } from "@/App"
51
52
  import { OrganizationHeader } from "@/components/organization/OrganizationHeader"
53
+ import { useOrganization } from "@/hooks/use-organization"
52
54
 
53
55
  const organizationSettingsSchema = z.object({
54
56
  name: z
@@ -70,10 +72,12 @@ export default function OrganizationSettingsPage() {
70
72
  const session = useGlobalStore((s) => s.session)
71
73
 
72
74
  const {
73
- data: organization,
75
+ organization,
74
76
  isLoading: isLoadingOrg,
75
77
  error: orgError,
76
- } = useOrgByGithubHandle(orgname || null)
78
+ } = useOrganization({
79
+ orgName: orgname,
80
+ })
77
81
 
78
82
  const [showRemoveMemberDialog, setShowRemoveMemberDialog] = useState<{
79
83
  member: Account
@@ -461,65 +465,63 @@ export default function OrganizationSettingsPage() {
461
465
  </p>
462
466
  </div>
463
467
  ) : (
464
- members.map((member) => (
465
- <div
466
- key={member.account_id}
467
- className="flex flex-col sm:flex-row sm:items-center sm:justify-between p-5 hover:bg-gray-50 transition-all duration-200 gap-4 sm:gap-0"
468
- >
469
- <Link
470
- href={`/${member.github_username || member.account_id}`}
471
- className="flex items-center gap-4 group cursor-pointer flex-1 min-w-0"
468
+ members.map((member) => {
469
+ const role = getMemberRole(
470
+ organization,
471
+ member.account_id,
472
+ )
473
+ return (
474
+ <div
475
+ key={member.account_id}
476
+ className="flex flex-col sm:flex-row sm:items-center sm:justify-between p-5 hover:bg-gray-50 transition-all duration-200 gap-4 sm:gap-0"
472
477
  >
473
- <Avatar className="h-12 w-12 border-2 border-gray-200 shadow-sm">
474
- <AvatarImage
475
- src={`https://github.com/${member.github_username}.png`}
476
- alt={`${member.github_username} avatar`}
477
- />
478
- <AvatarFallback className="text-sm bg-gradient-to-br from-blue-100 to-indigo-100 text-blue-700 font-medium">
479
- {(
480
- member.github_username ||
481
- member.account_id ||
482
- ""
483
- )
484
- .slice(0, 2)
485
- .toUpperCase()}
486
- </AvatarFallback>
487
- </Avatar>
488
- <div className="min-w-0 flex-1">
489
- <div className="flex items-center gap-2 mb-1">
490
- <span className="font-semibold text-gray-900 text-base group-hover:text-blue-600 transition-colors truncate">
491
- {member.github_username || member.account_id}
492
- </span>
493
- {member.account_id ===
494
- organization.owner_account_id && (
495
- <div className="flex items-center gap-1 px-2 py-1 bg-yellow-100 text-yellow-800 rounded-full text-xs font-medium flex-shrink-0">
496
- <Crown className="h-3 w-3" />
497
- Owner
498
- </div>
499
- )}
478
+ <Link
479
+ href={`/${member.github_username || member.account_id}`}
480
+ className="flex items-center gap-4 group cursor-pointer flex-1 min-w-0"
481
+ >
482
+ <Avatar className="h-12 w-12">
483
+ <AvatarImage
484
+ src={`https://github.com/${member.github_username}.png`}
485
+ alt={`${member.github_username} avatar`}
486
+ />
487
+ <AvatarFallback className="text-sm font-medium">
488
+ {(
489
+ member.github_username ||
490
+ member.account_id ||
491
+ ""
492
+ )
493
+ .slice(0, 2)
494
+ .toUpperCase()}
495
+ </AvatarFallback>
496
+ </Avatar>
497
+ <div className="min-w-0 flex-1">
498
+ <div className="flex items-center gap-2">
499
+ <span className="font-semibold text-gray-900 text-base group-hover:text-blue-600 transition-colors truncate">
500
+ {member.github_username || member.account_id}
501
+ </span>
502
+ {role !== "member" && <RoleBadge role={role} />}
503
+ </div>
504
+ <p className="text-sm text-gray-500 truncate">
505
+ {getRoleDescription(role)}
506
+ </p>
500
507
  </div>
501
- <p className="text-sm text-gray-500 truncate">
502
- {member.account_id ===
503
- organization.owner_account_id
504
- ? "Full access to organization settings"
505
- : "Standard member access"}
506
- </p>
507
- </div>
508
- </Link>
509
- {member.account_id !== organization.owner_account_id &&
510
- member.account_id !== session?.account_id && (
511
- <Button
512
- variant="ghost"
513
- size="sm"
514
- onClick={() => handleRemoveMember(member)}
515
- disabled={removeMemberMutation.isLoading}
516
- className="text-red-600 hover:text-red-700 hover:bg-red-50 border border-red-200 hover:border-red-300 self-start sm:self-center px-4 py-2"
517
- >
518
- Remove
519
- </Button>
520
- )}
521
- </div>
522
- ))
508
+ </Link>
509
+ {member.account_id !==
510
+ organization.owner_account_id &&
511
+ member.account_id !== session?.account_id && (
512
+ <Button
513
+ variant="ghost"
514
+ size="sm"
515
+ onClick={() => handleRemoveMember(member)}
516
+ disabled={removeMemberMutation.isLoading}
517
+ className="text-red-600 hover:text-red-700 hover:bg-red-50 border border-red-200 hover:border-red-300 self-start sm:self-center px-4 py-2"
518
+ >
519
+ Remove
520
+ </Button>
521
+ )}
522
+ </div>
523
+ )
524
+ })
523
525
  )}
524
526
  </div>
525
527
  </div>
@@ -14,6 +14,7 @@ import { usePackageReleaseImages } from "@/hooks/use-package-release-images"
14
14
  import { Skeleton } from "@/components/ui/skeleton"
15
15
  import { useRebuildPackageReleaseMutation } from "@/hooks/use-rebuild-package-release-mutation"
16
16
  import { useGlobalStore } from "@/hooks/use-global-store"
17
+ import { getBuildStatus } from "@/components/preview"
17
18
 
18
19
  export default function ReleaseDetailPage() {
19
20
  const params = useParams<{
@@ -60,7 +61,7 @@ export default function ReleaseDetailPage() {
60
61
  const session = useGlobalStore((s) => s.session)
61
62
  const { mutate: rebuildPackage, isLoading: isRebuildLoading } =
62
63
  useRebuildPackageReleaseMutation()
63
-
64
+ const { status } = getBuildStatus(latestBuild ?? null)
64
65
  if (isLoadingPackage || isLoadingRelease) {
65
66
  return (
66
67
  <>
@@ -170,7 +171,7 @@ export default function ReleaseDetailPage() {
170
171
  </div>
171
172
 
172
173
  {/* Images Section - Always show with skeletons while loading */}
173
- {Boolean(latestBuild) && (
174
+ {Boolean(latestBuild) && status != "error" && (
174
175
  <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6">
175
176
  <div className="grid grid-cols-1 md:grid-cols-3 gap-4">
176
177
  {availableViews.length > 0