discourse/app/assets/stylesheets/common/components/topic-map.scss
Keegan George 71f808dea9
Some checks failed
Licenses / run (push) Waiting to run
Linting / run (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (frontend, themes) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, chat) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, core) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, plugins) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, themes) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (annotations, core) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (backend, core) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (backend, plugins) (push) Waiting to run
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (frontend, plugins) (push) Waiting to run
Tests / core frontend (${{ matrix.browser }}) (Chrome) (push) Waiting to run
Tests / core frontend (${{ matrix.browser }}) (Firefox ESR) (push) Waiting to run
Tests / core frontend (${{ matrix.browser }}) (Firefox Evergreen) (push) Waiting to run
Migration Tests / Tests with Ruby ${{ matrix.ruby }} (3.3) (push) Has been cancelled
DEV: Improve method of presenting link clicks (#29453)
Currently the tracking for clicked links are injected into the HTML in a span tag. This leads to the link counter value being highlighted when copying and pasting. Additionally, any means for using CSS to hide link counters result in a gap due to it occupying a specific width.

With this change, we make link counters appear in a data attribute on the link element and visually shown with CSS `::after` element.
2024-10-31 12:44:08 -07:00

499 lines
9.1 KiB
SCSS

.topic-map.--op {
// topic map under OP
border-top: 1px solid var(--primary-low);
border-bottom: none;
padding-left: calc(
var(--topic-body-width-padding) + var(--topic-avatar-width)
);
}
.topic-map.--bottom {
// topic map at bottom of topic
grid-area: posts;
grid-row: 2;
max-width: calc(
var(--topic-avatar-width) + var(--topic-body-width) +
(var(--topic-body-width-padding) * 2)
);
}
body:not(.archetype-private_message) {
.topic-map {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
flex-wrap: wrap;
&:has(.topic-map__additional-contents *) {
column-gap: 0.75em;
}
}
}
.topic-map {
// both topic maps
--chart-line-color: var(--tertiary);
--chart-point-color: var(--tertiary-medium);
--chart-prediction-color: var(--primary-low-mid);
border-bottom: 1px solid var(--primary-low);
box-sizing: border-box;
max-width: calc(
var(--topic-avatar-width) + var(--topic-body-width) +
(var(--topic-body-width-padding) * 2)
);
@include breakpoint(mobile-large) {
font-size: var(--font-down-1);
}
&.--op,
&.--bottom {
@media screen and (max-width: 500px) {
padding-left: 0;
}
}
.--users-summary {
display: flex;
flex-wrap: wrap;
align-items: center;
overflow: hidden;
height: 2em;
align-self: center;
flex: 1 2 0;
gap: 0.25em;
min-width: 2em;
width: 0;
.avatar {
width: 2em;
height: 2em;
margin-right: 0;
}
.avatar-flair,
.post-count {
display: none;
}
}
&__stats {
display: flex;
flex-wrap: wrap;
margin: 0;
list-style: none;
}
a {
overflow-wrap: anywhere;
}
&__contents {
padding-block: 0.5em;
flex-grow: 1;
.number {
font-size: var(--font-up-1);
line-height: 1.2;
}
.topic-map__stats {
gap: 0.75em;
&.--single-stat {
button {
flex-direction: row;
gap: 0.25em;
span {
font-size: var(--font-0);
color: var(--primary-700) !important;
min-width: unset;
overflow: visible;
}
}
}
.fk-d-menu__trigger {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 0;
background: transparent;
min-width: 0;
.number {
color: var(--tertiary);
white-space: nowrap;
}
.topic-map__stat-label {
display: block;
min-width: 0;
font-size: var(--font-down-1);
color: var(--primary-medium);
width: 100%;
@include ellipsis;
}
}
}
}
.controls {
display: flex;
align-items: center;
.btn {
margin-right: 0.5em;
&:last-child {
margin: 0;
}
}
}
.participants {
// PMs
display: flex;
flex-wrap: wrap;
align-items: center;
& + .controls {
margin-top: 0.5em;
}
&.hide-names .user {
.username,
.group-name {
display: none;
}
}
.user {
@include ellipsis;
border: 1px solid var(--primary-low);
border-radius: 0.25em;
padding: 0;
margin: 0.125em 0.25em 0.125em 0;
display: flex;
align-items: center;
height: 26px;
.user-link,
.group-link {
@include ellipsis;
color: var(--primary-high);
&:hover {
color: var(--primary);
}
}
.avatar,
.d-icon-users {
margin-left: 0.25em;
margin-right: 0.25em;
}
.username,
.group-name {
margin-right: 0.25em;
}
&:last-child {
margin-right: 0;
}
.remove-invited {
display: flex;
flex: 1 0 0px;
align-items: center;
justify-content: center;
box-sizing: border-box;
border-radius: 0 var(--border-radius) var(--border-radius) 0;
padding-top: 0;
padding-bottom: 0;
height: calc(100% + 0.25em);
margin-right: -4px;
}
}
}
.add-remove-participant-btn {
.d-icon {
margin-left: 0.25em;
}
}
&__buttons {
margin-left: auto;
display: flex;
align-items: center;
gap: 0.75em;
}
.view-explainer {
color: var(--primary-700);
font-size: var(--font-down-1);
}
.estimated-read-time {
display: flex;
flex-direction: column-reverse;
align-items: end;
line-height: 1.2;
color: var(--primary-high);
white-space: nowrap;
span:first-child {
font-size: var(--font-down-1);
color: var(--primary-medium);
}
@media screen and (max-width: 475px) {
display: none;
}
}
}
.mobile-view {
.d-modal[class*="topic-map__"] {
h3 {
font-size: var(--font-up-2);
padding-inline: 1rem;
}
p {
overflow-wrap: break-word;
}
}
.topic-owner .onscreen-post {
padding-bottom: 0;
}
}
// DMenu popups
.fk-d-menu,
.fk-d-menu-modal {
//shared
&__inner-content {
.topic-map__likes-content &,
.topic-map__links-content &,
.topic-map__users-content &,
.topic-map__views-content & {
flex-direction: column;
padding-block: 0.75em;
}
}
&.topic-map__likes-content,
&.topic-map__links-content,
&.topic-map__users-content,
&.topic-map__views-content {
h3 {
padding-inline: 1rem;
padding-bottom: 0.5em;
font-size: var(--font-up-1);
border-bottom: 1px solid var(--primary-low);
}
.loading-container {
width: 100%;
}
}
&.topic-map__likes-content,
&.topic-map__links-content {
ul {
margin: 0;
padding: 0;
list-style-type: none;
}
}
//per type
&.topic-map__likes-content {
li > a {
display: grid;
grid-template-areas: "user likes" "post post";
grid-template-columns: auto 1fr;
gap: 0.25em;
padding: 0.75em 1rem;
.discourse-no-touch & {
&:hover {
background: var(--d-hover);
}
}
}
li:not(:last-of-type) {
a {
border-bottom: 1px solid var(--primary-low);
}
}
.like-section {
&__user {
grid-area: user;
color: var(--primary-high);
display: flex;
align-items: center;
font-weight: bold;
gap: 0.5em;
}
&__likes {
grid-area: likes;
display: flex;
gap: 0.25em;
color: var(--primary-medium);
justify-content: end;
align-items: center;
.d-icon {
font-size: var(--font-down-1);
color: var(--love);
position: relative;
}
}
}
p {
grid-area: post;
overflow-wrap: anywhere;
color: var(--primary-high);
text-align: left;
margin: 0;
padding-left: 2em;
}
}
&.topic-map__links-content {
li {
display: grid;
grid-template-columns: auto 1fr;
grid-template-areas:
"counter link"
". domain";
padding: 0.75em 1rem;
gap: 0.25em;
&:not(:last-of-type) {
border-bottom: 1px solid var(--primary-low);
}
.discourse-no-touch & {
&:hover {
background: var(--d-hover);
}
}
}
.topic-link {
grid-area: link;
}
.topic-link[data-clicks]::before {
@include click-counter-badge;
}
.topic-link[data-clicks]::after {
display: none;
}
.domain {
grid-area: domain;
font-size: var(--font-down-2);
color: var(--primary-medium);
}
.link-summary {
width: 100%;
.d-icon {
color: var(--primary-high);
}
}
}
&.topic-map__users-content {
.topic-map__users-list {
display: flex;
flex-wrap: wrap;
gap: 0.5em;
padding: 0.75em 1rem;
}
.poster {
display: block;
position: relative;
img {
width: 2.25em;
height: 2.25em;
}
}
.post-count,
.avatar-flair {
position: absolute;
border-radius: 1em;
display: flex;
align-items: center;
justify-content: center;
}
.post-count {
top: -0.15em;
right: -0.25em;
padding: 0.15em 0.4em 0.2em;
font-size: var(--font-down-2);
line-height: var(--line-height-small);
}
.avatar-flair {
right: -0.25em;
bottom: -0.15em;
font-size: var(--font-down-3);
width: 1.5em;
height: 1.5em;
background-size: contain;
}
}
&.topic-map__views-content {
.topic-views {
display: flex;
flex-direction: column;
align-items: center;
&__wrapper {
display: flex;
justify-content: space-evenly;
padding: 0 1rem;
}
&__count {
font-size: var(--font-up-4);
color: var(--primary-high);
}
&__date {
font-size: var(--font-down-1);
color: var(--primary-medium);
}
}
canvas {
padding: 0.75em 1rem;
}
.view-explainer {
padding: 0 1rem;
}
&:has(.topic-views) {
min-width: unset;
}
}
}