fix(web): replaceCheck type

This commit is contained in:
Zack Spear
2023-09-27 20:12:07 -07:00
committed by Zack Spear
parent 676ea0629b
commit c1b509220e
2 changed files with 18 additions and 1 deletions

View File

@@ -8,12 +8,17 @@ import type { WretchError } from 'wretch';
import { validateGuid, type ValidateGuidPayload } from '~/composables/services/keyServer';
import { useServerStore } from '~/store/server';
import type { UiBadgeProps } from '~/types/ui/badge';
/**
* @see https://stackoverflow.com/questions/73476371/using-pinia-with-vue-js-web-components
* @see https://github.com/vuejs/pinia/discussions/1085
*/
setActivePinia(createPinia());
export interface UiBadgePropsExtended extends UiBadgeProps {
text?: string;
}
export const useReplaceCheckStore = defineStore('replaceCheck', () => {
const serverStore = useServerStore();
@@ -27,7 +32,7 @@ export const useReplaceCheckStore = defineStore('replaceCheck', () => {
cause?: unknown;
} | null>(null);
const status = ref<'checking' | 'eligible' | 'error' | 'ineligible' | 'ready'>(guid.value ? 'ready' : 'error');
const statusOutput = computed(() => {
const statusOutput = computed((): UiBadgePropsExtended => {
// text values are translated in the component
switch (status.value) {
case 'eligible':

12
web/types/ui/badge.ts Normal file
View File

@@ -0,0 +1,12 @@
import { XCircleIcon } from '@heroicons/vue/24/solid';
import type { Component } from 'vue';
export type UiBadgePropsColor = 'alpha' | 'beta' | 'gamma' | 'gray' | 'red' | 'yellow' | 'green' | 'blue' | 'indigo' | 'purple' | 'pink' | 'orange' | 'black' | 'white' | 'transparent' | 'current' | 'custom';
export interface UiBadgeProps {
color?: UiBadgePropsColor;
icon?: typeof XCircleIcon | Component;
iconRight?: typeof XCircleIcon | Component;
iconStyles?: string;
size?: '12px' | '14px' | '16px' | '18px' | '20px' | '24px';
}