Skip to content

Commit

Permalink
Merge branch 'feat-lowercase-id' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
candicecz committed May 20, 2024
2 parents 60c981c + f9cbed0 commit fa154b0
Show file tree
Hide file tree
Showing 19 changed files with 216 additions and 96 deletions.
6 changes: 6 additions & 0 deletions configs/repositories.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@
"imageURL": "/assets/resources/lincs.png",
"type": "generalist"
},
{
"id": "MalariaGEN",
"label": "MalariaGEN",
"imageURL": "/assets/resources/malariagen.svg",
"type": "generalist"
},
{
"id": "Mendeley",
"label": "Mendeley",
Expand Down
86 changes: 86 additions & 0 deletions public/assets/resources/malariagen.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion src/components/filters/components/filters-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,15 @@ export const FiltersList: React.FC<FiltersList> = React.memo(
? items
.filter(item => {
const repo = REPOS.repositories.find(r => r.id === item.term);
// if repo is undefined, show the item as a generalist
if (repo === undefined && !item?.term?.includes('_exists_')) {
return item;
}
return repo && repo.type === 'generalist';
})
.sort((a, b) => a.displayAs.localeCompare(b.displayAs))
.sort((a, b) => b.count - a.count)
: [];

return (
<>
{/* Search through filter terms */}
Expand Down
15 changes: 15 additions & 0 deletions src/components/icon/components/glyph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,21 @@ const Glyph: React.FC<GlyphProps> = ({
transform='translate(0 0)'
/>
);

case 'spatialCoverage':
if (isDisabled) {
return (
<path d='M200,100c0,15.7-3.6,30.6-10.1,43.8l-57.1-57c0.1-0.7,0.5-1.4,1-1.9c2.2-2.2,5.5-3,8.5-2l5.5,1.8 c4.8,1.6,10-0.6,12.3-5.1c1.4-2.7,4.4-4.2,7.4-3.6l10.7,2.1c-9.5-34.3-41-59.5-78.3-59.5c-10.5,0-20.4,2-29.6,5.6L56.1,10.1 C69.4,3.6,84.3,0,100,0C155.2,0,200,44.8,200,100z M137.4,61.8c0-3.4-1.9-6.5-4.9-8l-11.4-5.7c-1.4-0.7-3.2-0.4-4.3,0.7l-1.5,1.5 c-1.8,1.8-4.3,2.8-6.8,2.8c-1.5,0-3-0.4-4.3-1l-5.9-3c-1.2-0.6-2.4-0.8-3.7-0.6l24.7,24.7l11.3-2.8 C134.6,69.5,137.4,65.9,137.4,61.8z M19.2,15.2l166.3,166.2l-17,17l-14.3-14.3C138.6,194.1,120,200,100,200C44.8,200,0,155.2,0,100 c0-20,5.8-38.5,15.9-54.1L2.2,32.2L19.2,15.2z M93.8,125c0.5,0,1.1,0.1,1.5,0.2L62.7,92.7c-0.1,0.9-0.2,1.7-0.2,2.6v10.9 c0,10.4,8.4,18.8,18.8,18.8H93.8z M124.7,154.6l-24.9-24.9c0.1,0.5,0.2,1,0.2,1.6V150c0,6.9,5.6,12.5,12.5,12.5c3.9,0,7.7-1.8,10-5 L124.7,154.6z' />
);
}
return (
<path
fill={fill}
stroke={stroke}
d='M69.5,24.7l3.9,6.8c1.1,1.9,1.6,4,1.6,6.2v16.2c0,1.5,0.6,3,1.7,4.1c2.4,2.4,6.4,2.2,8.6-0.5l5.3-6.6c1.8-2.3,5-3,7.7-1.7 l5.9,3c1.3,0.7,2.8,1,4.3,1c2.5,0,5-1,6.8-2.8l1.5-1.5c1.1-1.1,2.9-1.4,4.3-0.7l11.4,5.7c3,1.5,4.9,4.6,4.9,8 c0,4.1-2.8,7.7-6.8,8.7l-13.8,3.4c-2.9,0.7-5.9,0.6-8.8-0.4l-12.5-4.2c-1.3-0.4-2.6-0.7-4-0.7c-2.7,0-5.4,0.9-7.6,2.5L68.8,82.8 c-3.9,3-6.3,7.6-6.3,12.5v10.9c0,10.4,8.4,18.8,18.8,18.8h12.5c3.4,0,6.3,2.8,6.3,6.3V150c0,6.9,5.6,12.5,12.5,12.5 c3.9,0,7.7-1.8,10-5l10-13.3c3.2-4.3,5-9.6,5-15v-4.7c0-1.5,1-2.9,2.5-3.2l2.1-0.5c4.6-1.2,7.9-5.4,7.9-10.2c0-2.8-1.1-5.4-3-7.4 l-13.1-13.1c-1.4-1.4-1.4-3.8,0-5.2c2.2-2.2,5.5-3,8.5-2l5.5,1.8c4.8,1.6,10-0.6,12.3-5.1c1.4-2.7,4.4-4.2,7.4-3.6l10.7,2.1 c-9.5-34.3-41-59.5-78.3-59.5C89.2,18.8,78.9,20.9,69.5,24.7z M0,100C0,44.8,44.8,0,100,0s100,44.8,100,100s-44.8,100-100,100 S0,155.2,0,100z'
transform='translate(0 0)'
/>
);
case 'species':
if (isDisabled) {
return (
Expand Down
2 changes: 0 additions & 2 deletions src/components/icon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ export const MetadataIcon = React.forwardRef<HTMLDivElement, IconProps>(
FaIcon = FaFingerprint;
} else if (glyph?.toLowerCase() === 'inlanguage') {
FaIcon = FaLanguage;
} else if (glyph?.toLowerCase() === 'spatialcoverage') {
FaIcon = FaEarthAfrica;
} else if (glyph?.toLowerCase() === 'applicationcategory') {
FaIcon = FaLaptopCode;
} else if (glyph?.toLowerCase() === 'programminglanguage') {
Expand Down
43 changes: 27 additions & 16 deletions src/components/metadata/components/block.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import React from 'react';
import { Box, Button, Flex, Icon, Text, TooltipProps } from '@chakra-ui/react';
import {
Box,
Button,
Flex,
HStack,
Icon,
Text,
TooltipProps,
} from '@chakra-ui/react';
import { MetadataIcon } from 'src/components/icon';
import { getMetadataTheme } from 'src/components/icon/helpers';
import Tooltip from 'src/components/tooltip';
Expand All @@ -9,6 +17,7 @@ interface MetadataBlockProps {
id: string;
label: string;
property: string;
glyph?: string;
isDisabled?: boolean;
children?: React.ReactNode;
bg?: string;
Expand All @@ -25,28 +34,30 @@ export const MetadataBlock = ({
property,
children,
bg,
glyph,
colorScheme,
tooltipLabel,
}: MetadataBlockProps) => {
return (
<Box flexDirection='column' color={isDisabled ? 'gray.700' : 'text.body'}>
<Flex alignItems='center'>
<Flex alignItems='center' px={1} mb={0.5} flex={1}>
<MetadataIcon
id={id}
title={property}
glyph={property}
fill={
isDisabled
? 'gray.500'
: bg || `${getMetadataTheme(property) || colorScheme}.500`
}
isDisabled={isDisabled}
boxSize={4}
mr={1}
/>
<HStack alignItems='center' px={1} mb={0.5} flex={1} spacing={1}>
{glyph && (
<MetadataIcon
id={id}
title={property}
glyph={glyph}
fill={
isDisabled
? 'gray.500'
: bg || `${getMetadataTheme(property) || colorScheme}.500`
}
isDisabled={isDisabled}
boxSize={4}
/>
)}
<MetadataLabel label={label}></MetadataLabel>
</Flex>
</HStack>

{tooltipLabel && (
<MetadataTooltip
Expand Down
9 changes: 9 additions & 0 deletions src/components/metadata/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export interface MetadataContentProps {
id: string;
label: string;
property: string;
glyph?: string;
isDisabled: boolean;
name?: string;
img?: { src: string; alt: string };
Expand Down Expand Up @@ -168,6 +169,7 @@ const createFundingContent = (
return {
id: `${property}-${id}`,
label: 'Funding',
glyph: property,
property,
isDisabled: !fundingDetails || fundingDetails.length === 0,
items:
Expand Down Expand Up @@ -219,6 +221,7 @@ const createHealthConditionContent = (
id: `${property}-${id}`,
label: 'Health Condition',
property,
glyph: property,
isDisabled: !healthCondition,
items:
showItems && healthCondition
Expand Down Expand Up @@ -266,6 +269,7 @@ const createLicenseContent = (
id: `${property}-${id}`,
label: 'License',
property,
glyph: property,
isDisabled: !license,
name: license?.title,
url: license?.url,
Expand All @@ -287,6 +291,7 @@ const createMeasurementTechniqueContent = (
id: `${property}-${id}`,
label: 'Measurement Technique',
property,
glyph: property,
isDisabled: !measurementTechnique,
items:
showItems && measurementTechnique
Expand Down Expand Up @@ -326,6 +331,7 @@ const createInfectiousAgentContent = (
id: `${property}-${id}`,
label: 'Pathogen',
property,
glyph: property,
isDisabled: !infectiousAgent,
items:
showItems && infectiousAgent
Expand Down Expand Up @@ -377,6 +383,7 @@ const createSpeciesContent = (
id: `${property}-${id}`,
label: 'Species',
property,
glyph: property,
isDisabled: !species,
items:
showItems && species
Expand Down Expand Up @@ -429,6 +436,7 @@ const createUsageInfoContent = (
id: `${property}-${id}`,
label: 'Usage Info',
property,
glyph: property,
isDisabled: !usageInfo,
items: Array.isArray(usageInfo)
? usageInfo?.map((usage, idx) => ({
Expand Down Expand Up @@ -457,6 +465,7 @@ const createVariableMeasuredContent = (
id: `${property}-${id}`,
label: 'Variable Measured',
property,
glyph: property,
isDisabled: !variableMeasured,
items:
showItems && variableMeasured
Expand Down
2 changes: 1 addition & 1 deletion src/components/page-container/components/container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export const PageContainer: React.FC<PageContainerProps> = ({
py={4}
>
<NextLink
href={{ pathname: 'advanced-search' }}
href={{ pathname: '/advanced-search' }}
passHref
prefetch={false}
style={{
Expand Down
Loading

0 comments on commit fa154b0

Please sign in to comment.