File tree Expand file tree Collapse file tree 4 files changed +35
-7
lines changed
Expand file tree Collapse file tree 4 files changed +35
-7
lines changed Original file line number Diff line number Diff line change 1- import { useEffect , useState } from "react" ;
1+ import { useCallback , useEffect , useState } from "react" ;
2+ import { Tags } from "lucide-react" ;
3+
24import { closeWindow , getVersion } from "../../utils/desktopTools" ;
35
46import "./style.css" ;
57
68export function AppBar ( ) {
7- const [ version , setVersion ] = useState < string > ( "v0" ) ;
9+ const [ version , setVersion ] = useState < {
10+ [ key : string ] : string ;
11+ } > ( { } ) ;
12+
13+ const showVersions = useCallback ( ( ) => {
14+ const versionMessage = Object . entries ( version ) . map (
15+ v => `${ v [ 0 ] } : ${ v [ 1 ] } `
16+ ) . join ( "\n" ) ;
17+
18+ alert ( versionMessage ) ;
19+ } , [ version ] ) ;
820
921 useEffect ( ( ) => {
1022 ( async ( ) => {
@@ -24,7 +36,7 @@ export function AppBar() {
2436 </ div >
2537
2638 < div className = "version-info" >
27- Launcher { version }
39+ < Tags className = " version-button" onClick = { showVersions } />
2840 </ div >
2941 </ div >
3042 </ > ) ;
Original file line number Diff line number Diff line change 6060}
6161
6262.version-info {
63- padding : 0.25 rem ;
63+ padding : 1 rem ;
6464 font-size : 0.75rem ;
6565 font-weight : 200 ;
66+ pointer-events : all;
67+ }
68+
69+ .version-button {
70+ width : 1rem ;
71+ height : 1rem ;
72+ opacity : 0.5 ;
73+ cursor : pointer;
74+ }
75+
76+ .version-button : hover {
77+ opacity : 1 ;
78+ }
79+
80+ .version-button : active {
81+ transform : scale (0.5 );
6682}
6783
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ export interface PyWebview {
44 open_project : ( project_id : string ) => Promise < void > ;
55 get_data : ( ) => Promise < string > ;
66 store_data : ( data : string ) => Promise < boolean > ;
7- get_version : ( ) => Promise < string > ;
7+ get_version : ( ) => Promise < { [ key : string ] : string ; } > ;
88 check_updates : ( ) => Promise < boolean > ;
99 update : ( ) => Promise < void > ;
1010 }
Original file line number Diff line number Diff line change @@ -48,9 +48,9 @@ const setupDesktopTools = () => {
4848 return await getApi ( ) ?. store_data ( data ) || false ;
4949 }
5050
51- const getVersion = async ( ) : Promise < string > => {
51+ const getVersion = async ( ) : Promise < { [ key : string ] : string ; } > => {
5252 await waitForPWV ( ) ;
53- return await getApi ( ) ?. get_version ( ) || "v0" ;
53+ return await getApi ( ) ?. get_version ( ) || { } ;
5454 }
5555
5656 const checkUpdates = async ( ) : Promise < boolean > => {
You can’t perform that action at this time.
0 commit comments