patx/gitman

Add welcome hero, profile home redirect, and responsive header search

Commit 61e8307 · patx · Nov 3 at 10:46PM

Changeset
61e83079e0ccf63d689f34ae7b4ae498b487cafc
Parents
61a7b3b35c09d43d7d457243011e1c9f297023e4

View source at this commit

Comments

No comments yet.

Log in to comment

Diff

diff --git a/app.py b/app.py
index ecb7b24..8620ec5 100644
--- a/app.py
+++ b/app.py
@@ -5020,7 +5020,11 @@ def favicon():
 
 @app.route("/")
 def index():
-    return render("index.tpl", actions=list_recent_actions(50))
+    response.set_header("Cache-Control", "no-store")
+    user = current_user()
+    if user:
+        redirect(f"/{user['username']}")
+    return render("index.tpl", landing=True)
 
 
 @app.route("/-/notifications")
diff --git a/static/repo-search.js b/static/repo-search.js
new file mode 100644
index 0000000..4841f5b
--- /dev/null
+++ b/static/repo-search.js
@@ -0,0 +1,162 @@
+(() => {
+  document.querySelectorAll('[data-repo-search]').forEach((search) => {
+    const input = search.querySelector('[data-repo-search-input]');
+    const menu = search.querySelector('[data-repo-search-results]');
+    const empty = search.querySelector('[data-repo-search-empty]');
+    const hint = search.querySelector('[data-repo-search-hint]');
+    if (!input || !menu || !empty) return;
+
+    let token = 0;
+    let timer;
+    let wantsOpen = false;
+    let state = { query: '', page: 0, hasNext: false, loading: false };
+    const setOpen = (open) => {
+      menu.hidden = !open;
+      input.setAttribute('aria-expanded', String(open));
+      if (hint) hint.hidden = Boolean(input.value.trim());
+    };
+    const clearResults = () => menu.querySelectorAll('[data-repo-search-result]').forEach((item) => item.remove());
+    const showStatus = (message) => {
+      empty.textContent = message;
+      empty.hidden = false;
+      setOpen(wantsOpen && Boolean(input.value.trim()));
+    };
+    const searchRepos = async (append = false) => {
+      const query = input.value.trim();
+      if (!query) {
+        token += 1;
+        clearResults();
+        empty.hidden = true;
+        menu.removeAttribute('aria-busy');
+        state = { query: '', page: 0, hasNext: false, loading: false };
+        setOpen(false);
+        return;
+      }
+      if (append && (state.query !== query || state.loading || !state.hasNext)) return;
+      const requestToken = ++token;
+      const page = append ? state.page + 1 : 1;
+      state = { ...state, query, loading: true };
+      if (!append) clearResults();
+      showStatus('Searching…');
+      menu.setAttribute('aria-busy', 'true');
+      const url = new URL(search.dataset.repoSearchUrl, window.location.origin);
+      url.searchParams.set('q', query);
+      url.searchParams.set('page', String(page));
+      try {
+        const response = await fetch(url, { headers: { Accept: 'application/json' } });
+        if (!response.ok) throw new Error('Search failed');
+        const data = await response.json();
+        if (token !== requestToken || input.value.trim() !== query) return;
+        (data.results || []).forEach((result) => {
+          const item = document.createElement('div');
+          item.className = 'repo-search-result';
+          item.dataset.repoSearchResult = 'true';
+          const link = document.createElement('a');
+          link.className = 'repo-search-link';
+          link.href = result.url;
+          link.setAttribute('role', 'option');
+          const title = document.createElement('strong');
+          title.textContent = result.full_name;
+          const meta = document.createElement('small');
+          const stars = Number(result.star_count) || 0;
+          meta.textContent = `${stars} ${stars === 1 ? 'star' : 'stars'}`;
+          link.append(title, meta);
+          item.append(link);
+          menu.insertBefore(item, empty);
+        });
+        empty.textContent = 'No repositories found.';
+        empty.hidden = Boolean(menu.querySelector('[data-repo-search-result]'));
+        state = { query, page, hasNext: Boolean(data.pagination && data.pagination.has_next), loading: false };
+        setOpen(wantsOpen);
+      } catch (_) {
+        if (token !== requestToken || input.value.trim() !== query) return;
+        state = { ...state, loading: false, hasNext: false };
+        showStatus('Unable to search. Try again.');
+      } finally {
+        if (token === requestToken) menu.removeAttribute('aria-busy');
+      }
+    };
+    input.addEventListener('input', () => {
+      wantsOpen = true;
+      token += 1;
+      clearTimeout(timer);
+      clearResults();
+      if (!input.value.trim()) {
+        searchRepos();
+        return;
+      }
+      showStatus('Searching…');
+      timer = setTimeout(() => searchRepos(), 120);
+    });
+    input.addEventListener('focus', () => {
+      wantsOpen = true;
+      if (input.value.trim()) searchRepos();
+    });
+    input.addEventListener('keydown', (event) => {
+      const first = menu.querySelector('[role="option"]');
+      if (menu.hidden || !first) return;
+      if (event.key === 'ArrowDown') {
+        event.preventDefault();
+        first.focus();
+      } else if (event.key === 'Enter') {
+        event.preventDefault();
+        first.click();
+      }
+    });
+    menu.addEventListener('keydown', (event) => {
+      if (!['ArrowDown', 'ArrowUp'].includes(event.key)) return;
+      const options = Array.from(menu.querySelectorAll('[role="option"]'));
+      const index = options.indexOf(document.activeElement);
+      if (index < 0) return;
+      event.preventDefault();
+      const next = index + (event.key === 'ArrowDown' ? 1 : -1);
+      if (next < 0) input.focus();
+      else options[Math.min(next, options.length - 1)].focus();
+    });
+    menu.addEventListener('scroll', () => {
+      if (menu.scrollTop + menu.clientHeight >= menu.scrollHeight - 32) searchRepos(true);
+    });
+    const dismiss = () => {
+      wantsOpen = false;
+      setOpen(false);
+    };
+    document.addEventListener('click', (event) => {
+      if (!search.contains(event.target) && !event.target.closest('[data-mobile-search-open]')) dismiss();
+    });
+    document.addEventListener('keydown', (event) => {
+      if (event.key === 'Escape') dismiss();
+    });
+  });
+
+  const trigger = document.querySelector('[data-mobile-search-open]');
+  const dialog = document.querySelector('[data-mobile-search-dialog]');
+  const close = document.querySelector('[data-mobile-search-close]');
+  if (!trigger || !dialog || !close) return;
+  const mobile = window.matchMedia('(max-width: 760px)');
+  const resizeDialog = () => {
+    if (dialog.open) dialog.style.height = `${window.visualViewport ? window.visualViewport.height : window.innerHeight}px`;
+  };
+  trigger.addEventListener('click', () => {
+    if (!dialog.open) dialog.showModal();
+    document.body.classList.add('search-open');
+    resizeDialog();
+    dialog.querySelector('[data-repo-search-input]').focus();
+  });
+  close.addEventListener('click', () => dialog.close());
+  dialog.addEventListener('keydown', (event) => {
+    if (event.key === 'Escape') {
+      event.preventDefault();
+      dialog.close();
+    }
+  });
+  dialog.addEventListener('close', () => {
+    document.body.classList.remove('search-open');
+    dialog.style.removeProperty('height');
+    const target = mobile.matches ? trigger : document.querySelector('.header-repo-search input');
+    if (target) target.focus();
+  });
+  mobile.addEventListener('change', () => {
+    if (!mobile.matches && dialog.open) dialog.close();
+  });
+  if (window.visualViewport) window.visualViewport.addEventListener('resize', resizeDialog);
+})();
diff --git a/static/styles.css b/static/styles.css
index f99d4c7..9b95221 100644
--- a/static/styles.css
+++ b/static/styles.css
@@ -390,7 +390,6 @@ th { color: var(--ink); font-weight: 700; }
 .repo-search-input { width: 350px; margin-bottom: 0; }
 .repo-search-form { display: block; margin: 0; }
 .panel-heading > .repo-search { margin-left: auto; }
-.hero-actions .repo-search-menu { left: 0; right: auto; }
 .repo-search-menu {
   display: flex;
   flex-direction: column;
@@ -624,3 +623,34 @@ th { color: var(--ink); font-weight: 700; }
   white-space: nowrap;
   border: 0;
 }
+
+/* The public welcome page shares the site's theme and logo. */
+.landing-page main.page { display: grid; place-items: center; max-width: none; padding: 2rem 1.5rem; }
+.welcome-hero { display: flex; flex-direction: column; align-items: center; gap: 1.75rem; width: 100%; max-width: 44rem; text-align: center; }
+.welcome-logo { display: flex; align-items: center; justify-content: center; gap: clamp(1rem, 3vw, 2rem); margin: 0; line-height: 1; }
+.welcome-logo svg { flex: 0 0 auto; height: auto; }
+.welcome-logo svg:first-child { width: clamp(7rem, 17vw, 12rem); }
+.welcome-logo svg:last-child { width: clamp(5rem, 12vw, 8rem); }
+.welcome-description { max-width: 32rem; margin: 0; font-size: clamp(1.125rem, 2.3vw, 1.35rem); line-height: 1.6; text-wrap: balance; }
+.welcome-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: .75rem; width: 100%; }
+.welcome-actions .button { min-width: 9rem; }
+.button.primary { background: var(--ink); color: var(--page-bg); }
+.button.primary:hover, .button.primary:active { background: var(--press); color: var(--page-bg); }
+.header-repo-search { align-self: center; width: min(24rem, 40vw); margin-left: auto; }
+.header-repo-search .repo-search-input { width: 100%; padding-block: 10px; }
+.search-toggle { display: none; }
+.search-toggle, .mobile-search-close { padding: 0; min-height: 40px; background: transparent; }
+.search-toggle:hover, .mobile-search-close:hover { background: var(--chip); color: var(--ink); }
+.mobile-repo-search { position: fixed; inset: 0; width: 100%; max-width: none; height: 100vh; height: 100dvh; max-height: none; margin: 0; padding: max(1.5rem, env(safe-area-inset-top)) 1.5rem max(1.5rem, env(safe-area-inset-bottom)); border: 0; background: var(--page-bg); color: var(--text); overflow: hidden; }
+.mobile-repo-search[open] { display: flex; flex-direction: column; gap: 1.5rem; }
+.mobile-search-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex: 0 0 auto; }
+.mobile-search-heading h2 { margin: 0; }
+.mobile-search-content { display: flex; flex-direction: column; gap: 1rem; width: 100%; flex: 1; min-height: 0; }
+.mobile-search-content .repo-search-input { width: 100%; flex: 0 0 auto; }
+.mobile-search-content .repo-search-menu { position: static; flex: 1; min-height: 0; max-height: none; max-width: none; width: 100%; padding: 0; border: 0; border-radius: 0; background: transparent; overscroll-behavior: contain; }
+.mobile-search-content .repo-search-link { min-height: 48px; padding-block: .75rem; }
+.search-open { overflow: hidden; }
+@media (max-width: 760px) {
+  .header-repo-search { display: none; }
+  .search-toggle { display: inline-flex; }
+}
diff --git a/templates/base.tpl b/templates/base.tpl
index 8b98d50..f0b8343 100644
--- a/templates/base.tpl
+++ b/templates/base.tpl
@@ -14,27 +14,30 @@
   <meta name="description" content="GitMan: free Git repository hosting for open source software.">
   <title>{{(title + " · GitMan") if title else "GitMan"}}</title>
   <link rel="icon" type="image/svg+xml" href="/static/git.svg">
-  % if theme != 'dark':
+  % if not get('landing', False) and theme != 'dark':
     <link rel="stylesheet" href="/static/vendor/highlight.js/github.min.css">
   % end
-  % if theme != 'light':
+  % if not get('landing', False) and theme != 'light':
     <link rel="stylesheet" href="/static/vendor/highlight.js/github-dark.min.css"{{!' media="(prefers-color-scheme: dark)"' if theme == 'auto' else ''}}>
   % end
-  <link rel="stylesheet" href="/static/styles.css?v=17">
+  <link rel="stylesheet" href="/static/styles.css?v=18">
 </head>
-<body>
+<body class="{{'landing-page' if get('landing', False) else ''}}">
+  % if not get("landing", False):
   <header class="site-header">
     <a class="brand" href="/" aria-label="GitMan home">
-        <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" class="bi bi-git" viewBox="0 0 16 16" aria-hidden="true">
-          <path d="M15.698 7.287 8.712.302a1.03 1.03 0 0 0-1.457 0l-1.45 1.45 1.84 1.84a1.223 1.223 0 0 1 1.55 1.56l1.773 1.774a1.224 1.224 0 0 1 1.267 2.025 1.226 1.226 0 0 1-2.002-1.334L8.58 5.963v4.353a1.226 1.226 0 1 1-1.008-.036V5.887a1.226 1.226 0 0 1-.666-1.608L5.093 2.465l-4.79 4.79a1.03 1.03 0 0 0 0 1.457l6.986 6.986a1.03 1.03 0 0 0 1.457 0l6.953-6.953a1.03 1.03 0 0 0 0-1.457"/>
-        </svg>
-        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-person-arms-up" viewBox="0 0 16 16" aria-hidden="true">
-           <path d="M8 3a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3"/>
-           <path d="m5.93 6.704-.846 8.451a.768.768 0 0 0 1.523.203l.81-4.865a.59.59 0 0 1 1.165 0l.81 4.865a.768.768 0 0 0 1.523-.203l-.845-8.451A1.5 1.5 0 0 1 10.5 5.5L13 2.284a.796.796 0 0 0-1.239-.998L9.634 3.84a.7.7 0 0 1-.33.235c-.23.074-.665.176-1.304.176-.64 0-1.074-.102-1.305-.176a.7.7 0 0 1-.329-.235L4.239 1.286a.796.796 0 0 0-1.24.998l2.5 3.216c.317.316.475.758.43 1.204Z"/>
-        </svg>
+      % include("logo.tpl")
     </a>
+    % if user:
+      <div class="repo-search header-repo-search" data-repo-search data-repo-search-url="/-/repos/search">
+        % include("repo_search_input.tpl", input_id="repo-search-input", results_id="repo-search-results")
+      </div>
+    % end
     <nav class="nav">
       % if user:
+        <button class="nav-icons search-toggle" type="button" data-mobile-search-open aria-label="Search repositories" aria-haspopup="dialog" aria-controls="mobile-repo-search">
+          <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><circle cx="10.5" cy="10.5" r="6.5"/><path d="m16 16 5 5"/></svg>
+        </button>
         <a class="nav-icons notification-bell" data-notification-bell href="/-/notifications" aria-label="Notifications" title="Notifications">
           <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 16 16" aria-hidden="true">
             <path d="M8 16a2 2 0 0 0 2-2H6a2 2 0 0 0 2 2M8 1.918l-.797.161A4 4 0 0 0 4 6c0 .628-.134 2.197-.459 3.742-.16.767-.376 1.566-.663 2.258h10.244c-.287-.692-.502-1.49-.663-2.258C12.134 8.197 12 6.628 12 6a4 4 0 0 0-3.203-3.92zM14.22 12c.223.447.481.801.78 1H1c.299-.199.557-.553.78-1C2.68 10.2 3 6.88 3 6c0-2.42 1.72-4.44 4.005-4.901a1 1 0 1 1 1.99 0A5 5 0 0 1 13 6c0 .88.32 4.2 1.22 6"/>
@@ -58,6 +61,21 @@
       % end
     </nav>
   </header>
+  % if user:
+    <dialog id="mobile-repo-search" class="mobile-repo-search" aria-labelledby="mobile-search-title" data-mobile-search-dialog>
+      <div class="mobile-search-heading">
+        <h2 id="mobile-search-title">Search repositories</h2>
+        <button class="nav-icons mobile-search-close" type="button" data-mobile-search-close aria-label="Close search">
+          <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="m6 6 12 12M18 6 6 18"/></svg>
+        </button>
+      </div>
+      <div class="repo-search mobile-search-content" data-repo-search data-repo-search-url="/-/repos/search">
+        % include("repo_search_input.tpl", input_id="mobile-repo-search-input", results_id="mobile-repo-search-results")
+        <p class="muted" data-repo-search-hint>Type a repository name to search.</p>
+      </div>
+    </dialog>
+  % end
+  % end
 
   <main class="page">
     % if error:
@@ -68,6 +86,7 @@
     % end
     {{!base}}
   </main>
+  % if not get("landing", False):
   % import time
   <footer class="colophon">
     <p>© {{time.strftime("%Y")}} GitMan</p>
@@ -75,6 +94,7 @@
   <script src="/static/mentions.js?v=1" defer></script>
   % if user:
     <script src="/static/notifications.js?v=2" defer></script>
+    <script src="/static/repo-search.js?v=1" defer></script>
   % end
   <script src="/static/vendor/highlight.js/highlight.min.js"></script>
   <script>
@@ -367,131 +387,6 @@
       });
     })();
   </script>
-  <script>
-    (() => {
-      const search = document.querySelector("[data-repo-search]");
-      if (!search) return;
-
-      const input = search.querySelector("[data-repo-search-input]");
-      const menu = search.querySelector("[data-repo-search-results]");
-      const empty = search.querySelector("[data-repo-search-empty]");
-      if (!input || !menu) return;
-
-      let activeToken = 0;
-      let searchTimeout = null;
-      let searchState = { query: "", page: 0, hasNext: false, loading: false, token: 0 };
-
-      const setOpen = (isOpen) => {
-        menu.hidden = !isOpen;
-        input.setAttribute("aria-expanded", isOpen ? "true" : "false");
-      };
-
-      const clearResults = () => {
-        menu.querySelectorAll("[data-repo-search-result]").forEach((result) => result.remove());
-      };
-
-      const renderResults = (results, append = false) => {
-        if (!append) clearResults();
-
-        results.forEach((result) => {
-          const item = document.createElement("div");
-          const link = document.createElement("a");
-          const title = document.createElement("strong");
-          const meta = document.createElement("small");
-
-          item.className = "repo-search-result";
-          item.dataset.repoSearchResult = "true";
-          link.className = "repo-search-link";
-          link.href = result.url || "#";
-          link.setAttribute("role", "option");
-          title.textContent = result.full_name || `${result.owner_username}/${result.name}`;
-
-          meta.textContent = (result.star_count || 0) === 1 ? "1 star" : `${result.star_count || 0} stars`;
-          link.append(title, document.createTextNode(" "), meta);
-          item.append(link);
-
-          if (empty) {
-            menu.insertBefore(item, empty);
-          } else {
-            menu.append(item);
-          }
-        });
-
-        if (empty) empty.hidden = Boolean(menu.querySelector("[data-repo-search-result]"));
-        setOpen(Boolean(input.value.trim()));
-      };
-
-      const searchRepos = (append = false) => {
-        const query = input.value.trim();
-
-        if (!query) {
-          clearResults();
-          if (empty) empty.hidden = true;
-          setOpen(false);
-          searchState = { ...searchState, query: "", page: 0, hasNext: false, loading: false };
-          return;
-        }
-
-        if (append && (searchState.query !== query || searchState.loading || !searchState.hasNext)) return;
-
-        const token = append ? searchState.token : activeToken + 1;
-        const page = append ? searchState.page + 1 : 1;
-        activeToken = token;
-        searchState = { ...searchState, token, query, loading: true };
-        if (!append) {
-          clearResults();
-          if (empty) empty.hidden = true;
-        }
-
-        const url = new URL(search.dataset.repoSearchUrl, window.location.origin);
-        url.searchParams.set("q", query);
-        url.searchParams.set("page", String(page));
-        fetch(url.toString(), { headers: { Accept: "application/json" } })
-          .then((response) => {
-            if (!response.ok) throw new Error("Unable to search repositories.");
-            return response.json();
-          })
-          .then((data) => {
-            if (activeToken !== token || searchState.query !== query) return;
-            renderResults(data.results || [], append);
-            searchState = {
-              ...searchState,
-              page,
-              hasNext: Boolean(data.pagination && data.pagination.has_next),
-              loading: false,
-            };
-          })
-          .catch(() => {
-            if (activeToken !== token || searchState.query !== query) return;
-            renderResults([], append);
-            searchState = { ...searchState, loading: false, hasNext: false };
-          });
-      };
-
-      input.addEventListener("input", () => {
-        clearTimeout(searchTimeout);
-        searchTimeout = setTimeout(searchRepos, 120);
-      });
-
-      input.addEventListener("focus", () => {
-        if (input.value.trim()) searchRepos();
-      });
-
-      menu.addEventListener("scroll", () => {
-        if (menu.scrollTop + menu.clientHeight >= menu.scrollHeight - 32) {
-          searchRepos(true);
-        }
-      });
-
-      document.addEventListener("click", (event) => {
-        if (!search.contains(event.target)) setOpen(false);
-      });
-
-      document.addEventListener("keydown", (event) => {
-        if (event.key === "Escape") setOpen(false);
-      });
-    })();
-  </script>
   <script>
     (() => {
       const forms = document.querySelectorAll("[data-live-search-form]");
@@ -829,5 +724,6 @@
       });
     })();
   </script>
+  % end
 </body>
 </html>
diff --git a/templates/index.tpl b/templates/index.tpl
index fee46cb..c53cb83 100644
--- a/templates/index.tpl
+++ b/templates/index.tpl
@@ -1,41 +1,12 @@
-% rebase("base.tpl", title="Recent activity", user=user, error=error, notice=notice)
+% rebase("base.tpl", title="Free Git repository hosting", user=user, error=error, notice=notice, landing=True)
 
-<section class="panel">
-  <div class="panel-heading">
-    <div>
-            <p>GitMan.io: Free Git repository hosting for open source software</p>
-            % if not user:
-              <div class="hero-actions">
-                <a class="button" href="/signup">Create an account</a>
-                <a class="button" href="/login">Log in</a>
-              </div>
-            % else:
-              <div class="hero-actions">
-              <div class="repo-search" data-repo-search data-repo-search-url="/-/repos/search">
-                <input
-                  id="repo-search-input"
-                  class="repo-search-input"
-                  type="search"
-                  placeholder="Search all repositories"
-                  autocomplete="off"
-                  data-repo-search-input
-                  aria-haspopup="listbox"
-                  aria-expanded="false"
-                  aria-controls="repo-search-results"
-                >
-                <div id="repo-search-results" class="repo-search-menu" role="listbox" data-repo-search-results hidden>
-                  <p class="repo-search-empty" data-repo-search-empty hidden>No repositories found.</p>
-                </div>
-              </div>
-              </div>
-            % end
-    </div>
+<section class="welcome-hero">
+  <h1 class="welcome-logo" aria-label="GitMan">
+    % include("logo.tpl")
+  </h1>
+  <p class="welcome-description">Free Git repository hosting for open source software.</p>
+  <div class="welcome-actions">
+    <a class="button" href="/login">Log in</a>
+    <a class="button primary" href="/signup">Sign up</a>
   </div>
-
-  % if actions:
-        <h1>Recent Activity Feed</h1>
-    % include("activity_feed.tpl", actions=actions)
-  % else:
-    <p class="empty">No activity yet.</p>
-  % end
 </section>
diff --git a/templates/logo.tpl b/templates/logo.tpl
new file mode 100644
index 0000000..5d4092b
--- /dev/null
+++ b/templates/logo.tpl
@@ -0,0 +1,7 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" class="bi bi-git" viewBox="0 0 16 16" aria-hidden="true">
+  <path d="M15.698 7.287 8.712.302a1.03 1.03 0 0 0-1.457 0l-1.45 1.45 1.84 1.84a1.223 1.223 0 0 1 1.55 1.56l1.773 1.774a1.224 1.224 0 0 1 1.267 2.025 1.226 1.226 0 0 1-2.002-1.334L8.58 5.963v4.353a1.226 1.226 0 1 1-1.008-.036V5.887a1.226 1.226 0 0 1-.666-1.608L5.093 2.465l-4.79 4.79a1.03 1.03 0 0 0 0 1.457l6.986 6.986a1.03 1.03 0 0 0 1.457 0l6.953-6.953a1.03 1.03 0 0 0 0-1.457"/>
+</svg>
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-person-arms-up" viewBox="0 0 16 16" aria-hidden="true">
+   <path d="M8 3a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3"/>
+   <path d="m5.93 6.704-.846 8.451a.768.768 0 0 0 1.523.203l.81-4.865a.59.59 0 0 1 1.165 0l.81 4.865a.768.768 0 0 0 1.523-.203l-.845-8.451A1.5 1.5 0 0 1 10.5 5.5L13 2.284a.796.796 0 0 0-1.239-.998L9.634 3.84a.7.7 0 0 1-.33.235c-.23.074-.665.176-1.304.176-.64 0-1.074-.102-1.305-.176a.7.7 0 0 1-.329-.235L4.239 1.286a.796.796 0 0 0-1.24.998l2.5 3.216c.317.316.475.758.43 1.204Z"/>
+</svg>
diff --git a/templates/repo_search_input.tpl b/templates/repo_search_input.tpl
new file mode 100644
index 0000000..3d99bff
--- /dev/null
+++ b/templates/repo_search_input.tpl
@@ -0,0 +1,5 @@
+<label class="sr-only" for="{{input_id}}">Search repositories</label>
+<input id="{{input_id}}" class="repo-search-input" type="search" role="combobox" placeholder="Search repositories" autocomplete="off" data-repo-search-input aria-autocomplete="list" aria-haspopup="listbox" aria-expanded="false" aria-controls="{{results_id}}">
+<div id="{{results_id}}" class="repo-search-menu" role="listbox" aria-label="Repository results" data-repo-search-results hidden>
+  <p class="repo-search-empty" role="status" data-repo-search-empty hidden>No repositories found.</p>
+</div>
diff --git a/tests/test_app.py b/tests/test_app.py
index 19207fc..b22a044 100644
--- a/tests/test_app.py
+++ b/tests/test_app.py
@@ -520,7 +520,7 @@ def test_security_headers_and_secure_cookie_flags(isolated_app):
 
 def test_system_theme_and_local_syntax_highlighting_assets(isolated_app):
     client = WsgiClient(isolated_app.app)
-    response = client.get("/")
+    response = client.get("/login")
     assert response.status_code == 200
     assert 'name="color-scheme" content="light dark"' in response.text
     for mode, color in [("light", "#ffffff"), ("dark", "#000000")]:
@@ -546,7 +546,7 @@ def test_styles_keep_comment_and_activity_text_readable_on_mobile(isolated_app):
     assert "overflow-wrap: anywhere" in css
 
 
-def test_index_public_repo_search_finds_repositories_by_fuzzy_name(isolated_app):
+def test_homepage_redirect_and_header_repo_search_finds_repositories_by_fuzzy_name(isolated_app):
     owner = create_user("alice")
     other = create_user("bob")
     isolated_app.create_repository(owner, "gitman", "Local git hosting")
@@ -557,12 +557,22 @@ def test_index_public_repo_search_finds_repositories_by_fuzzy_name(isolated_app)
     anonymous_index_response = client.get("/")
     assert anonymous_index_response.status_code == 200
     assert 'data-repo-search-url="/-/repos/search"' not in anonymous_index_response.text
+    assert '<header class="site-header">' not in anonymous_index_response.text
+    assert '<footer' not in anonymous_index_response.text
+    assert 'class="welcome-hero"' in anonymous_index_response.text
+    assert 'href="/login"' in anonymous_index_response.text
+    assert 'href="/signup"' in anonymous_index_response.text
 
     login_client(client, "alice")
     index_response = client.get("/")
-    assert index_response.status_code == 200
-    assert 'data-repo-search-url="/-/repos/search"' in index_response.text
-    assert 'aria-controls="repo-search-results"' in index_response.text
+    assert index_response.status_code == 303
+    assert index_response.location_path == '/alice'
+    assert index_response.header('Cache-Control') == 'no-store'
+    profile_response = client.get('/alice')
+    assert 'data-repo-search-url="/-/repos/search"' in profile_response.text
+    assert 'aria-controls="repo-search-results"' in profile_response.text
+    assert 'data-mobile-search-dialog' in profile_response.text
+    assert 'data-repo-search-url="/-/repos/search"' in client.get('/settings').text
 
     fuzzy_response = client.get("/-/repos/search?q=gmn")
     fuzzy_results = json.loads(fuzzy_response.text)["results"]
@@ -2296,7 +2306,7 @@ def test_bottle_repository_pages_render_refs_files_raw_and_errors(isolated_app):
     commit_short = nodes["default_node"][:12]
 
     checks = [
-        ("/", 200, "Recent Activity"),
+        ("/", 200, "Free Git repository hosting"),
         ("/alice", 200, "alice/demo"),
         ("/alice?tab=stars", 200, "No starred repositories yet."),
         ("/alice/demo", 200, "<h1>Demo</h1>"),
@@ -2929,7 +2939,7 @@ def test_notifications_exclude_own_actions_before_pagination(isolated_app, monke
     assert 'Newer reply from Bob' not in second
     assert 'Own comment' not in first + second
     assert 'self mention' not in first + second
-    assert 'Own comment' in clients['alice'].get('/').text
+    assert 'Own comment' in clients['alice'].get('/bob/demo/issues/1').text
 
 
 @pytest.mark.parametrize('source', ['issue_title', 'issue_body', 'issue_comment', 'pr_title', 'pr_body', 'pr_comment', 'commit_comment'])
@@ -3021,7 +3031,7 @@ def test_notifications_hide_identifiable_own_commits_without_hiding_older_work(i
     feed = client.get('/-/notifications?per_page=1').text
     assert 'Earlier Bob work' in feed
     assert 'Own commit' not in feed
-    assert 'Own commit' in client.get('/').text
+    assert 'Own commit' in client.get('/bob/demo/commits').text
 
 
 def test_mention_autocomplete_searches_public_names_without_exposing_account_data(isolated_app):