Skip to content
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
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@
"@portabletext/react": "^3.2.0",
"@radix-ui/react-accordion": "^1.1.1",
"@radix-ui/react-checkbox": "^1.0.3",
"@radix-ui/react-dialog": "^1.0.4",
"@radix-ui/react-dialog": "^1.1.7",
"@radix-ui/react-dropdown-menu": "^2.0.5",
"@radix-ui/react-menubar": "^1.1.6",
"@radix-ui/react-popover": "^1.0.5",
"@radix-ui/react-popover": "^1.1.7",
"@radix-ui/react-select": "^2.2.6",
"@radix-ui/react-slider": "^1.1.2",
"@radix-ui/react-slot": "^1.2.3",
Expand All @@ -67,6 +67,7 @@
"@t3-oss/env-nextjs": "^0.13.0",
"@tanstack/react-query": "^5.84.1",
"@tanstack/react-query-devtools": "^5.84.1",
"@tanstack/react-virtual": "^3.13.12",
"@testing-library/user-event": "^14.5.1",
"@tolokoban/tgd": "^2.0.33",
"@types/d3": "^7.4.0",
Expand Down
23 changes: 13 additions & 10 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/api/entitycore/types/entities/me-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export interface IMEModelFilter
}

export const CreateMEModelSchema = z.object({
name: z.string(),
name: z.string().nonempty(),
description: z.string(),
validation_status: z.nativeEnum(ValidationStatus),
brain_region_id: z.string().uuid(),
Expand Down
60 changes: 30 additions & 30 deletions src/api/entitycore/types/entities/single-neuron-synaptome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,57 +71,57 @@ const SingleNeuronSynaptomeExclusionRuleSchema = z
})
.refine(
(data) => {
if (!isNil(data.distance_soma_gte) || !isNil(data.distance_soma_lte)) return true;
return false;
if (isNil(data.distance_soma_gte) && isNil(data.distance_soma_lte)) return false;
return true;
},
{
message: 'At least one of distance_soma_gte or distance_soma_lte must be provided',
path: ['distance_soma_gte', 'distance_soma_lte'],
}
);

export const SingleNeuronSynaptomeConfigurationSchema = z
.object({
id: z.string().uuid(),
name: z.string(),
target: z.string().optional(),
seed: z.number(),
color: z.string(),
formula: z.string().optional(),
soma_synapse_count: z.number().optional(),
type: z.union([z.literal(110), z.literal(10)]),
exclusion_rules: z.array(SingleNeuronSynaptomeExclusionRuleSchema).nullable(),
})
.superRefine((synapse, ctx) => {
export const SingleNeuronSynaptomeBaseSchema = z.object({
id: z.string().uuid(),
name: z.string().nonempty(),
target: z.string().optional(),
seed: z.number(),
color: z.string(),
formula: z.string().optional(),
soma_synapse_count: z.number().optional(),
type: z.union([z.literal(110), z.literal(10)]),
exclusion_rules: z.array(SingleNeuronSynaptomeExclusionRuleSchema).nullable(),
});

export const SingleNeuronSynaptomeConfigurationSchema = SingleNeuronSynaptomeBaseSchema.superRefine(
(synapse, ctx) => {
if (synapse.target !== 'soma' && isNil(synapse.formula)) {
return ctx.addIssue({
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'formula should be provided when target is different then "soma"',
path: ['formula'],
});
}

if (synapse.target === 'soma' && isNil(synapse.soma_synapse_count)) {
return ctx.addIssue({
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'soma_synapse_count must be a valid number when target is "soma"',
path: ['soma_synapse_count'],
});
}
})
.superRefine(async (synapse, ctx) => {
if (synapse.target !== 'soma') {
return validateSingleNeuronSynapseGenerationFormula(synapse.formula!).then((v) => {
if (!v) {
return ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'formula is not valid',
path: ['formula'],
});
}
}
).superRefine(async (synapse, ctx) => {
if (synapse.target !== 'soma') {
const v = await validateSingleNeuronSynapseGenerationFormula(synapse.formula!);
if (!v) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: 'formula is not valid',
path: ['formula'],
});
}
return true;
});
}
});

export type TSingleNeuronSynaptomeConfiguration = z.infer<
typeof SingleNeuronSynaptomeConfigurationSchema
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import snakeCase from 'lodash/snakeCase';

import { BrowseAction } from '@/ui/segments/workflows/elements/browse-action';
import { BrowseAction } from '@/ui/segments/workflows/elements/browse-build-action';
import { BrowseEntityScope } from '@/features/views/listing/browse-entity';
import { WorkspaceScope, WorkspaceSection } from '@/constants';

Expand Down Expand Up @@ -31,6 +31,7 @@ export default async function Page({
classNames={{ container: 'max-h-full' }}
dataType={dataType}
scope={scope ?? WorkspaceScope.Public}
miniViewProps={{ section: WorkspaceSection.BuildWorkflow }}
/>
</div>
<div className="mt-auto flex w-full items-center justify-end">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { Header } from '@/ui/segments/workflows/build/memodel/header';
import { Menu } from '@/ui/segments/workflows/build/memodel/menu';
import { Content } from '@/ui/segments/workflows/build/memodel';

import type { BuildStepKeys } from '@/ui/segments/workflows/build/memodel/helpers';
import type { ServerSideComponentProp, WorkspaceContext } from '@/types/common';

export default async function Page({
searchParams,
}: ServerSideComponentProp<
WorkspaceContext & { id: string },
{ step: BuildStepKeys; sessionId: string }
>) {
let { sessionId } = await searchParams;
if (!sessionId) sessionId = crypto.randomUUID();

return (
<div className="border-neutral-2 mx-2 flex h-full w-[calc(100%-10px)] flex-col rounded-2xl border p-4">
<div className="mb-2 w-full flex-shrink-0">
<Header />
</div>
<div className='grid min-h-0 w-full flex-1 grid-cols-[24rem_1fr] gap-4 [grid-template-areas:"menu_content"]'>
<div
id="menu"
className="flex h-full w-full flex-col gap-2 overflow-y-auto [grid-area:menu]"
>
<Menu sessionId={sessionId} />
</div>
<div className="h-full overflow-hidden [grid-area:content]">
<Content sessionId={sessionId} />
</div>
</div>
</div>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { Header } from '@/ui/segments/workflows/build/single-neuron-synaptome/header';
import { Menu } from '@/ui/segments/workflows/build/single-neuron-synaptome/menu';
import { Content } from '@/ui/segments/workflows/build/single-neuron-synaptome';

import type { BuildStepKeys } from '@/ui/segments/workflows/build/single-neuron-synaptome/helpers';
import type { ServerSideComponentProp, WorkspaceContext } from '@/types/common';

export default async function Page({
searchParams,
}: ServerSideComponentProp<
WorkspaceContext & { id: string },
{ step: BuildStepKeys; sessionId: string }
>) {
let { sessionId } = await searchParams;
if (!sessionId) sessionId = crypto.randomUUID();

return (
<div className="border-neutral-2 mx-2 flex h-full w-[calc(100%-10px)] flex-col rounded-2xl border p-4">
<div className="mb-2 w-full flex-shrink-0">
<Header />
</div>
<div className='grid min-h-0 w-full flex-1 grid-cols-[24rem_1fr] gap-4 [grid-template-areas:"menu_content"]'>
<div
id="menu"
className="secondary-scrollbar flex h-full w-full flex-col gap-2 px-2 [grid-area:menu]"
>
<Menu sessionId={sessionId} />
</div>
<div className="h-full overflow-hidden [grid-area:content]">
<Content sessionId={sessionId} />
</div>
</div>
</div>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
'use client';

import { type ReactNode, useState } from 'react';
import { motion } from 'motion/react';

import { BuildWorkflowsBreadcrumb } from '@/ui/segments/workflows/elements/build-breadcrumb';
import { useDisableElementOverflow } from '@/ui/hooks/use-disable-element-overflow';
import { useSelectEntityClickEvent } from '@/ui/segments/mini-detail-view/event';
import { cn } from '@/utils/css-class';

export default function Layout({ children }: { children: ReactNode }) {
const [miniViewPresent, setMiniViewPresent] = useState(false);
useDisableElementOverflow({ id: 'workspace-body' });
useSelectEntityClickEvent((ev) => {
setMiniViewPresent(ev.detail.display);
});

return (
<div className="bg-neutral-1 border-neutral-2 mx-2 h-full max-h-[calc(100vh-6rem)] w-[calc(100%-10px)] overflow-hidden rounded-2xl border">
<BuildWorkflowsBreadcrumb />
<motion.div
id="workflow-new-inner-layout"
className={cn(
'grid gap-2 [grid-area:main]',
'h-full max-h-[calc(100%-4rem)] px-3 py-2',
{ "grid-cols-1 [grid-template-areas:'body']": !miniViewPresent },
{ "grid-cols-[3fr_2fr] [grid-template-areas:'body_mini-view']": miniViewPresent }
)}
initial={false}
animate={{
gridTemplateColumns: miniViewPresent ? '3fr 2fr' : '1fr',
gridTemplateAreas: miniViewPresent ? "'body mini-view'" : "'body'",
}}
transition={{
type: 'spring',
stiffness: 320,
damping: 30,
mass: 0.6,
}}
style={{ willChange: 'grid-template-columns, grid-template-areas' }}
>
{children}
</motion.div>
</div>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import snakeCase from 'lodash/snakeCase';

import { BrowseEntityScope } from '@/features/views/listing/browse-entity';
import { WorkspaceScope, WorkspaceSection } from '@/constants';

import type { TExtendedEntitiesTypeDict } from '@/api/entitycore/types/extended-entity-type';
import type { ServerSideComponentProp, WorkspaceContext } from '@/types/common';
import type { TWorkspaceScope } from '@/constants';
import type { KebabCase } from '@/utils/type';

export default async function Page({
params,
searchParams,
}: ServerSideComponentProp<
WorkspaceContext & { type: KebabCase<TExtendedEntitiesTypeDict> },
{ scope: TWorkspaceScope | null }
>) {
const { scope } = await searchParams;
const { type } = await params;

const dataType = snakeCase(type) as TExtendedEntitiesTypeDict;

return (
<BrowseEntityScope
requireMiniDetailView
section={WorkspaceSection.BuildWorkflow}
requireBrainRegion={false}
classNames={{ container: 'max-h-full' }}
dataType={dataType}
scope={scope ?? WorkspaceScope.Public}
mainTableProps={{
selectionType: undefined,
}}
miniViewProps={{
section: WorkspaceSection.BuildWorkflow,
}}
/>
);
}

This file was deleted.

Loading