File tree Expand file tree Collapse file tree 1 file changed +25
-7
lines changed Expand file tree Collapse file tree 1 file changed +25
-7
lines changed Original file line number Diff line number Diff line change 22 import AsciiPreview from ' ./lib/AsciiPreview.svelte' ;
33 import data from ' ../../../languages.yaml' ;
44 import type { Languages } from ' ../../../languages.yaml' ;
5+ import { onMount } from ' svelte' ;
6+
7+ let tag_name: string ;
8+ let html_url: string ;
59
610 const languages = Object .entries (data as Languages ).map (
711 ([name , { ascii , colors }]) => ({
1014 ... colors ,
1115 })
1216 );
17+
18+ onMount (async () => {
19+ try {
20+ const response = await fetch (
21+ ' https://api.github.com/repos/o2sh/onefetch/releases/latest'
22+ );
23+ const data = await response .json ();
24+
25+ tag_name = data .tag_name ;
26+ html_url = data .html_url ;
27+ } catch (error ) {
28+ console .error (' Error:' , error );
29+ }
30+ });
1331 </script >
1432
1533<header >
16- < div class = " banner " >
17- <small
18- >Version 2.18 is available 🎉 Check the < a
19- href = " https://github.com/o2sh/onefetch/releases/tag/2.18.0 "
20- >release notes</a
21- >!!</ small >
22- </ div >
34+ { #if tag_name && html_url }
35+ <div class = " banner " >
36+ < small
37+ >Version { tag_name } is available 🎉 Check the
38+ < a href ={ html_url } >release notes</a >!!</ small >
39+ </ div >
40+ { /if }
2341 <h1 >Onefetch</h1 >
2442 <p >
2543 <small >
You can’t perform that action at this time.
0 commit comments