Skip to content

Commit

Permalink
fix tile ids
Browse files Browse the repository at this point in the history
  • Loading branch information
rpiaggio committed Oct 28, 2024
1 parent 35be79e commit 8e2baf1
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 23 deletions.
8 changes: 4 additions & 4 deletions common/src/main/scala/explore/model/ExploreGridLayouts.scala
Original file line number Diff line number Diff line change
Expand Up @@ -116,28 +116,28 @@ object ExploreGridLayouts:
end scheduling

object targets:
private lazy val SummaryHeight: NonNegInt = 6.refined
private lazy val SummaryHeight: NonNegInt = 9.refined
private lazy val TargetHeight: NonNegInt = 18.refined
private lazy val SkyPlotHeight: NonNegInt = 9.refined

private lazy val layoutMedium: Layout = Layout(
List(
LayoutItem(
i = ObsTabTileIds.TargetSummaryId.id.value,
i = TargetTabTileIds.Summary.id,
x = 0,
y = 0,
w = DefaultWidth.value,
h = SummaryHeight.value
),
LayoutItem(
i = ObsTabTileIds.TargetId.id.value,
i = TargetTabTileIds.AsterismEditor.id,
x = 0,
y = SummaryHeight.value,
w = DefaultWidth.value,
h = TargetHeight.value
),
LayoutItem(
i = ObsTabTileIds.PlotId.id.value,
i = TargetTabTileIds.ElevationPlot.id,
x = 0,
y = SummaryHeight.value + TargetHeight.value,
w = DefaultWidth.value,
Expand Down
4 changes: 2 additions & 2 deletions explore/src/main/scala/explore/tabs/AsterismEditorTile.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import explore.model.GlobalPreferences
import explore.model.GuideStarSelection
import explore.model.ObsConfiguration
import explore.model.ObsIdSet
import explore.model.ObsTabTileIds
import explore.model.ObservationsAndTargets
import explore.model.OnAsterismUpdateParams
import explore.model.OnCloneParameters
Expand Down Expand Up @@ -42,6 +41,7 @@ object AsterismEditorTile:

def asterismEditorTile(
userId: Option[User.Id],
tileId: Tile.TileId,
programId: Program.Id,
obsIds: ObsIdSet,
obsAndTargets: UndoSetter[ObservationsAndTargets],
Expand Down Expand Up @@ -74,7 +74,7 @@ object AsterismEditorTile:
)

Tile(
ObsTabTileIds.TargetId.id,
tileId,
title,
AsterismTileState(),
back = backButton,
Expand Down
6 changes: 4 additions & 2 deletions explore/src/main/scala/explore/tabs/ElevationPlotTile.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ object ElevationPlotTile:
vizTime: Option[Instant],
pendingTime: Option[Duration],
timingWindows: List[TimingWindow] = List.empty,
globalPreferences: GlobalPreferences
globalPreferences: GlobalPreferences,
emptyMessage: String
): Tile[Unit] =
Tile(
tileId,
Expand All @@ -46,7 +47,8 @@ object ElevationPlotTile:
vizTime,
pendingTime,
timingWindows,
globalPreferences
globalPreferences,
emptyMessage
): VdomNode
.getOrElse:
<.div(
Expand Down
3 changes: 2 additions & 1 deletion explore/src/main/scala/explore/tabs/ObsTabContents.scala
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,8 @@ object ObsTabContents extends TwoPanels:
none,
none,
List.empty,
props.globalPreferences.get
props.globalPreferences.get,
"No observation selected"
)

val summaryTiles: VdomNode =
Expand Down
4 changes: 3 additions & 1 deletion explore/src/main/scala/explore/tabs/ObsTabTiles.scala
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,8 @@ object ObsTabTiles:
vizTimeView.get,
obsDuration.map(_.toDuration),
timingWindows.get,
props.globalPreferences.get
props.globalPreferences.get,
"No target selected"
)

def getObsInfo(obsId: Observation.Id)(targetId: Target.Id): TargetEditObsInfo =
Expand Down Expand Up @@ -444,6 +445,7 @@ object ObsTabTiles:
val targetTile =
AsterismEditorTile.asterismEditorTile(
props.vault.userId,
ObsTabTileIds.TargetId.id,
props.programId,
ObsIdSet.one(props.obsId),
props.obsAndTargets,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import explore.model.AladinFullScreen
import explore.model.Asterism
import explore.model.GlobalPreferences
import explore.model.GuideStarSelection
import explore.model.ObsTabTileIds
import explore.model.ObservationsAndTargets
import explore.model.OnCloneParameters
import explore.model.TargetEditObsInfo
import explore.model.TargetTabTileIds
import explore.targeteditor.SiderealTargetEditor
import explore.undo.UndoSetter
import japgolly.scalajs.react.*
Expand Down Expand Up @@ -44,7 +44,7 @@ object SiderealTargetEditorTile:
backButton: Option[VdomNode] = none
) =
Tile(
ObsTabTileIds.TargetId.id,
TargetTabTileIds.AsterismEditor.id,
title,
back = backButton,
bodyClass = ExploreStyles.TargetTileBody
Expand Down
16 changes: 10 additions & 6 deletions explore/src/main/scala/explore/tabs/TargetTabContents.scala
Original file line number Diff line number Diff line change
Expand Up @@ -501,8 +501,9 @@ object TargetTabContents extends TwoPanels:
} else {
// We'll open all of the original groups who had any observations affected by the cloning.
props.expandedIds.mod(_ ++ SortedSet.from(allOriginalGroups)) >>
setCurrentTarget(idsToEdit.some)(params.originalId.some,
SetRouteVia.HistoryReplace
setCurrentTarget(idsToEdit.some)(
params.originalId.some,
SetRouteVia.HistoryReplace
)
})

Expand Down Expand Up @@ -544,6 +545,7 @@ object TargetTabContents extends TwoPanels:
val asterismEditorTile =
AsterismEditorTile.asterismEditorTile(
props.userId,
TargetTabTileIds.AsterismEditor.id,
props.programId,
idsToEdit,
props.obsAndTargets,
Expand Down Expand Up @@ -586,17 +588,18 @@ object TargetTabContents extends TwoPanels:
obsTimeView.get,
none,
Nil,
props.globalPreferences.get
props.globalPreferences.get,
"No target selected"
)

List(asterismEditorTile, skyPlotTile)
}

// We still want to render these 2 tiles, even when not shown, so as not to mess up the stored layout.
val dummyTargetTile: Tile[Unit] =
Tile(ObsTabTileIds.TargetId.id, "", hidden = true)(_ => EmptyVdom)
Tile(TargetTabTileIds.AsterismEditor.id, "", hidden = true)(_ => EmptyVdom)
val dummyElevationTile: Tile[Unit] =
Tile(ObsTabTileIds.PlotId.id, "", hidden = true)(_ => EmptyVdom)
Tile(TargetTabTileIds.ElevationPlot.id, "", hidden = true)(_ => EmptyVdom)

/**
* Renders a single sidereal target editor without an obs context
Expand Down Expand Up @@ -640,7 +643,8 @@ object TargetTabContents extends TwoPanels:
none,
none,
Nil,
props.globalPreferences.get
props.globalPreferences.get,
"No target selected"
)

val rightSide = { (resize: UseResizeDetectorReturn) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ case class NightPlot(
coordsTime: Instant,
excludeIntervals: List[BoundedInterval[Instant]],
pendingTime: Option[Duration],
options: View[ObjectPlotOptions]
options: View[ObjectPlotOptions],
emptyMessage: String
) extends ReactFnProps(NightPlot.component)

object NightPlot:
Expand Down Expand Up @@ -431,10 +432,10 @@ object NightPlot:
.useRef(none[Chart_]) // chart handler (chartOpt)
.useEffectWithDepsBy((props, _, _, _, _, chartOpt) =>
(props.plotData.value.size, chartOpt.value.void)
): (_, _, _, _, _, chartOpt) =>
): (props, _, _, _, _, chartOpt) =>
(size, _) =>
Callback:
if size === 0 then chartOpt.value.foreach(_.showLoading("No target selected"))
if size === 0 then chartOpt.value.foreach(_.showLoading(props.emptyMessage))
else chartOpt.value.foreach(_.hideLoading())
.render: (props, _, _, chartAndMoonData, chartOptions, chartOpt) =>
React.Fragment(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ case class ObjectPlotSection(
visualizationTime: Option[Instant],
pendingTime: Option[Duration],
timingWindows: List[TimingWindow],
globalPreferences: GlobalPreferences
globalPreferences: GlobalPreferences,
emptyMessage: String
) extends ReactFnProps(ObjectPlotSection.component)

object ObjectPlotSection:
Expand Down Expand Up @@ -161,7 +162,8 @@ object ObjectPlotSection:
dateView.get.atStartOfDay.toInstant(ZoneOffset.UTC),
windowsNetExcludeIntervals,
props.pendingTime,
options
options,
props.emptyMessage
)
case PlotRange.Semester =>
props.plotData.value.headOption.map { case (_, data) =>
Expand Down

0 comments on commit 8e2baf1

Please sign in to comment.