Skip to content

Commit f61db6e

Browse files
fix: PAT project list and assorted SDK view fixes (#1633)
1 parent e5105b9 commit f61db6e

8 files changed

Lines changed: 84 additions & 60 deletions

File tree

‎web/sdk/react/views-new/pat/components/pat-form-dialog.tsx‎

Lines changed: 49 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
UpdateCurrentUserPATRequestSchema,
1616
CheckCurrentUserPATTitleRequestSchema,
1717
ListRolesForPATRequestSchema,
18-
ListOrganizationProjectsRequestSchema
18+
ListProjectsByCurrentUserRequestSchema
1919
} from '@raystack/proton/frontier';
2020
import type { PAT } from '@raystack/proton/frontier';
2121
import {
@@ -145,11 +145,10 @@ export function PATFormDialog({
145145
};
146146

147147
const { data: projectsData, isLoading: isProjectsLoading } = useQuery(
148-
FrontierServiceQueries.listOrganizationProjects,
149-
create(ListOrganizationProjectsRequestSchema, {
150-
id: orgId,
151-
state: '',
152-
withMemberCount: false
148+
FrontierServiceQueries.listProjectsByCurrentUser,
149+
create(ListProjectsByCurrentUserRequestSchema, {
150+
orgId,
151+
nonInherited: false
153152
}),
154153
{ enabled: Boolean(orgId) }
155154
);
@@ -542,51 +541,51 @@ export function PATFormDialog({
542541
const remaining =
543542
selectedIds.length - visible.length;
544543
return (
545-
<Select
546-
multiple
547-
value={field.value}
548-
onValueChange={(val: string[]) => {
549-
field.onChange(val);
550-
clearErrors('projectIds');
551-
}}
552-
>
553-
<Select.Trigger>
554-
<Select.Value placeholder="Select projects">
555-
{selectedIds.length === 0 ? null : (
556-
<Flex gap={2} align="center">
557-
{visible.map(id => (
558-
<Chip
559-
key={id}
560-
className={styles.projectChip}
561-
>
562-
<span
563-
className={
564-
styles.projectChipLabel
565-
}
544+
<Select
545+
multiple
546+
value={field.value}
547+
onValueChange={(val: string[]) => {
548+
field.onChange(val);
549+
clearErrors('projectIds');
550+
}}
551+
>
552+
<Select.Trigger>
553+
<Select.Value placeholder="Select projects">
554+
{selectedIds.length === 0 ? null : (
555+
<Flex gap={2} align="center">
556+
{visible.map(id => (
557+
<Chip
558+
key={id}
559+
className={styles.projectChip}
566560
>
567-
{projects.find(p => p.id === id)
568-
?.title || id}
569-
</span>
570-
</Chip>
571-
))}
572-
{remaining > 0 && (
573-
<Chip>{`+${remaining}`}</Chip>
574-
)}
575-
</Flex>
576-
)}
577-
</Select.Value>
578-
</Select.Trigger>
579-
<Select.Content>
580-
{projects.map(project => (
581-
<Select.Item
582-
value={project.id}
583-
key={project.id}
584-
>
585-
{project.title}
586-
</Select.Item>
587-
))}
588-
</Select.Content>
589-
</Select>
561+
<span
562+
className={
563+
styles.projectChipLabel
564+
}
565+
>
566+
{projects.find(p => p.id === id)
567+
?.title || id}
568+
</span>
569+
</Chip>
570+
))}
571+
{remaining > 0 && (
572+
<Chip>{`+${remaining}`}</Chip>
573+
)}
574+
</Flex>
575+
)}
576+
</Select.Value>
577+
</Select.Trigger>
578+
<Select.Content>
579+
{projects.map(project => (
580+
<Select.Item
581+
value={project.id}
582+
key={project.id}
583+
>
584+
{project.title}
585+
</Select.Item>
586+
))}
587+
</Select.Content>
588+
</Select>
590589
);
591590
}}
592591
/>

‎web/sdk/react/views-new/pat/pat-details-view.tsx‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
FrontierServiceQueries,
2121
GetCurrentUserPATRequestSchema,
2222
ListRolesForPATRequestSchema,
23-
ListOrganizationProjectsRequestSchema
23+
ListProjectsByCurrentUserRequestSchema
2424
} from '@raystack/proton/frontier';
2525
import dayjs from 'dayjs';
2626
import relativeTime from 'dayjs/plugin/relativeTime';
@@ -129,11 +129,10 @@ export function PATDetailsView({
129129
);
130130

131131
const { data: projectsData, isLoading: isProjectsLoading } = useQuery(
132-
FrontierServiceQueries.listOrganizationProjects,
133-
create(ListOrganizationProjectsRequestSchema, {
134-
id: orgId,
135-
state: '',
136-
withMemberCount: false
132+
FrontierServiceQueries.listProjectsByCurrentUser,
133+
create(ListProjectsByCurrentUserRequestSchema, {
134+
orgId,
135+
nonInherited: false
137136
}),
138137
{ enabled: Boolean(orgId) }
139138
);

‎web/sdk/react/views-new/pat/pat-view.module.css‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,8 @@
2222
text-overflow: ellipsis;
2323
white-space: nowrap;
2424
}
25+
.emptyStateIcon {
26+
display: flex;
27+
justify-content: center;
28+
align-items: center;
29+
}

‎web/sdk/react/views-new/pat/pat-view.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@ export function PatsView({ onPATClick }: PatsViewProps = {}) {
169169
) : hasNoPats ? (
170170
<EmptyState
171171
variant="empty2"
172+
classNames={{
173+
icon: styles.emptyStateIcon
174+
}}
172175
icon={
173176
<Image
174177
src={keyIcon as unknown as string}

‎web/sdk/react/views-new/projects/projects-view.module.css‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,9 @@
1515
min-width: 140px;
1616
box-shadow: none;
1717
}
18+
19+
.emptyStateIcon {
20+
display: flex;
21+
justify-content: center;
22+
align-items: center;
23+
}

‎web/sdk/react/views-new/projects/projects-view.tsx‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,15 @@ export function ProjectsView({
145145
<ViewHeader title={title} description={description ?? `Manage projects for this ${t.organization({ case: 'lower' })}`} />
146146
<EmptyState
147147
variant="empty2"
148+
classNames={{
149+
icon: styles.emptyStateIcon
150+
}}
148151
icon={
149152
<Image
150153
src={inboxStackIcon as unknown as string}
151154
alt=""
152-
width="100%"
153-
height="100%"
155+
width={40}
156+
height={40}
154157
/>
155158
}
156159
heading={t.project()}

‎web/sdk/react/views-new/teams/teams-view.module.css‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,9 @@
1111
min-width: 120px;
1212
box-shadow: none;
1313
}
14+
15+
.emptyStateIcon {
16+
display: flex;
17+
justify-content: center;
18+
align-items: center;
19+
}

‎web/sdk/react/views-new/teams/teams-view.tsx‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,15 @@ export function TeamsView({
147147
/>
148148
<EmptyState
149149
variant="empty2"
150+
classNames={{
151+
icon: styles.emptyStateIcon
152+
}}
150153
icon={
151154
<Image
152155
src={usersIcon as unknown as string}
153156
alt=""
154-
width="100%"
155-
height="100%"
157+
width={40}
158+
height={40}
156159
/>
157160
}
158161
heading={t.team()}

0 commit comments

Comments
 (0)