1- import { For , Show , createMemo } from "solid-js" ;
1+ import { For , Show , Switch , Match , createMemo } from "solid-js" ;
22import { config } from "../../stores/config" ;
33import { viewState , ignoreItem , untrackItem , moveTrackedItem } from "../../stores/view" ;
44import type { Issue , PullRequest } from "../../services/api" ;
55import ItemRow from "./ItemRow" ;
6+ import { Tooltip } from "../shared/Tooltip" ;
67
78export interface TrackedTabProps {
89 issues : Issue [ ] ;
@@ -23,28 +24,26 @@ export default function TrackedTab(props: TrackedTabProps) {
2324 return { issueMap, prMap } ;
2425 } ) ;
2526
26- const trackedItems = ( ) => viewState . trackedItems ;
27-
2827 return (
2928 < div class = "flex flex-col h-full" >
3029 < Show
31- when = { trackedItems ( ) . length > 0 }
30+ when = { viewState . trackedItems . length > 0 }
3231 fallback = {
3332 < div class = "flex items-center justify-center py-16 text-center text-base-content/50 text-sm px-4" >
3433 No tracked items. Pin issues or PRs from the Issues and Pull Requests tabs.
3534 </ div >
3635 }
3736 >
3837 < div class = "divide-y divide-base-300" >
39- < For each = { trackedItems ( ) } >
38+ < For each = { viewState . trackedItems } >
4039 { ( item , index ) => {
4140 const liveData = ( ) =>
4241 item . type === "issue"
4342 ? maps ( ) . issueMap . get ( item . id )
4443 : maps ( ) . prMap . get ( item . id ) ;
4544
4645 const isFirst = ( ) => index ( ) === 0 ;
47- const isLast = ( ) => index ( ) === trackedItems ( ) . length - 1 ;
46+ const isLast = ( ) => index ( ) === viewState . trackedItems . length - 1 ;
4847
4948 return (
5049 < div class = "flex items-center gap-1" >
@@ -80,27 +79,30 @@ export default function TrackedTab(props: TrackedTabProps) {
8079 < span class = "font-medium text-sm text-base-content truncate" >
8180 { item . title }
8281 </ span >
83- < Show when = { item . type === "issue" } >
84- < span class = "badge badge-outline badge-sm badge-info" > Issue</ span >
85- </ Show >
86- < Show when = { item . type === "pullRequest" } >
87- < span class = "badge badge-outline badge-sm badge-success" > PR</ span >
88- </ Show >
82+ < Switch >
83+ < Match when = { item . type === "issue" } >
84+ < span class = "badge badge-outline badge-sm badge-info" > Issue</ span >
85+ </ Match >
86+ < Match when = { item . type === "pullRequest" } >
87+ < span class = "badge badge-outline badge-sm badge-success" > PR</ span >
88+ </ Match >
89+ </ Switch >
8990 </ div >
9091 < div class = "text-xs text-base-content/60 mt-0.5" >
9192 { item . repoFullName } { " " }
9293 < span class = "text-base-content/40" > (not in current data)</ span >
9394 </ div >
9495 </ div >
95- < button
96- class = "relative z-10 shrink-0 self-center rounded p-1 text-primary transition-opacity focus:outline-none focus:ring-2 focus:ring-primary"
97- aria-label = { `Unpin ${ item . title } ` }
98- title = "Untrack this item"
99- onClick = { ( ) => untrackItem ( item . id , item . type ) }
100- >
96+ < Tooltip content = "Untrack this item" >
97+ < button
98+ class = "relative z-10 shrink-0 self-center rounded p-1 text-primary transition-opacity focus:outline-none focus:ring-2 focus:ring-primary"
99+ aria-label = { `Unpin # ${ item . number } ${ item . title } ` }
100+ onClick = { ( ) => untrackItem ( item . id , item . type ) }
101+ >
101102 { /* Solid bookmark */ }
102- < svg xmlns = "http://www.w3.org/2000/svg" viewBox = "0 0 24 24" fill = "currentColor" class = "h-4 w-4" > < path fill-rule = "evenodd" d = "M6.32 2.577a49.255 49.255 0 0 1 11.36 0c1.497.174 2.57 1.46 2.57 2.93V21a.75.75 0 0 1-1.085.67L12 18.089l-7.165 3.583A.75.75 0 0 1 3.75 21V5.507c0-1.47 1.073-2.756 2.57-2.93Z" clip-rule = "evenodd" /> </ svg >
103- </ button >
103+ < svg xmlns = "http://www.w3.org/2000/svg" viewBox = "0 0 24 24" fill = "currentColor" class = "h-4 w-4" > < path fill-rule = "evenodd" d = "M6.32 2.577a49.255 49.255 0 0 1 11.36 0c1.497.174 2.57 1.46 2.57 2.93V21a.75.75 0 0 1-1.085.67L12 18.089l-7.165 3.583A.75.75 0 0 1 3.75 21V5.507c0-1.47 1.073-2.756 2.57-2.93Z" clip-rule = "evenodd" /> </ svg >
104+ </ button >
105+ </ Tooltip >
104106 </ div >
105107 }
106108 >
@@ -130,12 +132,14 @@ export default function TrackedTab(props: TrackedTabProps) {
130132 } }
131133 density = { config . viewDensity }
132134 >
133- < Show when = { item . type === "issue" } >
134- < span class = "badge badge-outline badge-sm badge-info" > Issue</ span >
135- </ Show >
136- < Show when = { item . type === "pullRequest" } >
137- < span class = "badge badge-outline badge-sm badge-success" > PR</ span >
138- </ Show >
135+ < Switch >
136+ < Match when = { item . type === "issue" } >
137+ < span class = "badge badge-outline badge-sm badge-info" > Issue</ span >
138+ </ Match >
139+ < Match when = { item . type === "pullRequest" } >
140+ < span class = "badge badge-outline badge-sm badge-success" > PR</ span >
141+ </ Match >
142+ </ Switch >
139143 </ ItemRow >
140144 ) }
141145 </ Show >
0 commit comments