mirror of
https://github.com/jackyzha0/quartz.git
synced 2026-03-21 21:45:42 -05:00
Adds a RecentChanges component that displays a live activity feed of recently created and modified notes, with richer UX than RecentNotes. Features: - Created vs. modified distinction (badge + 1h threshold heuristic) - Tab filter UI: All / New (by creation date) / Updated (modified only) - Load-more pagination per tab with configurable page size - Client-side relative timestamps via Intl.RelativeTimeFormat (locale-aware) - Progressive enhancement: SSR initial render + JSON data island for client - localStorage persistence of the active filter tab - Fully i18n: all UI strings go through cfg.locale New files: - quartz/components/RecentChanges.tsx - quartz/components/scripts/recentChanges.inline.ts - quartz/components/utils/recentChanges.ts - quartz/components/styles/recentChanges.scss Modified: - quartz/components/index.ts: export RecentChanges - quartz/i18n/locales/definition.ts: add recentChanges translation block - quartz/i18n/locales/*.ts (30 files): add English fallback translations
215 lines
4.2 KiB
SCSS
215 lines
4.2 KiB
SCSS
.recent-changes {
|
|
margin: 1.5rem 0;
|
|
|
|
// Badge colors (customizable via CSS custom properties)
|
|
--rc-created-bg: #b3e6cc;
|
|
--rc-created-text: #005500;
|
|
--rc-modified-bg: #d0e0f0;
|
|
--rc-modified-text: #003366;
|
|
|
|
h3 {
|
|
font-size: 1.3rem;
|
|
margin-bottom: 0.8rem;
|
|
color: var(--secondary);
|
|
}
|
|
|
|
.recent-changes-filter {
|
|
display: flex;
|
|
gap: 0.5rem;
|
|
margin-bottom: 1rem;
|
|
|
|
button {
|
|
padding: 0.35rem 0.75rem;
|
|
border: 1px solid var(--lightgray);
|
|
border-radius: 4px;
|
|
background: transparent;
|
|
color: var(--darkgray);
|
|
font-size: 0.8rem;
|
|
font-family: inherit;
|
|
cursor: pointer;
|
|
transition:
|
|
background-color 0.15s,
|
|
color 0.15s;
|
|
|
|
&.active {
|
|
background: var(--secondary);
|
|
color: var(--light);
|
|
border-color: var(--secondary);
|
|
}
|
|
|
|
&:hover:not(.active) {
|
|
background: var(--lightgray);
|
|
}
|
|
}
|
|
}
|
|
|
|
.rc-tab-desc {
|
|
font-size: 0.78rem;
|
|
color: var(--gray);
|
|
margin: -0.5rem 0 0.75rem;
|
|
min-height: 1.1em;
|
|
}
|
|
|
|
.rc-hidden-filter,
|
|
.rc-hidden-page {
|
|
display: none !important;
|
|
}
|
|
|
|
.recent-changes-load-more {
|
|
display: block;
|
|
margin: 1rem auto;
|
|
padding: 0.5rem 1.5rem;
|
|
border: 1px solid var(--lightgray);
|
|
border-radius: 4px;
|
|
background: transparent;
|
|
color: var(--secondary);
|
|
font-family: inherit;
|
|
font-size: 0.85rem;
|
|
cursor: pointer;
|
|
transition: background-color 0.15s;
|
|
|
|
&:hover {
|
|
background: var(--lightgray);
|
|
}
|
|
}
|
|
|
|
.recent-changes-list {
|
|
list-style-type: none;
|
|
padding: 0;
|
|
margin: 0;
|
|
|
|
&.detailed {
|
|
.recent-change-item {
|
|
margin-bottom: 1.5rem;
|
|
padding-bottom: 1.2rem;
|
|
border-bottom: 1px solid var(--lightgray);
|
|
|
|
&:last-child {
|
|
border-bottom: none;
|
|
}
|
|
}
|
|
|
|
.recent-change-excerpt {
|
|
margin: 0.5rem 0;
|
|
font-size: 0.9rem;
|
|
color: var(--gray);
|
|
line-height: 1.4;
|
|
}
|
|
|
|
.recent-change-tags {
|
|
margin-top: 0.5rem;
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
gap: 0.4rem;
|
|
|
|
.recent-change-tag {
|
|
font-size: 0.75rem;
|
|
padding: 0.2rem 0.5rem;
|
|
background-color: var(--lightgray);
|
|
border-radius: 4px;
|
|
color: var(--darkgray);
|
|
}
|
|
}
|
|
}
|
|
|
|
&.condensed {
|
|
.recent-change-item {
|
|
margin-bottom: 0.5rem;
|
|
display: flex;
|
|
flex-direction: column;
|
|
|
|
@media (min-width: 768px) {
|
|
flex-direction: row;
|
|
align-items: baseline;
|
|
justify-content: space-between;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.recent-change-item {
|
|
position: relative;
|
|
|
|
&.created {
|
|
.recent-change-type {
|
|
background-color: var(--rc-created-bg);
|
|
color: var(--rc-created-text);
|
|
}
|
|
}
|
|
|
|
&.modified {
|
|
.recent-change-type {
|
|
background-color: var(--rc-modified-bg);
|
|
color: var(--rc-modified-text);
|
|
}
|
|
}
|
|
}
|
|
|
|
.recent-change-link {
|
|
font-weight: 500;
|
|
text-decoration: none;
|
|
color: var(--dark);
|
|
|
|
&:hover {
|
|
text-decoration: underline;
|
|
color: var(--secondary);
|
|
}
|
|
}
|
|
|
|
.recent-change-meta {
|
|
display: flex;
|
|
gap: 0.5rem;
|
|
align-items: center;
|
|
margin-top: 0.25rem;
|
|
font-size: 0.8rem;
|
|
|
|
@media (min-width: 768px) {
|
|
.condensed & {
|
|
margin-top: 0;
|
|
}
|
|
}
|
|
}
|
|
|
|
.recent-change-type {
|
|
padding: 0.15rem 0.4rem;
|
|
border-radius: 3px;
|
|
font-size: 0.7rem;
|
|
font-weight: 600;
|
|
text-transform: uppercase;
|
|
}
|
|
|
|
.recent-change-date {
|
|
color: var(--gray);
|
|
}
|
|
|
|
.recent-changes-more {
|
|
margin-top: 1rem;
|
|
text-align: right;
|
|
|
|
a {
|
|
font-size: 0.85rem;
|
|
text-decoration: none;
|
|
color: var(--secondary);
|
|
|
|
&:hover {
|
|
text-decoration: underline;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Dark mode adjustments
|
|
@media (prefers-color-scheme: dark) {
|
|
.recent-changes {
|
|
--rc-created-bg: rgba(179, 230, 204, 0.2);
|
|
--rc-created-text: #b3e6cc;
|
|
--rc-modified-bg: rgba(208, 224, 240, 0.2);
|
|
--rc-modified-text: #d0e0f0;
|
|
|
|
.recent-changes-list.detailed .recent-change-tags .recent-change-tag {
|
|
background-color: var(--darkgray);
|
|
color: var(--light);
|
|
}
|
|
}
|
|
}
|