Skip to content

Commit 9c90e71

Browse files
feat: add tooltips (#159)
1 parent 3d9efcd commit 9c90e71

File tree

12 files changed

+94
-11
lines changed

12 files changed

+94
-11
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"axios": "^0.26.1",
4444
"date-fns": "^2.28.0",
4545
"electron-store": "^8.0.1",
46+
"floating-vue": "^2.0.0-beta.17",
4647
"fs-extra": "^10.0.1",
4748
"highlight.js": "^11.5.1",
4849
"html2canvas": "^1.4.1",

pnpm-lock.yaml

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/services/i18n/locales/en/common.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,7 @@
5050
"darkMode": "Dark Mode",
5151
"background": "Background",
5252
"restartApp": "Restart massCode",
53-
"updateAvailable": "Update Available"
53+
"updateAvailable": "Update Available",
54+
"hide": "Hide",
55+
"show": "Show"
5456
}

src/main/services/i18n/locales/en/menu.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,6 @@
6363
"format": "Format",
6464
"previewMarkdown": "Preview Markdown",
6565
"previewCode": "Preview Code",
66+
"previewScreenshot": "Preview Screenshot"
6667
}
6768
}

src/main/services/i18n/locales/ru/common.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,7 @@
4949
"darkMode": "Темный режим",
5050
"background": "Фон",
5151
"restartApp": "Перезагрузить massCode",
52-
"updateAvailable": "Доступно обновление"
52+
"updateAvailable": "Доступно обновление",
53+
"hide": "Hide",
54+
"show": "Show"
5355
}

src/main/services/i18n/locales/ru/menu.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
"copy": "Скопировать сниппет в буфер",
6363
"format": "Форматировать",
6464
"previewMarkdown": "Просмотр Markdown",
65-
"previewCode": "Просмотр результата HTML/CSS"
65+
"previewCode": "Просмотр результата HTML/CSS",
66+
"previewScreenshot": "Просмотр скриншота"
6667
}
6768
}

src/renderer/assets/scss/vendor.scss

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,25 @@
6464

6565
.toast-container {
6666
.toast {
67-
6867
width: 400px;
6968
&-text {
7069
display: flex;
7170
align-items: center;
7271
}
7372
}
74-
}
73+
}
74+
75+
.v-popper {
76+
&--theme-tooltip {
77+
.v-popper {
78+
&__inner {
79+
font-size: 12px;
80+
padding: 4px 8px !important;
81+
border-radius: 3px !important;
82+
}
83+
&__arrow-container {
84+
display: none;
85+
}
86+
}
87+
}
88+
}

src/renderer/components/sidebar/TheSidebar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
type="folders"
4444
>
4545
<template #action>
46-
<AppActionButton>
46+
<AppActionButton v-tooltip="i18n.t('newFolder')">
4747
<UniconsPlus @click="onAddNewFolder" />
4848
</AppActionButton>
4949
</template>

src/renderer/components/snippets/SnippetHeader.vue

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,48 @@
1212
<div class="action">
1313
<AppActionButton
1414
v-if="snippetStore.currentLanguage === 'markdown'"
15+
v-tooltip="
16+
!snippetStore.isMarkdownPreview
17+
? i18n.t('menu:editor.previewMarkdown')
18+
: i18n.t('hide') + ' ' + i18n.t('menu:editor.previewMarkdown')
19+
"
1520
@click="onClickMarkdownPreview"
1621
>
1722
<UniconsEye v-if="!snippetStore.isMarkdownPreview" />
1823
<UniconsEyeSlash v-else />
1924
</AppActionButton>
20-
<AppActionButton @click="onClickScreenshotPreview">
25+
<AppActionButton
26+
v-tooltip="
27+
!snippetStore.isScreenshotPreview
28+
? i18n.t('menu:editor.previewScreenshot')
29+
: i18n.t('hide') + ' ' + i18n.t('menu:editor.previewScreenshot')
30+
"
31+
@click="onClickScreenshotPreview"
32+
>
2133
<UniconsCamera v-if="!snippetStore.isScreenshotPreview" />
2234
<UniconsCameraSlash v-else />
2335
</AppActionButton>
24-
<AppActionButton @click="onCodePreview">
36+
<AppActionButton
37+
v-tooltip="
38+
!snippetStore.isCodePreview
39+
? i18n.t('menu:editor.previewCode')
40+
: i18n.t('hide') + ' ' + i18n.t('menu:editor.previewCode')
41+
"
42+
@click="onCodePreview"
43+
>
2544
<SvgArrowSlash v-if="snippetStore.isCodePreview" />
2645
<UniconsArrow v-else />
2746
</AppActionButton>
28-
<AppActionButton @click="onAddDescription">
47+
<AppActionButton
48+
v-tooltip="i18n.t('addDescription')"
49+
@click="onAddDescription"
50+
>
2951
<UniconsText />
3052
</AppActionButton>
31-
<AppActionButton @click="onAddNewFragment">
53+
<AppActionButton
54+
v-tooltip="i18n.t('newFragment')"
55+
@click="onAddNewFragment"
56+
>
3257
<UniconsPlus />
3358
</AppActionButton>
3459
</div>

src/renderer/components/snippets/SnippetListHeader.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
>
99
<AppActionButton
1010
v-if="!query"
11+
v-tooltip="i18n.t('newSnippet')"
1112
class="item"
1213
@click="onAddNewSnippet"
1314
>

0 commit comments

Comments
 (0)