File tree Expand file tree Collapse file tree 2 files changed +16
-18
lines changed Expand file tree Collapse file tree 2 files changed +16
-18
lines changed Original file line number Diff line number Diff line change 1
1
<script lang =" ts" >
2
+ import { onMount } from " svelte" ;
2
3
import { get } from " svelte/store" ;
3
- import { browser } from " $app/environment" ;
4
4
import { localStorageStore } from " $lib/localStorageStore" ;
5
5
6
6
/**
7
7
* The name of the localStorage item to get the date from.
8
8
*/
9
9
export let storedDateItem: string ;
10
+ /**
11
+ * Whether to show the pulse animation.
12
+ */
13
+ export let show = false ;
10
14
11
- let showPulse = false ;
15
+ let shouldShowPulse = false ;
12
16
13
- $ : if ( storedDateItem && browser ) {
17
+ onMount (() => {
14
18
const storedDateStore = localStorageStore (storedDateItem , " " );
15
- const storedDate = get (storedDateStore );
19
+ const storedDate = get (storedDateStore ). replace ( / " / g , " " ) ;
16
20
const lastVisitItem = localStorage .getItem (" lastVisit" );
17
21
if (storedDate && lastVisitItem ) {
18
- showPulse = new Date (storedDate ) > new Date (lastVisitItem );
22
+ shouldShowPulse = new Date (storedDate ) > new Date (lastVisitItem );
19
23
}
20
- }
24
+ });
21
25
</script >
22
26
23
- {#if showPulse }
27
+ {#if show && shouldShowPulse }
24
28
<div class =" relative inline-flex" >
25
29
<slot />
26
30
<span class =" absolute right-0 top-0 -mr-0.5 -mt-0.5 flex size-2.5" >
Original file line number Diff line number Diff line change 262
262
>
263
263
<Tabs .List class =" bg-input dark:bg-muted" >
264
264
{#each typedEntries (repos ) as [id, { name }]}
265
- {#if ! visitedTabs .includes (id ) && id !== currentRepo }
266
- <BlinkingBadge storedDateItem =" {id .toLowerCase ()}MostRecentUpdate" >
267
- <Tabs .Trigger
268
- class =" data-[state=inactive]:text-foreground/60 data-[state=inactive]:hover:bg-background/50 data-[state=active]:hover:text-foreground/75 data-[state=inactive]:hover:text-foreground dark:data-[state=inactive]:hover:bg-background/25"
269
- value ={id }
270
- >
271
- {name }
272
- </Tabs .Trigger >
273
- </BlinkingBadge >
274
- {:else }
265
+ <BlinkingBadge
266
+ storedDateItem =" {id .toLowerCase ()}MostRecentUpdate"
267
+ show ={! visitedTabs .includes (id ) && id !== currentRepo }
268
+ >
275
269
<Tabs .Trigger
276
270
class =" data-[state=inactive]:text-foreground/60 data-[state=inactive]:hover:bg-background/50 data-[state=active]:hover:text-foreground/75 data-[state=inactive]:hover:text-foreground dark:data-[state=inactive]:hover:bg-background/25"
277
271
value ={id }
278
272
>
279
273
{name }
280
274
</Tabs .Trigger >
281
- { /if }
275
+ </ BlinkingBadge >
282
276
{/each }
283
277
</Tabs .List >
284
278
<div class =" ml-auto flex items-center space-x-2 xs:ml-0" >
You can’t perform that action at this time.
0 commit comments