Skip to content

Commit e88a010

Browse files
authored
titleDetails implemented on DashCanvasView and DashContainerView (#781)
Goes with HoistReact PR: xh/hoist-react#4105
1 parent 5b023ac commit e88a010

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

client-app/src/desktop/tabs/layout/widgets/ChartWidget.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ import {DashCanvasViewModel, DashViewModel} from '@xh/hoist/desktop/cmp/dash';
88
import {button, modalToggleButton} from '@xh/hoist/desktop/cmp/button';
99
import {ONE_DAY} from '@xh/hoist/utils/datetime';
1010
import {Icon} from '@xh/hoist/icon/Icon';
11-
import './ChartWidget.scss';
1211
import {LineChartModel} from '../../charts/LineChartModel';
12+
import './ChartWidget.scss';
1313

1414
export const chartWidget = hoistCmp.factory({
1515
model: creates(() => ChartWidgetModel),
1616
render({model}) {
1717
const {panelModel, symbols, dashViewModel} = model,
1818
modalOpts = {
19-
title: dashViewModel.title,
19+
title: dashViewModel.fullTitle,
2020
icon: dashViewModel.icon,
2121
headerItems: [rangeSelector({model}), modalToggleButton({panelModel})]
2222
};
@@ -105,5 +105,10 @@ class ChartWidgetModel extends LineChartModel {
105105
exporting: {enabled: false}
106106
});
107107
}
108+
109+
// Demo dynamic titleDetails with ticking timestamp in view title.
110+
setInterval(() => {
111+
dashViewModel.titleDetails = new Date().toTimeString().split(' ')[0];
112+
}, 1000);
108113
}
109114
}

client-app/src/examples/portfolio/detail/orders/OrdersModel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export class OrdersModel extends HoistModel {
123123
});
124124
if (loadSpec.isStale) return;
125125

126-
dashViewModel.title = `Orders (${orders.length})`;
126+
dashViewModel.titleDetails = `(${orders.length})`;
127127
orders.forEach(order => (order.closingPrices = sparklineSeries[order.symbol]));
128128
gridModel.loadData(orders);
129129

0 commit comments

Comments
 (0)