0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-14 13:58:53 +08:00
discourse/app/assets/stylesheets/common/topic-timeline.scss
Kris 749d8f4325
UX: reposition and restyle translation features to improve experience (#37821)
This adds some polish to our translation feature and involves changing
some button positions and styling.

* Updated to the Font Awesome 7 "language" icon — this is an out-of-band
update but feels worth it for the better icon (it's larger/clearer)
* Repositioned the translation toggle so it doesn't stack for admins
above the timeline
* Repositioned the mobile translation toggle so it matches the desktop
position (admin first, then translation button)
* Removed use of the globe icon for translations — everything now uses
the consistent "language" icon to make it clear that it's all part of
the same system
* Adjusted a couple issues where things weren't as reactive as they
could be (switching from composer directly to editing a translation
would cause a button to remain when it shouldn't)
* Styling improvement for "active" state of translations
* When toggling translations on/off we now confirm with a toast 
* Moved the language dropdown in the composer when editing translations,
this saves a good amount of space

Toasts appear on toggle: 
<img width="250" alt="image"
src="https://github.com/user-attachments/assets/536b84bd-8499-4f01-8ffa-5afa85b7f9e0"
/>



Before|After — the icon is blue in the active state (a pattern we also
use for bookmarks)
<img width="140" alt="image"
src="https://github.com/user-attachments/assets/13fb3f83-5639-49ca-9379-92617d8b2bbb"
/><img width="150" alt="image"
src="https://github.com/user-attachments/assets/0e35ef09-074a-46db-9aaa-d8ae087bb2fd"
/>


Before|After - positioning mirrors the timeline order
<img width="200" alt="image"
src="https://github.com/user-attachments/assets/cf5921e0-9c1f-45d3-9f15-7f8a5df382e8"
/>
<img width="200" alt="image"
src="https://github.com/user-attachments/assets/dc897c90-d207-4123-b42b-c46f8f75110e"
/>


Before|After - dropdown repositioned and restyled (wraps on mobile if
needed)
<img width="260" alt="image"
src="https://github.com/user-attachments/assets/c2c11465-70d1-4c8a-8147-9d96154c9ec8"
/>

<img width="600" alt="image"
src="https://github.com/user-attachments/assets/7f731891-1de2-4a30-ad0a-59d0bf0d9da7"
/>

Before|After - consistent language icon when setting composer language 
<img width="440" alt="image"
src="https://github.com/user-attachments/assets/ac83ab2d-b1fd-4b4e-9411-e65557a1582d"
/>

<img width="440" alt="image"
src="https://github.com/user-attachments/assets/49bd6660-d7c5-4515-8bb2-8ffe10590338"
/>



Before|after - Icon consistency in posts:
<img width="600" alt="image"
src="https://github.com/user-attachments/assets/04c0b8a7-4921-4d2e-8ddc-b2f0c7f20ae0"
/>

<img width="600" alt="image"
src="https://github.com/user-attachments/assets/1c2c99c0-5d83-4c57-8619-5fdb42ba9d38"
/>



Before|after - Post control is now consistent: 
<img width="420" alt="image"
src="https://github.com/user-attachments/assets/ed5540a6-ae6e-4be9-b253-5bc8f2ad7377"
/>

<img width="420" alt="image"
src="https://github.com/user-attachments/assets/fa941b4c-7eb9-4bb8-b8e1-5f313ad30c17"
/>
2026-02-13 13:30:39 -05:00

338 lines
6.9 KiB
SCSS
Vendored

.timeline-loading {
width: 900px;
}
.timeline-container {
box-sizing: border-box;
z-index: z("timeline");
&.timeline-docked-bottom {
.timeline-footer-controls {
opacity: 0;
pointer-events: none;
cursor: default;
}
}
&.timeline-fullscreen.show {
max-height: 700px;
@media (prefers-reduced-motion: no-preference) {
transition: max-height 0.4s ease-out;
}
@media screen and (height <= 425px) {
max-height: 75vh;
}
.topic-timeline {
.timeline-footer-controls {
display: flex;
flex-wrap: wrap;
max-width: calc(100% - 9em); // 9em is the width of the timeline
}
}
.timeline-controls {
display: table-cell;
vertical-align: top;
}
}
&.timeline-fullscreen {
max-height: 0;
position: fixed;
margin-left: 0;
background-color: var(--secondary);
bottom: 0;
left: 0;
right: 0;
border-top: 1px solid var(--content-border-color);
box-shadow: var(--shadow-composer);
padding: 20px 0;
z-index: z("fullscreen");
@media (prefers-reduced-motion: no-preference) {
transition: max-height 0.3s ease-in;
}
@media screen and (height <= 425px) {
padding-top: 10px;
}
.back-button {
display: none;
}
.topic-timeline {
width: 100%;
table-layout: fixed;
margin-left: 0;
margin-right: 0;
display: table;
touch-action: none;
.topic-category {
margin-bottom: var(--space-2);
}
.timeline-date-wrapper {
text-align: right;
@include ellipsis;
}
.post-excerpt {
max-width: 650px;
line-height: var(--line-height-large);
display: block;
@include line-clamp(8);
@media screen and (height <= 425px) {
@include line-clamp(5);
}
}
.username {
color: var(--primary-high-or-secondary-low);
overflow-wrap: break-word;
font-weight: bold;
}
.title {
margin-top: 0;
padding-left: 1em;
display: table-cell;
vertical-align: top;
width: 100%;
h2 {
margin-top: 0;
display: block;
line-height: var(--line-height-medium);
font-size: var(--font-up-2);
@include line-clamp(4);
}
a {
color: var(--primary);
}
}
.timeline-last-read {
right: 0;
margin-left: 0;
.progress {
display: none;
}
}
.timeline-footer-controls {
display: none;
position: absolute;
bottom: 20px;
left: 10px;
.topic-admin-menu {
display: flex;
}
}
.timeline-scrollarea-wrapper {
display: table-cell;
padding-right: 1.5em;
width: 7em;
}
.timeline-scrollarea {
border-right: 1px solid var(--tertiary-low-or-tertiary-high);
border-left: none;
max-width: 120px;
.timeline-scroller {
position: relative;
margin-right: -1.5em;
padding-right: 1.5em;
justify-content: flex-end;
.timeline-scroller-content {
box-sizing: border-box;
max-width: 100%;
overflow: hidden;
text-align: right;
padding-left: 0;
padding-right: 1em;
}
.timeline-handle {
float: none;
width: 11px;
position: relative;
right: -6px;
}
}
.timeline-padding {
margin-left: 0;
margin-right: -1em;
}
}
}
.timeline-scrollarea-wrapper::after {
content: "";
display: table;
clear: both;
}
.start-date,
.now-date {
padding: 0.5em 0;
}
}
.topic-timeline {
transition: opacity 0.2s ease-in;
touch-action: none;
min-width: 6em;
.topic-admin-menu .btn {
height: 100%;
}
.timeline-controls {
display: flex;
gap: var(--space-2);
margin-bottom: var(--space-4);
}
.timeline-date-wrapper {
max-width: 9em;
overflow-wrap: anywhere;
}
.timeline-footer-controls {
// this is absolutely positioned to avoid
// adding extra height below short topics
// above the topic-footer-controls
position: absolute;
margin-top: 1em;
display: flex;
gap: var(--space-2);
flex-wrap: wrap;
@media (prefers-reduced-motion: no-preference) {
transition: opacity 0.2s ease-in;
}
button:last-child {
margin-right: 0;
}
}
.start-date {
color: var(--primary-med-or-secondary-med);
}
.timeline-scrollarea {
margin-top: 0.5em;
margin-left: 0.5em;
border-left: 1px solid var(--topic-timeline-border-color);
position: relative;
max-width: 100%;
transform: translateZ(0);
}
.timeline-padding {
transition: height 0.15s ease-out;
cursor: pointer;
// this element has a click event
// the negative margin lets this element overlap
// the scrollarea's vertical track and thus it
// enables taps on the track to work
margin-left: -1em;
.widget-dragging & {
transition: none;
}
.dragging & {
transition: none;
}
}
.timeline-handle {
border-radius: 0.8em;
width: 0.35em;
background-color: var(--topic-timeline-handle-color);
height: 100%;
float: left;
flex-shrink: 0;
z-index: z("base") + 1;
outline: 1px solid transparent;
margin-left: 0.5px;
}
.timeline-scroller-content {
box-sizing: border-box;
max-width: 100%;
overflow: hidden;
padding-left: var(--space-4);
position: absolute; // prevents text length from impacting width
max-height: 3em; // this hides the date when the count + date would wrap to more than 2 lines
}
.timeline-ago {
color: var(--primary-med-or-secondary-med);
max-width: 100%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.timeline-scroller {
@include unselectable;
margin-left: -0.22em;
cursor: ns-resize;
display: flex;
align-items: center;
.back-button {
margin-top: var(--space-4);
}
}
.timeline-replies {
overflow: hidden;
overflow-wrap: break-word;
font-weight: bold;
}
.timeline-last-read {
position: absolute;
margin-left: -0.35em;
z-index: z("base") + 2; // above timeline-handle
.progress {
font-size: 0.8em;
color: var(--tertiary);
margin-right: var(--space-4);
}
}
.back-button {
min-height: unset;
padding: 2px 5px;
}
.now-date {
display: inline-block;
color: var(--primary-med-or-secondary-med);
margin-top: var(--space-2);
}
}
}