@tscircuit/fake-snippets 0.0.115 → 0.0.116
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/.github/workflows/update-package.yml +58 -0
- package/bun.lock +4 -2
- package/dist/bundle.js +6 -2
- package/dist/index.js +5 -1
- package/fake-snippets-api/lib/db/seed.ts +6 -1
- package/fake-snippets-api/routes/api/autocomplete/create_autocomplete.ts +16 -0
- package/package.json +2 -2
- package/src/components/GithubAvatarWithFallback.tsx +1 -1
- package/src/components/organization/OrganizationHeader.tsx +6 -3
- package/src/components/organization/OrganizationMembers.tsx +53 -81
- package/src/components/package-port/CodeEditor.tsx +8 -18
- package/src/components/package-port/CodeEditorHeader.tsx +2 -2
- package/src/components/ui/role-badge.tsx +27 -0
- package/src/hooks/use-list-org-members.ts +1 -0
- package/src/hooks/use-package-by-package-name.ts +7 -2
- package/src/hooks/use-package-stars.ts +10 -9
- package/src/lib/utils/member-role.tsx +61 -0
- package/src/pages/organization-profile.tsx +1 -2
- package/src/pages/organization-settings.tsx +63 -61
- package/src/pages/release-detail.tsx +3 -2
|
@@ -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
|
-
|
|
75
|
+
organization,
|
|
74
76
|
isLoading: isLoadingOrg,
|
|
75
77
|
error: orgError,
|
|
76
|
-
} =
|
|
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
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
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
|
-
<
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
member.github_username
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
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
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
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
|