fix scroll restoration

This commit is contained in:
hzrd149 2025-01-17 14:09:57 -06:00
parent 1045c26472
commit 3f27144c44
7 changed files with 21 additions and 49 deletions

View File

@ -9,11 +9,11 @@ export default function DesktopLayout() {
return (
<>
<DesktopSideNav />
<Suspense fallback={<Spinner />}>
<ErrorBoundary>
<ErrorBoundary>
<Suspense fallback={<Spinner />}>
<Outlet />
</ErrorBoundary>
</Suspense>
</Suspense>
</ErrorBoundary>
</>
);
}

View File

@ -18,7 +18,7 @@ export default function ContainedParentView({
if (showMenu)
return (
<Flex flex={1} overflow="hidden" h="full">
<Flex flex={1} overflow="hidden" h="full" maxH="100vh">
<Flex width={width} direction="column">
{title && <SimpleHeader title={title} position="initial" />}
<Flex direction="column" p="2" gap="2" overflowY="auto" overflowX="hidden">

View File

@ -1,26 +0,0 @@
import { Box, CloseButton, Flex, FlexProps } from "@chakra-ui/react";
import useCurrentAccount from "../../../hooks/use-current-account";
import GhostTimeline from "./timeline";
import UserAvatar from "../../user/user-avatar";
import UserLink from "../../user/user-link";
import UserDnsIdentity from "../../user/user-dns-identity";
import accountService from "../../../services/account";
export default function GhostSideBar({ ...props }: Omit<FlexProps, "children">) {
const account = useCurrentAccount()!;
return (
<Flex direction="column" borderWidth={1} overflow="hidden" maxH="100vh" position="sticky" top="0" {...props}>
<Flex gap="2" borderBottomWidth={1} p="4" alignItems="center">
<UserAvatar pubkey={account.pubkey} size="md" />
<Flex direction="column">
<UserLink pubkey={account.pubkey} fontWeight="bold" />
<UserDnsIdentity pubkey={account.pubkey} />
</Flex>
<CloseButton ml="auto" mb="auto" onClick={() => accountService.stopGhost()} />
</Flex>
<GhostTimeline p="4" flex={1} />
</Flex>
);
}

View File

@ -55,9 +55,9 @@ const Item = ({ entity }: ItemComponentProps<Token>) => {
function output(token: Token) {
if (isEmojiToken(token)) {
return token.char;
return token.char || "";
} else if (isPersonToken(token)) {
return "nostr:" + nip19.npubEncode(token.pubkey);
return "nostr:" + nip19.npubEncode(token.pubkey) || "";
} else return "";
}

View File

@ -1,6 +1,7 @@
import { getEventPointerFromETag, getTagValue, safeRelayUrl } from "applesauce-core/helpers";
import { NostrEvent, isPTag } from "../../types/nostr-event";
import dayjs from "dayjs";
export type StreamStatus = "live" | "ended" | "planned";
@ -15,7 +16,8 @@ export function getStreamImage(stream: NostrEvent) {
}
export function getStreamStatus(stream: NostrEvent): StreamStatus {
return (getTagValue(stream, "status") as StreamStatus) || "ended";
if (dayjs.unix(stream.created_at).isBefore(dayjs().subtract(2, "weeks"))) return "ended";
else return (getTagValue(stream, "status") as StreamStatus) || "ended";
}
export function getStreamHost(stream: NostrEvent) {

View File

@ -1,11 +1,4 @@
html {
overflow: hidden;
margin: 0;
height: 100%;
width: 100%;
}
body {
margin: 0;
height: 100%;
width: 100%;
@ -14,6 +7,11 @@ body {
overscroll-behavior: none;
}
body {
margin: 0;
width: 100%;
}
body {
--safe-top: env(safe-area-inset-top, 0px);
--safe-bottom: env(safe-area-inset-bottom, 0px);
@ -27,10 +25,8 @@ body {
--safe-left: env(safe-area-inset-left); */
}
body,
#root {
width: 100%;
display: flex;
flex-direction: column;
min-height: 100%;
width: 100%;
}

View File

@ -44,7 +44,7 @@ function DVMFeeds() {
<Heading size="md" mt="4">
Favorite Feeds
</Heading>
<SimpleGrid columns={{ base: 1, md: 1, lg: 2, xl: 3 }} spacing="2">
<SimpleGrid columns={{ base: 1, md: 1, lg: 2, xl: 3, "2xl": 4 }} spacing="2">
{favoriteFeeds.map((feed) => (
<ErrorBoundary key={getEventUID(feed)} event={feed}>
<DVMCard dvm={feed} />
@ -64,7 +64,7 @@ function DVMFeeds() {
</Link>
</Text>
<IntersectionObserverProvider callback={callback}>
<SimpleGrid columns={{ base: 1, md: 1, lg: 2, xl: 3 }} spacing="2">
<SimpleGrid columns={{ base: 1, md: 1, lg: 2, xl: 3, "2xl": 4 }} spacing="2">
{DVMs.filter((feed) => !isEventInList(favorites, feed)).map((feed) => (
<ErrorBoundary key={getEventUID(feed)} event={feed}>
<DVMCard dvm={feed} />
@ -79,8 +79,8 @@ function DVMFeeds() {
function DiscoveryHomePage() {
return (
<VerticalPageLayout>
<SimpleGrid columns={{ base: 1, md: 1, lg: 2, xl: 3 }} spacing="2">
<Card as={LinkBox} display="block" p="4" maxW="lg">
<SimpleGrid columns={{ base: 1, md: 1, lg: 2, xl: 3, "2xl": 4 }} spacing="2">
<Card as={LinkBox} display="block" p="4">
<Telescope boxSize={16} float="left" ml="2" my="2" mr="6" />
<Flex direction="column">
<Heading size="md">
@ -91,7 +91,7 @@ function DiscoveryHomePage() {
<Text>What are other users seeing that you are not?</Text>
</Flex>
</Card>
<Card as={LinkBox} display="block" p="4" maxW="lg">
<Card as={LinkBox} display="block" p="4">
<RelayIcon boxSize={16} float="left" ml="2" my="2" mr="6" />
<Flex direction="column">
<Heading size="md">