feat: card UI polish — voting pill, rank badge, selection, density

Rework card layout from flex to block flow for sidebar compatibility.
Add voting pill capsule with voted-state tinting (orange/purple),
rank badge watermark, custom rt-selected selection system replacing
Reddit/RES classes, density-responsive border radius, bold titles,
and comprehensive dark mode variants for all interactive states.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-27 15:55:10 -04:00
parent 0eefcfc6cf
commit a13eca930c
2 changed files with 265 additions and 22 deletions

View File

@@ -1,9 +1,8 @@
/* --- Post list container --- */
html.rt-card-enabled #siteTable {
display: flex;
flex-direction: column;
align-items: flex-start;
gap: var(--rt-card-gap, 1rem);
padding-left: 8px;
padding-right: 6px;
box-sizing: border-box;
}
html.rt-card-enabled #siteTable > .clearleft {
@@ -12,26 +11,110 @@ html.rt-card-enabled #siteTable > .clearleft {
/* --- Card container --- */
.rt-card {
background: #ffffff;
position: relative;
background: #ffffff !important;
color: #0a0a0a;
border: 1px solid #e5e5e5;
border: 1px solid #e5e5e5 !important;
border-radius: 0.875rem;
padding: 1.5rem;
padding: 1rem;
box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
transition: border-color 0.15s;
transition: border-color 0.15s, background-color 0.15s;
display: flex;
align-items: flex-start;
gap: 0.75rem;
width: 100%;
margin-bottom: var(--rt-card-gap, 1rem);
box-sizing: border-box;
overflow: hidden;
}
.rt-card:hover {
border-color: #d4d4d4;
border-color: #d4d4d4 !important;
}
/* --- Card density --- */
html.rt-density-cozy .rt-card {
padding: 0.5rem;
gap: 0.5rem;
border-radius: 0.5rem;
}
html.rt-density-cozy .rt-card .midcol {
border-radius: 0.5rem;
}
html.rt-density-modern .rt-card {
padding: 1rem;
gap: 0.75rem;
border-radius: 0.75rem;
}
html.rt-density-modern .rt-card .midcol {
border-radius: 0.75rem;
}
html.rt-density-extra .rt-card {
padding: 1.5rem;
gap: 0.75rem;
border-radius: 0.875rem;
}
html.rt-density-extra .rt-card .midcol {
border-radius: 0.875rem;
}
/* --- Rank badge: watermark matching card border color --- */
.rt-card .rt-rank-badge {
position: absolute !important;
top: 4px !important;
left: 6px !important;
float: none !important;
margin: 0 !important;
width: auto !important;
font-size: 9px !important;
font-weight: 600 !important;
color: #e5e5e5 !important;
background: none !important;
border: none !important;
padding: 0 !important;
line-height: 1 !important;
pointer-events: none;
user-select: none;
}
html.rt-dark .rt-card .rt-rank-badge {
color: rgba(255, 255, 255, 0.1) !important;
}
/* --- Voting pill: interactive capsule --- */
.rt-card .midcol {
float: none;
flex-shrink: 0;
display: flex;
flex-direction: column;
align-items: center;
gap: 0;
min-width: 0;
padding: 4px 6px;
background: #f5f5f5;
border: 1px solid #e5e5e5;
border-radius: 0.875rem;
margin-top: 4px;
}
.rt-card .midcol .score {
font-size: 1rem;
font-weight: 700;
line-height: 1.3;
}
html.rt-dark .rt-card .midcol {
background: #262626;
border-color: #3a3a3a;
}
/* --- Post title --- */
.rt-card .entry a.title {
font-weight: 700 !important;
}
/* --- Card internal layout overrides --- */
.rt-card .midcol,
.rt-card .thumbnail {
float: none;
flex-shrink: 0;
@@ -46,22 +129,149 @@ html.rt-card-enabled #siteTable > .clearleft {
display: none;
}
/* --- Card dark mode --- */
.rt-dark .rt-card {
background: #171717;
/* --- Suppress Reddit/RES selection visuals unconditionally --- */
html.rt-card-enabled .rt-card.last-clicked,
html.rt-card-enabled .rt-card.res-selected,
html.rt-card-enabled .rt-card.RES-keyNav-activeElement {
outline: none !important;
}
html.rt-card-enabled .rt-card .entry.res-selected,
html.rt-card-enabled .rt-card .entry.RES-keyNav-activeElement {
background: transparent !important;
outline: none !important;
}
/* --- Our selection: .rt-selected (light) --- */
html.rt-card-enabled .rt-card.rt-selected {
border: 1px solid #c5cdf0 !important;
outline: none !important;
background: #f0f3fc !important;
}
html.rt-card-enabled .rt-card.rt-selected .rt-rank-badge {
color: #c5cdf0 !important;
}
html.rt-card-enabled .rt-card.rt-selected .midcol {
background: #eff7ff;
border-color: #c5cdf0;
}
html.rt-card-enabled .rt-card.rt-selected .midcol .score.unvoted {
color: #336699 !important;
}
html.rt-card-enabled .rt-card.rt-selected .midcol.unvoted .arrow {
filter: brightness(0) saturate(100%) invert(35%) sepia(30%) saturate(1000%) hue-rotate(175deg) brightness(90%);
}
/* --- Voted pill: tint + dim when deselected --- */
html.rt-card-enabled .rt-card .midcol.likes {
background: rgba(255, 139, 96, 0.12) !important;
border-color: #ff8b60 !important;
opacity: 0.45;
}
html.rt-card-enabled .rt-card .midcol.dislikes {
background: rgba(148, 148, 255, 0.12) !important;
border-color: #9494ff !important;
opacity: 0.45;
}
/* Opposing arrow: tint to match voted arrow, kept secondary */
html.rt-card-enabled .rt-card .midcol.likes .arrow.down {
filter: brightness(0) saturate(100%) invert(55%) sepia(90%) saturate(700%) hue-rotate(340deg);
opacity: 0.4;
}
html.rt-card-enabled .rt-card .midcol.dislikes .arrow.up {
filter: brightness(0) saturate(100%) invert(55%) sepia(70%) saturate(1200%) hue-rotate(210deg);
opacity: 0.4;
}
/* --- Voted pill: vibrant when selected --- */
html.rt-card-enabled .rt-card.rt-selected .midcol.likes {
background: rgba(255, 139, 96, 0.12) !important;
border-color: #ff8b60 !important;
opacity: 1;
}
html.rt-card-enabled .rt-card.rt-selected .midcol.dislikes {
background: rgba(148, 148, 255, 0.12) !important;
border-color: #9494ff !important;
opacity: 1;
}
/* --- Our selection: .rt-selected (dark) --- */
html.rt-card-enabled.rt-dark .rt-card.rt-selected {
border: 1px solid rgba(255, 255, 255, 0.3) !important;
outline: none !important;
background: #2a2a3a !important;
}
html.rt-card-enabled.rt-dark .rt-card.rt-selected .rt-rank-badge {
color: rgba(255, 255, 255, 0.3) !important;
}
html.rt-card-enabled.rt-dark .rt-card.rt-selected .midcol {
background: #333345;
border-color: rgba(255, 255, 255, 0.2);
}
/* --- Voted pill: dim (deselected, dark) --- */
html.rt-card-enabled.rt-dark .rt-card .midcol.likes {
background: rgba(255, 139, 96, 0.06) !important;
border-color: rgba(255, 139, 96, 0.2) !important;
}
html.rt-card-enabled.rt-dark .rt-card .midcol.dislikes {
background: rgba(148, 148, 255, 0.06) !important;
border-color: rgba(148, 148, 255, 0.2) !important;
}
/* --- Voted pill: vibrant (selected, dark) --- */
html.rt-card-enabled.rt-dark .rt-card.rt-selected .midcol.likes {
background: rgba(255, 139, 96, 0.15) !important;
border-color: rgba(255, 139, 96, 0.5) !important;
}
html.rt-card-enabled.rt-dark .rt-card.rt-selected .midcol.dislikes {
background: rgba(148, 148, 255, 0.15) !important;
border-color: rgba(148, 148, 255, 0.5) !important;
}
/* --- Card dark mode (base) --- */
html.rt-dark .rt-card {
background: #171717 !important;
color: #fafafa;
border-color: rgba(255, 255, 255, 0.1);
border-color: rgba(255, 255, 255, 0.1) !important;
}
.rt-dark .rt-card:hover {
border-color: rgba(255, 255, 255, 0.18);
html.rt-dark .rt-card:hover {
border-color: rgba(255, 255, 255, 0.18) !important;
}
/* --- Page background override --- */
html.rt-card-bg-shadcn .content[role="main"] {
background: #f5f5f5;
/* --- Page background: shadcn style (light) --- */
html.rt-card-bg-shadcn,
html.rt-card-bg-shadcn body,
html.rt-card-bg-shadcn .content,
html.rt-card-bg-shadcn .content[role="main"],
html.rt-card-bg-shadcn #siteTable,
html.rt-card-bg-shadcn .side,
html.rt-card-bg-shadcn .footer-parent {
background-color: #f5f5f5 !important;
}
html.rt-card-bg-shadcn.rt-dark .content[role="main"] {
background: #262626;
/* --- Page background: shadcn style (dark) --- */
html.rt-card-bg-shadcn.rt-dark,
html.rt-card-bg-shadcn.rt-dark body,
html.rt-card-bg-shadcn.rt-dark .content,
html.rt-card-bg-shadcn.rt-dark .content[role="main"],
html.rt-card-bg-shadcn.rt-dark #siteTable,
html.rt-card-bg-shadcn.rt-dark .side,
html.rt-card-bg-shadcn.rt-dark .footer-parent,
html.rt-card-bg-shadcn.rt-dark .res-nightmode .content,
html.rt-card-bg-shadcn.rt-dark .res-nightmode #siteTable {
background-color: #0a0a0a !important;
}

View File

@@ -4,6 +4,12 @@
function processPost(post) {
if (post.classList.contains("rt-card")) return;
post.classList.add("rt-card");
var rank = post.querySelector(":scope > .rank");
if (rank) {
rank.classList.add("rt-rank-badge");
post.appendChild(rank);
}
}
function processPosts() {
@@ -36,17 +42,44 @@
}
}
var DENSITY_CLASSES = ["rt-density-cozy", "rt-density-modern", "rt-density-extra"];
function applyDensity(settings) {
var html = document.documentElement;
for (var i = 0; i < DENSITY_CLASSES.length; i++) {
html.classList.remove(DENSITY_CLASSES[i]);
}
var cls = "rt-density-" + (settings.cardDensity || "modern");
html.classList.add(cls);
}
function initSelection() {
document.addEventListener("mousedown", function (e) {
var clickedCard = e.target.closest(".rt-card");
var prev = document.querySelectorAll(".rt-card.rt-selected");
for (var i = 0; i < prev.length; i++) {
prev[i].classList.remove("rt-selected");
}
if (clickedCard) {
clickedCard.classList.add("rt-selected");
}
});
}
function apply(settings) {
document.documentElement.classList.add("rt-card-enabled");
applyDarkMode(settings);
applyBackground(settings);
applyDensity(settings);
applyGap(settings);
processPosts();
initSelection();
}
function updateSettings(settings) {
applyDarkMode(settings);
applyBackground(settings);
applyDensity(settings);
applyGap(settings);
}