fix all build checks

This commit is contained in:
liangping
2023-06-08 10:02:47 +08:00
parent e2782c1e00
commit a25dde89f5
18 changed files with 123 additions and 80 deletions
+2
View File
@@ -1,4 +1,6 @@
<script lang="ts">
import { defineComponent, resolveComponent, h } from 'vue'
export default defineComponent({
setup() {
const routerView = resolveComponent('router-view');
+14 -3
View File
@@ -13,6 +13,7 @@ import { useBlockchain } from '@/stores';
import NavBarI18n from './NavBarI18n.vue';
import NavBarWallet from './NavBarWallet.vue';
import type { NavGroup, NavLink, NavSectionTitle } from '../types';
const dashboard = useDashboard();
dashboard.initial();
@@ -35,6 +36,16 @@ const changeOpen = (index: Number) => {
}
};
const showDiscord = window.location.host.search('ping.pub') > -1;
function isNavGroup(nav: NavGroup | NavLink | NavSectionTitle | any): nav is NavGroup {
return (<NavGroup>nav).children !== undefined;
}
function isNavLink(nav: NavGroup | NavLink | NavSectionTitle | any): nav is NavLink {
return (<NavLink>nav).to !== undefined;
}
function isNavTitle(nav: NavGroup | NavLink | NavSectionTitle | any): nav is NavSectionTitle {
return (<NavSectionTitle>nav).heading !== undefined;
}
</script>
<template>
@@ -62,7 +73,7 @@ const showDiscord = window.location.host.search('ping.pub') > -1;
class="px-2"
>
<div
v-if="item?.title && item?.children?.length"
v-if="isNavGroup(item)"
:tabindex="index"
class="collapse"
:class="{
@@ -151,7 +162,7 @@ const showDiscord = window.location.host.search('ping.pub') > -1;
<RouterLink
:to="item?.to"
v-if="item?.title && !item?.children?.length && item?.to"
v-if="isNavGroup(item)"
@click="sidebarShow = false"
class="cursor-pointer rounded-lg px-4 flex items-center py-2 hover:bg-gray-100 dark:hover:bg-[#373f59]"
>
@@ -183,7 +194,7 @@ const showDiscord = window.location.host.search('ping.pub') > -1;
</div>
</RouterLink>
<div
v-if="item?.heading"
v-if="isNavTitle(item)"
class="px-4 text-sm text-gray-400 pb-2 uppercase"
>
{{ item?.heading }}
+3 -1
View File
@@ -1,6 +1,8 @@
<script lang="ts" setup>
import { ref, watch } from 'vue';
import { Icon } from '@iconify/vue';
import { useI18n } from 'vue-i18n';
const i18nLangs: Array<{ label: string; i18nLang: string }> = [
{
label: 'English',
@@ -13,7 +15,7 @@ const i18nLangs: Array<{ label: string; i18nLang: string }> = [
];
let locale = ref(useI18n({ useScope: 'global' }).locale);
watch(locale, (val: string) => {
watch(locale, (val) => {
document.documentElement.setAttribute('lang', val as string);
});
+58
View File
@@ -0,0 +1,58 @@
// 👉 Vertical nav section title
export interface NavSectionTitle extends Partial<AclProperties> {
heading: string
}
// 👉 Vertical nav link
declare type ATagTargetAttrValues = '_blank' | '_self' | '_parent' | '_top' | 'framename'
declare type ATagRelAttrValues =
| 'alternate'
| 'author'
| 'bookmark'
| 'external'
| 'help'
| 'license'
| 'next'
| 'nofollow'
| 'noopener'
| 'noreferrer'
| 'prev'
| 'search'
| 'tag'
export interface NavLinkProps {
to?: RouteLocationRaw | string | null
href?: string
target?: ATagTargetAttrValues
rel?: ATagRelAttrValues
i18n?: boolean
}
export interface Icon {
icon?: string,
image?: string,
size: string,
}
export interface NavLink extends NavLinkProps {
title: string
icon?: Icon
badgeContent?: string
badgeClass?: string
disable?: boolean
order?: number
}
// 👉 Vertical nav group
export interface NavGroup extends NavLinkProps {
title: string
icon?: Icon
badgeContent?: string
badgeClass?: string
children: (NavLink | NavGroup)[]
disable?: boolean
order?: number
}
export declare type VerticalNavItems = (NavLink | NavGroup | NavSectionTitle)[]
export declare type HorizontalNavItems = (NavLink | NavGroup)[]