mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
feat(web): load older history by scrolling to top
Remove the redundant "Load older" button; the existing top sentinel already auto-loads older pages when approaching the top. Loading state moves to a floating pill overlay so prepends no longer shift layout.
This commit is contained in:
@@ -915,6 +915,15 @@ export function HappyThread(props: {
|
||||
<span>{t('misc.loadingMessages')}</span>
|
||||
</div>
|
||||
) : null}
|
||||
{props.isLoadingMoreMessages && !props.isSyncingTail ? (
|
||||
<div
|
||||
role="status"
|
||||
className="pointer-events-none absolute left-1/2 top-3 z-20 flex -translate-x-1/2 items-center gap-1.5 rounded-full border border-[var(--app-border)] bg-[var(--app-bg)]/90 px-2.5 py-1 text-xs text-[var(--app-hint)] shadow-sm backdrop-blur"
|
||||
>
|
||||
<Spinner size="sm" label={null} className="text-current" />
|
||||
<span>{t('misc.loading')}</span>
|
||||
</div>
|
||||
) : null}
|
||||
<ThreadPrimitive.Viewport
|
||||
asChild
|
||||
autoScroll={false}
|
||||
@@ -935,35 +944,6 @@ export function HappyThread(props: {
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{props.hasMoreMessages && !props.isSyncingTail ? (
|
||||
<div className="py-1 mb-2">
|
||||
<div className="mx-auto w-fit">
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => {
|
||||
void loadOlderFromUserAction()
|
||||
}}
|
||||
disabled={props.isLoadingMoreMessages || props.isSyncingTail}
|
||||
aria-busy={props.isLoadingMoreMessages}
|
||||
className="gap-1.5 text-xs opacity-80 hover:opacity-100"
|
||||
>
|
||||
{props.isLoadingMoreMessages ? (
|
||||
<>
|
||||
<Spinner size="sm" label={null} className="text-current" />
|
||||
{t('misc.loading')}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<span aria-hidden="true">↑</span>
|
||||
{t('misc.loadOlder')}
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{import.meta.env.DEV && props.normalizedMessagesCount === 0 && props.rawMessagesCount > 0 ? (
|
||||
<div className="mb-2 rounded-md bg-amber-500/10 p-2 text-xs">
|
||||
Message normalization returned 0 items for {props.rawMessagesCount} messages (see `web/src/chat/normalize.ts`).
|
||||
|
||||
@@ -848,7 +848,6 @@ export default {
|
||||
'misc.fastModeFast': 'Fast',
|
||||
'misc.variant': 'Variant',
|
||||
'misc.loading': 'Loading…',
|
||||
'misc.loadOlder': 'Load older',
|
||||
'misc.newMessage': '{n} new message{s}',
|
||||
'misc.loadingMessages': 'Loading messages…',
|
||||
'misc.typeMessage': "Type 'continue' to resume...",
|
||||
|
||||
@@ -852,7 +852,6 @@ export default {
|
||||
'misc.fastModeFast': '快速',
|
||||
'misc.variant': '变体',
|
||||
'misc.loading': '加载中…',
|
||||
'misc.loadOlder': '加载更早的',
|
||||
'misc.newMessage': '{n} 条新消息',
|
||||
'misc.loadingMessages': '加载消息中…',
|
||||
'misc.typeMessage': "输入 'continue' 继续...",
|
||||
|
||||
Reference in New Issue
Block a user