feat: hide quick add magic help behind a tooltip (#3353)
Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/3353
This commit is contained in:
commit
a988565227
@ -67,6 +67,7 @@ import {
|
|||||||
faStar,
|
faStar,
|
||||||
faSun,
|
faSun,
|
||||||
faTimesCircle,
|
faTimesCircle,
|
||||||
|
faCircleQuestion,
|
||||||
} from '@fortawesome/free-regular-svg-icons'
|
} from '@fortawesome/free-regular-svg-icons'
|
||||||
import {FontAwesomeIcon} from '@fortawesome/vue-fontawesome'
|
import {FontAwesomeIcon} from '@fortawesome/vue-fontawesome'
|
||||||
|
|
||||||
@ -86,6 +87,7 @@ library.add(faCheckDouble)
|
|||||||
library.add(faChessKnight)
|
library.add(faChessKnight)
|
||||||
library.add(faChevronDown)
|
library.add(faChevronDown)
|
||||||
library.add(faCircleInfo)
|
library.add(faCircleInfo)
|
||||||
|
library.add(faCircleQuestion)
|
||||||
library.add(faClock)
|
library.add(faClock)
|
||||||
library.add(faCloudDownloadAlt)
|
library.add(faCloudDownloadAlt)
|
||||||
library.add(faCloudUploadAlt)
|
library.add(faCloudUploadAlt)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="task-add" ref="taskAdd">
|
<div class="task-add" ref="taskAdd">
|
||||||
<div class="add-task__field field is-grouped">
|
<div class="add-task__field field is-grouped">
|
||||||
<p class="control has-icons-left is-expanded">
|
<p class="control has-icons-left has-icons-right is-expanded">
|
||||||
<textarea
|
<textarea
|
||||||
class="add-task-textarea input"
|
class="add-task-textarea input"
|
||||||
:class="{'textarea-empty': newTaskTitle === ''}"
|
:class="{'textarea-empty': newTaskTitle === ''}"
|
||||||
@ -16,6 +16,7 @@
|
|||||||
<span class="icon is-small is-left">
|
<span class="icon is-small is-left">
|
||||||
<icon icon="tasks"/>
|
<icon icon="tasks"/>
|
||||||
</span>
|
</span>
|
||||||
|
<quick-add-magic :highlight-hint-icon="taskAddHovered"/>
|
||||||
</p>
|
</p>
|
||||||
<p class="control">
|
<p class="control">
|
||||||
<x-button
|
<x-button
|
||||||
@ -32,11 +33,10 @@
|
|||||||
</x-button>
|
</x-button>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<Expandable :open="errorMessage !== '' || taskAddFocused || taskAddHovered && debouncedTaskAddHovered">
|
<Expandable :open="errorMessage !== ''">
|
||||||
<p class="pt-3 mt-0 help is-danger" v-if="errorMessage !== ''">
|
<p class="pt-3 mt-0 help is-danger" v-if="errorMessage !== ''">
|
||||||
{{ errorMessage }}
|
{{ errorMessage }}
|
||||||
</p>
|
</p>
|
||||||
<quick-add-magic v-else class="quick-add-magic" />
|
|
||||||
</Expandable>
|
</Expandable>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -44,7 +44,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {computed, ref} from 'vue'
|
import {computed, ref} from 'vue'
|
||||||
import {useI18n} from 'vue-i18n'
|
import {useI18n} from 'vue-i18n'
|
||||||
import {refDebounced, useElementHover, useFocusWithin} from '@vueuse/core'
|
import {useElementHover} from '@vueuse/core'
|
||||||
|
|
||||||
import {RELATION_KIND} from '@/types/IRelationKind'
|
import {RELATION_KIND} from '@/types/IRelationKind'
|
||||||
import type {ITask} from '@/modelTypes/ITask'
|
import type {ITask} from '@/modelTypes/ITask'
|
||||||
@ -77,8 +77,6 @@ const {t} = useI18n({useScope: 'global'})
|
|||||||
const authStore = useAuthStore()
|
const authStore = useAuthStore()
|
||||||
const taskStore = useTaskStore()
|
const taskStore = useTaskStore()
|
||||||
|
|
||||||
const taskAdd = ref<HTMLTextAreaElement | null>(null)
|
|
||||||
|
|
||||||
// enable only if we don't have a modal
|
// enable only if we don't have a modal
|
||||||
// onStartTyping(() => {
|
// onStartTyping(() => {
|
||||||
// if (newTaskInput.value === null || document.activeElement === newTaskInput.value) {
|
// if (newTaskInput.value === null || document.activeElement === newTaskInput.value) {
|
||||||
@ -87,10 +85,8 @@ const taskAdd = ref<HTMLTextAreaElement | null>(null)
|
|||||||
// newTaskInput.value.focus()
|
// newTaskInput.value.focus()
|
||||||
// })
|
// })
|
||||||
|
|
||||||
const { focused: taskAddFocused } = useFocusWithin(taskAdd)
|
const taskAdd = ref<HTMLTextAreaElement | null>(null)
|
||||||
|
|
||||||
const taskAddHovered = useElementHover(taskAdd)
|
const taskAddHovered = useElementHover(taskAdd)
|
||||||
const debouncedTaskAddHovered = refDebounced(taskAddHovered, 500)
|
|
||||||
|
|
||||||
const errorMessage = ref('')
|
const errorMessage = ref('')
|
||||||
|
|
||||||
@ -244,7 +240,14 @@ defineExpose({
|
|||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
.quick-add-magic {
|
.control.has-icons-left .icon,
|
||||||
padding-top: 0.75rem;
|
.control.has-icons-right .icon {
|
||||||
|
transition: all $transition;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
button.show-helper-text {
|
||||||
|
right: 0;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -1,9 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-if="mode !== 'disabled' && prefixes !== undefined">
|
<template v-if="mode !== 'disabled' && prefixes !== undefined">
|
||||||
<p class="help has-text-grey">
|
<BaseButton
|
||||||
{{ $t('task.quickAddMagic.hint') }}.
|
@click="() => visible = true"
|
||||||
<ButtonLink @click="() => visible = true">{{ $t('task.quickAddMagic.what') }}</ButtonLink>
|
class="icon is-small show-helper-text"
|
||||||
</p>
|
v-tooltip="$t('task.quickAddMagic.hint')"
|
||||||
|
:aria-label="$t('task.quickAddMagic.hint')"
|
||||||
|
:class="{'is-highlighted': highlightHintIcon}"
|
||||||
|
>
|
||||||
|
<icon :icon="['far', 'circle-question']"/>
|
||||||
|
</BaseButton>
|
||||||
<modal
|
<modal
|
||||||
:enabled="visible"
|
:enabled="visible"
|
||||||
@close="() => visible = false"
|
@close="() => visible = false"
|
||||||
@ -69,7 +74,7 @@
|
|||||||
<li>17th ({{ $t('task.quickAddMagic.dateNth', {day: '17'}) }})</li>
|
<li>17th ({{ $t('task.quickAddMagic.dateNth', {day: '17'}) }})</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>{{ $t('task.quickAddMagic.dateTime', {time: 'at 17:00', timePM: '5pm'}) }}</p>
|
<p>{{ $t('task.quickAddMagic.dateTime', {time: 'at 17:00', timePM: '5pm'}) }}</p>
|
||||||
|
|
||||||
<h3>{{ $t('task.quickAddMagic.repeats') }}</h3>
|
<h3>{{ $t('task.quickAddMagic.repeats') }}</h3>
|
||||||
<p>{{ $t('task.quickAddMagic.repeatsDescription', {suffix: 'every {amount} {type}'}) }}</p>
|
<p>{{ $t('task.quickAddMagic.repeatsDescription', {suffix: 'every {amount} {type}'}) }}</p>
|
||||||
<p>{{ $t('misc.forExample') }}</p>
|
<p>{{ $t('misc.forExample') }}</p>
|
||||||
@ -86,13 +91,13 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</card>
|
</card>
|
||||||
</modal>
|
</modal>
|
||||||
</div>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {ref, computed} from 'vue'
|
import {ref, computed} from 'vue'
|
||||||
|
|
||||||
import ButtonLink from '@/components/misc/ButtonLink.vue'
|
import BaseButton from '@/components/base/BaseButton.vue'
|
||||||
|
|
||||||
import {getQuickAddMagicMode} from '@/helpers/quickAddMagicMode'
|
import {getQuickAddMagicMode} from '@/helpers/quickAddMagicMode'
|
||||||
import {PREFIXES} from '@/modules/parseTaskText'
|
import {PREFIXES} from '@/modules/parseTaskText'
|
||||||
@ -100,5 +105,20 @@ import {PREFIXES} from '@/modules/parseTaskText'
|
|||||||
const visible = ref(false)
|
const visible = ref(false)
|
||||||
const mode = ref(getQuickAddMagicMode())
|
const mode = ref(getQuickAddMagicMode())
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
highlightHintIcon: boolean,
|
||||||
|
}>()
|
||||||
|
|
||||||
const prefixes = computed(() => PREFIXES[mode.value])
|
const prefixes = computed(() => PREFIXES[mode.value])
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.show-helper-text {
|
||||||
|
// Bulma adds pointer-events: none to the icon so we need to override it back here.
|
||||||
|
pointer-events: auto !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.is-highlighted {
|
||||||
|
color: inherit !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
@ -737,8 +737,7 @@
|
|||||||
"invalidAmount": "Please enter more than 0."
|
"invalidAmount": "Please enter more than 0."
|
||||||
},
|
},
|
||||||
"quickAddMagic": {
|
"quickAddMagic": {
|
||||||
"hint": "You can use Quick Add Magic",
|
"hint": "Use magic prefixes to define due dates, assignees and other task properties.",
|
||||||
"what": "What?",
|
|
||||||
"title": "Quick Add Magic",
|
"title": "Quick Add Magic",
|
||||||
"intro": "When creating a task, you can use special keywords to directly add attributes to the newly created task. This allows to add commonly used attributes to tasks much faster.",
|
"intro": "When creating a task, you can use special keywords to directly add attributes to the newly created task. This allows to add commonly used attributes to tasks much faster.",
|
||||||
"multiple": "You can use this multiple times.",
|
"multiple": "You can use this multiple times.",
|
||||||
|
@ -57,7 +57,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.field.has-addons .control .select select {
|
.field.has-addons .control .select select {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.control.has-icons-left .icon,
|
.control.has-icons-left .icon,
|
||||||
|
@ -301,4 +301,9 @@ function prepareFiltersAndLoadTasks() {
|
|||||||
border: none;
|
border: none;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.control.has-icons-left .icon,
|
||||||
|
.control.has-icons-right .icon {
|
||||||
|
transition: all $transition;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
Loading…
x
Reference in New Issue
Block a user