Skip to content

Commit bfc1507

Browse files
committed
fix/simplify #manage-settings in compact layout
1 parent 28cdf05 commit bfc1507

3 files changed

Lines changed: 76 additions & 86 deletions

File tree

src/manage.html

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,9 @@ <h1 i18n="styleManager"></h1>
173173
.updatable:not(.can-update):not(.update-problem):not(.update-done)">
174174
</label>
175175
</div>
176+
</div>
176177

178+
<div class="settings-column" id="wide-inputs">
177179
<div id="search-wrapper">
178180
<input id="search" type="search" i18n="placeholder:search" spellcheck="false"
179181
data-filter=":not(.not-matching)"
@@ -236,7 +238,7 @@ <h1 i18n="styleManager"></h1>
236238
</template>
237239
</div>
238240

239-
<div id="backup" class="flex wrap">
241+
<div id="backup" class="flex wrap center-items">
240242
<button id="sync-styles" class="icon flex center-items" i18n="title:optionsCustomizeSync">
241243
<img hidden>
242244
<i class=i-cloud></i>
@@ -251,26 +253,31 @@ <h1 i18n="styleManager"></h1>
251253
</main>
252254
</div>
253255

254-
<div class="settings-column" id="backup-hint">
255-
<details data-pref="manage.backup.expanded">
256+
<div class="settings-column" id="links">
257+
<details data-pref="manage.links.expanded">
256258
<summary></summary>
257-
<main i18n="backupReminder"></main>
259+
<main><% _.forEach([
260+
['userstyles.world/explore', /*i18n*/'linkGetShareStyles'],
261+
['uso.kkx.one/browse/styles', /*i18n*/'linkGetStyles'],
262+
['github.com/openstyles/stylus/wiki', /*i18n*/'linkGetHelp'],
263+
['github.com/openstyles/stylus', , 'GitHub'],
264+
['explore.transifex.com/github-7/Stylus/', /*i18n*/'linkTranslate'],
265+
], ([url, tl, text]) => { if (tl) { %>
266+
<a href="https://<%= url %>" target="_blank" class="target" i18n="<%= tl %>"></a>
267+
<% } else { %>
268+
<a href="https://<%= url %>" target="_blank" class="target"><%= text %></a>
269+
<% }}); %>
270+
</main>
258271
</details>
259272
</div>
260273

261-
<div class="settings-column" id="links">
262-
<details data-pref="manage.links.expanded">
274+
<div class="settings-column" id="backup-hint">
275+
<details data-pref="manage.backup.expanded">
263276
<summary></summary>
264-
<main>
265-
<a href="https://userstyles.world/explore" target="_blank" i18n="linkGetShareStyles"></a>
266-
<a href="https://uso.kkx.one/browse/styles" target="_blank" i18n="linkGetStyles"
267-
style="--filter: grayscale(1) brightness(2)"></a>
268-
<a href="https://github.com/openstyles/stylus/wiki" target="_blank" i18n="linkGetHelp"></a>
269-
<a href="https://github.com/openstyles/stylus" target="_blank">GitHub</a>
270-
<a href="https://explore.transifex.com/github-7/Stylus/" target="_blank" i18n="linkTranslate"></a>
271-
</main>
277+
<main i18n="backupReminder"></main>
272278
</details>
273279
</div>
280+
274281
</div>
275282

276283
<div id="header-resizer" i18n="title:headerResizerHint"></div>

src/manage/manage.css

Lines changed: 52 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/* postcss-simple-vars */
22
$pad: 16px;
3+
$pad05: calc(0.5 * $pad);
34
$summaryX: calc($pad - 3px);
45
$iconGapX: 12px;
56
$iconGapY: 4px;
@@ -60,31 +61,25 @@ a, .disabled a:hover {
6061
}
6162
h1 {
6263
margin-top: 0;
63-
margin-bottom: calc($pad/2);
64+
margin-bottom: $pad05;
6465
.filtered & {
6566
visibility: hidden;
6667
}
6768
}
6869
#disableAll-label {
69-
margin-bottom: calc($pad/2);
70+
margin-bottom: $pad05;
7071
}
7172
#manage-settings {
7273
display: flex;
7374
flex-flow: column;
7475
flex: 1;
75-
}
76-
.settings-column {
77-
width: 100%;
78-
margin-bottom: $pad;
76+
gap: $pad;
7977
}
8078
[id=actions] /* reducing specificity */ {
8179
flex: 1;
82-
@media (450px < width < 700px) {
83-
order: 2;
84-
min-width: 240px;
85-
}
8680
main {
87-
margin: 0 calc(-$pad/2) calc(-$pad/2) 0;
81+
min-width: calc(5 * 30px + $pad05);
82+
margin: 0 calc(-1 * $pad05) calc(-1 * $pad05) 0;
8883
.compact-layout & {
8984
margin-right: $pad;
9085
}
@@ -137,6 +132,9 @@ h1 {
137132
#backup {
138133
gap: $iconGapY;
139134
p {
135+
&:empty {
136+
display: none;
137+
}
140138
word-break: break-word;
141139
font-size: smaller;
142140
user-select: text;
@@ -145,19 +143,12 @@ h1 {
145143
}
146144
}
147145
#backup-hint {
148-
.compact-layout & {
149-
order: 99;
150-
main {
151-
min-width: 25vw;
152-
}
153-
hr {
154-
display: inline-block;
155-
width: .25em;
156-
}
157-
}
158146
hr {
159147
border: none;
160148
}
149+
.normal-layout & details:not([open]) {
150+
margin-top: calc(-1 * $pad05);
151+
}
161152
}
162153
#check-all-updates-force {
163154
white-space: normal;
@@ -316,8 +307,10 @@ h1 {
316307
height: 0;
317308
}
318309
.compact-layout & {
319-
padding: calc(.5*$pad) calc(.75*$pad);
320-
margin-top: -$pad;
310+
padding: $pad05 0;
311+
width: $pad;
312+
margin: -3px 0 0 0;
313+
position: absolute;
321314
}
322315
h2 {
323316
display: inline;
@@ -375,26 +368,18 @@ h1 {
375368
}
376369

377370
#links {
378-
.normal-layout & {
379-
margin: 0 $pad 0 0;
380-
}
381371
details:not([open]) h2::after {
382372
content: "...";
383373
}
384374
main {
385375
display: flex;
386-
flex-flow: column;
387-
align-items: flex-start;
388-
line-height: 1.6;
389-
}
390-
img {
391-
width: 16px;
392-
vertical-align: text-bottom;
393-
padding-right: .25em;
394-
transition: filter .5s;
376+
flex-flow: wrap;
377+
gap: $pad05;
395378
}
396-
a:not(:hover) img {
397-
filter: var(--filter, grayscale(1));
379+
a {
380+
width: auto;
381+
min-width: 0;
382+
padding-right: 0;
398383
}
399384
}
400385
/* no styles */
@@ -403,11 +388,14 @@ h1 {
403388
flex: 0;
404389
}
405390
#links {
406-
padding: 1.25rem 0 0 2rem;
391+
padding: calc(1.5*$pad) 0 0 calc(1.5*$pad);
407392
line-height: 2;
408393
font-size: larger;
409394
summary {
410-
visibility: hidden;
395+
display: none;
396+
}
397+
main {
398+
flex-flow: column;
411399
}
412400
}
413401
}
@@ -517,22 +505,23 @@ button i {
517505
}
518506
}
519507

520-
#search-wrapper, #sort-wrapper {
508+
#wide-inputs {
509+
gap: $pad05;
521510
display: flex;
522-
align-items: center;
523-
flex: 1;
524-
}
525-
#search-wrapper > :first-child,
526-
#sort-wrapper > :first-child {
527-
flex-grow: 1;
528-
max-width: calc(100% - var(--action-size));
511+
flex-flow: column;
512+
> * {
513+
display: flex;
514+
align-items: center;
515+
flex: 1;
516+
> :first-child {
517+
flex-grow: 1;
518+
max-width: calc(100% - var(--action-size));
519+
}
520+
}
529521
}
530522
#search + * {
531523
margin-left: -1px;
532524
}
533-
#search-wrapper {
534-
margin: calc($pad/2) 0;
535-
}
536525
#manage\.searchMode {
537526
background: var(--bg);
538527
}
@@ -704,7 +693,7 @@ button i {
704693
}
705694
}
706695

707-
@media screen and (max-width: 850px), compact {
696+
.compact-layout {
708697
body {
709698
display: block;
710699
height: auto;
@@ -737,36 +726,30 @@ button i {
737726
border-bottom: 1px dashed var(--c65);
738727
details + main,
739728
details > main {
740-
margin: -$pad 0 0 $pad;
729+
margin: 0 0 0 $pad;
741730
}
742731
}
743732
#stats {
744733
position: static;
745734
}
746-
#filters {
747-
flex-flow: column;
748-
}
749735
#manage-settings {
750736
flex-flow: wrap;
751-
padding: $pad 0 0 $pad;
752-
}
753-
.settings-column {
754-
display: flex;
755-
align-items: stretch;
756-
flex-flow: wrap;
757-
width: auto;
758-
height: fit-content;
759-
margin: -$pad $pad $pad 0;
760-
padding-top: $pad;
737+
align-items: flex-start;
738+
padding: $pad;
761739
}
762740
#installed {
763741
margin-top: 0;
764742
padding-left: 0;
765743
}
766-
#links {
767-
flex: 0 0 2em;
768-
&:has([open]) {
769-
flex: 0 0 fit-content;
744+
#backup-hint {
745+
main {
746+
min-width: 10em;
747+
max-height: 10em;
748+
overflow-y: auto;
749+
}
750+
hr {
751+
display: inline-block;
752+
width: .25em;
770753
}
771754
}
772755
}

src/manage/render.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const partDecorations = {
3030
const rxIsDateVer = /^20\d{4,6}(?:\.\d\d?){2}$/;
3131
const rxNonCJK = /[^\u3000-\uFE00]+/g;
3232

33-
let elLinks, elLinksParent;
33+
let elLinks, elLinksPrev;
3434
let numStyles = 0;
3535
export let favsBusy;
3636
export let partEntry;
@@ -292,12 +292,12 @@ export function updateTotal(delta) {
292292
return;
293293
}
294294
installed.dataset.total = numStyles;
295-
elLinksParent ??= (elLinks = $id('links')).parentNode;
295+
elLinksPrev ??= (elLinks = $('#links')).previousSibling;
296296
const det = elLinks.$('details');
297297
const prefId = 'manage.links.expanded';
298298
$toggleDataset(det, 'pref', numStyles && prefId);
299299
det.open = !numStyles || prefs.__values[prefId];
300300
if (!numStyles) installed.after(elLinks);
301-
else elLinksParent.append(elLinks);
301+
else elLinksPrev.after(elLinks);
302302
$rootCL.toggle('empty', !numStyles);
303303
}

0 commit comments

Comments
 (0)