-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4054 from gemini-hlsw/sc-3199-display-cfp-deadline
Show the deadline if a proposal can be retracted
- Loading branch information
Showing
9 changed files
with
149 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright (c) 2016-2023 Association of Universities for Research in Astronomy, Inc. (AURA) | ||
// For license information see LICENSE or https://opensource.org/licenses/BSD-3-Clause | ||
|
||
package explore.cache | ||
|
||
import cats.effect.IO | ||
import cats.effect.kernel.Resource | ||
import cats.syntax.all.* | ||
import clue.StreamingClient | ||
import explore.DefaultErrorPolicy | ||
import explore.model.CallForProposal | ||
import fs2.Stream | ||
import japgolly.scalajs.react.* | ||
import lucuma.react.common.ReactFnProps | ||
import lucuma.schemas.ObservationDB | ||
import queries.common.CallsQueriesGQL.ReadOpenCFPs | ||
|
||
case class CfpCache( | ||
setCalls: Option[List[CallForProposal]] => IO[Unit] | ||
)(using client: StreamingClient[IO, ObservationDB]) | ||
extends ReactFnProps[CfpCache](CfpCache.component) | ||
with CacheComponent.Props[List[CallForProposal]]: | ||
val setState = setCalls | ||
given StreamingClient[IO, ObservationDB] = client | ||
|
||
object CfpCache extends CacheComponent[List[CallForProposal], CfpCache]: | ||
|
||
override protected val updateStream | ||
: CfpCache => Resource[IO, Stream[IO, List[CallForProposal] => List[CallForProposal]]] = | ||
_ => Resource.pure(Stream.empty) | ||
|
||
given Reusability[CfpCache] = Reusability.always | ||
|
||
override protected val initial: CfpCache => IO[ | ||
(List[CallForProposal], fs2.Stream[IO, List[CallForProposal] => List[CallForProposal]]) | ||
] = props => | ||
import props.given | ||
|
||
ReadOpenCFPs[IO] | ||
.query() | ||
.map(_.map(_.callsForProposals.matches)) | ||
.tupleRight(Stream.empty) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.