Compare commits

..

No commits in common. "f8f07e9015a3779031f757193fe13968a2c06ccd" and "130a9891858fd3d59a53f35496b4bcadf8949308" have entirely different histories.

2 changed files with 31 additions and 11 deletions

View file

@ -1,7 +1,9 @@
import { import {
Component, Component,
For, For,
onCleanup,
createSignal, createSignal,
untrack,
Match, Match,
Switch as JsSwitch, Switch as JsSwitch,
ErrorBoundary, ErrorBoundary,
@ -16,6 +18,7 @@ import Thread from "./Thread.jsx";
const TrendTimelinePanel: Component<{ const TrendTimelinePanel: Component<{
client: mastodon.rest.Client; client: mastodon.rest.Client;
prefetch?: boolean;
openFullScreenToot: ( openFullScreenToot: (
toot: mastodon.v1.Status, toot: mastodon.v1.Status,
@ -34,6 +37,13 @@ const TrendTimelinePanel: Component<{
); );
const [expandedId, setExpandedId] = createSignal<string>(); const [expandedId, setExpandedId] = createSignal<string>();
const tlEndObserver = new IntersectionObserver(() => {
if (untrack(() => props.prefetch) && !snapshot.loading)
refetchTimeline();
});
onCleanup(() => tlEndObserver.disconnect());
const isExpandedId = createSelector(expandedId); const isExpandedId = createSelector(expandedId);
const isExpanded = (st: mastodon.v1.Status) => isExpandedId(st.id); const isExpanded = (st: mastodon.v1.Status) => isExpandedId(st.id);
@ -113,7 +123,7 @@ const TrendTimelinePanel: Component<{
toots={item} toots={item}
onBoost={(...args) => onBoost(index(), ...args)} onBoost={(...args) => onBoost(index(), ...args)}
onBookmark={(...args) => onBookmark(index(), ...args)} onBookmark={(...args) => onBookmark(index(), ...args)}
onReply={({ status }, element) => onReply={(client, status) =>
props.openFullScreenToot(status, element, true) props.openFullScreenToot(status, element, true)
} }
client={props.client} client={props.client}
@ -130,6 +140,8 @@ const TrendTimelinePanel: Component<{
}} }}
</For> </For>
</div> </div>
<div ref={(e) => tlEndObserver.observe(e)}></div>
<div <div
style={{ style={{
display: "flex", display: "flex",
@ -137,7 +149,7 @@ const TrendTimelinePanel: Component<{
"align-items": "center", "align-items": "center",
"justify-content": "center", "justify-content": "center",
"flex-flow": "column", "flex-flow": "column",
gap: "20px", gap: "20px"
}} }}
> >
<JsSwitch> <JsSwitch>
@ -150,6 +162,16 @@ const TrendTimelinePanel: Component<{
> >
Retry Retry
</Button> </Button>
</Match>
<Match when={true}>
<Button
variant="contained"
onClick={[refetchTimeline, undefined]}
disabled={snapshot.loading}
>
Refresh
</Button>
</Match> </Match>
</JsSwitch> </JsSwitch>
</div> </div>

View file

@ -88,15 +88,13 @@ export default defineConfig(({ mode }) => {
version(), version(),
], ],
server: { server: {
https: serverHttpCertBase https: {
? {
// This config controls https for the *dev server*. // This config controls https for the *dev server*.
// See docs/dev-https.md for setting up https // See docs/dev-https.md for setting up https
key: serverHttpCertKey, key: serverHttpCertKey,
cert: serverHttpCertCrt, cert: serverHttpCertCrt,
passphrase: serverHttpCertPassword, passphrase: serverHttpCertPassword,
} },
: undefined,
}, },
define: { define: {
"import.meta.env.BUILT_AT": `"${new Date().toISOString()}"`, "import.meta.env.BUILT_AT": `"${new Date().toISOString()}"`,