Files
api/web/components/Notifications/Indicator.vue
Eli Bosley f5724abffb feat: code first graphql (#1347)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Enhanced API capabilities with improved GraphQL interfaces for remote
access, parity checks, notifications, and virtual machine controls.
- Introduction of dynamic remote access settings and refined online
status and service monitoring.
- New `ParityCheckMutationsResolver` for managing parity check
operations through GraphQL.

- **Refactor**
- Consolidated and renamed internal types and schema definitions to
improve consistency and performance.
  - Removed deprecated legacy schemas to streamline the API.
- Updated import paths for various types to reflect new module
structures.

- **Chore**
- Updated environment configurations and test setups to support the new
logging and configuration mechanisms.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-04-11 15:03:01 -04:00

58 lines
1.6 KiB
Vue

<script setup lang="ts">
import { BellIcon, ExclamationTriangleIcon, ShieldExclamationIcon } from '@heroicons/vue/24/solid';
import { cn } from '@unraid/ui';
import type { OverviewQuery } from '~/composables/gql/graphql';
import { NotificationImportance as Importance } from '~/composables/gql/graphql';
const props = defineProps<{ overview?: OverviewQuery['notifications']['overview']; seen?: boolean }>();
const indicatorLevel = computed(() => {
if (!props.overview?.unread) {
return undefined;
}
switch (true) {
case props.overview.unread.alert > 0:
return Importance.ALERT;
case props.overview.unread.warning > 0:
return Importance.WARNING;
case props.overview.unread.total > 0:
return 'UNREAD';
default:
return undefined;
}
});
const icon = computed<{ component: Component; color: string } | null>(() => {
switch (indicatorLevel.value) {
case Importance.WARNING:
return {
component: ExclamationTriangleIcon,
color: 'text-yellow-500 translate-y-0.5',
};
case Importance.ALERT:
return {
component: ShieldExclamationIcon,
color: 'text-unraid-red',
};
}
return null;
});
</script>
<template>
<div class="relative">
<BellIcon class="w-6 h-6 text-header-text-primary" />
<div
v-if="!seen && indicatorLevel === 'UNREAD'"
class="absolute top-0 right-0 size-2.5 rounded-full border border-neutral-800 bg-unraid-green"
/>
<component
:is="icon.component"
v-else-if="!seen && icon && indicatorLevel"
:class="cn('absolute -top-1 -right-1 size-4 rounded-full', icon.color)"
/>
</div>
</template>