Enhance dashboard charts design

This commit is contained in:
Jonathan Adeline committed 2025-03-10 05:50:54 +00:00
1 parent 1dc9a16030
commit f113354cb8
11 files changed
+279 -138

No files matched your search

@@ -7,6 +7,6 @@
@import 'dashboard_widget';
@import 'dashboard_summary_widget';
@import 'create_widget_button';
@import 'widget_header';
@import 'widget';
@import 'widget_settings_base_form';
@import 'create_widget_modal';
@@ -1,5 +1,5 @@
.dashboard-summary-widget {
padding: 0 24px 24px;
// nothing
}
.dashboard-summary-widget__summary {
@@ -7,7 +7,6 @@
font-size: 40px;
font-weight: 600;
line-height: 40px;
margin-top: 16px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
@@ -16,3 +15,11 @@
.dashboard-summary-widget__summary--misconfigured {
color: #cdcecf;
}
.dashboard-summary-widget__loading {
height: 120px;
.dashboard-summary-widget--with-header-description & {
height: 141.8px;
}
}
@@ -0,0 +1,62 @@
.widget__header {
display: flex;
flex-direction: row;
align-items: start;
gap: 7px;
padding: 20px 24px;
border-bottom: 1px solid $palette-neutral-200;
position: relative;
height: auto;
&--no-border {
border-bottom: none;
padding-bottom: 0;
}
&--edit-mode {
padding: 20px 55px 20px 24px;
}
}
.widget__header-main {
display: flex;
flex-direction: column;
min-width: 0;
}
.widget__header-context-menu {
margin-left: auto;
width: 46px;
position: absolute;
right: 0;
top: 8px;
}
.widget__header-title-wrapper {
display: flex;
align-items: center;
gap: 14px;
height: 20px;
}
.widget__header-title {
color: $palette-neutral-1200;
font-size: 16px;
font-weight: 500;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.widget__header-description {
@extend %ellipsis;
color: #6a6b70;
font-size: 12px;
font-weight: 400;
margin-top: 8px;
}
.widget__content {
padding: 20px;
}
@@ -1,57 +0,0 @@
.widget-header {
display: flex;
flex-direction: row;
align-items: start;
gap: 7px;
}
.widget-header__main {
padding-top: 24px;
overflow: hidden;
}
.widget-header__context-menu {
flex-grow: 1;
text-align: right;
margin: 6px -14px 0 7px;
width: 46px;
}
.widget-header__title-wrapper {
display: flex;
gap: 7px;
}
.widget-header__title {
color: $palette-neutral-1200;
font-size: 16px;
font-weight: 500;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.widget-header__description {
color: #6a6b70;
font-size: 12px;
font-weight: 400;
margin-top: 8px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.widget-header__fix-configuration {
display: flex;
align-items: center;
gap: 6px;
color: #b23f30;
font-size: 10px;
font-weight: 500;
line-height: 12px;
letter-spacing: 0.2px;
padding: 4px 8px;
border-radius: 80px;
background: #fff2f0;
white-space: nowrap;
}
@@ -12,14 +12,12 @@
</div>
<component
:is="widgetComponent(widget.type)"
v-if="isLoading === false"
:dashboard="dashboard"
:widget="widget"
:store-prefix="storePrefix"
:loading="isLoading"
:edit-mode="isEditMode"
/>
<div v-else>
<div class="dashboard-widget__loading"></div>
</div>
</div>
</template>
@@ -1,45 +1,46 @@
<template>
<div class="dashboard-summary-widget">
<div class="widget-header">
<div class="widget-header__main">
<div class="widget-header__title-wrapper">
<div class="widget-header__title">{{ widget.title }}</div>
<div
v-if="dataSourceMisconfigured"
class="widget-header__fix-configuration"
>
<svg
width="5"
height="6"
viewBox="0 0 5 6"
fill="none"
xmlns="http://www.w3.org/2000/svg"
<div
class="dashboard-summary-widget"
:class="{
'dashboard-summary-widget--with-header-description': widget.description,
}"
>
<template v-if="!loading">
<div class="widget__header widget__header--no-border">
<div class="widget__header-main">
<div class="widget__header-title-wrapper">
<div class="widget__header-title">{{ widget.title }}</div>
<Badge
v-if="dataSourceMisconfigured"
color="red"
indicator
rounded
>{{ $t('widget.fixConfiguration') }}</Badge
>
<circle cx="2.5" cy="3" r="2.5" fill="#FF5A44" />
</svg>
{{ $t('widget.fixConfiguration') }}
</div>
<div v-if="widget.description" class="widget__header-description">
{{ widget.description }}
</div>
</div>
<div v-if="widget.description" class="widget-header__description">
{{ widget.description }}
</div>
<WidgetContextMenu
v-if="isEditMode"
:widget="widget"
:dashboard="dashboard"
@delete-widget="$emit('delete-widget', $event)"
></WidgetContextMenu>
</div>
<WidgetContextMenu
v-if="isEditMode"
:widget="widget"
:dashboard="dashboard"
@delete-widget="$emit('delete-widget', $event)"
></WidgetContextMenu>
</div>
<div
class="dashboard-summary-widget__summary"
:class="{
'dashboard-summary-widget__summary--misconfigured':
dataSourceMisconfigured,
}"
>
{{ result }}
</div>
<div
class="widget__content dashboard-summary-widget__summary"
:class="{
'dashboard-summary-widget__summary--misconfigured':
dataSourceMisconfigured,
}"
>
{{ result }}
</div>
</template>
<div v-else class="dashboard-summary-widget__loading loading-spinner"></div>
</div>
</template>
@@ -63,6 +64,11 @@ export default {
required: false,
default: '',
},
loading: {
type: Boolean,
required: false,
default: false,
},
},
computed: {
dataSource() {
@@ -1,11 +1,11 @@
<template>
<div ref="contextButton" class="widget-header__context-menu">
<div ref="contextButton" class="widget__header-context-menu">
<ButtonIcon
icon="iconoir-more-vert"
type="secondary"
size="regular"
@click.stop="
$refs.context.toggle($refs.contextButton, 'bottom', 'right', 8, 0)
$refs.context.toggle($refs.contextButton, 'bottom', 'right', 8, -8)
"
></ButtonIcon>
<WidgetContext