Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
cquiroz committed Aug 16, 2024
1 parent 9fa28f5 commit eb867a6
Show file tree
Hide file tree
Showing 14 changed files with 6 additions and 42 deletions.
3 changes: 1 addition & 2 deletions common/src/main/scala/explore/components/Tile.scala
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ case class Tile[A](
}

object Tile:
type TileId = NonEmptyString
type RenderInTitle = VdomNode => VdomNode
type TileId = NonEmptyString

private type Props[A] = Tile[A]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,18 +128,11 @@ object GeneratedSequenceBody:

case class GeneratedSequenceTitle(
obsExecution: Pot[Execution]
// programId: Program.Id,
// obsId: Observation.Id,
// targetIds: List[Target.Id],
// snPerClass: Map[ObserveClass, SignalToNoise],
// sequenceChanged: View[Pot[Unit]]
) extends ReactFnProps(GeneratedSequenceTitle.component)

object GeneratedSequenceTitle:
private type Props = GeneratedSequenceTitle

private given Reusability[InstrumentExecutionConfig] = Reusability.byEq

private val component =
ScalaFnComponent
.withHooks[Props]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import explore.model.Execution
import explore.model.ObsTabTilesIds
import explore.model.Observation
import explore.model.OdbItcResult
import japgolly.scalajs.react.*
import lucuma.core.model.Program

object SequenceEditorTile:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import lucuma.ui.table.*
import lucuma.ui.table.hooks.*

import scala.collection.immutable.SortedSet
import explore.model.enums.TileSizeState

case class ConstraintsSummaryTableBody(
userId: Option[User.Id],
Expand Down
2 changes: 0 additions & 2 deletions explore/src/main/scala/explore/notes/NotesTile.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ package explore.tabs

import cats.syntax.all.*
import crystal.react.*
import crystal.react.hooks.*
import eu.timepit.refined.types.string.NonEmptyString
import explore.Icons
import explore.components.HelpIcon
import explore.components.Tile
import explore.components.Tile.RenderInTitle
import explore.components.ui.ExploreStyles
import explore.model.ObsTabTilesIds
import explore.model.Observation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import crystal.react.syntax.pot.given
import explore.Icons
import explore.common.UserPreferencesQueries
import explore.common.UserPreferencesQueries.TableStore
import explore.components.Tile
import explore.components.ui.ExploreStyles
import explore.model.AppContext
import explore.model.Asterism
Expand Down
3 changes: 0 additions & 3 deletions explore/src/main/scala/explore/proposal/ProgramUsers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@ import cats.effect.IO
import cats.syntax.all.*
import crystal.*
import crystal.react.*
import crystal.react.hooks.*
import explore.Icons
import explore.components.Tile
import explore.components.Tile.RenderInTitle
import explore.components.ui.ExploreStyles
import explore.model.AppContext
import explore.model.CoIInvitation
import explore.model.ProgramUserWithRole
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import crystal.*
import crystal.react.*
import explore.components.Tile
import explore.components.ui.ExploreStyles
import explore.config.ObsTimeEditor
import explore.model.GlobalPreferences
import explore.model.ObsConfiguration
import explore.model.ObsIdSet
Expand Down
1 change: 0 additions & 1 deletion explore/src/main/scala/explore/tabs/GroupEditBody.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import eu.timepit.refined.types.numeric.NonNegShort
import eu.timepit.refined.types.string.NonEmptyString
import explore.Icons
import explore.common.GroupQueries
import explore.components.Tile
import explore.components.ui.ExploreStyles
import explore.model.AppContext
import explore.model.GroupTree
Expand Down
2 changes: 0 additions & 2 deletions explore/src/main/scala/explore/tabs/ItcTile.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@

package explore.tabs

import cats.syntax.all.*
import crystal.Pot
import crystal.react.View
import explore.components.Tile
import explore.components.ui.ExploreStyles
import explore.itc.ItcPanelBody
import explore.itc.ItcPanelTitle
import explore.itc.ItcPanelTileState
Expand Down
2 changes: 0 additions & 2 deletions explore/src/main/scala/explore/tabs/ObsTabTiles.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import explore.components.TileController
import explore.components.ui.ExploreStyles
import explore.config.sequence.SequenceEditorTile
import explore.constraints.ConstraintsPanel
import explore.findercharts.ChartSelector
import explore.itc.ItcProps
import explore.model.*
import explore.model.AppContext
Expand Down Expand Up @@ -55,7 +54,6 @@ import lucuma.core.math.Offset
import lucuma.core.math.skycalc.averageParallacticAngle
import lucuma.core.model.ConstraintSet
import lucuma.core.model.CoordinatesAtVizTime
import lucuma.core.model.ObsAttachment as ObsAtt
import lucuma.core.model.PosAngleConstraint
import lucuma.core.model.Program
import lucuma.core.model.Target
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@

package explore.targeteditor

import cats.effect.IO
import cats.syntax.all.*
import crystal.react.*
import crystal.react.hooks.*
import explore.components.Tile
import explore.components.ui.ExploreStyles
import explore.config.ObsTimeEditor
import explore.model.AladinFullScreen
Expand Down Expand Up @@ -35,7 +33,6 @@ import lucuma.react.common.ReactFnProps
import lucuma.ui.reusability.given
import lucuma.ui.syntax.all.given
import monocle.Iso
import queries.schemas.odb.ObsQueries

import java.time.Instant
import monocle.Lens
Expand Down Expand Up @@ -90,16 +87,15 @@ object AsterismEditorBody extends AsterismModifier:
private val component =
ScalaFnComponent
.withHooks[Props]
.useContext(AppContext.ctx)
.useMemoBy((props, _) => (props.obsIds, props.obsAndTargets.get._1)) { (_, _) =>
.useMemoBy(props => (props.obsIds, props.obsAndTargets.get._1)) { _ =>
ObsIdSetEditInfo.fromObservationList
}
.useLayoutEffectWithDepsBy((_, _, obsEditInfo) => obsEditInfo) { (p, _, _) => obsEditInfo =>
.useLayoutEffectWithDepsBy((_, obsEditInfo) => obsEditInfo) { (p, _) => obsEditInfo =>
p.state.zoom(AsterismTileState.obsEditInfo).set(obsEditInfo.value.some)
}
.useLayoutEffectWithDepsBy((props, _, obsEditInfo) =>
.useLayoutEffectWithDepsBy((props, obsEditInfo) =>
(obsEditInfo.asterismIds, props.focusedTargetId)
) { (props, _, _) => (asterismIds, focusedTargetId) =>
) { (props, _) => (asterismIds, focusedTargetId) =>
// If the selected targetId is None, or not in the asterism, select the first target (if any).
// Need to replace history here.
focusedTargetId.filter(asterismIds.contains_) match
Expand All @@ -108,15 +104,7 @@ object AsterismEditorBody extends AsterismModifier:
}
// full screen aladin
.useStateView(AladinFullScreen.Normal)
.render { (props, ctx, obsEditInfo, fullScreen) =>
import ctx.given
// Save the time here. this works for the obs and target tabs
// It's OK to set the viz time for executed observations, I think.
val vizTimeView = props.vizTime.withOnMod(t =>
ObsQueries
.updateVisualizationTime[IO](props.obsIds.toList, t)
.runAsync
)
.render { (props, obsEditInfo, fullScreen) =>

val vizTime = props.vizTime.get

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import eu.timepit.refined.types.string.*
import explore.DefaultErrorPolicy
import explore.common.*
import explore.components.HelpIcon
import explore.components.Tile
import explore.components.ui.ExploreStyles
import explore.model.AladinFullScreen
import explore.model.AppContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import crystal.react.hooks.*
import explore.Icons
import explore.common.UserPreferencesQueries
import explore.common.UserPreferencesQueries.TableStore
import explore.components.Tile
import explore.components.ColumnSelectorState
import explore.components.ui.ExploreStyles
import explore.model.AladinFullScreen
Expand Down

0 comments on commit eb867a6

Please sign in to comment.