Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • minerva/frontend
1 result
Show changes
Commits on Source (2)
minerva-front (18.1.1) stable; urgency=medium
* Bug fix: styling of notes reset only for a href (#334)
* Bug fix: disable searching for chemicals in projects without disease (#347)
-- Piotr Gawron <piotr.gawron@uni.lu> Tue, 04 Feb 2025 16:00:00 +0200
minerva-front (18.1.0) stable; urgency=medium
* Small improvement: support for links that should be opened immediately
(#342)
......@@ -6,7 +12,6 @@ minerva-front (18.1.0) stable; urgency=medium
* Bug fix: submap download did not download selected map (#337)
* Bug fix: styling of notes contains original styling for links (#344)
-- Piotr Gawron <piotr.gawron@uni.lu> Thu, 30 Jan 2025 15:00:00 +0200
minerva-front (18.0.7) stable; urgency=medium
......
......@@ -17,6 +17,8 @@ import { getReduxStoreWithActionsListener } from '@/utils/testing/getReduxStoreA
import { InitialStoreState } from '@/utils/testing/getReduxWrapperWithStore';
import { act, render, screen } from '@testing-library/react';
import { MockStoreEnhanced } from 'redux-mock-store';
import { projectFixture } from '@/models/fixtures/projectFixture';
import { PROJECT_STATE_INITIAL_MOCK } from '@/redux/project/project.mock';
import { BioEntityDrawer } from './BioEntityDrawer.component';
const renderComponent = (
......@@ -360,6 +362,10 @@ describe('BioEntityDrawer - component', () => {
chemicals: {},
},
},
project: {
...PROJECT_STATE_INITIAL_MOCK,
data: projectFixture,
},
});
const button = screen.getByText('Chemicals for target', { exact: false });
......
......@@ -15,6 +15,8 @@ import { ElementSearchResultType } from '@/types/models';
import { CommentItem } from '@/components/Map/Drawer/BioEntityDrawer/Comments/CommentItem.component';
import { ModificationResidueItem } from '@/components/Map/Drawer/BioEntityDrawer/ModificationResidueItem';
import React from 'react';
import { projectDataSelector } from '@/redux/project/project.selectors';
import { showToast } from '@/utils/showToast';
import { CollapsibleSection } from '../ExportDrawer/CollapsibleSection';
import { AnnotationItem } from './AnnotationItem';
import { AssociatedSubmap } from './AssociatedSubmap';
......@@ -31,8 +33,17 @@ export const BioEntityDrawer = (): React.ReactNode => {
const relatedSubmap = useAppSelector(currentDrawerBioEntityRelatedSubmapSelector);
const currentTargetId = bioEntityData?.id ? `${TARGET_PREFIX}:${bioEntityData.id}` : '';
const project = useAppSelector(projectDataSelector);
const fetchChemicalsForTarget = (): void => {
dispatch(getChemicalsForBioEntityDrawerTarget(currentTargetId));
if (project === undefined || project.disease === null || project.disease === undefined) {
showToast({
type: 'info',
message: `Project disease not defined. Only projects with defined disease have chemical search available`,
});
} else {
dispatch(getChemicalsForBioEntityDrawerTarget(currentTargetId));
}
};
const fetchDrugsForTarget = (): void => {
dispatch(getDrugsForBioEntityDrawerTarget(currentTargetId));
......@@ -75,7 +86,7 @@ export const BioEntityDrawer = (): React.ReactNode => {
</div>
)}
{bioEntityData.notes && (
<span className="visited:text-purple-600 text-blue-600 underline hover:text-blue-800">
<span className="[&_a]:text-blue-600 [&_a]:underline [&_a]:hover:text-blue-800">
<hr className="border-b border-b-divide" />
<div
className="mt-2 text-sm font-normal"
......
import { z } from 'zod';
export const disease = z.object({
id: z.number().int().positive(),
link: z.string().nullable(),
type: z.string(),
resource: z.string(),
annotatorClassName: z.string(),
});
// eslint-disable-next-line import/no-extraneous-dependencies
import { createFixture, Generator } from 'zod-fixture';
import { disease } from '@/models/disease';
import { ZOD_SEED } from '@/constants';
import { ZodNullable } from 'zod';
import { referenceSchema } from '@/models/referenceSchema';
export const diseaseGenerator = Generator({
schema: ZodNullable,
......@@ -11,7 +11,7 @@ export const diseaseGenerator = Generator({
return context.path.at(-1) === 'disease';
},
output: () =>
createFixture(disease, {
createFixture(referenceSchema, {
seed: ZOD_SEED,
array: { min: 2, max: 2 },
}),
......
import { z } from 'zod';
import { licenseSchema } from '@/models/licenseSchema';
import { disease } from './disease';
import { referenceSchema } from '@/models/referenceSchema';
import { organism } from './organism';
import { overviewImageView } from './overviewImageView';
export const projectSchema = z.object({
version: z.string(),
disease: disease.nullable(),
disease: referenceSchema.nullable(),
diseaseName: z.string().nullable(),
organism: organism.nullable(),
organismName: z.string().nullable(),
......
......@@ -2,23 +2,32 @@ import { twMerge } from 'tailwind-merge';
import { Icon } from '../Icon';
type ToastArgs = {
type: 'success' | 'error';
type: 'success' | 'error' | 'info';
message: string;
onDismiss: () => void;
};
const textColors = {
error: 'text-red-500',
success: 'text-green-500',
info: 'text-blue-500',
};
const bgColors = {
error: 'before:bg-red-500',
success: 'before:bg-green-500',
info: 'before:bg-blue-500',
};
export const Toast = ({ type, message, onDismiss }: ToastArgs): React.ReactNode => (
<div
className={twMerge(
'flex h-[76px] w-[700px] items-center rounded-l rounded-r-lg bg-white p-4 drop-shadow before:absolute before:inset-y-0 before:left-0 before:block before:w-1 before:rounded-l-lg before:content-[""]',
type === 'error' ? 'before:bg-red-500' : 'before:bg-green-500',
bgColors[type],
)}
>
<p
className={twMerge(
'h-full overflow-y-auto text-base font-bold',
type === 'error' ? 'text-red-500' : 'text-green-500',
)}
className={twMerge('h-full overflow-y-auto text-base font-bold', textColors[type])}
dangerouslySetInnerHTML={{ __html: message }}
/>
......
......@@ -9,7 +9,6 @@ import {
} from '@/models/compartmentPathwaySchema';
import { configurationOptionSchema } from '@/models/configurationOptionSchema';
import { configurationSchema, formatSchema, miriamTypesSchema } from '@/models/configurationSchema';
import { disease } from '@/models/disease';
import { drugSchema } from '@/models/drugSchema';
import { elementSearchResult, elementSearchResultType } from '@/models/elementSearchResult';
import { exportElementsSchema, exportNetworkchema } from '@/models/exportSchema';
......@@ -78,7 +77,6 @@ export type MapModel = z.infer<typeof mapModelSchema>;
export type MapOverlay = z.infer<typeof mapOverlay>;
export type MapBackground = z.infer<typeof mapBackground>;
export type Organism = z.infer<typeof organism>;
export type Disease = z.infer<typeof disease>;
export type Drug = z.infer<typeof drugSchema>;
export type PinDetailsItem = z.infer<typeof targetSchema>;
export type BioEntity = z.infer<typeof bioEntitySchema>;
......
......@@ -4,7 +4,7 @@ import { Toast } from '@/shared/Toast';
const DEFAULT_DURATION_MS = 5000;
type ShowToastArgs = {
type: 'success' | 'error';
type: 'success' | 'error' | 'info';
message: string;
duration?: number;
};
......