11<script setup>
2- const platforms = {
3- ' macos_x86' : ' universal.dmg' ,
4- ' macos_arm' : ' universal.dmg' ,
5- ' windows_x86' : ' x64.Setup.exe' ,
6- ' windows_arm' : ' arm64.Setup.exe' ,
7- ' linux_x86' : ' _amd64.deb' ,
8- ' linux_arm' : ' _arm64.deb'
9- };
2+ const availablePlatform = [
3+ {
4+ platform: ' macOS' ,
5+ binaries: [{
6+ name: ' Universal.dmg' ,
7+ tail: ' universal.dmg'
8+ }]
9+ },
10+ {
11+ platform: ' Windows' ,
12+ binaries: [{
13+ name: ' x86_64.setup.exe' ,
14+ tail: ' x64-setup.exe'
15+ }]
16+ },
17+ {
18+ platform: ' Linux' ,
19+ binaries: [
20+ {
21+ name: ' x86_64.deb' ,
22+ tail: ' amd64.deb'
23+ },
24+ {
25+ name: ' x86_64.AppImage' ,
26+ tail: ' amd64.AppImage'
27+ }
28+ ]
29+ }
30+ ];
31+
1032const getLatestLinks = async () => {
1133 const data = await fetch (' https://api.github.com/repos/geek-fun/dockit/releases/latest' )
1234 .then ((res ) => res .json ())
@@ -16,51 +38,80 @@ const getLatestLinks = async () => {
1638 url: item .browser_download_url
1739 }));
1840}
41+ const downloadBinary = async (binaryTail ) => {
1942
20- const downloadFn = async ( event ) => {
21- const { architecture , platform } = await navigator . userAgentData . getHighEntropyValues ([ ' architecture ' ] );
22- const links = await getLatestLinks ();
23- const link = links . find (( item ) => item . name . endsWith (platforms[ ` ${ platform } _ ${ architecture } ` . toLowerCase ()]) );
24- if (link) {
25- window . open ( link . url , ' _blank ' ). focus ();
26- } else {
27- console .error ( ' downloadFn ' , ' no link found ' )
43+ const links = await getLatestLinks ();
44+ const link = links . find (( item ) => item . name . endsWith (binaryTail) );
45+ if (link) {
46+ window . open ( link . url , ' _blank ' ). focus ( );
47+ } else {
48+ console . error ( ' downloadBinary ' , ' no link found ' )
49+ }
50+ console .log ( ' downloadBinary ' , { links } )
2851 }
29- console .log (' downloadFn' , {
30- links,
31- entropyValues: {architecture, platform}
32- })
33- }
3452 </script >
3553<template >
54+ <div class =" download-box" >
55+ <div class =" card" v-for =" platform in availablePlatform" :key =" platform.platform" >
56+ <div class =" card-body" >
57+ <h5 class =" card-title" >{{ platform.platform }}</h5 >
58+ <button class =" downloadButton" @click =" downloadBinary(binary.tail)"
59+ v-for =" binary in platform.binaries" :key =" binary.name" ><span >{{ binary.name }}</span >
60+ <span class =" download-arrow" >
61+ <svg width =" 24px" height =" 24px" viewBox =" 0 0 24 24" fill =" none" xmlns =" http://www.w3.org/2000/svg" ><path
62+ d =" M12 12V19M12 19L9.75 16.6667M12 19L14.25 16.6667M6.6 17.8333C4.61178 17.8333 3 16.1917 3 14.1667C3 12.498 4.09438 11.0897 5.59198 10.6457C5.65562 10.6268 5.7 10.5675 5.7 10.5C5.7 7.46243 8.11766 5 11.1 5C14.0823 5 16.5 7.46243 16.5 10.5C16.5 10.5582 16.5536 10.6014 16.6094 10.5887C16.8638 10.5306 17.1284 10.5 17.4 10.5C19.3882 10.5 21 12.1416 21 14.1667C21 16.1917 19.3882 17.8333 17.4 17.8333"
63+ stroke =" #464455" stroke-linecap =" round" stroke-linejoin =" round" /></svg >
64+
65+ </span >
66+ </button >
67+ </div >
68+ </div >
69+ </div >
3670 <p >
3771 Download the the latest of DocKit for your platform, or you can find the historic/cross-platforms version in
3872 <a href =" https://github.com/geek-fun/dockit/releases" >github release</a >
3973 </p >
40- <button :class =" $style.downloadButton" @click =" downloadFn" ><i class =" fab fa-apple" ></i >Download DocKit</button >
4174</template >
42- <style module>
75+ <style scoped lang="scss">
76+ .download-box {
77+ display : flex ;
78+ // justify-content: center;
79+ justify-content : space-between ;
80+ align-items : flex-start ;
81+ flex-wrap : wrap ;
82+ }
83+
84+ .card {
85+ margin : 10px ;
86+ width : 200px ;
87+ height : 100% ;
88+ padding : 10px ;
89+ border-radius : 8px ;
90+ box-shadow : 0 0 1px 1px rgba (236 , 240 , 241 , 0.5 );
91+ }
92+
4393.downloadButton {
44- display : inline-block ;
94+ display : flex ; /* Use Flexbox */
95+ align-items : center ; /* Vertically center items */
96+ justify-content : center ;
4597 padding : 10px ;
46- font-size : 16 px ;
98+ margin : 10 px auto ;
4799 font-weight : bold ;
48100 text-align : center ;
49- text-decoration : none ;
50- background-color : #87CEFA ; /* Light Blue color */
51- color : #fff ;
52- border : 1px solid #87CEFA ; /* Light Blue color */
101+ border : 1px solid var (--vp-c-divider );
102+ background-color : var (--vp-sidebar-bg-color );
53103 border-radius : 10px ; /* Rounded corners */
54104 cursor : pointer ;
105+ width : 99% ;
55106 transition : background-color 0.3s ;
56- margin-right : 10px ; /* Add some space between buttons */
57- }
58107
59- .downloadButton :hover {
60- background-color : #6495ED ; /* Slightly darker blue on hover */
61- }
108+ & :hover {
109+ border : 1 px solid var ( --vp-c-primary );
110+ }
62111
63- .downloadButton i {
64- margin-right : 8px ; /* Adjust the space between icon and text */
112+ .download-arrow {
113+ padding-left : 10px ;
114+ }
65115}
116+
66117 </style >
0 commit comments