Skip to content

Commit 0972b74

Browse files
st3inyChristophWurst
authored andcommitted
feat(contacts): implement read-only and edit modes
Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
1 parent a352bff commit 0972b74

20 files changed

Lines changed: 501 additions & 456 deletions

css/ContactDetailsLayout.scss

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@
2020
*
2121
*/
2222

23-
$contact-details-label-min-width: 100px;
2423
$contact-details-label-max-width: 200px;
25-
$contact-details-label-width: calc(($contact-details-label-min-width + $contact-details-label-max-width) / 2);
26-
27-
$contact-details-value-min-width: 200px;
2824
$contact-details-value-max-width: 300px;
29-
$contact-details-value-width: calc(($contact-details-value-min-width + $contact-details-value-max-width) / 2);
30-
3125
$contact-details-row-gap: 15px;

css/Properties/Properties.scss

Lines changed: 43 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,8 @@
2323

2424
@import '../ContactDetailsLayout.scss';
2525

26-
$property-label-min-width: $contact-details-label-min-width;
2726
$property-label-max-width: $contact-details-label-max-width;
28-
$property-label-width: $contact-details-label-width;
29-
30-
$property-value-min-width: $contact-details-value-min-width;
3127
$property-value-max-width: $contact-details-value-max-width;
32-
$property-value-width: $contact-details-value-width;
3328

3429
$property-ext-padding-right: 8px;
3530
$property-row-gap: $contact-details-row-gap;
@@ -42,13 +37,6 @@ $property-row-gap: $contact-details-row-gap;
4237
display: flex;
4338
align-items: center;
4439
gap: $property-row-gap;
45-
46-
.property__actions {
47-
// placeholder for the actions menu
48-
&__empty {
49-
width: 44px;
50-
}
51-
}
5240
}
5341

5442
// property row
@@ -57,12 +45,6 @@ $property-row-gap: $contact-details-row-gap;
5745
align-items: center;
5846
gap: $property-row-gap;
5947

60-
&--without-actions {
61-
.property__value {
62-
margin-right: $property-row-gap + 44px; // actions menu / button
63-
}
64-
}
65-
6648
// fix default margin from server stylesheet causing slight misalignment
6749
input {
6850
margin-right: 0;
@@ -71,88 +53,89 @@ $property-row-gap: $contact-details-row-gap;
7153

7254
// property label or multiselect within row
7355
&__label {
56+
// Global single column layout
7457
display: flex;
75-
justify-content: end;
76-
flex: 1 auto;
77-
78-
width: $property-label-width !important;
79-
min-width: $property-label-min-width !important;
80-
max-width: $property-label-max-width !important;
58+
flex: 0 1 auto;
59+
justify-content: flex-end;
60+
width: $contact-details-label-max-width;
61+
min-width: 0; // Has to be zero unless we implement wrapping
8162

82-
&:not(.multiselect) {
63+
// Text label styling
64+
> :not(.multiselect):not(.material-design-icon) {
8365
overflow: hidden;
84-
overflow-x: hidden;
8566
white-space: nowrap;
8667
text-overflow: ellipsis;
8768
opacity: .7;
8869
}
8970
}
9071

91-
// Hide delete buttons initially
92-
.action-item.icon-delete {
93-
opacity: 0;
94-
}
95-
9672
// Property value within row, after label
9773
&__value {
98-
flex: 1 auto;
74+
align-items: center;
9975

100-
width: $property-value-width !important;
101-
//min-width: $property-value-min-width !important;
102-
min-width: unset !important;
103-
max-width: $property-value-max-width !important;
76+
// Global single column layout
77+
display: flex;
78+
flex: 0 1 auto;
79+
width: $property-value-max-width;
80+
min-width: 0; // Has to be zero unless we implement wrapping
10481

10582
textarea {
106-
align-self: flex-start;
83+
// Limit max height to make scrolling the form a bit easier
10784
min-height: 2 * $grid-height-unit - 2*$grid-input-margin;
10885
max-height: 5 * $grid-height-unit - 2*$grid-input-margin;
10986
}
11087

111-
// read-only mode
112-
&:read-only {
113-
border-color: var(--color-border-dark);
88+
input,
89+
textarea {
90+
width: 100%;
91+
92+
// Remove default input styling for read-only inputs.
93+
// We can't use plain divs because that would cause jumping on switching modes.
94+
&[readonly] {
95+
border: none;
96+
overflow: auto;
97+
outline: none;
98+
resize: none;
99+
padding: 0;
100+
border-radius: 0;
101+
}
114102
}
115-
&--with-ext {
116-
// ext icon width + 8px padding
117-
padding-right: 24px;
103+
}
104+
105+
&__label,
106+
&__value {
107+
// Fix default multiselect styling
108+
> .multiselect {
109+
width: 100%;
110+
min-width: unset;
118111
}
119112

120-
// Show ext icon permanently on focus
121-
&:hover,
122-
&:focus,
123-
&:active {
124-
~ .property__ext {
125-
opacity: .5;
126-
}
113+
// Fix default date time picker styling
114+
> .mx-datepicker {
115+
width: 100%;
127116
}
128117
}
129118

130119
// Show ext buttons on full row hover
131120
&:hover {
132121
.property__ext {
133-
opacity: .5;
122+
opacity: .7;
134123
}
135124
}
136125

137126
// External link (tel, mailto, http, ftp...)
138127
&__ext {
139-
position: absolute;
140-
// 8px padding + actions
141-
right: 44px + $property-ext-padding-right;
142128
opacity: 0;
129+
143130
&:hover,
144-
&:focus,
145-
&:active {
131+
&:focus {
146132
opacity: .7;
147133
}
148134
}
149135

150-
.no-move {
151-
right: $property-ext-padding-right;
152-
}
153-
154136
// Delete property button + actions
155137
&__actions {
156138
z-index: 10;
139+
width: 44px;
157140
}
158141
}

css/contacts.scss

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,19 @@ $grid-input-height-with-margin: $grid-height-unit - $grid-input-margin * 2;
3838
// various
3939
@import 'animations';
4040

41-
42-
4341
.app-content-details {
4442
padding: calc(var(--default-grid-baseline) * 2);
4543
padding-top: 0;
4644
height: 100%;
4745
overflow: auto;
46+
47+
// Compensate top padding reserved for the back button on mobile
48+
@media (max-width: 1024px) {
49+
height: calc(100% - 44px);
50+
}
4851
}
4952

5053
.app-content-list {
5154
// Cancel scrolling
5255
overflow: visible;
53-
5456
}

package-lock.json

Lines changed: 6 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
"ical.js": "^1.5.0",
6161
"moment": "^2.29.4",
6262
"p-limit": "^4.0.0",
63-
"p-queue": "^7.3.4",
6463
"qr-image": "^3.2.0",
6564
"string-natural-compare": "^3.0.1",
6665
"uuid": "^9.0.0",

0 commit comments

Comments
 (0)