Compare commits
3 Commits
e34355e8be
...
0dd44372e8
Author | SHA1 | Date | |
---|---|---|---|
0dd44372e8
|
|||
f0fe3f8803
|
|||
275954f52d
|
@@ -61,7 +61,20 @@ export function BusinessDataProvider(props: { children: JSX.Element }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const addPassages = (passages: Passages): void => {
|
const addPassages = (passages: Passages): void => {
|
||||||
setStore('passages', passages);
|
const storePassages = store.passages;
|
||||||
|
for (const lineId of Object.keys(passages)) {
|
||||||
|
const newLinePassages = passages[lineId];
|
||||||
|
const linePassages = storePassages[lineId];
|
||||||
|
if (linePassages === undefined) {
|
||||||
|
setStore('passages', lineId, newLinePassages);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (const destination of Object.keys(newLinePassages)) {
|
||||||
|
const newLinePassagesDestination = newLinePassages[destination];
|
||||||
|
setStore('passages', lineId, destination, newLinePassagesDestination);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const clearPassages = (): void => {
|
const clearPassages = (): void => {
|
||||||
|
@@ -173,9 +173,8 @@ export const PassagesDisplay: ParentComponent = () => {
|
|||||||
chunkSize += byLinePassagesKeys.length;
|
chunkSize += byLinePassagesKeys.length;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const [store] = createStore(chunk);
|
|
||||||
const panelid = index++;
|
const panelid = index++;
|
||||||
const panel = <PassagesPanel show={panelid == displayedPanelId()} passages={store} />;
|
const panel = <PassagesPanel show={panelid == displayedPanelId()} passages={chunk} />;
|
||||||
newPanels.push(panel);
|
newPanels.push(panel);
|
||||||
positioneds.push({ position: panelid, panel: panel });
|
positioneds.push({ position: panelid, panel: panel });
|
||||||
|
|
||||||
@@ -186,8 +185,7 @@ export const PassagesDisplay: ParentComponent = () => {
|
|||||||
}
|
}
|
||||||
if (chunkSize) {
|
if (chunkSize) {
|
||||||
const panelId = index++;
|
const panelId = index++;
|
||||||
const [store] = createStore(chunk);
|
const panel = <PassagesPanel show={panelId == displayedPanelId()} passages={chunk} />;
|
||||||
const panel = <PassagesPanel show={panelId == displayedPanelId()} passages={store} />;
|
|
||||||
newPanels.push(panel);
|
newPanels.push(panel);
|
||||||
positioneds.push({ position: panelId, panel: panel });
|
positioneds.push({ position: panelId, panel: panel });
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { VoidComponent, createEffect, createResource, createSignal, ParentComponent, ParentProps, Show, useContext } from 'solid-js';
|
import { VoidComponent, createEffect, createResource, createSignal, ParentComponent, ParentProps, Show, useContext, For } from 'solid-js';
|
||||||
import { createDateNow, getTime } from '@solid-primitives/date';
|
import { createDateNow, getTime } from '@solid-primitives/date';
|
||||||
import { AnimationOptions } from '@motionone/types';
|
import { AnimationOptions } from '@motionone/types';
|
||||||
import { Motion } from "@motionone/solid";
|
import { Motion } from "@motionone/solid";
|
||||||
@@ -123,18 +123,17 @@ export const PassagesPanel: PassagesPanelComponent = (props) => {
|
|||||||
return (
|
return (
|
||||||
<div classList={{ [styles.passagesContainer]: true, [styles.displayed]: props.show }} >
|
<div classList={{ [styles.passagesContainer]: true, [styles.displayed]: props.show }} >
|
||||||
<Show when={lines() !== undefined} >
|
<Show when={lines() !== undefined} >
|
||||||
{() => {
|
<For each={lines()}>
|
||||||
const ret = [];
|
{(line) =>
|
||||||
for (const line of lines()) {
|
<Show when={props.passages[line.id]}>
|
||||||
const byLinePassages = props.passages[line.id];
|
<For each={Object.keys(props.passages[line.id])}>
|
||||||
if (byLinePassages !== undefined) {
|
{(destination) =>
|
||||||
for (const destination of Object.keys(byLinePassages)) {
|
<DestinationPassages passages={props.passages[line.id][destination]} line={line} destination={destination} />
|
||||||
ret.push(<DestinationPassages passages={byLinePassages[destination]} line={line} destination={destination} />);
|
|
||||||
}
|
}
|
||||||
|
</For>
|
||||||
|
</Show>
|
||||||
}
|
}
|
||||||
}
|
</For>
|
||||||
return ret;
|
|
||||||
}}
|
|
||||||
</Show>
|
</Show>
|
||||||
</div >
|
</div >
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user