Files
api/web/components/UserProfile/ServerState.vue
Zack Spear 1ecac5ee4e fix(web): theme header differences (#1085)
* feat(theme): add default header colors for theme differences

* refactor(theme): update UserProfile component colors to use theme variables

* fix(theme): safely handle default header colors for themes
2025-01-30 11:14:30 -08:00

44 lines
1.5 KiB
Vue

<script setup lang="ts">
import { storeToRefs } from 'pinia';
import type { ComposerTranslation } from 'vue-i18n';
import { useServerStore } from '~/store/server';
import type { ServerStateDataAction } from '~/types/server';
defineProps<{ t: ComposerTranslation; }>();
const { state, stateData } = storeToRefs(useServerStore());
const purchaseAction = computed((): ServerStateDataAction | undefined => {
return stateData.value.actions && stateData.value.actions.find(action => action.name === 'purchase');
});
const upgradeAction = computed((): ServerStateDataAction | undefined => {
return stateData.value.actions && stateData.value.actions.find(action => action.name === 'upgrade');
});
</script>
<template>
<span class="flex flex-row items-center gap-x-8px">
<template v-if="upgradeAction">
<UpcServerStateBuy
class="text-header-text-secondary"
:title="t('Upgrade Key')"
@click="upgradeAction.click?.()"
>
<h5>Unraid OS <em><strong>{{ t(stateData.humanReadable) }}</strong></em></h5>
</UpcServerStateBuy>
</template>
<h5 v-else>
Unraid OS <em :class="{ 'text-unraid-red': stateData.error || state === 'EEXPIRED' }"><strong>{{ t(stateData.humanReadable) }}</strong></em>
</h5>
<template v-if="purchaseAction">
<UpcServerStateBuy
class="text-orange-dark relative top-[1px] hidden sm:block"
:title="t('Purchase Key')"
@click="purchaseAction.click?.()"
>{{ t('Purchase') }}</UpcServerStateBuy>
</template>
</span>
</template>