Skip to content

Commit a94e774

Browse files
committed
broke the Desktop view - resetting to the old view, while keeping mobile working
Signed-off-by: Kai Wagner <kai.wagner@percona.com>
1 parent 9e3a1f7 commit a94e774

File tree

4 files changed

+58
-6
lines changed

4 files changed

+58
-6
lines changed

app/assets/stylesheets/components/sidebar.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@
3434
transform: scale(1.05);
3535
}
3636

37+
@media (min-width: 901px) {
38+
.sidebar-collapse-button {
39+
display: none;
40+
}
41+
}
42+
3743
@media (max-width: 720px) {
3844
.layout-sidebar-resizer {
3945
width: 18px;

app/assets/stylesheets/components/topics.css

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ a.topic-icon {
220220
}
221221
}
222222

223-
.topic-title-stack {
223+
.topic-title-mobile {
224224
display: flex;
225225
flex-direction: column;
226226
gap: var(--spacing-1);
@@ -375,8 +375,14 @@ a.topic-icon {
375375
}
376376

377377

378-
.topic-title-stack {
379-
display: flex;
378+
.topic-title-main {
379+
display: inline-flex;
380+
align-items: center;
381+
gap: var(--spacing-2);
382+
}
383+
384+
.topic-title-mobile {
385+
display: none;
380386
flex-direction: column;
381387
gap: var(--spacing-2);
382388
}
@@ -444,6 +450,14 @@ a.topic-icon {
444450
}
445451

446452
@media (max-width: 900px) {
453+
.topic-title-main {
454+
display: none;
455+
}
456+
457+
.topic-title-mobile {
458+
display: flex;
459+
}
460+
447461
.topic-row-footer {
448462
display: grid;
449463
grid-template-columns: var(--topic-footer-icons-width, 96px) minmax(0, 1fr) auto;

app/javascript/controllers/sidebar_controller.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ export default class extends Controller {
3030
}
3131

3232
toggle() {
33+
if (!this.isMobile()) {
34+
return
35+
}
36+
3337
if (this.isCollapsed()) {
3438
this.expand()
3539
} else {
@@ -104,6 +108,12 @@ export default class extends Controller {
104108
}
105109

106110
applyStoredState() {
111+
if (!this.isMobile()) {
112+
this.expand(false)
113+
this.setSidebarWidth(this.clampWidth(this.readWidth()))
114+
return
115+
}
116+
107117
const collapsed = window.localStorage.getItem(STORAGE_COLLAPSED_KEY) === "true"
108118
if (collapsed) {
109119
this.collapse(false)

app/views/topics/_status_cell.html.slim

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,32 @@
22
- status_class = "status-#{status}"
33
- star_data = star_data || {}
44
td.topic-title.status-border class=status_class id=dom_id(topic, "status_cell") data-label="Topic"
5-
.topic-title-stack
5+
- creator = topic.creator_display_alias
6+
- last_sender = topic.last_sender_person&.default_alias
7+
.topic-title-main
8+
- if status.to_s == "reading"
9+
- read_count = state[:read_count].to_i
10+
- total_count = topic.message_count
11+
- unread_count = [total_count - read_count, 0].max
12+
- if unread_count.positive?
13+
= link_to topic_path(topic, anchor: "first-unread"), class: "topic-icon topic-icon-reading", title: "Jump to first unread message (#{unread_count} unread)" do
14+
i.fa-solid.fa-envelope
15+
span.topic-icon-badge.topic-icon-badge-sup = unread_count
16+
- else
17+
.topic-icon.topic-icon-reading title="All messages read"
18+
i.fa-solid.fa-envelope
19+
= render partial: "topics/star_icon", locals: { topic: topic, star_data: star_data }
20+
= render partial: "topics/note_icon", locals: { topic: topic, count: note_count.to_i }
21+
= render partial: "topics/team_readers_icon", locals: { topic: topic, readers: team_readers }
22+
- commitfest_summary = @commitfest_summaries&.dig(topic.id)
23+
- if commitfest_summary
24+
= render partial: "topics/commitfest_icon", locals: { summary: commitfest_summary }
25+
- elsif topic.has_attachments?
26+
.topic-icon title="Attachments"
27+
i.fa-solid.fa-paperclip
28+
= link_to topic.title, topic_path(topic), class: "topic-link"
29+
.topic-title-mobile
630
= link_to topic.title, topic_path(topic), class: "topic-link"
7-
- creator = topic.creator_display_alias
8-
- last_sender = topic.last_sender_person&.default_alias
931
- if creator || last_sender
1032
.topic-byline
1133
- if creator

0 commit comments

Comments
 (0)