pages/search: indicator for discarded tabs

This commit is contained in:
He4eT 2024-01-21 21:37:11 +01:00
commit bcf56cf841
4 changed files with 25 additions and 1 deletions

View file

@ -20,6 +20,10 @@ html, body {
--gray-dark-60: #2b2a33; --gray-dark-60: #2b2a33;
--gray-dark-80: #1c1b22; --gray-dark-80: #1c1b22;
--gray-dark-90: #15141a; --gray-dark-90: #15141a;
--green-20: #b3ffe3;
--green-40: #54ffbd;
--green-60: #2ac3a2;
} }
body { body {

View file

@ -8,10 +8,14 @@ const tabView = (result) => {
const [label, title, url] = const [label, title, url] =
result.map((field) => fuzzysort.highlight(field)) result.map((field) => fuzzysort.highlight(field))
const tooltip = (tab.discarded ? `[discarded] ` : '')
+ `${tab.title}\n${tab.url}`
return ` return `
<button class='tab' data-id='${tab.id}'> <button class='tab' data-id='${tab.id}' title='${tooltip}'>
<span class='label'>${label ?? tab.label}</span> <span class='label'>${label ?? tab.label}</span>
<img class='favicon' src='${tab.favIconUrl ?? defaultFavicon}'/> <img class='favicon' src='${tab.favIconUrl ?? defaultFavicon}'/>
<div class='indicator ${tab.discarded ? 'discarded' : 'active'}'></div>
<span class='title'>${title ?? tab.title}</span> <span class='title'>${title ?? tab.title}</span>
<span class='url'>${url ?? tab.url}</span> <span class='url'>${url ?? tab.url}</span>
</button> </button>

View file

@ -21,6 +21,7 @@ export const init = ({
}) })
const pickFields = (tab) => [ const pickFields = (tab) => [
'discarded',
'favIconUrl', 'favIconUrl',
'id', 'id',
'label', 'label',

View file

@ -65,6 +65,21 @@ main {
height: calc(2 * var(--step)); height: calc(2 * var(--step));
} }
.tab > .indicator {
flex-shrink: 0;
border-radius: 50%;
width: calc(1 * var(--step));
height: calc(1 * var(--step));
}
.tab > .indicator.active {
background-color: var(--green-60);
}
.tab > .indicator.discarded {
background-color: var(--gray-light-50);
}
.tab > .label { .tab > .label {
font-family: monospace; font-family: monospace;
color: var(--gray-dark-10); color: var(--gray-dark-10);