diff --git a/telescope/html/css/main.css b/telescope/html/css/main.css index fc8058b3..bc112695 100644 --- a/telescope/html/css/main.css +++ b/telescope/html/css/main.css @@ -34,6 +34,19 @@ section.project:not(:first-child) { border-top: 1px solid rgba(0, 40, 100, 0.12); } +section.project h3 a { + text-decoration: none; + color: var(--foreground); +} + +section.project h3 a i { + display: none; +} + +section.project h3 a:hover i { + display: inline-block; +} + .project-cards { display: grid; grid-gap: 0.5rem 0rem; diff --git a/telescope/html/js/app/components/Dashboard.mjs b/telescope/html/js/app/components/Dashboard.mjs index 95d1e361..69aa5726 100644 --- a/telescope/html/js/app/components/Dashboard.mjs +++ b/telescope/html/js/app/components/Dashboard.mjs @@ -10,6 +10,7 @@ import TagListFilter from "./TagListFilter.mjs"; export default class Dashboard extends Component { constructor() { super(); + this.firstLoad = true; this.triggerRecheck = this.triggerRecheck.bind(this); this.fetchCheckResult = this.fetchCheckResult.bind(this); this.setFocusedCheck = this.setFocusedCheck.bind(this); @@ -64,8 +65,6 @@ export default class Dashboard extends Component { }); // Watch history to focus check. window.addEventListener("hashchange", this.onHashChange); - // Check if page has state on load. - this.onHashChange(); } componentWillUnmount() { @@ -78,12 +77,18 @@ export default class Dashboard extends Component { componentDidUpdate() { this.updateFavicon(); + // Check if page has state on first load (after render) + if (this.firstLoad) { + this.onHashChange(); + this.firstLoad = false; + } } onHashChange() { - const [project, name] = window.location.hash.slice(1).split("/"); - // Highlight check in page. - if (project && name) { + const hash = window.location.hash; + // Highlight check in page? + if (hash.includes("/")) { + const [project, name] = hash.slice(1).split("/") this.setState({ focusedCheck: { project, @@ -91,7 +96,12 @@ export default class Dashboard extends Component { }, }); } + // Scroll to check? + if (hash.startsWith("#project-")) { + document.querySelector(hash).scrollIntoView(); + } } + updateFavicon() { const { results } = this.state; diff --git a/telescope/html/js/app/components/Project.mjs b/telescope/html/js/app/components/Project.mjs index 3446f913..cd490263 100644 --- a/telescope/html/js/app/components/Project.mjs +++ b/telescope/html/js/app/components/Project.mjs @@ -55,12 +55,17 @@ export default class Project extends Component { } render({ name }) { + const slug = name.toLowerCase().replace(" ", "-"); return html`
${this.renderStatus()}

- ${name} + + ${name} + ${" "} + +

${this.renderChecks()}