Skip to content

Commit caf9893

Browse files
committed
fix(tray-binary): fix sync state parsing, version display, add close button
- Parse versioned sync-state.json format (categories nested under struct) - Fix double-v in version display (git describe already includes v prefix) - Add close button to dashboard panel header
1 parent a772409 commit caf9893

4 files changed

Lines changed: 36 additions & 4 deletions

File tree

cmd/sap-devs-tray/frontend/css/app.css

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,27 @@ body {
3333
}
3434

3535
.panel-header .version {
36-
margin-left: auto;
3736
font-size: 12px;
3837
color: var(--sapContent_LabelColor, #6a6d70);
3938
}
4039

40+
.panel-header .close-btn {
41+
margin-left: auto;
42+
background: none;
43+
border: none;
44+
font-size: 18px;
45+
cursor: pointer;
46+
color: var(--sapContent_LabelColor, #6a6d70);
47+
padding: 2px 6px;
48+
border-radius: 4px;
49+
line-height: 1;
50+
}
51+
52+
.panel-header .close-btn:hover {
53+
background: var(--sapNeutralBackground, #eaecee);
54+
color: var(--sapTextColor, #32363a);
55+
}
56+
4157
.status-card, .profile-card, .tools-card {
4258
margin: 0 16px 12px;
4359
padding: 14px;

cmd/sap-devs-tray/frontend/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
</svg>
1818
<span class="title">sap-devs</span>
1919
<span class="version" id="version">v...</span>
20+
<button type="button" class="close-btn" id="btn-close" title="Close">&times;</button>
2021
</div>
2122

2223
<div class="status-card">

cmd/sap-devs-tray/frontend/js/app.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@
4242

4343
setText('profile-name', state.profile.name || state.profile.id);
4444
setText('profile-id', state.profile.id);
45-
setText('version', 'v' + state.version);
45+
var ver = state.version;
46+
setText('version', ver.charAt(0) === 'v' ? ver : 'v' + ver);
4647
}
4748

4849
function setText(id, text) {
@@ -76,6 +77,17 @@
7677
}
7778

7879
document.addEventListener('DOMContentLoaded', function() {
80+
var btnClose = document.getElementById('btn-close');
81+
if (btnClose) {
82+
btnClose.addEventListener('click', function() {
83+
if (window.wails && window.wails.Window) {
84+
window.wails.Window.Hide();
85+
} else {
86+
window.close();
87+
}
88+
});
89+
}
90+
7991
var btnSync = document.getElementById('btn-sync');
8092
if (btnSync) {
8193
btnSync.addEventListener('click', function() {

cmd/sap-devs-tray/state.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,16 @@ func readSyncState(cacheDir string) SyncState {
4444
if err != nil {
4545
return SyncState{Status: "unknown"}
4646
}
47-
var raw map[string]time.Time
47+
var raw struct {
48+
Version int `json:"version"`
49+
Categories map[string]time.Time `json:"categories"`
50+
}
4851
if err := json.Unmarshal(data, &raw); err != nil {
4952
return SyncState{Status: "unknown"}
5053
}
5154
var latest time.Time
5255
count := 0
53-
for _, t := range raw {
56+
for _, t := range raw.Categories {
5457
count++
5558
if t.After(latest) {
5659
latest = t

0 commit comments

Comments
 (0)