mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-02 19:49:58 +00:00
## Summary Only remaining use is in `buttonTypes.ts` which @viva-jinyi is going to be working on to consolidate our different buttons soon. ## Changes - **What**: Replace light/dark colors with theme aware design system tokens. ## Review Focus Double check the chosen colors for the components ## Screenshots | Before | After | | ------ | ----- | | <img width="607" height="432" alt="image" src="https://github.com/user-attachments/assets/6c0ee6d6-819f-40b1-b775-f8b25dd18104" /> | <img width="646" height="488" alt="image" src="https://github.com/user-attachments/assets/9c8532de-8ac6-4b48-9021-3fd0b3e0bc63" /> | ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6705-Style-WIP-Design-System-use-across-more-components-2ab6d73d365081619115fc5f87a46341) by [Unito](https://www.unito.io) --------- Co-authored-by: github-actions <github-actions@github.com>
94 lines
2.3 KiB
Vue
94 lines
2.3 KiB
Vue
<template>
|
|
<Button
|
|
v-if="!isLoggedIn"
|
|
outlined
|
|
rounded
|
|
severity="secondary"
|
|
class="size-8 bg-secondary-background text-base-foreground hover:bg-secondary-background-hover"
|
|
@click="handleSignIn()"
|
|
@mouseenter="showPopover"
|
|
@mouseleave="hidePopover"
|
|
>
|
|
<template #icon>
|
|
<i class="icon-[lucide--user] size-4" />
|
|
</template>
|
|
</Button>
|
|
<Popover
|
|
ref="popoverRef"
|
|
class="p-2"
|
|
@mouseout="hidePopover"
|
|
@mouseover="cancelHidePopover"
|
|
>
|
|
<div>
|
|
<div class="mb-1">{{ t('auth.loginButton.tooltipHelp') }}</div>
|
|
<a
|
|
:href="apiNodesOverviewUrl"
|
|
target="_blank"
|
|
class="text-neutral-500 hover:text-primary"
|
|
>{{ t('auth.loginButton.tooltipLearnMore') }}</a
|
|
>
|
|
</div>
|
|
</Popover>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import Button from 'primevue/button'
|
|
import Popover from 'primevue/popover'
|
|
import { ref } from 'vue'
|
|
|
|
import { useCurrentUser } from '@/composables/auth/useCurrentUser'
|
|
import { useExternalLink } from '@/composables/useExternalLink'
|
|
import { t } from '@/i18n'
|
|
|
|
const { isLoggedIn, handleSignIn } = useCurrentUser()
|
|
const { buildDocsUrl } = useExternalLink()
|
|
const apiNodesOverviewUrl = buildDocsUrl(
|
|
'/tutorials/api-nodes/overview#api-nodes',
|
|
{
|
|
includeLocale: true
|
|
}
|
|
)
|
|
const popoverRef = ref<InstanceType<typeof Popover> | null>(null)
|
|
let hideTimeout: ReturnType<typeof setTimeout> | null = null
|
|
let showTimeout: ReturnType<typeof setTimeout> | null = null
|
|
|
|
const showPopover = (event: Event) => {
|
|
// Clear any existing timeouts
|
|
if (hideTimeout) {
|
|
clearTimeout(hideTimeout)
|
|
hideTimeout = null
|
|
}
|
|
if (showTimeout) {
|
|
clearTimeout(showTimeout)
|
|
showTimeout = null
|
|
}
|
|
|
|
showTimeout = setTimeout(() => {
|
|
if (popoverRef.value) {
|
|
popoverRef.value.show(event, event.target as HTMLElement)
|
|
}
|
|
}, 200)
|
|
}
|
|
|
|
const cancelHidePopover = () => {
|
|
if (hideTimeout) {
|
|
clearTimeout(hideTimeout)
|
|
hideTimeout = null
|
|
}
|
|
}
|
|
|
|
const hidePopover = () => {
|
|
// Clear show timeout if mouse leaves before popover appears
|
|
if (showTimeout) {
|
|
clearTimeout(showTimeout)
|
|
showTimeout = null
|
|
}
|
|
|
|
hideTimeout = setTimeout(() => {
|
|
if (popoverRef.value) {
|
|
popoverRef.value.hide()
|
|
}
|
|
}, 150) // Minimal delay to allow moving to popover
|
|
}
|
|
</script>
|