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
9 changes: 5 additions & 4 deletions app/components/size-badge-popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
SparklesIcon,
} from 'lucide-react'
import { useEffect, useMemo, useRef, useState } from 'react'
import { href, useFetcher, useParams } from 'react-router'
import { href, useFetcher } from 'react-router'
import { Badge, Button } from '~/app/components/ui'
import { Avatar, AvatarFallback, AvatarImage } from '~/app/components/ui/avatar'
import {
Expand All @@ -27,6 +27,7 @@ import {
import { cn } from '~/app/libs/utils'

interface SizeBadgePopoverProps {
orgSlug: string
complexity: string | null
complexityReason: string | null
riskAreas: string | null
Expand All @@ -40,6 +41,7 @@ interface SizeBadgePopoverProps {
}

export function SizeBadgePopover({
orgSlug,
complexity,
complexityReason,
riskAreas,
Expand All @@ -51,7 +53,6 @@ export function SizeBadgePopover({
repositoryId,
number,
}: SizeBadgePopoverProps) {
const { orgSlug } = useParams()
const fetcher = useFetcher()
const draftFetcher = useFetcher<{ reason?: string; error?: string }>()
const [open, setOpen] = useState(false)
Expand Down Expand Up @@ -256,7 +257,7 @@ export function SizeBadgePopover({
draftFetcher.submit(fd, {
method: 'post',
action: href('/:orgSlug/draft-feedback-reason', {
orgSlug: orgSlug!,
orgSlug,
}),
})
}}
Expand All @@ -280,7 +281,7 @@ export function SizeBadgePopover({
fetcher.submit(fd, {
method: 'post',
action: href('/:orgSlug/pr-size-feedback', {
orgSlug: orgSlug!,
orgSlug,
}),
})
}}
Expand Down
1 change: 0 additions & 1 deletion app/components/ui/pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { cn } from '~/app/libs/utils'

function Pagination({ className, ...props }: React.ComponentProps<'nav'>) {
return (
// biome-ignore lint/a11y/useSemanticElements: shadcn-ui issue
<nav
// biome-ignore lint/a11y/noRedundantRoles: shadcn-ui issue
role="navigation"
Expand Down
9 changes: 4 additions & 5 deletions app/routes/$orgSlug/settings/data-management/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState } from 'react'
import { data, href, useFetcher, useParams } from 'react-router'
import { data, href, useFetcher } from 'react-router'
import { match } from 'ts-pattern'
import {
Alert,
Expand Down Expand Up @@ -212,12 +212,10 @@ function RecalculateSection() {

// --- Export Data Section ---

function ExportDataSection() {
const { orgSlug } = useParams()
function ExportDataSection({ orgSlug }: { orgSlug: string }) {
const [includeRaw, setIncludeRaw] = useState(false)

const handleDownload = () => {
if (!orgSlug) return
const params = includeRaw ? '?includeRaw=true' : ''
window.location.assign(
href('/:orgSlug/settings/data-management/export-parquet', {
Expand Down Expand Up @@ -258,6 +256,7 @@ function ExportDataSection() {

export default function DataManagementPage({
loaderData: { refreshRequestedAt },
params: { orgSlug },
}: Route.ComponentProps) {
return (
<ContentSection
Expand All @@ -267,7 +266,7 @@ export default function DataManagementPage({
<Stack gap="6">
<RefreshSection refreshRequestedAt={refreshRequestedAt} />
<RecalculateSection />
<ExportDataSection />
<ExportDataSection orgSlug={orgSlug} />
</Stack>
</ContentSection>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const action = async ({ params, context }: Route.ActionArgs) => {
await deleteRepository(organization.id, repositoryId)

return redirect(
href('/:orgSlug/settings/repositories', { orgSlug: organization.slug! }),
href('/:orgSlug/settings/repositories', { orgSlug: organization.slug }),
)
}

Expand Down Expand Up @@ -76,7 +76,7 @@ export default function DeleteRepositoryPage({
<Button asChild variant="ghost">
<Link
to={href('/:orgSlug/settings/repositories', {
orgSlug: organization.slug!,
orgSlug: organization.slug,
})}
>
Cancel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export const action = async ({
await updateRepository(organization.id, repositoryId, submission.value)

return redirect(
href('/:orgSlug/settings/repositories', { orgSlug: organization.slug! }),
href('/:orgSlug/settings/repositories', { orgSlug: organization.slug }),
)
}

Expand Down Expand Up @@ -160,7 +160,7 @@ const GithubRepositoryForm = ({
<Button asChild variant="ghost">
<Link
to={href('/:orgSlug/settings/repositories', {
orgSlug: organization.slug!,
orgSlug: organization.slug,
})}
>
Cancel
Expand Down
6 changes: 5 additions & 1 deletion app/routes/$orgSlug/throughput/deployed/+columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import dayjs from '~/app/libs/dayjs'
import { complexitySortingFn } from '~/app/libs/pr-classify'
import type { PullRequest } from './index'

export function createColumns(timezone: string): ColumnDef<PullRequest>[] {
export function createColumns(
timezone: string,
orgSlug: string,
): ColumnDef<PullRequest>[] {
return [
{
accessorKey: 'author',
Expand Down Expand Up @@ -71,6 +74,7 @@ export function createColumns(timezone: string): ColumnDef<PullRequest>[] {
),
cell: ({ row }) => (
<SizeBadgePopover
orgSlug={orgSlug}
complexity={row.original.complexity}
complexityReason={row.original.complexityReason}
riskAreas={row.original.riskAreas}
Expand Down
6 changes: 5 additions & 1 deletion app/routes/$orgSlug/throughput/deployed/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,14 @@ export default function DeployedPage({
teams,
businessDaysOnly,
},
params: { orgSlug },
}: Route.ComponentProps) {
const [, setSearchParams] = useSearchParams()
const timezone = useTimezone()
const columns = useMemo(() => createColumns(timezone), [timezone])
const columns = useMemo(
() => createColumns(timezone, orgSlug),
[timezone, orgSlug],
)

return (
<Stack>
Expand Down
6 changes: 5 additions & 1 deletion app/routes/$orgSlug/throughput/merged/+columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import dayjs from '~/app/libs/dayjs'
import { complexitySortingFn } from '~/app/libs/pr-classify'
import type { PullRequest } from './index'

export function createColumns(timezone: string): ColumnDef<PullRequest>[] {
export function createColumns(
timezone: string,
orgSlug: string,
): ColumnDef<PullRequest>[] {
return [
{
accessorKey: 'author',
Expand Down Expand Up @@ -71,6 +74,7 @@ export function createColumns(timezone: string): ColumnDef<PullRequest>[] {
),
cell: ({ row }) => (
<SizeBadgePopover
orgSlug={orgSlug}
complexity={row.original.complexity}
complexityReason={row.original.complexityReason}
riskAreas={row.original.riskAreas}
Expand Down
6 changes: 5 additions & 1 deletion app/routes/$orgSlug/throughput/merged/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,14 @@ export default function OrganizationIndex({
teams,
businessDaysOnly,
},
params: { orgSlug },
}: Route.ComponentProps) {
const [, setSearchParams] = useSearchParams()
const timezone = useTimezone()
const columns = useMemo(() => createColumns(timezone), [timezone])
const columns = useMemo(
() => createColumns(timezone, orgSlug),
[timezone, orgSlug],
)

return (
<Stack>
Expand Down
6 changes: 5 additions & 1 deletion app/routes/$orgSlug/throughput/ongoing/+columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import dayjs from '~/app/libs/dayjs'
import { complexitySortingFn } from '~/app/libs/pr-classify'
import type { PullRequest } from './index'

export function createColumns(timezone: string): ColumnDef<PullRequest>[] {
export function createColumns(
timezone: string,
orgSlug: string,
): ColumnDef<PullRequest>[] {
return [
{
accessorKey: 'author',
Expand Down Expand Up @@ -70,6 +73,7 @@ export function createColumns(timezone: string): ColumnDef<PullRequest>[] {
),
cell: ({ row }) => (
<SizeBadgePopover
orgSlug={orgSlug}
complexity={row.original.complexity}
complexityReason={row.original.complexityReason}
riskAreas={row.original.riskAreas}
Expand Down
6 changes: 5 additions & 1 deletion app/routes/$orgSlug/throughput/ongoing/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,14 @@ export const loader = async ({ request, context }: Route.LoaderArgs) => {

export default function OngoingPage({
loaderData: { pullRequests, median, teams, businessDaysOnly },
params: { orgSlug },
}: Route.ComponentProps) {
const [, setSearchParams] = useSearchParams()
const timezone = useTimezone()
const columns = useMemo(() => createColumns(timezone), [timezone])
const columns = useMemo(
() => createColumns(timezone, orgSlug),
[timezone, orgSlug],
)

return (
<Stack>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,9 @@ function MemberLink({
login: string
displayName: string
}) {
const { orgSlug = '' } = useParams()
const { orgSlug } = useParams()
const [searchParams] = useSearchParams()
if (!orgSlug) throw new Error('MemberLink requires orgSlug param')
const query = searchParams.toString()
const basePath = href('/:orgSlug/workload/:login', { orgSlug, login })
const linkTo = query ? `${basePath}?${query}` : basePath
Expand Down
2 changes: 1 addition & 1 deletion app/routes/_index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const loader = async ({ request }: Route.LoaderArgs) => {

const firstOrg = await getFirstOrganization(session.user.id)
if (firstOrg) {
throw redirect(href('/:orgSlug', { orgSlug: firstOrg.slug! }))
throw redirect(href('/:orgSlug', { orgSlug: firstOrg.slug }))
}

throw redirect('/no-org')
Expand Down
2 changes: 1 addition & 1 deletion app/routes/admin/_index/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const AdminOrganizationIndex = ({
<Button asChild size="sm" variant="link">
<Link
to={href('/:orgSlug/settings', {
orgSlug: organization.slug!,
orgSlug: organization.slug,
})}
>
Settings
Expand Down
2 changes: 1 addition & 1 deletion app/routes/resources/organization.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const OrganizationSwitcher = ({
{fetcher.data?.organizations.map((organization) => (
<DropdownMenuGroup key={organization.id}>
<DropdownMenuItem asChild>
<Link to={href('/:orgSlug', { orgSlug: organization.slug! })}>
<Link to={href('/:orgSlug', { orgSlug: organization.slug })}>
{organization.name}
</Link>
</DropdownMenuItem>
Expand Down
2 changes: 1 addition & 1 deletion biome.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://biomejs.dev/schemas/2.3.13/schema.json",
"$schema": "https://biomejs.dev/schemas/2.4.7/schema.json",
"assist": { "actions": { "source": { "organizeImports": "off" } } },
"files": {
"includes": [
Expand Down