Skip to content

Commit

Permalink
Merge pull request #13 from JuckZ/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
JuckZ authored Mar 7, 2023
2 parents ca16b63 + e671048 commit 5894f18
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export default class AwesomeBrainManagerPlugin extends Plugin {
createTime,
spend: '0',
breaknum: '0',
expectedTime: (SETTINGS.expectedTime.value * 60 * 1000).toString(),
expectedTime: (parseFloat(SETTINGS.expectedTime.value) * 60 * 1000).toString(),
status: 'todo',
tags: tagsStr,
};
Expand Down
6 changes: 3 additions & 3 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Settings {
powerMode: SettingModel<string, string>;
shakeMode: SettingModel<boolean, boolean>;
toolbar: SettingModel<boolean, boolean>;
expectedTime: SettingModel<number, number>;
expectedTime: SettingModel<string, string>;
clickString: SettingModel<string, string>;
customTag: SettingModel<string, string>;
debugEnable: SettingModel<boolean, boolean>;
Expand Down Expand Up @@ -72,7 +72,7 @@ class Settings {
.key('expectedTime')
.name(t.setting.expectedTime.name)
.desc(t.setting.expectedTime.desc)
.number(25)
.text('25')
.build(new RawSerde());

this.clickString = this.settings
Expand Down Expand Up @@ -161,7 +161,7 @@ class Settings {
.desc(
'Change value to your ntfy server address, or use the ntfy official address https://ntfy.sh/change_to_your_topic_name, or disable if empty. Notice: Please learn how to use it from official documents to ensure information security!!!',
)
.text('https://ntfy.sh/change_to_your_topic_name')
.text('')
.build(new RawSerde());

this.ntfyToken = this.settings
Expand Down
24 changes: 23 additions & 1 deletion src/ui/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@
<Teleport to="body" disable="false">
<Toolbar />
</Teleport>
<Teleport to="body" disable="false">
<NModal
v-model:show="showModal"
preset="dialog"
title="确认"
content="你确认?"
positive-text="确认"
negative-text="算了"
@positive-click="submitCallback"
@negative-click="cancelCallback"
/>
</Teleport>
<!-- <Teleport to="#awesome-brain-manager-pomodoro-history-view" disable="false">
<Toolbar />
</Teleport> -->
Expand All @@ -26,6 +38,7 @@ import {
type GlobalThemeOverrides,
NConfigProvider,
NMessageProvider,
NModal,
NNotificationProvider,
NSpace,
darkTheme,
Expand All @@ -35,7 +48,7 @@ import {
lightTheme,
zhCN,
} from 'naive-ui';
import { onMounted, onUnmounted, onUpdated, ref, watchEffect } from 'vue';
import { onUpdated, ref, watchEffect } from 'vue';
import { storeToRefs } from 'pinia';
import LoggerUtil from '../utils/logger';
import { useSystemStore } from '../stores';
Expand All @@ -44,6 +57,7 @@ import Toolbar from './Toolbar.vue';
let theme = ref(darkTheme);
let locale = ref(zhCN);
let dateLocale = ref(dateZhCN);
const showModal = ref(false);
const { systemState } = storeToRefs(useSystemStore());
Expand All @@ -66,6 +80,14 @@ const lightThemeOverrides: GlobalThemeOverrides = {};
const darkThemeOverrides: GlobalThemeOverrides = {};
const submitCallback = () => {
console.log('submitCallback');
};
const cancelCallback = () => {
console.log('cancelCallback');
};
onUpdated(() => {
LoggerUtil.log('app updated');
});
Expand Down
4 changes: 2 additions & 2 deletions src/ui/ClockView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ const { currentPomodoro } = storeToRefs(usePomodoroStore());
function updateTime() {
const pomodoro = currentPomodoro.value;
if (!pomodoro) {
if (!pomodoro || pomodoro.status !== 'ing') {
return;
}
currentSpend.value = moment().valueOf() - parseInt(pomodoro.lastactive) + parseInt(pomodoro.spend);
// 转换成毫秒
expectedTime.value = parseInt(pomodoro.expectedTime);
expectedTime.value = parseFloat(pomodoro.expectedTime);
const leftTime = moment.duration(expectedTime.value - currentSpend.value, 'milliseconds');
time.value = moment.utc(leftTime.asMilliseconds()).format('HH:mm:ss');
}
Expand Down
6 changes: 4 additions & 2 deletions src/ui/modal/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,10 @@ export class PomodoroReminderModal extends Modal {

onOpen() {
const { contentEl } = this;

contentEl.createEl('h2', { text: t.info.done + this.pomodoro.task });
contentEl.createEl('h2', { text: t.info.done });
contentEl.createEl('div', {
text: `✅ ${this.pomodoro.task}`,
});
}

onClose() {
Expand Down

0 comments on commit 5894f18

Please sign in to comment.