File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5252 "pinia" : " ^2.0.12" ,
5353 "sanitize-html" : " ^2.7.0" ,
5454 "universal-analytics" : " ^0.5.3" ,
55+ "vercel-toast" : " ^1.5.5" ,
5556 "vue" : " ^3.2.26" ,
5657 "vue-router" : " ^4.0.12" ,
5758 "vue3-perfect-scrollbar" : " ^1.6.0"
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ export default new Store<AppStore>({
88 defaults : {
99 bounds : { } ,
1010 sidebarWidth : 180 ,
11- snippetListWidth : 250
11+ snippetListWidth : 250 ,
12+ notifySupport : false
1213 }
1314} )
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ import {
2727 onCopySnippet ,
2828 emitter
2929} from ' @/composable'
30+ import { createToast , destroyAllToasts } from ' vercel-toast'
3031
3132// По какой то причине необходимо явно установить роут в '/'
3233// для корректного поведения в продакшен сборке
@@ -79,7 +80,39 @@ const trackAppUpdate = () => {
7980 store .app .set (' version' , appStore .version )
8081}
8182
83+ const showSupportToast = () => {
84+ if (! store .app .get (' notifySupport' )) {
85+ const message = document .createElement (' div' )
86+
87+ setTimeout (() => {
88+ message .innerHTML = ` Hi, Anton here 👋<br><br>
89+ I need your support. If you find this app useful, please put a star on <a class="external" href="#">github</a>. It will inspire me to continue development on the project.<br><br>My goal is at least 10k stars. `
90+
91+ createToast (message , {
92+ action: {
93+ text: ' Close' ,
94+ callback (toast ) {
95+ toast .destroy ()
96+ store .app .set (' notifySupport' , true )
97+ track (' app/notify' , ' support-go-to-github' )
98+ }
99+ }
100+ })
101+
102+ const a = document .querySelector (' .external' )
103+
104+ a ?.addEventListener (' click' , () => {
105+ ipc .invoke (' main:open-url' , ' https://github.com/massCodeIO/massCode' )
106+ store .app .set (' notifySupport' , true )
107+ destroyAllToasts ()
108+ track (' app/notify' , ' support-close' )
109+ })
110+ }, 1000 * 60 * 5 )
111+ }
112+ }
113+
82114init ()
115+ showSupportToast ()
83116
84117watch (
85118 () => appStore .theme ,
Original file line number Diff line number Diff line change 5454.ti-autocomplete {
5555 border : 1px solid var (--color-border ) !important ;
5656 background-color : var (--color-bg ) !important ;
57+ }
58+
59+ .toast-container {
60+ .toast {
61+
62+ width : 400px ;
63+ & -text {
64+ display : flex ;
65+ align-items : center ;
66+ }
67+ }
5768}
Original file line number Diff line number Diff line change @@ -2,9 +2,10 @@ import { createApp } from 'vue'
22import { createPinia } from 'pinia'
33import router from './router'
44import App from './App.vue'
5- import './assets/scss/main.scss'
65import PerfectScrollbar from 'vue3-perfect-scrollbar'
76import 'vue3-perfect-scrollbar/dist/vue3-perfect-scrollbar.css'
7+ import 'vercel-toast/dist/vercel-toast.css'
8+ import './assets/scss/main.scss'
89
910createApp ( App )
1011 . use ( createPinia ( ) )
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ type AppEvents =
2424 | 'install'
2525 | 'empty-trash'
2626 | 'set-theme'
27+ | 'notify'
2728
2829type TrackSnippetEvents = CombineWith < SnippetEvents , 'snippets' >
2930type TrackFolderEvents = CombineWith < FolderEvents , 'folders' >
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ export interface AppStore {
77 sidebarWidth : number
88 snippetListWidth : number
99 version ?: string
10+ notifySupport : boolean
1011}
1112
1213interface Editor {
Original file line number Diff line number Diff line change @@ -11726,6 +11726,11 @@ vendors@^1.0.0:
1172611726 resolved "https://registry.yarnpkg.com/vendors/-/vendors-1.0.4.tgz#e2b800a53e7a29b93506c3cf41100d16c4c4ad8e"
1172711727 integrity sha512-/juG65kTL4Cy2su4P8HjtkTxk6VmJDiOPBufWniqQ6wknac6jNiXS9vU+hO3wgusiyqWlzTbVHi0dyJqRONg3w==
1172811728
11729+ vercel-toast@^1.5.5:
11730+ version "1.5.5"
11731+ resolved "https://registry.yarnpkg.com/vercel-toast/-/vercel-toast-1.5.5.tgz#484355b1113b2f602969eddca1ede9157b22c750"
11732+ integrity sha512-MTcNPcy9V+aiHIg5iS9h/3UQXHfY00a5pQv4D14XWOql9sUQuiB3mxQXyARLIHT+HblqZgf4awyaleA/ND16tA==
11733+
1172911734verror@1.10.0:
1173011735 version "1.10.0"
1173111736 resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400"
You can’t perform that action at this time.
0 commit comments