Skip to content

Commit 8691acd

Browse files
committed
make recap record of history tasks
this fix #135
1 parent efca297 commit 8691acd

8 files changed

Lines changed: 336 additions & 23 deletions

File tree

locales/en.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,14 @@
154154
"statistics-work-time": "Work time",
155155
"statistics-rest-time": "Rest time",
156156
"statistics-time-sum": "All together",
157+
"recap": "Recap",
158+
"time-statistics": "Time Statistics",
159+
"recap-empty": "No completed tasks recorded yet.",
160+
"recap-delete-entry": "Delete this entry",
161+
"recap-delete-date": "Delete all entries on this date",
162+
"recap-delete-title": "Delete Recap Entry",
163+
"recap-delete-entry-confirm": "Are you sure you want to delete this entry?",
164+
"recap-delete-date-confirm": "Are you sure you want to delete all entries on",
157165
"today": "Today",
158166
"yesterday": "Yesterday",
159167
"this-week": "This Week",

locales/zh-CN.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,14 @@
157157
"statistics-work-time": "工作时间",
158158
"statistics-rest-time": "休息时间",
159159
"statistics-time-sum": "时间总计",
160+
"recap": "完成回顾",
161+
"time-statistics": "时间统计",
162+
"recap-empty": "还没有记录任何完成的内容。",
163+
"recap-delete-entry": "删除这条记录",
164+
"recap-delete-date": "删除当天的所有记录",
165+
"recap-delete-title": "删除回顾记录",
166+
"recap-delete-entry-confirm": "确定要删除这条记录吗?",
167+
"recap-delete-date-confirm": "确定要删除该天的所有记录吗:",
160168
"today": "今天",
161169
"yesterday": "昨天",
162170
"this-week": "本周",

locales/zh-TW.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,14 @@
150150
"statistics-work-time": "工作時間",
151151
"statistics-rest-time": "休息時間",
152152
"statistics-time-sum": "時間總計",
153+
"recap": "完成回顧",
154+
"time-statistics": "時間統計",
155+
"recap-empty": "還沒有記錄任何完成的內容。",
156+
"recap-delete-entry": "刪除這條記錄",
157+
"recap-delete-date": "刪除當天的所有記錄",
158+
"recap-delete-title": "刪除回顧記錄",
159+
"recap-delete-entry-confirm": "確定要刪除這條記錄嗎?",
160+
"recap-delete-date-confirm": "確定要刪除該天的所有記錄嗎:",
153161
"today": "今天",
154162
"yesterday": "昨天",
155163
"this-week": "本週",

main.js

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ let win = null, settingsWin = null, aboutWin = null, tourWin = null, floatingWin
3232
kioskInterval = null,
3333
recorderDate = null, tempDate = null, yearAndMon = null, yearMonDay = null, year = null,
3434
estimCurrent = 0, todaySum = 0,
35-
store = null, styleCache = null, statistics = null, timingData = null,
35+
store = null, styleCache = null, statistics = null, timingData = null, recapStore = null,
3636
personalizationNotificationList = [[], [], [], [], [], []],
3737
isMultiMonitorLoose = false;
3838

@@ -396,9 +396,11 @@ app.on('ready', () => {
396396
if (process.env.NODE_ENV === "portable") {
397397
store = new Store({ cwd: app.getPath('exe').replace("wnr.exe", ""), name: 'wnr-config' });//accept portable
398398
statistics = new Store({ cwd: app.getPath('exe').replace("wnr.exe", ""), name: 'wnr-statistics' });
399+
recapStore = new Store({ cwd: app.getPath('exe').replace("wnr.exe", ""), name: 'wnr-recap' });
399400
} else {
400401
store = new Store();
401402
statistics = new Store({ name: 'statistics' });
403+
recapStore = new Store({ name: 'recap' });
402404
}
403405
styleCache = new Store({ name: 'style-cache' });
404406
timingData = new Store({ name: 'timing-data' });
@@ -1894,6 +1896,34 @@ ipcMain.on('warning-giver-all-task-end', function () {
18941896
traySolution(isFullscreenMode);
18951897
})
18961898

1899+
ipcMain.on('save-recap-entry', function (event, data) {
1900+
if (!recapStore.has('entries')) {
1901+
recapStore.set('entries', []);
1902+
}
1903+
let entries = recapStore.get('entries');
1904+
entries.push({
1905+
title: data.title,
1906+
note: data.note,
1907+
sessionId: data.sessionId,
1908+
timestamp: data.timestamp,
1909+
date: new Date(data.timestamp).toISOString().split('T')[0],
1910+
method: data.method,
1911+
isOnlyRest: data.isOnlyRest
1912+
});
1913+
recapStore.set('entries', entries);
1914+
})
1915+
1916+
ipcMain.on('recap-delete-confirm', function (event, data) {
1917+
let confirmMsg = "";
1918+
if (data.type === 'entry') {
1919+
confirmMsg = i18n.__('recap-delete-entry-confirm');
1920+
} else if (data.type === 'date') {
1921+
confirmMsg = i18n.__('recap-delete-date-confirm') + " " + data.date + "?";
1922+
}
1923+
customDialog("select_on", i18n.__('recap-delete-title'), confirmMsg,
1924+
"win.webContents.send('recap-delete-execute', " + JSON.stringify(data) + ");");
1925+
})
1926+
18971927
ipcMain.on('update-feedback', function (event, message) {
18981928
// another button usage: button3_update
18991929
if (message === "update-available") {
@@ -1927,7 +1957,7 @@ ipcMain.on('can-redo-alert', function () {
19271957

19281958
ipcMain.on('delete-all-data', function () {
19291959
if (settingsWin != null) {
1930-
customDialog("select_on", i18n.__('delete-all-data-dialog-box-title'), i18n.__('delete-all-data-dialog-box-content'), "store.clear();statistics.clear();styleCache.clear();timingData.clear();relaunchSolution()");
1960+
customDialog("select_on", i18n.__('delete-all-data-dialog-box-title'), i18n.__('delete-all-data-dialog-box-content'), "store.clear();statistics.clear();styleCache.clear();timingData.clear();recapStore.clear();relaunchSolution()");
19311961
}
19321962
})
19331963

renderer.js

Lines changed: 50 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,32 @@ let titleAlternative = {
2424
y: 20,
2525
tipElements: "a, i, span, img, div, input",
2626
noTitle: false,
27+
bottomTooltipSelectors: ['#statistics-back', '#back-index', '#statistics-back i'],
28+
bottomTooltipMargin: 80,
29+
isBottomTooltipElement: function(element) {
30+
let $element = $(element);
31+
for (let i = 0; i < this.bottomTooltipSelectors.length; i++) {
32+
let selector = this.bottomTooltipSelectors[i];
33+
if ($element.is(selector)) {
34+
return true;
35+
}
36+
let $container = $(selector);
37+
if ($container.length > 0 && $container[0].contains && $container[0].contains(element)) {
38+
return true;
39+
}
40+
if ($element.closest(selector).length > 0) {
41+
return true;
42+
}
43+
}
44+
return false;
45+
},
46+
isNearBottomEdge: function(pageY) {
47+
if (!window || !window.innerHeight) return false;
48+
return pageY > (window.innerHeight - this.bottomTooltipMargin);
49+
},
2750
init: function () {
2851
let b = this.noTitle, isTitle;
52+
let self = this;
2953
$(this.tipElements).each(function () {
3054
$(this).mouseover(function (e) {
3155
if (b) {
@@ -36,23 +60,40 @@ let titleAlternative = {
3660
if (isTitle) {
3761
this.myTitle = this.title;
3862
this.title = "";
39-
let a = "<div class='tipsy'><div class='tipsy-arrow tipsy-arrow-n'></div><div class='tipsy-inner'>" + this.myTitle + "</div></div>";
63+
let isBottomTooltip = self.isBottomTooltipElement(this) || self.isNearBottomEdge(e.pageY);
64+
let arrowClass = isBottomTooltip ? 'tipsy-arrow-s' : 'tipsy-arrow-n';
65+
let a = "<div class='tipsy'><div class='tipsy-arrow " + arrowClass + "'></div><div class='tipsy-inner'>" + this.myTitle + "</div></div>";
4066
$('body').append(a);
41-
$('.tipsy').css({
42-
"top": (e.pageY + 24) + "px",
43-
"left": (e.pageX - 24) + "px"
44-
}).show('fast');
67+
if (isBottomTooltip) {
68+
$('.tipsy').css({
69+
"top": (e.pageY - 40) + "px",
70+
"left": (e.pageX - 24) + "px"
71+
}).show('fast');
72+
} else {
73+
$('.tipsy').css({
74+
"top": (e.pageY + 24) + "px",
75+
"left": (e.pageX - 24) + "px"
76+
}).show('fast');
77+
}
4578
}
4679
}).mouseout(function () {
4780
if (this.myTitle != null) {
4881
this.title = this.myTitle;
4982
$('.tipsy').remove()
5083
}
5184
}).mousemove(function (e) {
52-
$('.tipsy').css({
53-
"top": (e.pageY + 24) + "px",
54-
"left": (e.pageX - 24) + "px"
55-
}).show('fast');
85+
let isBottomTooltip = self.isBottomTooltipElement(this) || self.isNearBottomEdge(e.pageY);
86+
if (isBottomTooltip) {
87+
$('.tipsy').css({
88+
"top": (e.pageY - 40) + "px",
89+
"left": (e.pageX - 24) + "px"
90+
}).show('fast');
91+
} else {
92+
$('.tipsy').css({
93+
"top": (e.pageY + 24) + "px",
94+
"left": (e.pageX - 24) + "px"
95+
}).show('fast');
96+
}
5697
})
5798
})
5899
}

0 commit comments

Comments
 (0)