Skip to content

Commit 5fa879a

Browse files
committed
merge 'develop' into feat/circuit-entitycore-1
2 parents 057e8d5 + b58ecb2 commit 5fa879a

File tree

5 files changed

+57
-26
lines changed

5 files changed

+57
-26
lines changed

src/app/app/virtual-lab/lab/[virtualLabId]/project/[projectId]/build/page.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import BookmarkButton from '@/features/bookmark/control';
1313
import { selectedRowsAtom } from '@/state/explore-section/list-view-atoms';
1414
import { ExploreDataScope } from '@/types/explore-section/application';
1515
import { getEntityByLegacyType } from '@/entity-configuration/domain/helpers';
16+
import { DataType } from '@/constants/explore-section/list-views';
1617
import { Btn } from '@/components/buttons/base/legacy-btn';
1718
import { classNames } from '@/util/utils';
1819
import {
@@ -74,7 +75,10 @@ function BrowseModelsTab() {
7475
<>
7576
<div className="flex grow flex-col">
7677
<ScopeSelectorSmall expanded={expanded} onMenuExpand={onMenuExpand} />
77-
{dataType ? (
78+
79+
{dataType &&
80+
dataType !== DataType.PairedNeuronCircuit &&
81+
dataType !== DataType.SmallMicrocircuit ? (
7882
<div
7983
id="explore-table-container-for-observable"
8084
className={classNames(

src/components/VirtualLab/ScopeSelector/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,10 @@ export function ScopeSelector() {
114114
const tileStyle = highlight ? 'bg-white text-primary-9' : 'bg-primary-9 text-white';
115115
const descStyle = highlight ? 'text-primary-8' : 'text-gray-100';
116116

117-
if (id === 'small-microcircuit' && section === 'build') {
117+
if (
118+
(tileType === 'small-microcircuit' || tileType === 'paired-neurons') &&
119+
section === 'build'
120+
) {
118121
// eslint-disable-next-line
119122
disabled = true;
120123
}

src/components/explore-section/ExploreSectionListingView/ExploreSectionTable.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,14 @@ export function BaseTable<T extends EntityCoreIdentifiable>({
174174
expandableConfig,
175175
showHeader = true,
176176
rowClassName,
177+
tableStyle,
178+
onRow,
177179
}: TableProps<T> &
178180
AdditionalTableProps<T> & {
179181
showLoadMore?: (value?: boolean) => void;
180182
scrollable?: boolean;
181183
expandableConfig?: ExpandableConfig<T>;
184+
tableStyle?: CSSProperties | undefined;
182185
}) {
183186
const [containerDimension, setContainerDimension] = useState<{ height: number; width: number }>({
184187
height: 0,
@@ -227,6 +230,7 @@ export function BaseTable<T extends EntityCoreIdentifiable>({
227230
showHeader={showHeader}
228231
ref={tableRef}
229232
sticky={sticky}
233+
style={tableStyle}
230234
aria-label="listing-view-table"
231235
className={classNames(styles.table, 'grow [&_.ant-table-sticky-holder]:shadow-md')}
232236
columns={
@@ -253,6 +257,7 @@ export function BaseTable<T extends EntityCoreIdentifiable>({
253257
isString(rowClassName) ? rowClassName : rowClassName?.(row, index, indent)
254258
)
255259
}
260+
onRow={onRow}
256261
rowKey={(row) => row.id}
257262
rowSelection={rowSelection}
258263
scroll={
@@ -286,6 +291,8 @@ export default function ExploreSectionTable<T extends EntityCoreIdentifiable>({
286291
useBrainRegion = true,
287292
expandableConfig,
288293
rowClassName,
294+
tableStyle,
295+
onRow,
289296
}: TableProps<T> &
290297
AdditionalTableProps<T> & {
291298
renderButton?: (props: RenderButtonProps<T>) => ReactNode;
@@ -297,6 +304,7 @@ export default function ExploreSectionTable<T extends EntityCoreIdentifiable>({
297304
dataKey: string;
298305
useBrainRegion?: boolean;
299306
expandableConfig?: ExpandableConfig<T>;
307+
tableStyle?: CSSProperties | undefined;
300308
}) {
301309
const { rowSelection, selectedRows, clearSelectedRows } = useRowSelection({
302310
dataKey,
@@ -331,6 +339,8 @@ export default function ExploreSectionTable<T extends EntityCoreIdentifiable>({
331339
scrollable={scrollable}
332340
expandableConfig={expandableConfig}
333341
rowClassName={rowClassName}
342+
style={tableStyle}
343+
onRow={onRow}
334344
/>
335345
{(!autohideControls || (autohideControls && selectedRows.length > 0)) && (
336346
<TableControls

src/components/explore-section/ExploreSectionListingView/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use client';
22

33
import { useAtom, useSetAtom } from 'jotai';
4-
import { ReactNode } from 'react';
4+
import { CSSProperties, ReactNode } from 'react';
55

66
import type { ExpandableConfig, RowSelectionType } from 'antd/es/table/interface';
77
import type { TableProps } from 'antd';
@@ -47,6 +47,8 @@ export interface Props<T extends EntityCoreIdentifiable> {
4747
useBrainRegion?: boolean;
4848
rowClassName?: string | TableProps<T>['rowClassName'];
4949
expandableConfig?: ExpandableConfig<T>;
50+
tableStyle?: CSSProperties | undefined;
51+
onRow?: TableProps<T>['onRow'];
5052
}
5153

5254
export default function ExploreSectionListingView<T extends EntityCoreIdentifiable>({
@@ -67,6 +69,8 @@ export default function ExploreSectionListingView<T extends EntityCoreIdentifiab
6769
useBrainRegion = true,
6870
rowClassName,
6971
expandableConfig = undefined,
72+
tableStyle,
73+
onRow,
7074
}: Props<T>) {
7175
const { node } = useBrainRegionHierarchy({ dataKey });
7276

@@ -155,6 +159,8 @@ export default function ExploreSectionListingView<T extends EntityCoreIdentifiab
155159
useBrainRegion={useBrainRegion}
156160
rowClassName={rowClassName}
157161
expandableConfig={expandableConfig}
162+
tableStyle={tableStyle}
163+
onRow={onRow}
158164
/>
159165
</>
160166
)}

src/page-wrappers/build/me-model/emodel.selection.tsx

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
'use client';
22

33
import { usePathname, useRouter } from 'next/navigation';
4-
import { useEffect, useId } from 'react';
4+
import { HTMLAttributes, TdHTMLAttributes, useEffect, useId } from 'react';
55

66
import ExploreSectionListingView from '@/components/explore-section/ExploreSectionListingView';
77

88
import { useBuildMeModelSessionState } from '@/features/entities/me-model/build/create.state-session';
9-
import {
10-
checkSelectedEmodelBlackList,
11-
EmodelBlackList,
12-
} from '@/page-wrappers/build/me-model/helpers';
9+
import { checkSelectedEmodelBlackList } from '@/page-wrappers/build/me-model/helpers';
1310
import { ExploreDataScope } from '@/types/explore-section/application';
1411
import { resolveExploreDetailsPageUrl } from '@/utils/url-builder';
1512
import { DataType } from '@/constants/explore-section/list-views';
@@ -119,7 +116,7 @@ export default function EmodelSelection({ params, searchParams }: Props) {
119116
}
120117

121118
return (
122-
<div className="h-full px-10" id="explore-table-container-for-observable ">
119+
<div className="h-full px-10" id="explore-table-container-for-observable">
123120
<ExploreSectionListingView<IEModel>
124121
dataKey={dataKey}
125122
containerClass="h-full bg-white"
@@ -136,30 +133,41 @@ export default function EmodelSelection({ params, searchParams }: Props) {
136133
Select e-model
137134
</Btn>
138135
)}
136+
onRow={(row) => {
137+
if (checkSelectedEmodelBlackList(row))
138+
// this new line in the attribute is required to be displayed in two lines
139+
return {
140+
'black-listed': `This e-model cannot be combined
141+
with any morphology for now.
142+
`,
143+
} as HTMLAttributes<any> & TdHTMLAttributes<any>;
144+
return {};
145+
}}
139146
rowClassName={(row: IEModel) => {
140-
return EmodelBlackList.includes(row.name)
147+
return checkSelectedEmodelBlackList(row)
141148
? classNames(
142149
'bg-gray-200 [&_td]:bg-gray-200! hover:[bg-gray-200] [&:hover_td]:bg-gray-200',
143150
'[&_.ant-radio-input]:pointer-events-none [&_.ant-radio-wrapper]:pointer-events-none [&_.ant-radio]:pointer-events-none [&_.ant-radio-input]:pointer-events-none',
144151
'[&_.ant-radio-input]:cursor-not-allowed [&_.ant-radio-wrapper]:cursor-not-allowed',
145152
'[&_.ant-table-cell]:cursor-not-allowed',
146153
`
147-
[&_td:has(.ant-radio-wrapper)]:hover:after:content-['This_e-model_cannot_be_combined_\\a_with_any_morphology_for_now.']!
148-
[&_td:has(.ant-radio-wrapper)]:hover:after:absolute
149-
[&_td:has(.ant-radio-wrapper)]:hover:after:bg-yellow-100
150-
[&_td:has(.ant-radio-wrapper)]:hover:after:backdrop-blur-xl
151-
[&_td:has(.ant-radio-wrapper)]:hover:after:border
152-
[&_td:has(.ant-radio-wrapper)]:hover:after:border-yellow-100/20
153-
[&_td:has(.ant-radio-wrapper)]:hover:after:shadow-lg
154-
[&_td:has(.ant-radio-wrapper)]:hover:after:text-primary-8
155-
[&_td:has(.ant-radio-wrapper)]:hover:after:text-sm
156-
[&_td:has(.ant-radio-wrapper)]:hover:after:px-2
157-
[&_td:has(.ant-radio-wrapper)]:hover:after:py-1
158-
[&_td:has(.ant-radio-wrapper)]:hover:after:rounded
159-
[&_td:has(.ant-radio-wrapper)]:hover:after:whitespace-pre
160-
[&_td:has(.ant-radio-wrapper)]:hover:after:z-50
161-
[&_td:has(.ant-radio-wrapper)]:hover:after:top-[10px]
162-
[&_td:has(.ant-radio-wrapper)]:hover:after:left-[10px]
154+
[tr:has(.ant-radio-wrapper)]:relative!
155+
[tr:has(.ant-radio-wrapper)]:hover:after:content-[attr(black-listed)]!
156+
[tr:has(.ant-radio-wrapper)]:hover:after:absolute
157+
[tr:has(.ant-radio-wrapper)]:hover:after:bg-yellow-100
158+
[tr:has(.ant-radio-wrapper)]:hover:after:backdrop-blur-xl
159+
[tr:has(.ant-radio-wrapper)]:hover:after:border
160+
[tr:has(.ant-radio-wrapper)]:hover:after:border-yellow-100/20
161+
[tr:has(.ant-radio-wrapper)]:hover:after:shadow-lg
162+
[tr:has(.ant-radio-wrapper)]:hover:after:text-primary-8
163+
[tr:has(.ant-radio-wrapper)]:hover:after:text-sm
164+
[tr:has(.ant-radio-wrapper)]:hover:after:px-2
165+
[tr:has(.ant-radio-wrapper)]:hover:after:py-1
166+
[tr:has(.ant-radio-wrapper)]:hover:after:rounded
167+
[tr:has(.ant-radio-wrapper)]:hover:after:whitespace-pre-line
168+
[tr:has(.ant-radio-wrapper)]:hover:after:z-50
169+
[tr:has(.ant-radio-wrapper)]:hover:after:top-[10px]
170+
[tr:has(.ant-radio-wrapper)]:hover:after:left-[10px]
163171
`
164172
)
165173
: '';

0 commit comments

Comments
 (0)