Skip to content

Commit 6f31543

Browse files
committed
Fix type issues in organizations.
1 parent 066fed1 commit 6f31543

File tree

13 files changed

+156
-43
lines changed

13 files changed

+156
-43
lines changed

apps/dashboard/app/(main)/organizations/[slug]/components/invitation-list.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
} from '@/components/ui/alert-dialog';
1717
import { Badge } from '@/components/ui/badge';
1818
import { Button } from '@/components/ui/button';
19+
import type { CancelInvitation, Invitation } from '@/hooks/use-organizations';
1920

2021
dayjs.extend(relativeTime);
2122

@@ -28,7 +29,11 @@ export function InvitationList({
2829
invitations,
2930
onCancelInvitation,
3031
isCancellingInvitation,
31-
}: any) {
32+
}: {
33+
invitations: Invitation[];
34+
onCancelInvitation: CancelInvitation;
35+
isCancellingInvitation: boolean;
36+
}) {
3237
const [invitationToCancel, setInvitationToCancel] =
3338
useState<InvitationToCancel | null>(null);
3439

@@ -54,7 +59,7 @@ export function InvitationList({
5459
</Badge>
5560
</div>
5661
<div className="space-y-3">
57-
{invitations.map((invitation: any) => (
62+
{invitations.map((invitation) => (
5863
<div
5964
className="flex items-center justify-between rounded border border-border/50 bg-muted/30 p-4"
6065
key={invitation.id}

apps/dashboard/app/(main)/organizations/[slug]/components/invite-member-dialog.tsx

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,24 @@ import {
1919
SelectTrigger,
2020
SelectValue,
2121
} from '@/components/ui/select';
22-
import { useOrganizationMembers } from '@/hooks/use-organizations';
22+
import {
23+
type Organization,
24+
useOrganizationMembers,
25+
} from '@/hooks/use-organizations';
26+
27+
type InviteRole = 'owner' | 'admin' | 'member';
2328

24-
export function InviteMemberDialog({ isOpen, onClose, organizationId }: any) {
29+
export function InviteMemberDialog({
30+
isOpen,
31+
onClose,
32+
organizationId,
33+
}: {
34+
isOpen: boolean;
35+
onClose: () => void;
36+
organizationId: Organization['id'];
37+
}) {
2538
const [inviteEmail, setInviteEmail] = useState('');
26-
const [inviteRole, setInviteRole] = useState<'owner' | 'admin' | 'member'>(
27-
'member'
28-
);
39+
const [inviteRole, setInviteRole] = useState<InviteRole>('member');
2940
const { inviteMember, isInvitingMember } =
3041
useOrganizationMembers(organizationId);
3142

@@ -63,7 +74,7 @@ export function InviteMemberDialog({ isOpen, onClose, organizationId }: any) {
6374
<div className="space-y-2">
6475
<Label htmlFor="role">Role</Label>
6576
<Select
66-
onValueChange={(value) => setInviteRole(value as any)}
77+
onValueChange={(value) => setInviteRole(value as InviteRole)}
6778
value={inviteRole}
6879
>
6980
<SelectTrigger>

apps/dashboard/app/(main)/organizations/[slug]/components/member-list.tsx

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ import {
3030
SelectTrigger,
3131
SelectValue,
3232
} from '@/components/ui/select';
33+
import type {
34+
OrganizationMember,
35+
UpdateMemberData,
36+
} from '@/hooks/use-organizations';
3337

3438
dayjs.extend(relativeTime);
3539

@@ -38,12 +42,28 @@ interface MemberToRemove {
3842
name: string;
3943
}
4044

45+
interface MemberListProps {
46+
members: OrganizationMember[];
47+
onRemoveMember: (memberId: string) => void;
48+
isRemovingMember: boolean;
49+
onUpdateRole: (member: UpdateMemberData) => void;
50+
isUpdatingMember: boolean;
51+
organizationId: string;
52+
}
53+
54+
interface RoleSelectorProps {
55+
member: MemberListProps['members'][number];
56+
onUpdateRole: MemberListProps['onUpdateRole'];
57+
isUpdatingMember: MemberListProps['isUpdatingMember'];
58+
organizationId: MemberListProps['organizationId'];
59+
}
60+
4161
function RoleSelector({
4262
member,
4363
onUpdateRole,
4464
isUpdatingMember,
4565
organizationId,
46-
}: any) {
66+
}: RoleSelectorProps) {
4767
if (member.role === 'owner') {
4868
return (
4969
<Badge
@@ -60,7 +80,11 @@ function RoleSelector({
6080
defaultValue={member.role}
6181
disabled={isUpdatingMember}
6282
onValueChange={(newRole) =>
63-
onUpdateRole({ memberId: member.id, role: newRole, organizationId })
83+
onUpdateRole({
84+
memberId: member.id,
85+
role: newRole as UpdateMemberData['role'],
86+
organizationId,
87+
})
6488
}
6589
>
6690
<SelectTrigger className="w-32 rounded">
@@ -81,7 +105,7 @@ export function MemberList({
81105
onUpdateRole,
82106
isUpdatingMember,
83107
organizationId,
84-
}: any) {
108+
}: MemberListProps) {
85109
const [memberToRemove, setMemberToRemove] = useState<MemberToRemove | null>(
86110
null
87111
);
@@ -106,7 +130,7 @@ export function MemberList({
106130

107131
{members && members.length > 0 ? (
108132
<div className="space-y-3">
109-
{members.map((member: any) => (
133+
{members.map((member) => (
110134
<div
111135
className="flex items-center justify-between rounded border border-border/50 bg-muted/30 p-4"
112136
key={member.id}

apps/dashboard/app/(main)/organizations/[slug]/components/organization-logo-uploader.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,22 @@ import {
1919
} from '@/components/ui/dialog';
2020
import { Input } from '@/components/ui/input';
2121
import { Label } from '@/components/ui/label';
22-
import { useOrganizations } from '@/hooks/use-organizations';
22+
import { type Organization, useOrganizations } from '@/hooks/use-organizations';
2323
import { getOrganizationInitials } from '@/lib/utils';
2424
import 'react-image-crop/dist/ReactCrop.css';
2525
import { UploadSimpleIcon } from '@phosphor-icons/react';
2626
import { getCroppedImage } from '@/lib/canvas-utils';
2727

2828
interface OrganizationLogoUploaderProps {
29-
organization: {
30-
id: string;
31-
name: string;
32-
logo: string | null;
33-
};
29+
organization: Organization;
3430
}
3531

3632
export function OrganizationLogoUploader({
3733
organization,
3834
}: OrganizationLogoUploaderProps) {
3935
const { uploadOrganizationLogo, isUploadingOrganizationLogo } =
4036
useOrganizations();
41-
const [preview, setPreview] = useState<string | null>(organization.logo);
37+
const [preview, setPreview] = useState(organization.logo);
4238
const [imageSrc, setImageSrc] = useState<string | null>(null);
4339
const [crop, setCrop] = useState<Crop>();
4440
const [completedCrop, setCompletedCrop] = useState<PixelCrop>();

apps/dashboard/app/(main)/organizations/[slug]/components/overview-tab.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,15 @@ import {
2222
CardTitle,
2323
} from '@/components/ui/card';
2424
import { Skeleton } from '@/components/ui/skeleton';
25-
import { useOrganizationMembers } from '@/hooks/use-organizations';
25+
import {
26+
type Organization,
27+
useOrganizationMembers,
28+
} from '@/hooks/use-organizations';
2629

2730
dayjs.extend(relativeTime);
2831

2932
interface OverviewTabProps {
30-
organization: any;
33+
organization: Organization;
3134
}
3235

3336
export function OverviewTab({ organization }: OverviewTabProps) {

apps/dashboard/app/(main)/organizations/[slug]/components/settings-tab.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ import {
3232
import { Input } from '@/components/ui/input';
3333
import { Label } from '@/components/ui/label';
3434
import { Skeleton } from '@/components/ui/skeleton';
35-
import { useOrganizations } from '@/hooks/use-organizations';
35+
import { type Organization, useOrganizations } from '@/hooks/use-organizations';
3636
import { trpc } from '@/lib/trpc';
3737
import { OrganizationLogoUploader } from './organization-logo-uploader';
3838
import { TransferAssets } from './transfer-assets';
3939

4040
interface SettingsTabProps {
41-
organization: any;
41+
organization: Organization;
4242
}
4343

4444
export function SettingsTab({ organization }: SettingsTabProps) {

apps/dashboard/app/(main)/organizations/[slug]/components/team-view.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@ import {
55
EnvelopeIcon,
66
PlusIcon,
77
UsersIcon,
8+
type Icon as IconType,
89
} from '@phosphor-icons/react';
910
import { useState } from 'react';
1011
import { Button } from '@/components/ui/button';
1112
import { Skeleton } from '@/components/ui/skeleton';
1213
import {
1314
useOrganizationInvitations,
1415
useOrganizationMembers,
16+
type ActiveOrganization,
17+
type Organization,
1518
} from '@/hooks/use-organizations';
1619
import { InvitationList } from './invitation-list';
1720
import { InviteMemberDialog } from './invite-member-dialog';
@@ -23,7 +26,7 @@ const StatCard = ({
2326
label,
2427
value,
2528
}: {
26-
icon: any;
29+
icon: IconType;
2730
label: string;
2831
value: number;
2932
}) => (
@@ -55,7 +58,11 @@ const ViewSkeleton = () => (
5558
</div>
5659
);
5760

58-
export function TeamView({ organization }: { organization: any }) {
61+
export function TeamView({
62+
organization,
63+
}: {
64+
organization: NonNullable<Organization | ActiveOrganization>;
65+
}) {
5966
const [showInviteDialog, setShowInviteDialog] = useState(false);
6067

6168
const {

apps/dashboard/app/(main)/organizations/[slug]/components/teams-tab.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,13 @@ import {
99
CardTitle,
1010
} from '@/components/ui/card';
1111
import { TeamView } from './team-view';
12+
import type { ActiveOrganization, Organization } from '@/hooks/use-organizations';
1213

13-
export function TeamsTab({ organization }: { organization: any }) {
14+
export function TeamsTab({
15+
organization,
16+
}: {
17+
organization: Organization | ActiveOrganization;
18+
}) {
1419
if (!(organization && organization.id)) {
1520
return (
1621
<div className="py-12 text-center">

apps/dashboard/app/(main)/organizations/[slug]/page.tsx

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
1616
import { Badge } from '@/components/ui/badge';
1717
import { Button } from '@/components/ui/button';
1818
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
19-
import { useOrganizations } from '@/hooks/use-organizations';
19+
import {
20+
type Organization,
21+
type OrganizationsError,
22+
useOrganizations,
23+
} from '@/hooks/use-organizations';
2024
import { getOrganizationInitials } from '@/lib/utils';
2125
import { OrganizationPageSkeleton } from './components/organization-page-skeleton';
2226
import { OverviewTab } from './components/overview-tab';
@@ -27,7 +31,11 @@ function SetActiveButton({
2731
onSetActive,
2832
isSettingActive,
2933
isCurrentlyActive,
30-
}: any) {
34+
}: {
35+
onSetActive: () => void;
36+
isSettingActive: boolean;
37+
isCurrentlyActive: boolean;
38+
}) {
3139
if (isCurrentlyActive) {
3240
return (
3341
<Badge
@@ -62,12 +70,19 @@ function SetActiveButton({
6270
);
6371
}
6472

73+
interface PageHeaderProps {
74+
organization: Organization;
75+
isCurrentlyActive: boolean;
76+
onSetActive: () => void;
77+
isSettingActive: boolean;
78+
}
79+
6580
function PageHeader({
6681
organization,
6782
isCurrentlyActive,
6883
onSetActive,
6984
isSettingActive,
70-
}: any) {
85+
}: PageHeaderProps) {
7186
return (
7287
<div className="rounded border border-border/50 bg-muted/30 p-6">
7388
<div className="flex items-center justify-between">
@@ -128,7 +143,13 @@ function OrganizationNotFound() {
128143
);
129144
}
130145

131-
function ErrorDisplay({ onRetry, error }: any) {
146+
function ErrorDisplay({
147+
onRetry,
148+
error,
149+
}: {
150+
onRetry: () => void;
151+
error: OrganizationsError;
152+
}) {
132153
return (
133154
<div className="py-12 text-center">
134155
<div className="mx-auto max-w-md rounded border border-border/50 bg-muted/30 p-6">

apps/dashboard/app/(main)/organizations/components/organization-switcher.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@ import {
1212
DropdownMenuSeparator,
1313
DropdownMenuTrigger,
1414
} from '@/components/ui/dropdown-menu';
15-
import { useOrganizations } from '@/hooks/use-organizations';
15+
import {
16+
type ActiveOrganization,
17+
type Organization,
18+
useOrganizations,
19+
} from '@/hooks/use-organizations';
1620
import { cn, getOrganizationInitials } from '@/lib/utils';
1721

1822
interface OrganizationSwitcherProps {
19-
organizations: any[];
20-
activeOrganization: any | null;
23+
organizations: Organization[];
24+
activeOrganization: ActiveOrganization;
2125
className?: string;
2226
}
2327

0 commit comments

Comments
 (0)