Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 49 additions & 50 deletions web/sdk/react/views-new/pat/components/pat-form-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
UpdateCurrentUserPATRequestSchema,
CheckCurrentUserPATTitleRequestSchema,
ListRolesForPATRequestSchema,
ListOrganizationProjectsRequestSchema
ListProjectsByCurrentUserRequestSchema
} from '@raystack/proton/frontier';
import type { PAT } from '@raystack/proton/frontier';
import {
Expand Down Expand Up @@ -145,11 +145,10 @@ export function PATFormDialog({
};

const { data: projectsData, isLoading: isProjectsLoading } = useQuery(
FrontierServiceQueries.listOrganizationProjects,
create(ListOrganizationProjectsRequestSchema, {
id: orgId,
state: '',
withMemberCount: false
FrontierServiceQueries.listProjectsByCurrentUser,
create(ListProjectsByCurrentUserRequestSchema, {
orgId,
nonInherited: false
}),
{ enabled: Boolean(orgId) }
);
Expand Down Expand Up @@ -542,51 +541,51 @@ export function PATFormDialog({
const remaining =
selectedIds.length - visible.length;
return (
<Select
multiple
value={field.value}
onValueChange={(val: string[]) => {
field.onChange(val);
clearErrors('projectIds');
}}
>
<Select.Trigger>
<Select.Value placeholder="Select projects">
{selectedIds.length === 0 ? null : (
<Flex gap={2} align="center">
{visible.map(id => (
<Chip
key={id}
className={styles.projectChip}
>
<span
className={
styles.projectChipLabel
}
<Select
multiple
value={field.value}
onValueChange={(val: string[]) => {
field.onChange(val);
clearErrors('projectIds');
}}
>
<Select.Trigger>
<Select.Value placeholder="Select projects">
{selectedIds.length === 0 ? null : (
<Flex gap={2} align="center">
{visible.map(id => (
<Chip
key={id}
className={styles.projectChip}
>
{projects.find(p => p.id === id)
?.title || id}
</span>
</Chip>
))}
{remaining > 0 && (
<Chip>{`+${remaining}`}</Chip>
)}
</Flex>
)}
</Select.Value>
</Select.Trigger>
<Select.Content>
{projects.map(project => (
<Select.Item
value={project.id}
key={project.id}
>
{project.title}
</Select.Item>
))}
</Select.Content>
</Select>
<span
className={
styles.projectChipLabel
}
>
{projects.find(p => p.id === id)
?.title || id}
</span>
</Chip>
))}
{remaining > 0 && (
<Chip>{`+${remaining}`}</Chip>
)}
</Flex>
)}
</Select.Value>
</Select.Trigger>
<Select.Content>
{projects.map(project => (
<Select.Item
value={project.id}
key={project.id}
>
{project.title}
</Select.Item>
))}
</Select.Content>
</Select>
);
}}
/>
Expand Down
11 changes: 5 additions & 6 deletions web/sdk/react/views-new/pat/pat-details-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
FrontierServiceQueries,
GetCurrentUserPATRequestSchema,
ListRolesForPATRequestSchema,
ListOrganizationProjectsRequestSchema
ListProjectsByCurrentUserRequestSchema
} from '@raystack/proton/frontier';
import dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';
Expand Down Expand Up @@ -129,11 +129,10 @@ export function PATDetailsView({
);

const { data: projectsData, isLoading: isProjectsLoading } = useQuery(
FrontierServiceQueries.listOrganizationProjects,
create(ListOrganizationProjectsRequestSchema, {
id: orgId,
state: '',
withMemberCount: false
FrontierServiceQueries.listProjectsByCurrentUser,
create(ListProjectsByCurrentUserRequestSchema, {
orgId,
nonInherited: false
}),
{ enabled: Boolean(orgId) }
);
Expand Down
5 changes: 5 additions & 0 deletions web/sdk/react/views-new/pat/pat-view.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,8 @@
text-overflow: ellipsis;
white-space: nowrap;
}
.emptyStateIcon {
display: flex;
justify-content: center;
align-items: center;
}
3 changes: 3 additions & 0 deletions web/sdk/react/views-new/pat/pat-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ export function PatsView({ onPATClick }: PatsViewProps = {}) {
) : hasNoPats ? (
<EmptyState
variant="empty2"
classNames={{
icon: styles.emptyStateIcon
}}
icon={
<Image
src={keyIcon as unknown as string}
Expand Down
6 changes: 6 additions & 0 deletions web/sdk/react/views-new/projects/projects-view.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,9 @@
min-width: 140px;
box-shadow: none;
}

.emptyStateIcon {
display: flex;
justify-content: center;
align-items: center;
}
7 changes: 5 additions & 2 deletions web/sdk/react/views-new/projects/projects-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,15 @@ export function ProjectsView({
<ViewHeader title={title} description={description ?? `Manage projects for this ${t.organization({ case: 'lower' })}`} />
<EmptyState
variant="empty2"
classNames={{
icon: styles.emptyStateIcon
}}
icon={
<Image
src={inboxStackIcon as unknown as string}
alt=""
width="100%"
height="100%"
width={40}
height={40}
/>
}
heading={t.project()}
Expand Down
6 changes: 6 additions & 0 deletions web/sdk/react/views-new/teams/teams-view.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,9 @@
min-width: 120px;
box-shadow: none;
}

.emptyStateIcon {
display: flex;
justify-content: center;
align-items: center;
}
7 changes: 5 additions & 2 deletions web/sdk/react/views-new/teams/teams-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,15 @@ export function TeamsView({
/>
<EmptyState
variant="empty2"
classNames={{
icon: styles.emptyStateIcon
}}
icon={
<Image
src={usersIcon as unknown as string}
alt=""
width="100%"
height="100%"
width={40}
height={40}
/>
}
heading={t.team()}
Expand Down
Loading