Skip to content

Commit

Permalink
#85: Remove circular dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
netzwerg committed Apr 11, 2022
1 parent 983ea62 commit 70dfe08
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 15 deletions.
8 changes: 5 additions & 3 deletions src/Timeline.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import React, { useCallback, Fragment } from 'react'

import { Domain, EventComponentFactory, LaneDisplayMode, TimelineEvent, TimelineLane } from './model'
import { Domain, EventComponentFactory, LaneDisplayMode, TimelineEvent, TimelineLane, TimelineLayer } from './model'

import { TimelineTheme } from './theme/model'
import { TimelineThemeProvider } from './theme/TimelineThemeProvider'

import { useEvents, useTimeline, useTimelineAnimation } from './hooks'
import { useEvents } from './hooks/useEvents'
import { useTimeline } from './hooks/useTimeline'
import { useTimelineAnimation } from './hooks/useTimelineAnimation'

import { noOp } from './utils'

Expand All @@ -16,7 +18,7 @@ import { CollapsedMarks } from './layers/CollapsedMarks'
import { EventClusters } from './layers/EventClusters'
import { Axes } from './layers/Axes'
import { Axis } from './layers/Axis'
import { defaultOrderedZoomLevels, TimelineLayer, ZoomLevels } from '.'
import { defaultOrderedZoomLevels, ZoomLevels } from './shared/ZoomScale'

export interface TimelineProps<EID extends string, LID extends string, E extends TimelineEvent<EID, LID>> {
width: number
Expand Down
5 changes: 0 additions & 5 deletions src/hooks/index.ts

This file was deleted.

3 changes: 2 additions & 1 deletion src/hooks/useTimeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import { useEffect, useState } from 'react'

import { useZoomLevels } from './useZoomLevels'

import { Domain, TimelineEvent, TimelineLane, ZoomLevels } from '..'
import { ScaleBand, scaleBand, ScaleLinear, scaleLinear } from 'd3-scale'
import { Domain, TimelineEvent, TimelineLane } from '../model'
import { ZoomLevels } from '../shared/ZoomScale'

export const calcMaxDomain = <EID extends string, LID extends string, E extends TimelineEvent<EID, LID>>(
events: ReadonlyArray<E>
Expand Down
3 changes: 1 addition & 2 deletions src/hooks/useTimelineAnimation.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { useEffect, useState } from 'react'

import { Domain } from '..'
import { Domain } from '../model'

type Animation =
| 'none'
Expand Down
5 changes: 3 additions & 2 deletions src/hooks/useZoom.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ScaleLinear } from 'd3-scale'
import { useZoomLevels } from '.'
import { Domain, getDomainSpan, ZoomLevels, ZoomScale, zoomScaleWidth } from '..'
import { useZoomLevels } from './useZoomLevels'
import { getDomainSpan, ZoomLevels, ZoomScale, zoomScaleWidth } from '../shared/ZoomScale'
import { Domain } from '../model'

interface UseZoomProps {
domain: Domain
Expand Down
2 changes: 1 addition & 1 deletion src/layers/interaction/Interaction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ScaleLinear } from 'd3-scale'
import { Domain } from '../../model'
import { MouseAwareSvg, SvgCoordinates } from './MouseAwareSvg'
import { MouseCursor } from './MouseCursor'
import { useZoom } from '../../hooks'
import { useZoom } from '../../hooks/useZoom'
import { ZoomLevels, getDomainSpan } from '../../shared/ZoomScale'
import { InteractionHandling } from './InteractionHandling'
import { useTrimming } from './trimmer/useTrimming'
Expand Down
2 changes: 1 addition & 1 deletion src/test/Timeline.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { render, screen } from './test-utils'
import data from './data.json'
import { Timeline } from '../Timeline'
import { THEME } from './testTheme'
import { calcMaxDomain } from '../hooks'
import { calcMaxDomain } from '../hooks/useTimeline'

describe('Timeline', () => {
const events = data.events
Expand Down

0 comments on commit 70dfe08

Please sign in to comment.