Skip to content

Commit f77705e

Browse files
committed
feat(www): add some ui improvements and update the frontend
1 parent a49f8c0 commit f77705e

File tree

5 files changed

+42
-33
lines changed

5 files changed

+42
-33
lines changed

apps/www/src/router/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ router.beforeEach(async (to, from, next) => {
6969
return next('/')
7070
}
7171

72-
7372
if (to.meta.requiresAuth && !auth.token) {
7473
return next({ name: 'signin' })
7574
}
@@ -93,4 +92,4 @@ router.beforeEach(async (to, from, next) => {
9392
next()
9493
})
9594

96-
export default router
95+
export default router

apps/www/src/stores/auth-store.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ export const useAuthStore = defineStore('auth', () => {
2525
})
2626
const me = computed(() => getMeResult.value?.me ?? null)
2727
const isLoggedIn = computed(() => {
28-
if (!token.value) return false;
29-
return !!getMeResult.value?.me;
30-
});
28+
if (!token.value) return false
29+
return !!getMeResult.value?.me
30+
})
3131

3232
window.addEventListener('storage', (event) => {
3333
if (event.key === 'token' && !event.newValue) {

apps/www/src/stores/journal-store.ts

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ import {
66
useGetJournalPagesQuery,
77
useUpdateJournalPageMutation,
88
type CreateJournalInput,
9-
type UpdateJournalInput
9+
type UpdateJournalInput,
1010
} from '../../gql_generated/graphql'
1111

1212
export const useJournalStore = defineStore('journal', () => {
1313
const {
1414
result: getJournalPagesResult,
1515
loading: loadingPages,
16-
refetch: refetchPages
16+
refetch: refetchPages,
1717
} = useGetJournalPagesQuery()
18-
const { mutate: updateJournalMutation } = useUpdateJournalPageMutation();
19-
const { mutate: createJournalMutation } = useCreateJournalPageMutation();
18+
const { mutate: updateJournalMutation } = useUpdateJournalPageMutation()
19+
const { mutate: createJournalMutation } = useCreateJournalPageMutation()
2020

2121
const pages = computed(() => getJournalPagesResult.value ?? null)
2222

@@ -25,16 +25,18 @@ export const useJournalStore = defineStore('journal', () => {
2525
const {
2626
result: singleResult,
2727
loading: loadingSingle,
28-
error: singleError
28+
error: singleError,
2929
} = useGetJournalPageQuery(
3030
() => ({ id: activeJournalId.value || 'placeholder' }),
3131
{
3232
enabled: computed(() => !!activeJournalId.value),
33-
fetchPolicy: 'cache-and-network'
34-
}
33+
fetchPolicy: 'cache-and-network',
34+
},
3535
)
3636

37-
const currentJournal = computed(() => singleResult.value?.journalPage ?? null)
37+
const currentJournal = computed(
38+
() => singleResult.value?.journalPage ?? null,
39+
)
3840

3941
function setSelectedJournal(id: string | null) {
4042
activeJournalId.value = id
@@ -44,24 +46,24 @@ export const useJournalStore = defineStore('journal', () => {
4446
try {
4547
await updateJournalMutation({
4648
id,
47-
input
49+
input,
4850
})
4951
await refetchPages()
5052
} catch (e) {
51-
console.error("Update failed:", e);
52-
throw e;
53+
console.error('Update failed:', e)
54+
throw e
5355
}
5456
}
5557

5658
async function createJournal(input: CreateJournalInput) {
5759
try {
5860
await createJournalMutation({
59-
input
61+
input,
6062
})
6163
await refetchPages()
6264
} catch (e) {
63-
console.error("Creation failed:", e);
64-
throw e;
65+
console.error('Creation failed:', e)
66+
throw e
6567
}
6668
}
6769

@@ -70,16 +72,15 @@ export const useJournalStore = defineStore('journal', () => {
7072
return loading
7173
})
7274

73-
7475
return {
7576
pages,
7677
currentJournal,
7778
isLoading,
7879
loadingSingle,
7980
activeJournalId,
8081
setSelectedJournal,
81-
refetchPages,
82+
refetchPages,
8283
updateJournal,
83-
createJournal
84+
createJournal,
8485
}
85-
})
86+
})

apps/www/src/utils/date.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
export const monthMap: Record<string, number> = {
2-
"january": 0, "february": 1, "march": 2, "april": 3,
3-
"may": 4, "june": 5, "july": 6, "august": 7,
4-
"september": 8, "october": 9, "november": 10, "december": 11
5-
};
2+
january: 0,
3+
february: 1,
4+
march: 2,
5+
april: 3,
6+
may: 4,
7+
june: 5,
8+
july: 6,
9+
august: 7,
10+
september: 8,
11+
october: 9,
12+
november: 10,
13+
december: 11,
14+
}

packages/ai/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { generateText } from 'ai';
2-
import { google } from '@ai-sdk/google';
1+
import { generateText } from 'ai'
2+
import { google } from '@ai-sdk/google'
33

44
const result = await generateText({
5-
model: google('gemini-2.5-flash-lite'),
6-
prompt: 'Analizza questo diario: Oggi mi sento...',
7-
});
5+
model: google('gemini-2.5-flash-lite'),
6+
prompt: 'Analizza questo diario: Oggi mi sento...',
7+
})
88

9-
console.log(result.text);
9+
console.log(result.text)

0 commit comments

Comments
 (0)