design: confirm message with daisyui design
This commit is contained in:
@@ -33,11 +33,11 @@ export const useGitHubContent = ({
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
confirmMessage('Note saved')
|
confirmMessage('✅ Note saved')
|
||||||
|
|
||||||
return response?.data.content?.sha ?? null
|
return response?.data.content?.sha ?? null
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
errorMessage('Note could not be saved')
|
errorMessage('❌ Note could not be saved')
|
||||||
console.warn(error)
|
console.warn(error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ const saveCredentials = async (token: GithubToken): Promise<void> => {
|
|||||||
const accessToken = await saveAccessToken(token)
|
const accessToken = await saveAccessToken(token)
|
||||||
|
|
||||||
await saveAccessTokenToLocal()
|
await saveAccessTokenToLocal()
|
||||||
confirmMessage(`${accessToken.username} is logged in!`)
|
confirmMessage(`✅ ${accessToken.username} is logged in!`)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useGitHubLogin = () => {
|
export const useGitHubLogin = () => {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import './styles/app.css'
|
|
||||||
import 'notyf/notyf.min.css'
|
import 'notyf/notyf.min.css'
|
||||||
|
import './styles/app.css'
|
||||||
|
|
||||||
import { createPinia } from 'pinia'
|
import { createPinia } from 'pinia'
|
||||||
import { createApp } from 'vue'
|
import { createApp } from 'vue'
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useOfflineNotes } from '@/hooks/useOfflineNotes.hook'
|
import { useOfflineNotes } from '@/hooks/useOfflineNotes.hook'
|
||||||
|
import { confirmMessage } from '@/utils/notif'
|
||||||
|
|
||||||
const { cacheAllNotes, isLoading, totalOfNotes, noteCompleted } =
|
const { cacheAllNotes, isLoading, totalOfNotes, noteCompleted } =
|
||||||
useOfflineNotes()
|
useOfflineNotes()
|
||||||
|
|
||||||
const confirmBeforeCachingAllNotes = () => {
|
const confirmBeforeCachingAllNotes = async () => {
|
||||||
confirm('Do you want to cache all notes?')
|
confirm('Do you want to cache all notes?')
|
||||||
cacheAllNotes()
|
await cacheAllNotes()
|
||||||
|
confirmMessage('✅ All notes have been locally saved')
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -60,9 +60,13 @@ a {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.notif-success {
|
.notyf__wrapper {
|
||||||
background-color: oklch(var(--a));
|
padding-top: 0;
|
||||||
color: oklch(var(--ac));
|
padding-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.alert {
|
||||||
|
max-width: 500px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.repo-note {
|
.repo-note {
|
||||||
|
|||||||
@@ -3,8 +3,12 @@ import { Notyf } from 'notyf'
|
|||||||
const notif = new Notyf({
|
const notif = new Notyf({
|
||||||
types: [
|
types: [
|
||||||
{
|
{
|
||||||
className: 'notif-success',
|
className: 'prose alert alert-success',
|
||||||
type: 'confirm'
|
type: 'confirm'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
className: 'prose alert alert-error',
|
||||||
|
type: 'error'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
@@ -15,4 +19,5 @@ export const confirmMessage = (message: string) =>
|
|||||||
message
|
message
|
||||||
})
|
})
|
||||||
|
|
||||||
export const errorMessage = (message: string) => notif.error(message)
|
export const errorMessage = (message: string) =>
|
||||||
|
notif.open({ type: 'error', message })
|
||||||
|
|||||||
Reference in New Issue
Block a user