Skip to content

web search done right

like/dislike/block button tooltips

Mikkel Denkerd9b7328a67f6
diff --git a/crates/core/src/query/optic.rs b/crates/core/src/query/optic.rs
index f0de4c25..7c7920e3 100644
--- a/crates/core/src/query/optic.rs
+++ b/crates/core/src/query/optic.rs
@@ -337,6 +337,13 @@ mod tests {
let res = searcher
.search(&SearchQuery {
query: "website".to_string(),
+ optic: Some(Optic {
+ rankings: vec![RankingCoeff {
+ target: RankingTarget::Signal("host_centrality".to_string()),
+ value: 1_000_000.0,
+ }],
+ ..Default::default()
+ }),
..Default::default()
})
.unwrap()
@@ -380,7 +387,7 @@ mod tests {
Matches {
Domain("a.com")
},
- Action(Boost(10))
+ Action(Boost(100))
}
"#,
)
diff --git a/frontend/src/lib/components/Button.svelte b/frontend/src/lib/components/Button.svelte
index 6076b509..cc9266f3 100644
--- a/frontend/src/lib/components/Button.svelte
+++ b/frontend/src/lib/components/Button.svelte
@@ -10,8 +10,16 @@
export let padding: boolean = true;
export let kind: ButtonKind = 'primary';
export let _class: string = '';
+ export let aria_label: string | undefined = void 0;
</script>
-<button on:click {title} {form} {type} class={getButtonTailwindStyle(padding, pale, kind, _class)}>
+<button
+ on:click
+ {title}
+ {form}
+ {type}
+ class={getButtonTailwindStyle(padding, pale, kind, _class)}
+ aria-label={aria_label}
+>
<slot />
</button>
diff --git a/frontend/src/routes/search/Modal.svelte b/frontend/src/routes/search/Modal.svelte
index 0a544ae4..7c3c8033 100644
--- a/frontend/src/routes/search/Modal.svelte
+++ b/frontend/src/routes/search/Modal.svelte
@@ -34,16 +34,22 @@
ranking: Ranking.LIKED,
kind: 'success',
Icon: HandThumbUp,
+ title: 'Like Site',
+ aria_label: 'I want more results like this site.',
},
{
ranking: Ranking.DISLIKED,
kind: 'warning',
Icon: HandThumbDown,
+ title: 'Dislike Site',
+ aria_label: 'I want fewer results like this site.',
},
{
ranking: Ranking.BLOCKED,
kind: 'error',
Icon: NoSymbol,
+ title: 'Block Site',
+ aria_label: 'I never want to see results from this site.',
},
] as const;
@@ -74,9 +80,11 @@
<h2 class="w-full text-center">Do you like results from</h2>
<p class="text-center">{modal.site.site}?</p>
<div class="flex justify-center space-x-1.5 pt-2">
- {#each rankingChoices as { ranking, kind, Icon }}
+ {#each rankingChoices as { ranking, kind, Icon, title, aria_label }}
<Button
{kind}
+ {title}
+ {aria_label}
pale={$hostRankingsStore[modal.site.site] != ranking}
padding={false}
form="searchbar-form"