feat(ui): check if project exists when searching #1030
Conversation
Concept ACK |
import Modal from "./Modal"; | ||
import ModalNewProject from "./Modal/NewProject.svelte"; | ||
import ModalSearch from "./Modal/Search.svelte"; | ||
import ModalShortcuts from "./Modal/Shortcuts.svelte"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to separate such cosmetic changes into separates PRs. And I'd prefer to undo this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a cosmetic change, it's a structural one. Given the overhead of getting a change reviewed, approved and kept in sync with mainline, I made the call to include it here. As I touched the part of the codebase already. It does not distract or obfuscate the other changes and it should be fine to approve it along the rest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the wrong categorization on my side. In any case, still not fond of this change. What's the context and motivation here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the removal of the unnecessary bookkeeping in index.js
plus dropping the superfluous Modal suffix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I don't dislike dropping the bookkepping but the namespacing I do appreciate. The prefix is staying around as you see, though less elegant. Happy to talk about this another time.
@@ -1,6 +1,8 @@ | |||
<script lang="ts"> | |||
<script lang="typescript"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<script lang="typescript"> | |
<script lang="ts"> |
Unless there's a good reason for the change, let's keep it consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah cool 👍
enum TrackingEvent { | ||
Track = "track", | ||
Untrack = "untrack", | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kind of unnecessary to move this to a new module with only this type when it is only used here...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consumers rely on the string value of these variants to catch the right events, but I didn't find a way to share that meaningfully. This was an attempt to do so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fwiw: I'm all for small modules with specific data 👍 Just because it's only used here now doesn't mean the tests of time will not force it to be used elsewhere or be added to.
<script lang="ts"> | ||
import { createEventDispatcher } from "svelte"; | ||
|
||
<script lang="typescript"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<script lang="typescript"> | |
<script lang="ts"> |
@@ -1,4 +1,4 @@ | |||
<script lang="ts"> | |||
<script lang="typescript"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<script lang="typescript"> | |
<script lang="ts"> |
@@ -0,0 +1,171 @@ | |||
<script lang="typescript"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<script lang="typescript"> | |
<script lang="ts"> |
let id: string; | ||
let value: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you document what these are?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you expand on what kind of documentation you expect when stumbling upon these? Also would it help to rename them to not require documentation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, renaming would probably be best. Expanding, I open this file and have no idea what id
and value
stand or are used for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the code I'd probably call this rawUrn
or unvalidatedUrn
.
Also is the id
above actually the urn
? I find the name id
hard to discern whether it's a PeerId or a RadUrn. WHERE ARE MY TYPES AS DOCUMENTATION /raises fist to sky
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the code I'd probably call this
rawUrn
orunvalidatedUrn
.
It's validated.
It's the id
part of of a RadUrn.
@@ -1,6 +1,8 @@ | |||
<script lang="ts"> | |||
<script lang="typescript"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just out of curiosity, what's the difference? So far we've been using ts
everywhere.
Official docs also mention ts
: https://svelte.dev/blog/svelte-and-typescript#1_Compiling_TypeScript.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somehow my editor stack doesn't pick it up unless it's the full language name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whirrd!
I think we should try to keep them consistent, so we should either fix your editor or update the rest of the codebase to use typescript
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.container { | ||
width: 26.5rem; | ||
} | ||
|
||
.search-bar { | ||
margin-bottom: 1rem; | ||
position: relative; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.container { | |
width: 26.5rem; | |
} | |
.search-bar { | |
margin-bottom: 1rem; | |
position: relative; | |
} | |
.container { | |
width: 50vw; | |
max-width: 800px; | |
min-width: 500px; | |
} | |
.search-bar { | |
margin-bottom: 1rem; | |
position: relative; | |
padding: var(--content-padding); | |
background-color: var(--color-background); | |
border-radius: 4px; | |
} |
Now the validation error message is displaying in red on top of the overlay which is dark, looking no good, imo:
This suggestion does two things:
- Improves the responsiveness of the modal container, looking better in both small and large screens:
- Wraps the search bar with the appropriate background colour with nice padding:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion, @radicle-dev/product is aware of it and the work is tracked in #1031
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woudln't hurt to include this alrerady though as an temporary improvement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can make these changes when polishing for the beta release. Don't see much value in doing changes until @radicle-dev/product has settled on something.
Co-authored-by: Nuno Alexandre <hi@nunoalexandre.com>
Co-authored-by: Nuno Alexandre <hi@nunoalexandre.com>
import { Icon, Input } from "../DesignSystem/Primitive"; | ||
import { Remote, TrackToggle } from "../DesignSystem/Component"; | ||
|
||
let id: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, what's the id
used for? I see that upon validation you set it as the Urn minus rad:git
, but I can't see where that's used 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's shown next to the track button in the search resullt.
|
||
case Kind.RequestProject: | ||
projectRequestStore.loading(); | ||
// FIXME(xla): This truly belongs in project.ts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or project/search.ts
Up until now we assumed the provided urn is not present in the monorepo.
This change alters the behaviour to first check if a project exists
locally - because locally sourced is best source. If it exists locally
the result box offers to navigate directly to it -- also possible with a
hit of enter. Should it not exist a track toggle is presented, which
when pressed will fire a request for the project and show a
notification.
Refs #984