Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
bchu1 committed Jan 31, 2025
1 parent 1f8a76c commit 4e4fd9e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { useI18n } from 'app/hooks/useI18n'
import { generateMethodLinks } from './common'
import { MethodLink } from './MethodLink'
import { MethodLinkDataType } from './type'
import { Annotation_Method_Type_Enum } from 'app/__generated_v2__/graphql'

function MethodTypeSection({
methodType,
Expand Down Expand Up @@ -87,11 +88,17 @@ export function MethodLinksOverview() {
{t('annotationMethodsSummary')}
</PageHeaderSubtitle>
<div className="p-sds-l flex flex-col gap-sds-l bg-sds-color-primitive-gray-100 rounded-sds-m">
{deposition.annotation_methods
.sort(
(a, b) =>
methodTypes.indexOf((a.method_type ?? 'manual') as MethodType) -
methodTypes.indexOf((b.method_type ?? 'manual') as MethodType),
{deposition.annotationMethodAndMethodLinksCombinations?.aggregate
?.sort(
(aggregateA, aggregateB) =>
methodTypes.indexOf(
aggregateA.groupBy?.methodType ??
Annotation_Method_Type_Enum.Manual,
) -
methodTypes.indexOf(
aggregateB.groupBy?.methodType ??
Annotation_Method_Type_Enum.Manual,
),
)
.map(({ method_type, method_links }, i) => (
<>
Expand Down
7 changes: 6 additions & 1 deletion frontend/packages/data-portal/app/constants/methodTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ import { Annotation_Method_Type_Enum } from 'app/__generated_v2__/graphql'
import { I18nKeys } from 'app/types/i18n'
import { checkExhaustive } from 'app/types/utils'

export const methodTypes = ['hybrid', 'automated', 'manual'] as const
export const METHOD_TYPE_ORDER = [
Annotation_Method_Type_Enum.Hybrid,
Annotation_Method_Type_Enum.Automated,
Annotation_Method_Type_Enum.Manual,
Annotation_Method_Type_Enum.Simulated,
]

export type MethodType = (typeof methodTypes)[number]

Expand Down
5 changes: 2 additions & 3 deletions frontend/packages/data-portal/app/hooks/useDepositionById.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ export type Deposition = NonNullable<GetDepositionByIdQuery['deposition']>
export type Dataset = GetDepositionByIdQuery['datasets'][number]

export function useDepositionById() {
const { v1, v2 } = useTypedLoaderData<{
v1: GetDepositionByIdQuery
const { v2 } = useTypedLoaderData<{
v2: GetDepositionByIdV2Query
}>()

Expand All @@ -24,7 +23,7 @@ export function useDepositionById() {
)

return {
deposition: v1.deposition as Deposition,
deposition: v2.depositions[0],
datasets: v2.datasets,
annotationMethodCounts,
}
Expand Down

0 comments on commit 4e4fd9e

Please sign in to comment.