@@ -12,6 +12,8 @@ import { ifDefined } from "lit/directives/if-defined.js";
1212import { when } from "lit/directives/when.js" ;
1313import queryString from "query-string" ;
1414
15+ import { originsWithRemainder } from "./templates/origins-with-remainder" ;
16+
1517import { BtrixElement } from "@/classes/BtrixElement" ;
1618import { none } from "@/layouts/empty" ;
1719import { pageHeading } from "@/layouts/page" ;
@@ -138,45 +140,31 @@ export class SelectBrowserProfile extends BtrixElement {
138140 : html ` < sl-spinner slot ="prefix "> </ sl-spinner > ` }
139141 ${ browserProfiles ?. items . map (
140142 ( profile , i ) => html `
141- < sl-option
142- value =${ profile . id }
143- class =${ clsx (
144- tw `part-[base]:flex-wrap` ,
145- tw `part-[prefix]:order-2` ,
146- tw `part-[label]:order-1 part-[label]:basis-1/2 part-[label]:overflow-hidden` ,
147- tw `part-[suffix]:order-3 part-[suffix]:basis-full part-[suffix]:overflow-hidden` ,
148- i && tw `border-t` ,
149- ) }
143+ < btrix-popover
144+ class ="part-[body]:w-64 "
145+ placement ="left "
146+ trigger ="hover "
147+ hoist
150148 >
151- < span class ="font-medium "> ${ profile . name } </ span >
152- < span
153- class ="whitespace-nowrap text-xs text-neutral-500 "
154- slot ="prefix "
155- >
156- ${ this . localize . relativeDate (
157- profile . modified || profile . created ,
158- { capitalize : true } ,
149+ < div slot ="content "> ${ this . renderOverview ( profile ) } </ div >
150+
151+ < sl-option
152+ value =${ profile . id }
153+ class =${ clsx (
154+ tw `part-[base]:flex-wrap` ,
155+ tw `part-[label]:basis-1/2 part-[label]:overflow-hidden` ,
156+ tw `part-[suffix]:basis-full part-[suffix]:overflow-hidden` ,
157+ i && tw `border-t` ,
159158 ) }
160- </ span >
161- < div
162- slot ="suffix "
163- class ="flex w-full items-center justify-between gap-1.5 overflow-hidden pl-2.5 pt-0.5 "
164159 >
165- < btrix-code
166- class ="w-0 flex-1 text-xs "
167- language ="url "
168- value =${ profile . origins [ 0 ] }
169- noWrap
170- truncate
171- > </ btrix-code >
172- ${ when (
173- profile . proxyId ,
174- ( proxyId ) => html `
175- < btrix-proxy-badge proxyId =${ proxyId } > </ btrix-proxy-badge >
176- ` ,
177- ) }
178- </ div >
179- </ sl-option >
160+ < span class ="font-medium "> ${ profile . name } </ span >
161+ < div slot ="suffix " class ="w-full pl-2.5 pt-0.5 ">
162+ ${ originsWithRemainder ( profile . origins , {
163+ disablePopover : true ,
164+ } ) }
165+ </ div >
166+ </ sl-option >
167+ </ btrix-popover >
180168 ` ,
181169 ) }
182170 ${ browserProfiles && ! browserProfiles . total
@@ -222,57 +210,8 @@ export class SelectBrowserProfile extends BtrixElement {
222210
223211 private renderSelectedProfileInfo ( ) {
224212 const profileContent = ( profile : Profile ) => {
225- const modifiedByAnyDate = [
226- profile . modifiedCrawlDate ,
227- profile . modified ,
228- profile . created ,
229- ] . reduce ( ( a , b ) => ( b && a && b > a ? b : a ) , profile . created ) ;
230-
231213 return html `${ pageHeading ( { content : msg ( "Overview" ) , level : 3 } ) }
232- < section class ="mt-5 ">
233- < btrix-desc-list >
234- < btrix-desc-list-item label =${ msg ( "Description" ) } >
235- ${ profile . description
236- ? html `
237- <!-- display: inline -->
238- < div
239- class ="text-balanced whitespace-pre-line font-sans leading-relaxed text-neutral-600 "
240- > ${ profile . description } </ div
241- >
242- `
243- : none }
244- </ btrix-desc-list-item >
245- < btrix-desc-list-item label =${ msg ( "Tags" ) } >
246- ${ profile . tags . length
247- ? html `< div class ="mt-1 flex flex-wrap gap-1.5 ">
248- ${ profile . tags . map (
249- ( tag ) => html `< btrix-tag > ${ tag } </ btrix-tag > ` ,
250- ) }
251- </ div > `
252- : none }
253- </ btrix-desc-list-item >
254- < btrix-desc-list-item label =${ msg ( "Crawler Channel" ) } >
255- < btrix-crawler-channel-badge
256- channelId =${ profile . crawlerChannel ||
257- CrawlerChannelImage . Default }
258- > </ btrix-crawler-channel-badge >
259- </ btrix-desc-list-item >
260- ${ when (
261- profile . proxyId ,
262- ( proxyId ) => html `
263- < btrix-desc-list-item label =${ msg ( "Proxy" ) } >
264- < btrix-proxy-badge proxyId =${ proxyId } > </ btrix-proxy-badge >
265- </ btrix-desc-list-item >
266- ` ,
267- ) }
268- < btrix-desc-list-item label =${ msg ( "Last Modified" ) } >
269- ${ this . localize . relativeDate (
270- modifiedByAnyDate || profile . created ,
271- { capitalize : true } ,
272- ) }
273- </ btrix-desc-list-item >
274- </ btrix-desc-list >
275- </ section >
214+ < section class ="mt-5 "> ${ this . renderOverview ( profile ) } </ section >
276215
277216 < sl-divider class ="my-5 "> </ sl-divider >
278217
@@ -327,6 +266,53 @@ export class SelectBrowserProfile extends BtrixElement {
327266 </ sl-drawer > ` ;
328267 }
329268
269+ private readonly renderOverview = ( profile : Profile ) => {
270+ const modifiedByAnyDate = [
271+ profile . modifiedCrawlDate ,
272+ profile . modified ,
273+ profile . created ,
274+ ] . reduce ( ( a , b ) => ( b && a && b > a ? b : a ) , profile . created ) ;
275+
276+ return html `< btrix-desc-list >
277+ < btrix-desc-list-item label =${ msg ( "Description" ) } >
278+ ${ profile . description
279+ ? html `
280+ <!-- display: inline -->
281+ < div
282+ class ="text-balanced line-clamp-2 whitespace-pre-line font-sans leading-relaxed text-neutral-600 "
283+ > ${ profile . description } </ div
284+ >
285+ `
286+ : none }
287+ </ btrix-desc-list-item >
288+ < btrix-desc-list-item label =${ msg ( "Tags" ) } >
289+ ${ profile . tags . length
290+ ? html `< div class ="mt-1 flex flex-wrap gap-1.5 ">
291+ ${ profile . tags . map ( ( tag ) => html `< btrix-tag > ${ tag } </ btrix-tag > ` ) }
292+ </ div > `
293+ : none }
294+ </ btrix-desc-list-item >
295+ < btrix-desc-list-item label =${ msg ( "Crawler Channel" ) } >
296+ < btrix-crawler-channel-badge
297+ channelId =${ profile . crawlerChannel || CrawlerChannelImage . Default }
298+ > </ btrix-crawler-channel-badge >
299+ </ btrix-desc-list-item >
300+ ${ when (
301+ profile . proxyId ,
302+ ( proxyId ) => html `
303+ < btrix-desc-list-item label =${ msg ( "Proxy" ) } >
304+ < btrix-proxy-badge proxyId =${ proxyId } > </ btrix-proxy-badge >
305+ </ btrix-desc-list-item >
306+ ` ,
307+ ) }
308+ < btrix-desc-list-item label =${ msg ( "Last Modified" ) } >
309+ ${ this . localize . relativeDate ( modifiedByAnyDate || profile . created , {
310+ capitalize : true ,
311+ } ) }
312+ </ btrix-desc-list-item >
313+ </ btrix-desc-list > ` ;
314+ } ;
315+
330316 private renderNoProfiles ( ) {
331317 return html `
332318 < div class ="mx-2 text-sm text-neutral-500 ">
0 commit comments