feat: add pull-to-refresh button to top bar for all list views
Add a sticky top bar with a refresh button that uses HTMX to re-fetch the current view content without a full page reload. Works on dashboard, issues, and pulls views via the shared layout template. Closes leeworks-agents/gitea-mobile#51 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -115,6 +115,10 @@ var basePage = template.Must(template.New("base").Parse(`<!DOCTYPE html>
|
|||||||
<script src="/static/htmx.min.js"></script>
|
<script src="/static/htmx.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<header class="top-bar">
|
||||||
|
<span class="top-bar-title">Gitea Mobile</span>
|
||||||
|
<button class="refresh-btn" hx-get="" hx-target="#main-content" hx-swap="innerHTML" aria-label="Refresh">↻</button>
|
||||||
|
</header>
|
||||||
<div class="content" id="main-content">
|
<div class="content" id="main-content">
|
||||||
{{.Content}}
|
{{.Content}}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -13,6 +13,10 @@
|
|||||||
<script src="/static/htmx.min.js"></script>
|
<script src="/static/htmx.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<header class="top-bar">
|
||||||
|
<span class="top-bar-title">Gitea Mobile</span>
|
||||||
|
<button class="refresh-btn" hx-get="" hx-target="#main-content" hx-swap="innerHTML" aria-label="Refresh">↻</button>
|
||||||
|
</header>
|
||||||
<div class="content" id="main-content">
|
<div class="content" id="main-content">
|
||||||
{{template "content" .}}
|
{{template "content" .}}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+44
-1
@@ -47,10 +47,53 @@ body {
|
|||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Top bar */
|
||||||
|
.top-bar {
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
z-index: 100;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: var(--spacing-sm) var(--spacing-lg);
|
||||||
|
padding-top: max(var(--spacing-sm), env(safe-area-inset-top));
|
||||||
|
background: var(--bg-secondary);
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.top-bar-title {
|
||||||
|
font-size: var(--font-base);
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--text-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.refresh-btn {
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
font-size: 1.4rem;
|
||||||
|
padding: var(--spacing-xs) var(--spacing-sm);
|
||||||
|
cursor: pointer;
|
||||||
|
-webkit-tap-highlight-color: transparent;
|
||||||
|
line-height: 1;
|
||||||
|
border-radius: var(--radius-sm);
|
||||||
|
transition: color 0.15s ease, background 0.15s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.refresh-btn:active {
|
||||||
|
color: var(--accent-blue);
|
||||||
|
background: var(--bg-tertiary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.refresh-btn.htmx-request {
|
||||||
|
animation: spin 0.6s linear infinite;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
/* Content area */
|
/* Content area */
|
||||||
.content {
|
.content {
|
||||||
padding: var(--spacing-lg);
|
padding: var(--spacing-lg);
|
||||||
padding-top: max(var(--spacing-lg), env(safe-area-inset-top));
|
padding-top: var(--spacing-lg);
|
||||||
max-width: 640px;
|
max-width: 640px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user