Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REFACTOR: convert to ember component, add timeline toggle #73

Merged
merged 22 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c56dc58
DEV: make TOC an ember component, WIP
awesomerobot Dec 15, 2023
18c646a
Styling, translations, manage overlay state
awesomerobot Dec 15, 2023
7d9d4b0
update template arg
awesomerobot Dec 15, 2023
8a8d42d
clean up imports
awesomerobot Dec 15, 2023
f4cb699
Add Docs support
awesomerobot Dec 22, 2023
088f240
Fix autoTOC, update tests
awesomerobot Dec 22, 2023
b6e398b
Replace acceptance test with system test, fix TOC_min_heading
awesomerobot Jan 4, 2024
bd76123
cover topics with one post and no timeline
awesomerobot Jan 4, 2024
deb74b4
DEV: Update logic
janzenisaac Jan 10, 2024
5cc9ef8
remove "allowed groups" setting for now
awesomerobot Jan 10, 2024
da64a4e
remove option to show on replies
awesomerobot Jan 10, 2024
29c213a
ensure activeHeading exists before checking ID
awesomerobot Jan 10, 2024
f9d9050
test post needs to be longer, minor buffer adjustment
awesomerobot Jan 10, 2024
55236a3
add test for toggle
awesomerobot Jan 10, 2024
c81df9b
replace acceptance tests with system specs
awesomerobot Jan 11, 2024
19c6c59
update discourse-compatibility
awesomerobot Jan 11, 2024
707d829
update default min heading
awesomerobot Jan 11, 2024
d8fb6bb
prevent toggle from showing on mobile, mobile tests, renderInOutlet
awesomerobot Jan 11, 2024
a292304
check if headingPositions exists, fix for docs, test typo
awesomerobot Jan 11, 2024
6b6f79f
remove sequence check, allow more flexibility
awesomerobot Jan 16, 2024
89a41ac
hide scrollbars while subsections expand
awesomerobot Jan 23, 2024
381674d
pin to previous version
awesomerobot Jan 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .discourse-compatibility
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
< 3.2.0.beta5-dev: 3179e886a366e15fb0de3c869990c2292763bd89
< 3.2.0.beta2: 0f2a0e73e6c2924f2b44d3241931f2bd5f77a9ae
3.1.999: 323bd485b08889360edcae826d6272fd8e77d180
2.7.13: 5b2f5a455e1adf8ce5e8c1cfb7fbc3c388d3d82a
Expand Down
15 changes: 11 additions & 4 deletions assets/sprite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
169 changes: 105 additions & 64 deletions common/common.scss
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
$padding-basis: 0.75em;

.d-toc-main {
display: none;
width: 225px;
@media screen and (max-width: 1045px) {
.desktop-view & {
width: 150px;
}
@media screen and (min-width: 925px) {
.container.posts {
// needs to be static, otherwise we get content shifts when the TOC shows/hides
grid-template-columns: 75% 25%;
}
border-left: 1px solid var(--primary-low);
}

.overlay .d-toc-main {
max-width: 100%;
}

.d-toc-main {
min-width: 6em;
max-width: 13em;

word-wrap: break-word;
box-sizing: border-box;
a {
display: block;
Expand All @@ -19,8 +26,8 @@ $padding-basis: 0.75em;
}
}
#d-toc {
border-left: 1px solid var(--primary-low);
max-height: calc(100vh - 4.5em - var(--header-offset));
padding-bottom: 0.5em;
overflow: auto;
ul {
list-style-type: none;
Expand Down Expand Up @@ -119,67 +126,54 @@ html.rtl SELECTOR {
}
// END active line marker

.d-toc-mini,
a.d-toc-close {
display: none;
.d-toc-mini {
height: 100%;
button {
height: 100%;
}
}

.d-toc-timeline-visible {
.d-toc-main,
.d-toc-mini {
display: block;
}
// overlayed timeline (on mobile and narrow screens)
.topic-navigation.with-topic-progress {
.d-toc-wrapper {
position: fixed;
margin-top: 0.25em;
height: calc(100vh - 50px - var(--header-offset));
opacity: 0.5;
right: -100vw;
top: var(--header-offset);
width: 75vw;
max-width: 350px;
background-color: var(--secondary);
box-shadow: var(--shadow-dropdown);
z-index: z("modal", "overlay");
transition: all 0.2s ease-in-out;
.d-toc-main {
width: 100%;
padding: 0.5em;
height: 100%;
#d-toc {
max-height: calc(100% - 3em);
}
}
&.overlay {
right: 0;
width: 75vw;
opacity: 1;
.d-toc-main #d-toc li.d-toc-item ul {
transition: none;
}
// overlayed timeline (on mobile and narrow screens)
.topic-navigation.with-topic-progress {
.d-toc-wrapper {
position: fixed;
margin-top: 0.25em;
height: calc(100vh - 50px - var(--header-offset));
opacity: 0.5;
right: -100vw;
top: var(--header-offset);
width: 75vw;
max-width: 350px;
background-color: var(--secondary);
box-shadow: var(--shadow-dropdown);
z-index: z("modal", "overlay");
transition: all 0.2s ease-in-out;
.d-toc-main {
width: 100%;
padding: 0.5em;
height: 100%;
#d-toc {
max-height: calc(100% - 3em);
}

a.scroll-to-bottom,
a.d-toc-close {
display: inline-block;
padding: 0.5em;
}
&.overlay {
right: 0;
width: 75vw;
opacity: 1;
.d-toc-main #d-toc li.d-toc-item ul {
transition: none;
}
}

.d-toc-icons {
text-align: right;
}
a.scroll-to-bottom,
a.d-toc-close {
display: inline-block;
padding: 0.5em;
}
}

// core overrides when timeline is active
.timeline-container,
#topic-progress {
display: none;
}
.container.posts .topic-navigation.with-topic-progress {
align-self: start;
.d-toc-icons {
text-align: right;
}
}
}

Expand All @@ -202,7 +196,7 @@ a.d-toc-close {
}
}

.d-toc-timeline-visible .topic-navigation.with-topic-progress .d-toc-wrapper {
.topic-navigation.with-topic-progress .d-toc-wrapper {
right: unset;
left: -100vw;
&.overlay {
Expand Down Expand Up @@ -240,3 +234,50 @@ a.d-toc-close {
display: block;
}
}

// toggle in timeline
.timeline-container
.topic-timeline
.timeline-footer-controls
button:last-child {
// annoying core style
&.timeline-toggle {
margin-right: 100%;
white-space: nowrap;
}
}

// toggle in timeline dtoc
.d-toc-main {
.timeline-toggle {
margin-top: 1em;
}
}

// jump to bottom in timeline
.d-toc-footer-icons {
font-size: var(--font-down-1);
margin-top: 0.5em;
button {
color: var(--tertiary);
.d-icon {
color: currentColor;
}
}
}

// on shorter screens, we can keep this consistently in the same location
// this is kind of far away for tall screens, so the more variable position below might be better
@media screen and (max-height: 950px) {
.timeline-toggle {
position: fixed;
bottom: 0;
}
}

// hides the timeline when d-toc is shown
.d-toc-active {
.timeline-container {
display: none;
}
}
Loading