-
Notifications
You must be signed in to change notification settings - Fork 117
update support ticket to support categories, project, and target options #6689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 15 commits
3be1fcf
5bcf8e6
a34b349
23c28a4
a40fdbf
4feb3ff
c0cce7b
24677e8
c88dd7b
edf992c
35326cf
e41ece0
5f0d6ac
d6217f5
fbf0c63
9c8bf4a
e76a0b1
9a162e5
f5f1438
a08864a
1bd9716
d412ed0
24bf245
a2e5a12
fc84dea
f979a00
539a7d2
63b812a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -1,6 +1,8 @@ | ||||||||
import { Select, SelectContent, SelectItem, SelectTrigger } from '@/components/ui/select'; | ||||||||
import { FragmentType, graphql, useFragment } from '@/gql'; | ||||||||
import { SelectValue } from '@radix-ui/react-select'; | ||||||||
import { Link, useRouter } from '@tanstack/react-router'; | ||||||||
import { SetStateAction } from 'react'; | ||||||||
Check failure on line 5 in packages/web/app/src/components/layouts/project-selector.tsx
|
||||||||
|
||||||||
const ProjectSelector_OrganizationConnectionFragment = graphql(` | ||||||||
fragment ProjectSelector_OrganizationConnectionFragment on OrganizationConnection { | ||||||||
|
@@ -21,7 +23,23 @@ | |||||||
currentOrganizationSlug: string; | ||||||||
currentProjectSlug: string; | ||||||||
organizations: FragmentType<typeof ProjectSelector_OrganizationConnectionFragment> | null; | ||||||||
onValueChange?: (id: string) => void; | ||||||||
optional?: boolean; | ||||||||
showOrganization?: boolean; | ||||||||
}) { | ||||||||
const optional = typeof props.optional !== 'undefined' ? props.optional : false; | ||||||||
const showOrganization = | ||||||||
typeof props.showOrganization !== 'undefined' ? props.showOrganization : true; | ||||||||
Comment on lines
+33
to
+34
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
const onValueChangeFunc: (id: string) => void = | ||||||||
typeof props.onValueChange !== 'undefined' ? props.onValueChange : (id: string) => { | ||||||||
void router.navigate({ | ||||||||
to: '/$organizationSlug/$projectSlug', | ||||||||
params: { | ||||||||
organizationSlug: props.currentOrganizationSlug, | ||||||||
projectSlug: id, | ||||||||
}, | ||||||||
}) | ||||||||
}; | ||||||||
const router = useRouter(); | ||||||||
|
||||||||
const organizations = useFragment( | ||||||||
|
@@ -38,47 +56,57 @@ | |||||||
|
||||||||
return ( | ||||||||
<> | ||||||||
{currentOrganization ? ( | ||||||||
<Link | ||||||||
to="/$organizationSlug" | ||||||||
params={{ organizationSlug: props.currentOrganizationSlug }} | ||||||||
className="max-w-[200px] shrink-0 truncate font-medium" | ||||||||
> | ||||||||
{currentOrganization.slug} | ||||||||
</Link> | ||||||||
{showOrganization ? ( | ||||||||
currentOrganization ? ( | ||||||||
<Link | ||||||||
to="/$organizationSlug" | ||||||||
params={{ organizationSlug: props.currentOrganizationSlug }} | ||||||||
className="max-w-[200px] shrink-0 truncate font-medium" | ||||||||
> | ||||||||
{currentOrganization.slug} | ||||||||
</Link> | ||||||||
) : ( | ||||||||
<div className="h-5 w-48 max-w-[200px] animate-pulse rounded-full bg-gray-800" /> | ||||||||
) | ||||||||
) : ( | ||||||||
<div className="h-5 w-48 max-w-[200px] animate-pulse rounded-full bg-gray-800" /> | ||||||||
'' | ||||||||
)} | ||||||||
{projects?.length && currentProject ? ( | ||||||||
|
||||||||
{(projects?.length && currentProject) || optional ? ( | ||||||||
<> | ||||||||
<div className="italic text-gray-500">/</div> | ||||||||
{showOrganization ? <div className="italic text-gray-500">/</div> : null} | ||||||||
<Select | ||||||||
value={props.currentProjectSlug} | ||||||||
onValueChange={id => { | ||||||||
void router.navigate({ | ||||||||
to: '/$organizationSlug/$projectSlug', | ||||||||
params: { | ||||||||
organizationSlug: props.currentOrganizationSlug, | ||||||||
projectSlug: id, | ||||||||
}, | ||||||||
}); | ||||||||
}} | ||||||||
onValueChange={onValueChangeFunc} | ||||||||
> | ||||||||
<SelectTrigger variant="default" data-cy="project-picker-trigger"> | ||||||||
<div className="font-medium" data-cy="project-picker-current"> | ||||||||
{currentProject.slug} | ||||||||
{optional ? <SelectValue placeholder="Pick an option" /> : (currentProject?.slug ?? '')} | ||||||||
</div> | ||||||||
</SelectTrigger> | ||||||||
<SelectContent> | ||||||||
{projects.map(project => ( | ||||||||
{optional ? ( | ||||||||
<SelectItem | ||||||||
key={project.slug} | ||||||||
value={project.slug} | ||||||||
data-cy={`project-picker-option-${project.slug}`} | ||||||||
key={'empty'} | ||||||||
Check failure on line 90 in packages/web/app/src/components/layouts/project-selector.tsx
|
||||||||
value={'empty'} | ||||||||
Check failure on line 91 in packages/web/app/src/components/layouts/project-selector.tsx
|
||||||||
data-cy={`project-picker-option-Unassigned`} | ||||||||
Check failure on line 92 in packages/web/app/src/components/layouts/project-selector.tsx
|
||||||||
> | ||||||||
{project.slug} | ||||||||
Unassigned | ||||||||
</SelectItem> | ||||||||
))} | ||||||||
) : null | ||||||||
} | ||||||||
{projects ? ( | ||||||||
projects.map(project => ( | ||||||||
<SelectItem | ||||||||
key={project.slug} | ||||||||
value={project.id} | ||||||||
data-cy={`project-picker-option-${project.slug}`} | ||||||||
> | ||||||||
{project.slug} | ||||||||
</SelectItem> | ||||||||
)) | ||||||||
) : null | ||||||||
} | ||||||||
</SelectContent> | ||||||||
</Select> | ||||||||
</> | ||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be shorted when using nullish coalescing