Skip to content

Commit 319785c

Browse files
committed
polish big number status bar
1 parent b661e3e commit 319785c

File tree

5 files changed

+20
-21
lines changed

5 files changed

+20
-21
lines changed

src/messageTypes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ export type LocalizedMessages = {
263263
comparisonValuePlaceholder: string;
264264
comparisonTitleLabel: string;
265265
comparisonTitlePlaceholder: string;
266+
comparisonTitleHelp: string;
266267
comparisonFormatLabel: string;
267268
comparisonFormatHelp: string;
268269
};

src/notebooks/deepnote/bigNumberComparisonSettingsWebview.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ export class BigNumberComparisonSettingsWebviewProvider {
168168
comparisonValuePlaceholder: localize.BigNumberComparison.comparisonValuePlaceholder,
169169
comparisonTitleLabel: localize.BigNumberComparison.comparisonTitleLabel,
170170
comparisonTitlePlaceholder: localize.BigNumberComparison.comparisonTitlePlaceholder,
171+
comparisonTitleHelp: localize.BigNumberComparison.comparisonTitleHelp,
171172
comparisonFormatLabel: localize.BigNumberComparison.comparisonFormatLabel,
172173
comparisonFormatHelp: localize.BigNumberComparison.comparisonFormatHelp,
173174
saveButton: localize.BigNumberComparison.saveButton,

src/notebooks/deepnote/deepnoteBigNumberCellStatusBarProvider.ts

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -136,17 +136,16 @@ export class DeepnoteBigNumberCellStatusBarProvider
136136
const items: NotebookCellStatusBarItem[] = [];
137137
const metadata = cell.metadata as Record<string, unknown> | undefined;
138138

139-
// 1. Block type indicator with title
140-
const title = (metadata?.deepnote_big_number_title as string) || '';
141-
const blockTypeText = title ? `Big Number: ${title}` : 'Big Number';
139+
// 1. Block type indicator
142140
items.push({
143-
text: blockTypeText,
141+
text: 'Big Number',
144142
alignment: 1, // NotebookCellStatusBarAlignment.Left
145143
priority: 100,
146144
tooltip: this.buildTooltip(metadata)
147145
});
148146

149147
// 2. Title editor
148+
const title = (metadata?.deepnote_big_number_title as string) || '';
150149
const titleText = title ? `$(edit) ${title}` : '$(edit) Set title';
151150
items.push({
152151
text: titleText,
@@ -162,10 +161,9 @@ export class DeepnoteBigNumberCellStatusBarProvider
162161

163162
// 3. Format selector
164163
const format = (metadata?.deepnote_big_number_format as string) || 'number';
165-
const formatIcon = this.getFormatIcon(format);
166164
const formatLabel = this.getFormatLabel(format);
167165
items.push({
168-
text: `${formatIcon} ${formatLabel}`,
166+
text: formatLabel,
169167
alignment: 1,
170168
priority: 90,
171169
tooltip: l10n.t('Click to change format'),
@@ -184,9 +182,9 @@ export class DeepnoteBigNumberCellStatusBarProvider
184182
let comparisonText: string;
185183
if (comparisonEnabled && comparisonType && comparisonValue) {
186184
const comparisonTypeLabel = comparisonType === 'percentage-change' ? '% change' : 'vs';
187-
comparisonText = `$(graph) ${comparisonTypeLabel}: ${comparisonValue}`;
185+
comparisonText = `Comparison: ${comparisonTypeLabel} ${comparisonValue}`;
188186
} else {
189-
comparisonText = '$(graph) Add comparison';
187+
comparisonText = 'Set up comparison';
190188
}
191189

192190
items.push({
@@ -201,6 +199,13 @@ export class DeepnoteBigNumberCellStatusBarProvider
201199
}
202200
});
203201

202+
// 5. Hint text on the right
203+
items.push({
204+
text: l10n.t('Expression to show'),
205+
alignment: 2, // NotebookCellStatusBarAlignment.Right
206+
priority: 100
207+
});
208+
204209
return items;
205210
}
206211

@@ -223,17 +228,6 @@ export class DeepnoteBigNumberCellStatusBarProvider
223228
return lines.join('\n');
224229
}
225230

226-
private getFormatIcon(format: string): string {
227-
switch (format) {
228-
case 'currency':
229-
return '$(symbol-currency)';
230-
case 'percent':
231-
return '$(symbol-misc)';
232-
default:
233-
return '$(symbol-number)';
234-
}
235-
}
236-
237231
private getFormatLabel(format: string): string {
238232
switch (format) {
239233
case 'currency':
@@ -251,7 +245,7 @@ export class DeepnoteBigNumberCellStatusBarProvider
251245
const currentTitle = (metadata?.deepnote_big_number_title as string) || '';
252246

253247
const newTitle = await window.showInputBox({
254-
prompt: l10n.t('Enter title for big number'),
248+
prompt: l10n.t('Enter title for big number. You can use {{var}} syntax to reference variables.'),
255249
value: currentTitle,
256250
placeHolder: l10n.t('e.g., Total Revenue')
257251
});
@@ -315,4 +309,3 @@ export class DeepnoteBigNumberCellStatusBarProvider
315309
this.comparisonSettingsWebview.dispose();
316310
}
317311
}
318-

src/platform/common/utils/localize.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,7 @@ export namespace BigNumberComparison {
930930
export const comparisonValuePlaceholder = l10n.t('e.g., last_month_revenue');
931931
export const comparisonTitleLabel = l10n.t('Comparison title (optional)');
932932
export const comparisonTitlePlaceholder = l10n.t('e.g., vs last month');
933+
export const comparisonTitleHelp = l10n.t('You can use {{var}} syntax to reference variables');
933934
export const comparisonFormatLabel = l10n.t('Comparison format (optional)');
934935
export const comparisonFormatHelp = l10n.t('Leave empty to use the same format as the main value');
935936
export const saveButton = l10n.t('Save');

src/webviews/webview-side/bigNumberComparisonSettings/BigNumberComparisonSettingsPanel.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,9 @@ export const BigNumberComparisonSettingsPanel: React.FC<IBigNumberComparisonSett
172172
onChange={handleComparisonTitleChange}
173173
placeholder={getLocString('comparisonTitlePlaceholder', 'e.g., vs last month')}
174174
/>
175+
<div className="help-text">
176+
{getLocString('comparisonTitleHelp', 'You can use {{var}} syntax to reference variables')}
177+
</div>
175178
</div>
176179

177180
<div className="form-section">

0 commit comments

Comments
 (0)