Skip to content

Commit 125cee9

Browse files
Circuit detail view hero image preview section (#307)
* Added component to MainDetailView * Updated CircuitSchemaProps and corrected subcircuits for plural in the minified json --------- Co-authored-by: Loris Olivier <53363974+loris-maru@users.noreply.github.com>
1 parent f811075 commit 125cee9

File tree

4 files changed

+56
-19
lines changed

4 files changed

+56
-19
lines changed

public/circuits/ALL_CIRCUITS.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import { CircuitSchemaProps } from '../type';
22
import HeaderDetailView from './HeaderDetailView';
3+
import Visualiser from './visualisation/Visualiser';
34

45
export default function MainDetailViewCore({ content }: { content: CircuitSchemaProps }) {
56
return (
67
<div className="relative flex w-full flex-col text-primary-9">
78
<HeaderDetailView content={content} />
9+
<Visualiser content={content} />
810
</div>
911
);
1012
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
'use client';
2+
3+
import Image from 'next/image';
4+
import { CircuitSchemaProps } from '../../type';
5+
import placeholderImage from './circuit-preview-image_01.jpg';
6+
7+
export default function Visualiser({ content }: { content: CircuitSchemaProps }) {
8+
const imageUrl = content.overview.mainDisplay[0].url;
9+
10+
return (
11+
<div
12+
id="visualiser"
13+
className="relative my-24 flex w-full items-center justify-center overflow-hidden bg-white"
14+
>
15+
<Image
16+
src={imageUrl || placeholderImage}
17+
width={1920}
18+
height={1080}
19+
alt={`Image of the circuit ${content.name}`}
20+
className="relative z-10 select-none transition-all duration-300 ease-out"
21+
priority
22+
/>
23+
</div>
24+
);
25+
}

src/components/explore-section/Circuit/type/index.tsx

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ export type CircuitSchemaProps = {
2929
key: string;
3030
name: string;
3131
description: string;
32-
parent?: string;
32+
parent?: string | null;
33+
derivedFrom: string[];
3334
hasSubcircuits: boolean;
3435
brainRegion: string;
3536
species: string;
@@ -38,11 +39,11 @@ export type CircuitSchemaProps = {
3839
numberOfSynapses: number;
3940
metadata: {
4041
contributorSimple?: string;
41-
contributor?: string;
42+
contributor?: string | null;
4243
contributingInstitution?: string;
4344
registrationDate?: string;
4445
revision: number | null;
45-
createdBy: string;
46+
createdBy: string | null;
4647
creationDate: string;
4748
license: {
4849
name: string;
@@ -55,24 +56,33 @@ export type CircuitSchemaProps = {
5556
key: string;
5657
isAvailable: boolean;
5758
}[];
58-
subcircuits: CircuitSchemaProps[] | null;
59+
subcircuits: CircuitSchemaProps[];
5960

60-
// TO BE REVISED
61-
provenance: {
62-
isASubcircuit: boolean;
63-
subcircuitOf: string | null;
64-
literature: PaperLitteratureProps[];
65-
};
66-
relatedPublications: PaperLitteratureProps[];
67-
images: {
68-
low?: string | null;
69-
normal?: string | null;
70-
high: string | null;
71-
};
7261
overview: {
73-
cellStatistics: GraphDataImageProps[];
74-
networkStatistics: GraphDataImageProps[];
62+
mainDisplay: {
63+
name: string;
64+
url: string;
65+
}[];
66+
cellStatistics: {
67+
name: string;
68+
url: string;
69+
}[];
70+
networkStatistics: {
71+
name: string;
72+
url: string;
73+
}[];
7574
};
75+
76+
literature: {
77+
category: string;
78+
title: string;
79+
authors: string;
80+
doi: string;
81+
url: string;
82+
journal: string;
83+
publicationDate: string;
84+
abstract: string;
85+
}[];
7686
};
7787

7888
export type CircuitCellValue = {

0 commit comments

Comments
 (0)