Skip to content

Commit e5036b7

Browse files
committed
feat: add translations and app logo
1 parent d74952f commit e5036b7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+2390
-335
lines changed

icon.png

188 KB
Loading

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"pinia": "^2.1.7",
4040
"tippy.js": "^6.3.7",
4141
"vue": "^3.3.4",
42+
"vue-i18n": "^9.10.2",
4243
"vue-router": "^4.2.5"
4344
},
4445
"devDependencies": {

pnpm-lock.yaml

+36
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ edition = "2021"
1111
tauri-build = { version = "1.5", features = [] }
1212

1313
[dependencies]
14-
tauri = { version = "1.5", features = [ "fs-all", "shell-open"] }
14+
tauri = { version = "1.5", features = [ "global-shortcut-all", "fs-all", "shell-open"] }
1515
serde = { version = "1.0", features = ["derive"] }
1616
serde_json = "1.0"
1717
tauri-plugin-persisted-scope = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" }

src-tauri/icons/128x128.png

4.57 KB
Loading

src-tauri/icons/[email protected]

15.9 KB
Loading

src-tauri/icons/32x32.png

525 Bytes
Loading

src-tauri/icons/Square107x107Logo.png

3.51 KB
Loading

src-tauri/icons/Square142x142Logo.png

5.37 KB
Loading

src-tauri/icons/Square150x150Logo.png

5.97 KB
Loading

src-tauri/icons/Square284x284Logo.png

19.9 KB
Loading

src-tauri/icons/Square30x30Logo.png

482 Bytes
Loading

src-tauri/icons/Square310x310Logo.png

22.7 KB
Loading

src-tauri/icons/Square44x44Logo.png

861 Bytes
Loading

src-tauri/icons/Square71x71Logo.png

1.9 KB
Loading

src-tauri/icons/Square89x89Logo.png

2.68 KB
Loading

src-tauri/icons/StoreLogo.png

1.01 KB
Loading

src-tauri/icons/icon.icns

611 KB
Binary file not shown.

src-tauri/icons/icon.ico

-51.9 KB
Binary file not shown.

src-tauri/icons/icon.png

91 KB
Loading

src-tauri/tauri.conf.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
"tauri": {
1313
"allowlist": {
1414
"all": false,
15+
"globalShortcut": {
16+
"all": true
17+
},
1518
"shell": {
1619
"all": false,
1720
"open": true
@@ -32,7 +35,9 @@
3235
"resizable": true,
3336
"title": "linked",
3437
"width": 450,
35-
"height": 850
38+
"height": 850,
39+
"minWidth": 450,
40+
"minHeight": 450
3641
}
3742
],
3843
"security": {

src/App.vue

+18-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,27 @@
22
import {onMounted} from "vue";
33
import {useRouter} from "vue-router";
44
import {useCalendarStore} from "@/stores/useCalendarStore.ts";
5+
import {registerAll} from '@tauri-apps/api/globalShortcut';
6+
import {getToday, shiftDateByDays} from "@/utils/calendar.ts";
57
6-
const router = useRouter()
78
const store = useCalendarStore()
9+
const router = useRouter()
10+
11+
const shortcutRouteMap: Record<string, () => string> = {
12+
'CommandOrControl+.': () => `/day/${getToday()}`,
13+
'CommandOrControl+,': () => '/settings',
14+
'CommandOrControl+P': () => `/day/${shiftDateByDays(store.currentDate, -1)}`,
15+
'CommandOrControl+N': () => `/day/${shiftDateByDays(store.currentDate, 1)}`,
16+
'CommandOrControl+Shift+P': () => `/day/${shiftDateByDays(store.currentDate, -7)}`,
17+
'CommandOrControl+Shift+N': () => `/day/${shiftDateByDays(store.currentDate, 7)}`,
18+
}
819
9-
onMounted(() => router.push(`/day/${store.currentDate}`))
20+
onMounted(async () => {
21+
await registerAll(Object.keys(shortcutRouteMap), async (shortcut: string) => {
22+
await router.push(shortcutRouteMap[shortcut]())
23+
});
24+
await router.push(`/day/${store.currentDate}`)
25+
})
1026
</script>
1127

1228
<template>

src/components/back-button.vue

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<script setup lang="ts">
2+
import BackIcon from "@/assets/icons/back.svg";
3+
import {useI18n} from "vue-i18n";
4+
const {t} = useI18n()
5+
</script>
6+
7+
<template>
8+
<router-link
9+
to="/"
10+
class="
11+
flex
12+
items-center
13+
align-center
14+
mb-3
15+
hover:text-bright-pink
16+
focus:outline-none
17+
focus:ring-2 focus:ring-bright-pink
18+
focus:border-bright-pink
19+
"
20+
>
21+
<span class="mr-1"><BackIcon /></span>
22+
{{ t('settings.back') }}
23+
</router-link>
24+
</template>

src/components/day-switcher.vue

+9-10
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,13 @@ const currentWeek = computed(() => store.currentWeek)
1111
const router = useRouter()
1212
1313
function switchDay(date: string) {
14-
store.setDate(date)
15-
router.push(`/day/${date}`)
14+
router.push({name: 'day', params: {day: date}})
1615
}
1716
</script>
1817

1918
<template>
2019
<div
21-
class="
20+
class="
2221
flex
2322
dark:bg-black
2423
justify-center
@@ -31,18 +30,18 @@ function switchDay(date: string) {
3130
>
3231
<template v-for="date in currentWeek" :key="date.day">
3332
<div
34-
class="flex-col justify-center items-center self-center text-center"
33+
class="flex-col justify-center items-center self-center text-center"
3534
>
3635
<span
37-
class="block mb-1 text-xs text-gray-400 dark:text-gray-600"
38-
:class="{
36+
class="block mb-1 text-xs text-gray-400 dark:text-gray-600"
37+
:class="{
3938
'text-bright-pink dark:text-red-500': date.isoDate === currentDate
4039
}"
4140
>
4241
{{ date.weekDay }}
4342
</span>
4443
<span
45-
class="
44+
class="
4645
flex
4746
justify-center
4847
items-center
@@ -58,11 +57,11 @@ function switchDay(date: string) {
5857
cursor-pointer
5958
ring-bright-pink
6059
"
61-
:class="{
60+
:class="{
6261
'ring-4 text-sm': date.isoDate === currentDate
6362
}"
64-
:key="date.day"
65-
@click="switchDay(date.isoDate)"
63+
:key="date.day"
64+
@click="switchDay(date.isoDate)"
6665
>
6766
{{ date.day }}
6867
</span>

src/components/editor.vue

+2-7
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,14 @@ import {Strike} from "@tiptap/extension-strike";
2222
import {Document} from "@tiptap/extension-document";
2323
import {Text} from "@tiptap/extension-text";
2424
import {History} from "@tiptap/extension-history";
25-
import Commands from "@/components/slash-commands/commands.ts";
26-
import suggestion from "@/components/slash-commands/suggestion.ts";
2725
2826
const store = useCalendarStore()
2927
const editor = ref()
3028
const content = ref('')
3129
3230
onMounted(async () => {
3331
editor.value = new Editor({
34-
autofocus: true,
32+
autofocus: 'end',
3533
content: await fetchContent(store.currentDate) as string,
3634
editable: true,
3735
extensions: [
@@ -51,10 +49,7 @@ onMounted(async () => {
5149
Strike,
5250
Link,
5351
History,
54-
/*Commands.configure({
55-
suggestion,
56-
}),
57-
Image,
52+
/*Image,
5853
Placeholder.configure({
5954
includeChildren: true,
6055
placeholder: ({ node }) => {

src/components/filepath-settings.vue

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<script setup lang="ts">
2+
import {useI18n} from "vue-i18n";
3+
const {t} = useI18n()
4+
</script>
5+
6+
<template>
7+
<h3 class="mt-8">{{ t('settings.data.title') }}</h3>
8+
<p class="text-sm text-gray-500">{{ t('settings.data.hint')}}</p>
9+
</template>

src/components/locale-settings.vue

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
<script setup lang="ts">
2+
import {ref} from "vue";
3+
import DropdownIcon from '@/assets/icons/dropdown.svg'
4+
import TickIcon from '@/assets/icons/tick.svg'
5+
import {SUPPORT_LOCALES} from "@/i18n.ts";
6+
import {useI18n} from "vue-i18n";
7+
8+
const open = ref(false)
9+
const {messages, locale} = useI18n();
10+
11+
function handleLanguageChange(desiredLocale: string) {
12+
locale.value = desiredLocale;
13+
localStorage.setItem('lang', desiredLocale)
14+
open.value = !open.value
15+
}
16+
</script>
17+
18+
<template>
19+
<div class="relative">
20+
<h3 class="mt-8">{{ $t('settings.languages.title') }}</h3>
21+
<p class="text-sm leading-5 text-gray-500">{{ $t('settings.languages.hint') }}</p>
22+
<button
23+
type="button"
24+
class="
25+
mt-4
26+
relative
27+
w-full
28+
bg-gray-100
29+
dark:bg-gray-800
30+
rounded-md
31+
pl-3
32+
pr-10
33+
py-2
34+
text-left
35+
focus:outline-none
36+
focus:ring-2 focus:ring-bright-pink
37+
focus:border-bright-pink
38+
sm:text-sm
39+
cursor-pointer
40+
"
41+
aria-haspopup="listbox"
42+
aria-expanded="true"
43+
aria-labelledby="listbox-label"
44+
@click="open = !open"
45+
>
46+
<span class="block truncate">{{ messages[locale].title }}</span>
47+
<span
48+
class="
49+
absolute
50+
inset-y-0
51+
right-0
52+
flex
53+
items-center
54+
pr-2
55+
pointer-events-none
56+
"
57+
>
58+
<DropdownIcon/>
59+
</span>
60+
</button>
61+
<ul
62+
class="
63+
absolute
64+
z-10
65+
mt-1
66+
w-full
67+
bg-gray-100
68+
dark:bg-gray-800
69+
shadow-lg
70+
max-h-60
71+
rounded-md
72+
py-1
73+
text-base
74+
ring-1 ring-black ring-opacity-5
75+
overflow-auto
76+
focus:outline-none
77+
sm:text-sm
78+
"
79+
style="
80+
margin-left: 0 !important;
81+
margin-right: 0 !important;
82+
margin-top: 0.25rem !important;
83+
"
84+
tabindex="-1"
85+
role="listbox"
86+
aria-labelledby="listbox-label"
87+
aria-activedescendant="listbox-option-3"
88+
v-if="open"
89+
>
90+
<template v-for="availableLocale in SUPPORT_LOCALES">
91+
<li
92+
class="cursor-pointer select-none relative py-2 pl-8 pr-4 flex space-x-4 group hover:bg-bright-pink rounded-lg"
93+
id="listbox-option-0"
94+
role="option"
95+
@click="handleLanguageChange(availableLocale)"
96+
>
97+
<span
98+
class="
99+
group-hover:text-white
100+
text-bright-pink
101+
items-center
102+
pl-1.5
103+
w-5
104+
h-5
105+
-ml-9
106+
"
107+
v-if="availableLocale == locale"
108+
>
109+
<TickIcon/>
110+
</span>
111+
<span class="font-normal block truncate">
112+
{{ messages[availableLocale].title }} <span class="text-xs italic opacity-50">({{availableLocale}})</span>
113+
</span>
114+
</li>
115+
</template>
116+
</ul>
117+
</div>
118+
</template>

src/components/search-settings.vue

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<script setup lang="ts">
2+
import {useI18n} from "vue-i18n";
3+
const {t} = useI18n()
4+
</script>
5+
6+
<template>
7+
<h3 class="mt-8">{{ t('settings.search.index.title') }}</h3>
8+
<p class="text-sm text-gray-500">{{ t('settings.search.index.hint') }}</p>
9+
</template>

0 commit comments

Comments
 (0)