feat(web): adopt vuesax icons and shared skeleton loading

Replace the inline SVG icon set with the vuesax linear pack, add skeleton primitives for loading states, and keep page scroll inside the app shell.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-11-05 14:46:35 +03:30
co-authored by Cursor
parent 41f310f3a2
commit 6c6e32e099
133 changed files with 9069 additions and 7416 deletions
@@ -0,0 +1,19 @@
<script setup lang="ts">
import { provide, toRef } from 'vue';
import { CRM_SKELETON_LOADING } from './context';
const props = withDefaults(
defineProps<{
loading?: boolean;
}>(),
{ loading: false },
);
provide(CRM_SKELETON_LOADING, toRef(props, 'loading'));
</script>
<template>
<div class="crm-skeleton-root" :data-loading="loading ? '1' : '0'">
<slot />
</div>
</template>
@@ -0,0 +1,31 @@
<script setup lang="ts">
import { computed, toRef } from 'vue';
import { Skeleton, theme } from 'ant-design-vue';
import { useCrmSkeletonLoading } from './context';
const ASkeletonAvatar = Skeleton.Avatar;
const props = withDefaults(
defineProps<{
loading?: boolean;
size?: number;
shape?: 'circle' | 'square';
}>(),
{ size: 40, shape: 'circle' },
);
const { token } = theme.useToken();
const isLoading = useCrmSkeletonLoading(toRef(props, 'loading'));
const sizePx = computed(() => props.size ?? token.value.controlHeightLG ?? 40);
</script>
<template>
<a-skeleton-avatar
v-if="isLoading"
active
:size="sizePx"
:shape="shape"
/>
<slot v-else />
</template>
@@ -0,0 +1,51 @@
<script setup lang="ts">
import { computed, toRef } from 'vue';
import { Skeleton, theme } from 'ant-design-vue';
import { useCrmSkeletonLoading } from './context';
const ASkeletonButton = Skeleton.Button;
const props = withDefaults(
defineProps<{
loading?: boolean;
width?: string | number;
height?: string | number;
round?: boolean;
block?: boolean;
}>(),
{
round: false,
block: true,
},
);
const { token } = theme.useToken();
const isLoading = useCrmSkeletonLoading(toRef(props, 'loading'));
const widthCss = computed(() =>
props.width == null ? '100%' : typeof props.width === 'number' ? `${props.width}px` : props.width,
);
const heightCss = computed(() =>
props.height == null
? `${token.value.controlHeight}px`
: typeof props.height === 'number'
? `${props.height}px`
: props.height,
);
</script>
<template>
<a-skeleton-button
v-if="isLoading"
active
:block="block"
:shape="round ? 'round' : 'default'"
:style="{
width: widthCss,
minWidth: widthCss,
height: heightCss,
borderRadius: round ? '999px' : `${token.borderRadius}px`,
}"
/>
<slot v-else />
</template>
@@ -0,0 +1,30 @@
<script setup lang="ts">
import { toRef } from 'vue';
import { Card as ACard, Skeleton as ASkeleton } from 'ant-design-vue';
import { useCrmSkeletonLoading } from './context';
const props = withDefaults(
defineProps<{
loading?: boolean;
/** Approximate body lines inside the card */
rows?: number;
bordered?: boolean;
/** Min height so layout does not jump */
minHeight?: number;
}>(),
{ rows: 4, bordered: false },
);
const isLoading = useCrmSkeletonLoading(toRef(props, 'loading'));
</script>
<template>
<a-card
v-if="isLoading"
:bordered="bordered"
:style="minHeight ? { minHeight: `${minHeight}px` } : undefined"
>
<a-skeleton active :title="{ width: '40%' }" :paragraph="{ rows }" />
</a-card>
<slot v-else />
</template>
@@ -0,0 +1,50 @@
<script setup lang="ts">
import { computed, toRef } from 'vue';
import { Skeleton, theme } from 'ant-design-vue';
import { useCrmSkeletonLoading } from './context';
const ASkeletonButton = Skeleton.Button;
const ASkeletonInput = Skeleton.Input;
const props = withDefaults(
defineProps<{
loading?: boolean;
width?: string | number;
/** button | input | select — all use controlHeight 36 */
shape?: 'button' | 'input' | 'select' | 'default';
}>(),
{ shape: 'default', width: 120 },
);
const { token } = theme.useToken();
const isLoading = useCrmSkeletonLoading(toRef(props, 'loading'));
const widthCss = computed(() =>
typeof props.width === 'number' ? `${props.width}px` : props.width,
);
const isField = computed(() => props.shape === 'input' || props.shape === 'select');
</script>
<template>
<a-skeleton-input
v-if="isLoading && isField"
active
:style="{
width: widthCss,
minWidth: widthCss,
height: `${token.controlHeight}px`,
}"
/>
<a-skeleton-button
v-else-if="isLoading"
active
:style="{
width: widthCss,
minWidth: widthCss,
height: `${token.controlHeight}px`,
borderRadius: `${token.borderRadius}px`,
}"
/>
<slot v-else />
</template>
@@ -0,0 +1,44 @@
<script setup lang="ts">
import { toRef } from 'vue';
import { Card as ACard, Flex as AFlex, Skeleton, theme } from 'ant-design-vue';
import { useCrmSkeletonLoading } from './context';
const ASkeletonButton = Skeleton.Button;
const props = withDefaults(
defineProps<{
loading?: boolean;
bordered?: boolean;
}>(),
{ bordered: false },
);
const { token } = theme.useToken();
const isLoading = useCrmSkeletonLoading(toRef(props, 'loading'));
</script>
<template>
<a-card v-if="isLoading" :bordered="bordered">
<a-flex vertical :gap="token.paddingXS">
<a-skeleton-button
active
:style="{
width: '45%',
minWidth: 0,
height: `${token.fontSizeSM}px`,
borderRadius: `${token.borderRadiusSM}px`,
}"
/>
<a-skeleton-button
active
:style="{
width: '60%',
minWidth: 0,
height: '28px',
borderRadius: `${token.borderRadius}px`,
}"
/>
</a-flex>
</a-card>
<slot v-else />
</template>
@@ -0,0 +1,31 @@
<script setup lang="ts">
import { toRef } from 'vue';
import { Flex as AFlex, Skeleton as ASkeleton, theme } from 'ant-design-vue';
import { useCrmSkeletonLoading } from './context';
const props = withDefaults(
defineProps<{
loading?: boolean;
rows?: number;
avatar?: boolean;
}>(),
{ rows: 6, avatar: true },
);
const { token } = theme.useToken();
const isLoading = useCrmSkeletonLoading(toRef(props, 'loading'));
</script>
<template>
<a-flex v-if="isLoading" vertical :gap="token.paddingSM">
<a-skeleton
v-for="i in rows"
:key="i"
active
:avatar="avatar ? { size: token.controlHeight, shape: 'circle' } : false"
:title="{ width: '40%' }"
:paragraph="{ rows: 1, width: ['70%'] }"
/>
</a-flex>
<slot v-else />
</template>
@@ -0,0 +1,26 @@
<script setup lang="ts">
import { toRef } from 'vue';
import { Skeleton as ASkeleton } from 'ant-design-vue';
import { useCrmSkeletonLoading } from './context';
const props = withDefaults(
defineProps<{
loading?: boolean;
rows?: number;
width?: string | number | Array<string | number>;
}>(),
{ rows: 3 },
);
const isLoading = useCrmSkeletonLoading(toRef(props, 'loading'));
</script>
<template>
<a-skeleton
v-if="isLoading"
active
:title="false"
:paragraph="{ rows, width }"
/>
<slot v-else />
</template>
@@ -0,0 +1,115 @@
<script setup lang="ts">
import { computed, toRef } from 'vue';
import { Card as ACard, Flex as AFlex, Skeleton, theme } from 'ant-design-vue';
import { useCrmSkeletonLoading } from './context';
const ASkeletonButton = Skeleton.Button;
const props = withDefaults(
defineProps<{
loading?: boolean;
rows?: number;
columns?: number;
/** Wrap bones in a card (matches most list pages) */
card?: boolean;
bordered?: boolean;
}>(),
{ rows: 8, columns: 5, card: true, bordered: false },
);
const { token } = theme.useToken();
const isLoading = useCrmSkeletonLoading(toRef(props, 'loading'));
const colWidths = computed(() => {
const n = Math.max(1, props.columns);
return Array.from({ length: n }, (_, i) => {
if (i === 0) return '22%';
if (i === n - 1) return '12%';
return `${Math.floor(66 / Math.max(1, n - 2))}%`;
});
});
const rowHeight = computed(() => token.value.controlHeight + (token.value.paddingXS ?? 8));
const headerH = computed(() => Math.round((token.value.fontSizeSM ?? 12) + 4));
const cellH = computed(() => token.value.fontSize ?? 14);
</script>
<template>
<a-card v-if="isLoading && card" :bordered="bordered">
<a-flex vertical :gap="token.paddingXS">
<a-flex :gap="token.paddingSM" :style="{ marginBottom: `${token.marginXS}px` }">
<a-skeleton-button
v-for="(w, i) in colWidths"
:key="`h-${i}`"
active
:style="{
width: w,
minWidth: 0,
flex: `0 0 ${w}`,
height: `${headerH}px`,
borderRadius: `${token.borderRadiusSM}px`,
}"
/>
</a-flex>
<a-flex
v-for="r in rows"
:key="`r-${r}`"
:gap="token.paddingSM"
align="center"
:style="{ minHeight: `${rowHeight}px` }"
>
<a-skeleton-button
v-for="(w, i) in colWidths"
:key="`c-${r}-${i}`"
active
:style="{
width: i === 0 ? '85%' : '70%',
maxWidth: w,
minWidth: 0,
flex: `0 0 ${w}`,
height: `${cellH}px`,
borderRadius: `${token.borderRadiusSM}px`,
}"
/>
</a-flex>
</a-flex>
</a-card>
<a-flex v-else-if="isLoading" vertical :gap="token.paddingXS">
<a-flex :gap="token.paddingSM" :style="{ marginBottom: `${token.marginXS}px` }">
<a-skeleton-button
v-for="(w, i) in colWidths"
:key="`h-${i}`"
active
:style="{
width: w,
minWidth: 0,
flex: `0 0 ${w}`,
height: `${headerH}px`,
borderRadius: `${token.borderRadiusSM}px`,
}"
/>
</a-flex>
<a-flex
v-for="r in rows"
:key="`r-${r}`"
:gap="token.paddingSM"
align="center"
:style="{ minHeight: `${rowHeight}px` }"
>
<a-skeleton-button
v-for="(w, i) in colWidths"
:key="`c-${r}-${i}`"
active
:style="{
width: i === 0 ? '85%' : '70%',
maxWidth: w,
minWidth: 0,
flex: `0 0 ${w}`,
height: `${cellH}px`,
borderRadius: `${token.borderRadiusSM}px`,
}"
/>
</a-flex>
</a-flex>
<slot v-else />
</template>
@@ -0,0 +1,55 @@
<script setup lang="ts">
import { computed, toRef } from 'vue';
import { Skeleton, theme } from 'ant-design-vue';
import { useCrmSkeletonLoading } from './context';
const ASkeletonButton = Skeleton.Button;
const props = withDefaults(
defineProps<{
loading?: boolean;
width?: string | number;
/** Typography title level approximation: 1≈38, 2≈30, 3≈24, 4≈20, 5≈16 */
level?: 1 | 2 | 3 | 4 | 5;
}>(),
{ level: 3, width: 180 },
);
const { token } = theme.useToken();
const isLoading = useCrmSkeletonLoading(toRef(props, 'loading'));
const height = computed(() => {
switch (props.level) {
case 1:
return 38;
case 2:
return 30;
case 3:
return 24;
case 4:
return 20;
default:
return 16;
}
});
const widthCss = computed(() =>
typeof props.width === 'number' ? `${props.width}px` : props.width,
);
</script>
<template>
<a-skeleton-button
v-if="isLoading"
active
:style="{
width: widthCss,
minWidth: widthCss,
height: `${height}px`,
borderRadius: `${token.borderRadiusSM}px`,
}"
/>
<div v-else :style="{ minHeight: `${height}px` }">
<slot />
</div>
</template>
@@ -0,0 +1,13 @@
import { computed, inject, type ComputedRef, type InjectionKey, type Ref } from 'vue';
export const CRM_SKELETON_LOADING: InjectionKey<Ref<boolean> | ComputedRef<boolean>> =
Symbol('crmSkeletonLoading');
/** Resolve whether a skeleton block should show bones (local override wins). */
export function useCrmSkeletonLoading(local?: Ref<boolean | undefined> | ComputedRef<boolean | undefined>) {
const injected = inject(CRM_SKELETON_LOADING, null);
return computed(() => {
if (local?.value !== undefined) return !!local.value;
return !!injected?.value;
});
}
+11
View File
@@ -0,0 +1,11 @@
export { default as CrmSkeleton } from './CrmSkeleton.vue';
export { default as CrmSkeletonBone } from './CrmSkeletonBone.vue';
export { default as CrmSkeletonTitle } from './CrmSkeletonTitle.vue';
export { default as CrmSkeletonControl } from './CrmSkeletonControl.vue';
export { default as CrmSkeletonParagraph } from './CrmSkeletonParagraph.vue';
export { default as CrmSkeletonAvatar } from './CrmSkeletonAvatar.vue';
export { default as CrmSkeletonCard } from './CrmSkeletonCard.vue';
export { default as CrmSkeletonTable } from './CrmSkeletonTable.vue';
export { default as CrmSkeletonKpi } from './CrmSkeletonKpi.vue';
export { default as CrmSkeletonList } from './CrmSkeletonList.vue';
export { CRM_SKELETON_LOADING, useCrmSkeletonLoading } from './context';