Files
api/web/components/UserProfile/DropdownTrigger.vue
Michael Datelle a1d02b486a refactor: swap out dropdown with reka components (#1245)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Introduced a new `DropdownMenu` component in user profiles with
dynamic content rendering.
- Added a new `Popover` component with interactive Storybook demos,
improving component discoverability.
- Added a new `DropdownMenuArrow` component to enhance dropdown visuals.
- Implemented new CSS custom properties for charts, enhancing styling
capabilities in light and dark themes.
- Enhanced dropdown functionality by encapsulating dropdown logic in a
new `UpcDropdownMenu` component.
- Added a new `Select` component for improved user interaction within
the `Sheet` component.
- Introduced a new `SheetWithSelect` story to showcase selection
functionality within the `Sheet` component.
- Updated the `Sidebar` component to improve modal behavior and content
positioning.
- Enhanced `UserProfile` components with a new feedback function for
better status indication.

- **Style**
- Refined layouts by replacing fixed widths with flexible, responsive
designs.
- Updated global styling with a refreshed chart color palette and
expanded dark mode support.

- **Refactor**
- Migrated components to use a unified UI library, streamlining
interactions and boosting consistency.
- Improved type safety in `BrandLoading` component by utilizing a new
type for variants and sizes.
- Updated component imports and organization to enhance maintainability.

- **Bug Fixes**
- Removed unused promotional code and components, simplifying the
codebase and improving performance.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: mdatelle <mike@datelle.net>
Co-authored-by: Zack Spear <hi@zackspear.com>
Co-authored-by: Eli Bosley <ekbosley@gmail.com>
2025-03-24 17:24:52 -04:00

87 lines
2.7 KiB
Vue

<script setup lang="ts">
import { storeToRefs } from 'pinia';
import {
Bars3Icon,
BellAlertIcon,
ExclamationTriangleIcon,
InformationCircleIcon,
ShieldExclamationIcon,
} from '@heroicons/vue/24/solid';
import type { ComposerTranslation } from 'vue-i18n';
import { useDropdownStore } from '~/store/dropdown';
import { useErrorsStore } from '~/store/errors';
import { useServerStore } from '~/store/server';
import { useUpdateOsStore } from '~/store/updateOs';
const props = defineProps<{ t: ComposerTranslation }>();
const dropdownStore = useDropdownStore();
const { dropdownVisible } = storeToRefs(dropdownStore);
const { errors } = storeToRefs(useErrorsStore());
const { rebootType, state, stateData } = storeToRefs(useServerStore());
const { available: osUpdateAvailable } = storeToRefs(useUpdateOsStore());
const showErrorIcon = computed(() => errors.value.length || stateData.value.error);
const text = computed((): string => {
if (stateData.value.error && state.value !== 'EEXPIRED') {
return props.t('Fix Error');
}
return '';
});
const title = computed((): string => {
if (state.value === 'ENOKEYFILE') {
return props.t('Get Started');
}
if (state.value === 'EEXPIRED') {
return props.t('Trial Expired, see options below');
}
if (showErrorIcon.value) {
return props.t('Learn more about the error');
}
return dropdownVisible.value ? props.t('Close Dropdown') : props.t('Open Dropdown');
});
</script>
<template>
<button
class="group text-18px border-0 relative flex flex-row justify-end items-center h-full gap-x-8px opacity-100 hover:opacity-75 focus:opacity-75 transition-opacity text-header-text-primary"
:title="title"
@click="dropdownStore.dropdownToggle()"
>
<template v-if="errors.length && errors[0].level">
<InformationCircleIcon
v-if="errors[0].level === 'info'"
class="text-unraid-red fill-current relative w-24px h-24px"
/>
<ExclamationTriangleIcon
v-if="errors[0].level === 'warning'"
class="text-unraid-red fill-current relative w-24px h-24px"
/>
<ShieldExclamationIcon
v-if="errors[0].level === 'error'"
class="text-unraid-red fill-current relative w-24px h-24px"
/>
</template>
<span v-if="text" class="relative leading-none">
<span>{{ text }}</span>
<span
class="absolute bottom-[-3px] inset-x-0 h-2px w-full bg-gradient-to-r from-unraid-red to-orange rounded opacity-0 group-hover:opacity-100 group-focus:opacity-100 transition-opacity"
/>
</span>
<BellAlertIcon
v-if="osUpdateAvailable && !rebootType"
class="hover:animate-pulse fill-current relative w-16px h-16px"
/>
<Bars3Icon class="w-20px" />
<BrandAvatar />
</button>
</template>