Refactor search logic

- type events that are handed between components
- simplify the `resolve` function interface
  - before we had return values and exceptions, now just a single union
    type as return value
  - move navigation to the Search component to reduce its
    responsibilities
  - flatten and simplify multi-level branching
- shuffle around code
  - move the `resolve` function to the `Search` component module,
    because it's only used there

Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
This commit is contained in:
Rūdolfs Ošiņš
2022-09-29 14:50:13 +02:00
parent 01e0116029
commit d0edc52831
6 changed files with 198 additions and 165 deletions
+6 -1
View File
@@ -19,7 +19,12 @@
const getProjects =
config.projects.pinned.length > 0
? Project.getMulti(config.projects.pinned)
? Project.getMulti(
config.projects.pinned.map(project => ({
nameOrUrn: project.urn,
seed: project.seed,
})),
)
: Promise.resolve([]);
const onClick = (project: ProjectInfo, seed: Host) => {