Joaquín Sánchez 2024-04-22 22:28:21 +09:00 zatwierdzone przez GitHub
commit d35d6837e8
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
2 zmienionych plików z 33 dodań i 5 usunięć

Wyświetl plik

@ -11,11 +11,28 @@ const props = defineProps<{
large?: true large?: true
match?: boolean match?: boolean
target?: string target?: string
button?: boolean
}>() }>()
defineEmits<{
(event: 'click'): void
}>()
const vm = getCurrentInstance()
const router = useRouter() const router = useRouter()
const scrollOnClick = computed(() => props.to && !(props.target === '_blank' || props.external)) const scrollOnClick = computed(() => props.to && !(props.target === '_blank' || props.external))
function focus() {
setTimeout(() => {
if (props.button)
vm?.vnode.el?.querySelector('button')?.focus()
else
vm?.vnode.el?.focus()
}, 100)
}
defineExpose({ focus })
useCommand({ useCommand({
scope: 'Settings', scope: 'Settings',
@ -45,13 +62,17 @@ useCommand({
exact-active-class="text-primary" exact-active-class="text-primary"
:class="disabled ? 'op25 pointer-events-none ' : match ? 'text-primary' : ''" :class="disabled ? 'op25 pointer-events-none ' : match ? 'text-primary' : ''"
block w-full group focus:outline-none block w-full group focus:outline-none
:tabindex="disabled ? -1 : null" :tabindex="!button && disabled ? -1 : undefined"
:custom="button"
@click="scrollOnClick ? $scrollToTop() : undefined" @click="scrollOnClick ? $scrollToTop() : undefined"
> >
<div <component
:is="button ? 'button' : 'div'"
w-full flex px5 py3 md:gap2 gap4 items-center w-full flex px5 py3 md:gap2 gap4 items-center
transition-250 group-hover:bg-active transition-250 group-hover:bg-active
group-focus-visible:ring="2 current" group-focus-visible:ring="2 current"
:disabled="button ? disabled : undefined"
@click="button && !disabled && $emit('click')"
> >
<div flex-1 flex items-center md:gap2 gap4> <div flex-1 flex items-center md:gap2 gap4>
<div <div
@ -85,6 +106,6 @@ useCommand({
</slot> </slot>
</p> </p>
<div v-if="to" :class="!external ? 'i-ri:arrow-right-s-line' : 'i-ri:external-link-line'" text-xl text-secondary-light class="rtl-flip" /> <div v-if="to" :class="!external ? 'i-ri:arrow-right-s-line' : 'i-ri:external-link-line'" text-xl text-secondary-light class="rtl-flip" />
</div> </component>
</NuxtLink> </NuxtLink>
</template> </template>

Wyświetl plik

@ -6,12 +6,14 @@ useHydratedHead({
title: () => `${t('settings.about.label')} | ${t('nav.settings')}`, title: () => `${t('settings.about.label')} | ${t('nav.settings')}`,
}) })
const commitRef = ref()
const showCommit = ref(buildInfo.env !== 'release' && buildInfo.env !== 'dev') const showCommit = ref(buildInfo.env !== 'release' && buildInfo.env !== 'dev')
const builtTime = useFormattedDateTime(buildInfo.time) const builtTime = useFormattedDateTime(buildInfo.time)
function handleShowCommit() { function handleShowCommit() {
setTimeout(() => { setTimeout(() => {
showCommit.value = true showCommit.value = true
nextTick(() => commitRef.value?.focus())
}, 50) }, 50)
} }
</script> </script>
@ -33,9 +35,12 @@ function handleShowCommit() {
<template v-if="isHydrated"> <template v-if="isHydrated">
<SettingsItem <SettingsItem
ref="commitRef"
:text="$t('settings.about.version')" :text="$t('settings.about.version')"
:to="showCommit ? `https://github.com/elk-zone/elk/commit/${buildInfo.commit}` : undefined" :to="showCommit ? `https://github.com/elk-zone/elk/commit/${buildInfo.commit}` : undefined"
external target="_blank" external
target="_blank"
:button="!showCommit"
@click="handleShowCommit" @click="handleShowCommit"
> >
<template #content> <template #content>
@ -54,7 +59,9 @@ function handleShowCommit() {
<SettingsItem <SettingsItem
:text="$t('nav.show_intro')" :text="$t('nav.show_intro')"
icon="i-ri:article-line" icon="i-ri:article-line"
cursor-pointer large cursor-pointer
large
button
@click="openPreviewHelp" @click="openPreviewHelp"
/> />