Skip to content
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

frontend styling and some journey improvements #261

Merged
merged 5 commits into from
Apr 11, 2024
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
2 changes: 1 addition & 1 deletion backend/composer/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ def create_statement_preview(self, instance, journey):
laterality_description = instance.get_laterality_description()

apinatomy = instance.apinatomy_model if instance.apinatomy_model else ""
journey_sentence = ', '.join(journey)
journey_sentence = '; '.join(journey)

# Creating the statement
if sex or species != "":
Expand Down
8 changes: 4 additions & 4 deletions backend/composer/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ class Meta:
verbose_name_plural = "Region/Layer Combinations"

def __str__(self):
return f'{self.region.name} - {self.layer.name}'
return f"{self.region.name} ({self.layer.name})"


class AnatomicalEntity(models.Model):
Expand All @@ -268,9 +268,9 @@ class AnatomicalEntity(models.Model):
@property
def name(self):
if self.simple_entity:
return self.simple_entity.name
elif self.region_layer:
return f'{self.region_layer.region.name},{self.region_layer.layer.name}'
return str(self.simple_entity)
if self.region_layer:
return str(self.region_layer)
return 'Unknown Anatomical Entity'

@property
Expand Down
8 changes: 5 additions & 3 deletions frontend/src/components/ProofingTab/ProofingTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,15 @@ const ProofingTab = (props: any) => {
<Stack spacing={2}>
<Typography variant="h5">Journey</Typography>
{statement.journey.map((journeyStep: string, index: number) => {
if (index === 0) {
return <>{journeyStep.charAt(0).toUpperCase() + journeyStep.slice(1)}, </>;
if (index === 0 && index === statement.journey.length - 1) {
return <>{journeyStep.charAt(0).toUpperCase() + journeyStep.slice(1)}. </>;
} else if (index === 0) {
return <>{journeyStep.charAt(0).toUpperCase() + journeyStep.slice(1)}; </>;
} else {
if (index === statement.journey.length - 1) {
return <>{journeyStep}.</>;
} else {
return <>{journeyStep}, </>;
return <>{journeyStep}; </>;
}
}
})}
Expand Down
10 changes: 9 additions & 1 deletion frontend/src/components/Widgets/CustomEntitiesDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,14 @@ export default function CustomEntitiesDropdown({
}
}, [inputValue, id, onSearch, postProcessOptions, selectedOptions]);

const getLabel = (option: Option) => {
if (option?.content.length > 3) {
const index = option?.label.lastIndexOf('(');
return <> {option?.label.slice(0, index)} <b>{option.label.slice(index)}</b> </>;
} else {
return option?.label;
}
}

useEffect(() => {
if (!isDropdownOpened) return;
Expand Down Expand Up @@ -747,7 +755,7 @@ export default function CustomEntitiesDropdown({
>
{option?.label?.length > 100
? option?.label.slice(0, 100) + "..."
: option?.label}
: getLabel(option)}
</Typography>
<Typography whiteSpace="nowrap" variant="body2">
{option?.id}
Expand Down