Skip to content

Commit

Permalink
widgets loading state
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikita-Polyakov committed Mar 13, 2024
1 parent f03dd76 commit aa96140
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/components/pages/Swap/Widget/Form.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<base-widget class="swap-widget" :title="t('exchange.Swap')" v-loading="parentLoading" v-bind="$attrs">
<base-widget class="swap-widget" :title="t('exchange.Swap')" v-bind="$attrs">
<template #filters>
<swap-status-action-badge>
<template #label>{{ t('marketText') }}:</template>
Expand Down
14 changes: 11 additions & 3 deletions src/components/shared/Widget/Base.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
size="big"
primary
:class="['base-widget', { delimeter, full }]"
v-loading="loading"
>
<template #header v-if="hasHeader">
<div class="base-widget-block base-widget-header">
Expand Down Expand Up @@ -41,6 +42,10 @@ import { debouncedInputHandler } from '@/utils';
@Component
export default class BaseWidget extends Vue {
/**
* The widget title has a large font-size
*/
@Prop({ default: false, type: Boolean }) readonly primaryTitle!: boolean;
/**
* The widget title text
*/
Expand All @@ -62,9 +67,9 @@ export default class BaseWidget extends Vue {
*/
@Prop({ default: false, type: Boolean }) readonly extensive!: boolean;
/**
* The widget title has a large font-size
* Widget has a loading state
*/
@Prop({ default: false, type: Boolean }) readonly primaryTitle!: boolean;
@Prop({ default: false, type: Boolean }) readonly loading!: boolean;
@Prop({ default: () => {}, type: Function }) readonly onResize!: (rect: DOMRect) => void;
Expand Down Expand Up @@ -134,9 +139,12 @@ $left: $inner-spacing-medium;
display: flex;
flex-flow: column nowrap;
align-items: normal;
overflow: unset;
overflow: hidden;
&.full {
width: 100%;
height: 100%;
flex: 1;
}
Expand Down
7 changes: 5 additions & 2 deletions src/components/shared/Widget/Grid/Grid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
:is-resizable="resizable"
:margin="[margin, margin]"
:responsive="true"
:prevent-collision="true"
:prevent-collision="false"
:vertical-compact="compact"
:use-css-transforms="false"
:use-css-transforms="true"
@layout-ready="onReady"
@breakpoint-changed="onBreakpointChanged"
>
Expand All @@ -20,6 +20,8 @@
v-if="ready"
:name="widget.i"
v-bind="{
id: widget.i,
loading,
onResize: ($event) => onWidgetResize($event, widget.i),
}"
/>
Expand Down Expand Up @@ -65,6 +67,7 @@ export default class WidgetsGrid extends Vue {
@Prop({ default: false, type: Boolean }) readonly draggable!: boolean;
@Prop({ default: false, type: Boolean }) readonly resizable!: boolean;
@Prop({ default: false, type: Boolean }) readonly compact!: boolean;
@Prop({ default: false, type: Boolean }) readonly loading!: boolean;
@Prop({ default: () => DEFAULT_COLS, type: Object }) readonly cols!: LayoutConfig;
@Prop({ default: () => DEFAULT_BREAKPOINTS, type: Object }) readonly breakpoints!: LayoutConfig;
Expand Down
2 changes: 1 addition & 1 deletion src/components/shared/Widget/PriceChart.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<base-widget full v-loading="parentLoading">
<base-widget v-bind="$attrs">
<template #title>
<tokens-row border :assets="tokens" size="medium" />
<div v-if="tokenA" class="token-title">
Expand Down
15 changes: 5 additions & 10 deletions src/views/Swap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,20 @@
:resizable="resizable"
:compact="compact"
:layouts="layouts"
:loading="parentLoading"
class="swap-container"
>
<template v-slot:[SwapWidgets.Form]="props">
<swap-form-widget :id="SwapWidgets.Form" v-bind="props" primary-title :parent-loading="parentLoading" />
<swap-form-widget v-bind="props" primary-title />
</template>
<template v-slot:[SwapWidgets.Chart]="props">
<swap-chart-widget :id="SwapWidgets.Chart" v-bind="props" full :parent-loading="parentLoading" />
<swap-chart-widget v-bind="props" full />
</template>
<template v-slot:[SwapWidgets.Distribution]="props">
<swap-distribution-widget :id="SwapWidgets.Distribution" v-bind="props" :parent-loading="parentLoading" />
<swap-distribution-widget v-bind="props" />
</template>
<template v-slot:[SwapWidgets.Transactions]="props">
<swap-transactions-widget
:id="SwapWidgets.Transactions"
v-bind="props"
full
extensive
:parent-loading="parentLoading"
/>
<swap-transactions-widget v-bind="props" full extensive />
</template>
</widgets-grid>
</div>
Expand Down

0 comments on commit aa96140

Please sign in to comment.