Skip to content

Commit

Permalink
chore(ui): fix issues with long names
Browse files Browse the repository at this point in the history
  • Loading branch information
diegopvlk committed Sep 8, 2024
1 parent 48dd1a5 commit 9ed276d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
4 changes: 2 additions & 2 deletions data/ui/med-dialog.blp
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ Adw.Dialog medDialog {
}

content: ScrolledWindow {
Adw.Clamp {
Adw.Clamp medDialogClamp {
maximum-size: 412;

Box medDialogBox {
Box {
orientation: vertical;
margin-start: 10;
margin-end: 10;
Expand Down
2 changes: 2 additions & 0 deletions src/historyFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export let removedItem;
historyHeaderFactory.connect('setup', (factory, listHeaderItem) => {
const dateLabel = new Gtk.Label({
halign: Gtk.Align.START,
ellipsize: Pango.EllipsizeMode.END,
margin_bottom: 1,
});
listHeaderItem.set_child(dateLabel);
Expand Down Expand Up @@ -63,6 +64,7 @@ historyItemFactory.connect('setup', (factory, listItem) => {
box.append(labelsBox);
const name = new Gtk.Label({
halign: Gtk.Align.START,
ellipsize: Pango.EllipsizeMode.END,
margin_bottom: 1,
});
labelsBox.append(name);
Expand Down
10 changes: 7 additions & 3 deletions src/medDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,13 @@ export default function openMedicationDialog(DosageWindow, list, position, mode)

const btnNew = new Gtk.Button({
css_classes: ['flat'],
can_shrink: true,
label: _('New'),
});

btnNew.remove_css_class('text-button');
btnNew.get_first_child().set_halign(Gtk.Align.START);
btnNew.get_first_child().set_max_width_chars(50);
oneTimeEntries.append(btnNew);

btnNew.connect('clicked', () => {
Expand All @@ -268,8 +270,10 @@ export default function openMedicationDialog(DosageWindow, list, position, mode)
const item = it.obj;
const btn = new Gtk.Button({
css_classes: ['flat', 'one-time-name'],
can_shrink: true,
label: item.name,
});
btn.get_first_child().set_max_width_chars(50);
btn.remove_css_class('text-button');
btn.get_first_child().set_halign(Gtk.Align.START);

Expand Down Expand Up @@ -413,9 +417,9 @@ export default function openMedicationDialog(DosageWindow, list, position, mode)
}
};

const medDialogBox = builder.get_object('medDialogBox');
const [medDialogBoxHeight] = medDialogBox.measure(Gtk.Orientation.VERTICAL, -1);
medDialog.content_height = medDialogBoxHeight + 48;
const medDialogClamp = builder.get_object('medDialogClamp');
const [medDialogClampHeight] = medDialogClamp.measure(Gtk.Orientation.VERTICAL, -1);
medDialog.content_height = medDialogClampHeight + 48;

setSpecificDaysButtonOrder();

Expand Down
1 change: 1 addition & 0 deletions src/todayFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ todayItemFactory.connect('setup', (factory, listItem) => {
box.append(labelsBox);
const name = new Gtk.Label({
halign: Gtk.Align.START,
ellipsize: Pango.EllipsizeMode.END,
margin_bottom: 1,
});
labelsBox.append(name);
Expand Down
1 change: 1 addition & 0 deletions src/treatmentsFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ treatmentsFactory.connect('setup', (factory, listItem) => {
box.append(labelsBox);
const name = new Gtk.Label({
halign: Gtk.Align.START,
ellipsize: Pango.EllipsizeMode.END,
margin_bottom: 1,
});
labelsBox.append(name);
Expand Down

0 comments on commit 9ed276d

Please sign in to comment.