mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-03-17 21:31:43 +01:00
fix build
This commit is contained in:
parent
ea15fa1dd1
commit
ae30445451
@ -1,98 +0,0 @@
|
||||
import { useContext } from "react";
|
||||
import { Avatar, Box, Button, Flex, FlexProps, Heading, IconButton, LinkOverlay } from "@chakra-ui/react";
|
||||
import { Link as RouterLink } from "react-router-dom";
|
||||
import { css } from "@emotion/react";
|
||||
import { useObservable } from "applesauce-react/hooks";
|
||||
|
||||
import Plus from "../icons/plus";
|
||||
import useCurrentAccount from "../../hooks/use-current-account";
|
||||
import AccountSwitcher from "../layout/nav-items/account-switcher";
|
||||
import NavItems from "../layout/nav-items";
|
||||
import { PostModalContext } from "../../providers/route/post-modal-provider";
|
||||
import { offlineMode } from "../../services/offline-mode";
|
||||
import WifiOff from "../icons/wifi-off";
|
||||
import TaskManagerButtons from "./task-manager-buttons";
|
||||
import localSettings from "../../services/local-settings";
|
||||
|
||||
const hideScrollbar = css`
|
||||
-ms-overflow-style: none;
|
||||
scrollbar-width: none;
|
||||
&::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
`;
|
||||
|
||||
export default function DesktopSideNav(props: Omit<FlexProps, "children">) {
|
||||
const account = useCurrentAccount();
|
||||
const { openModal } = useContext(PostModalContext);
|
||||
const offline = useObservable(offlineMode);
|
||||
const showBrandLogo = useObservable(localSettings.showBrandLogo);
|
||||
|
||||
return (
|
||||
<Flex
|
||||
{...props}
|
||||
gap="2"
|
||||
direction="column"
|
||||
width="15rem"
|
||||
p="2"
|
||||
alignItems="stretch"
|
||||
flexShrink={0}
|
||||
h="100vh"
|
||||
overflowY="auto"
|
||||
overflowX="hidden"
|
||||
css={hideScrollbar}
|
||||
>
|
||||
<Flex direction="column" flexShrink={0} gap="2">
|
||||
{showBrandLogo && (
|
||||
<Flex gap="2" alignItems="center" position="relative" my="2">
|
||||
<Avatar src="/apple-touch-icon.png" size="md" />
|
||||
<Heading size="md">
|
||||
<LinkOverlay as={RouterLink} to="/">
|
||||
noStrudel
|
||||
</LinkOverlay>
|
||||
</Heading>
|
||||
{offline && (
|
||||
<IconButton
|
||||
aria-label="Disable offline mode"
|
||||
title="Disable offline mode"
|
||||
icon={<WifiOff boxSize={5} color="orange" />}
|
||||
onClick={() => offlineMode.next(false)}
|
||||
/>
|
||||
)}
|
||||
</Flex>
|
||||
)}
|
||||
{account && (
|
||||
<>
|
||||
<AccountSwitcher />
|
||||
<Button
|
||||
as={RouterLink}
|
||||
leftIcon={<Plus boxSize={6} />}
|
||||
aria-label="Create new"
|
||||
title="Create new"
|
||||
colorScheme="primary"
|
||||
size="lg"
|
||||
to="/new"
|
||||
>
|
||||
New
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
<NavItems />
|
||||
<Box h="4" />
|
||||
{!account && (
|
||||
<Button
|
||||
as={RouterLink}
|
||||
to="/signin"
|
||||
state={{ from: location.pathname }}
|
||||
colorScheme="primary"
|
||||
w="full"
|
||||
flexShrink={0}
|
||||
>
|
||||
Sign in
|
||||
</Button>
|
||||
)}
|
||||
</Flex>
|
||||
<TaskManagerButtons mt="auto" flexShrink={0} />
|
||||
</Flex>
|
||||
);
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
import React from "react";
|
||||
import { Box, Container, Flex, Spacer } from "@chakra-ui/react";
|
||||
import { useObservable } from "applesauce-react/hooks";
|
||||
|
||||
import { ErrorBoundary } from "../error-boundary";
|
||||
import DesktopSideNav from "./desktop-side-nav";
|
||||
import MobileBottomNav from "./mobile-bottom-nav";
|
||||
import accountService from "../../services/account";
|
||||
import { useBreakpointValue } from "../../providers/global/breakpoint-provider";
|
||||
import GhostSideBar from "./ghost/sidebar";
|
||||
|
||||
export default function Layout({ children }: { children: React.ReactNode }) {
|
||||
const isMobile = useBreakpointValue({ base: true, md: false });
|
||||
const isGhost = useObservable(accountService.isGhost);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Flex direction={{ base: "column", md: "row" }} minH="100vh">
|
||||
<Spacer display={["none", null, "block"]} />
|
||||
{!isMobile && <DesktopSideNav position="sticky" top="0" flexShrink={0} />}
|
||||
<Container
|
||||
// set base to "md" so that when layout switches to column it is full width
|
||||
size={{ base: "md", md: "md", lg: "lg", xl: "xl", "2xl": "2xl" }}
|
||||
display="flex"
|
||||
flexGrow={1}
|
||||
padding="0"
|
||||
flexDirection="column"
|
||||
mx="0"
|
||||
pb={isMobile ? "14" : 0}
|
||||
minH="50vh"
|
||||
overflow="hidden"
|
||||
>
|
||||
<ErrorBoundary>{children}</ErrorBoundary>
|
||||
</Container>
|
||||
{!isMobile && isGhost ? <GhostSideBar maxW="lg" minW="md" /> : <Box flexShrink={1} maxW="15rem" flex={1} />}
|
||||
{isMobile && (
|
||||
<MobileBottomNav
|
||||
position="fixed"
|
||||
bottom="0"
|
||||
left="0"
|
||||
right="0"
|
||||
backgroundColor="var(--chakra-colors-chakra-body-bg)"
|
||||
zIndex={10}
|
||||
/>
|
||||
)}
|
||||
<Spacer display={["none", null, "block"]} />
|
||||
</Flex>
|
||||
</>
|
||||
);
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
import { Avatar, Flex, FlexProps, IconButton, useDisclosure } from "@chakra-ui/react";
|
||||
import { useEffect } from "react";
|
||||
import { useLocation, Link as RouterLink } from "react-router-dom";
|
||||
|
||||
import useCurrentAccount from "../../hooks/use-current-account";
|
||||
import { DirectMessagesIcon, NotesIcon, NotificationsIcon, PlusCircleIcon, SearchIcon } from "../icons";
|
||||
import UserAvatar from "../user/user-avatar";
|
||||
import MobileSideDrawer from "../layout/mobile/nav-drawer";
|
||||
import Rocket02 from "../icons/rocket-02";
|
||||
|
||||
export default function MobileBottomNav(props: Omit<FlexProps, "children">) {
|
||||
const { isOpen, onOpen, onClose } = useDisclosure();
|
||||
const account = useCurrentAccount();
|
||||
|
||||
const location = useLocation();
|
||||
useEffect(() => onClose(), [location.key, account]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Flex {...props} gap="2" p="2" alignItems="center" pb="calc(var(--chakra-space-2) + env(safe-area-inset-bottom))">
|
||||
{account ? (
|
||||
<UserAvatar pubkey={account.pubkey} size="sm" onClick={onOpen} noProxy />
|
||||
) : (
|
||||
<Avatar size="sm" src="/apple-touch-icon.png" onClick={onOpen} cursor="pointer" />
|
||||
)}
|
||||
<IconButton as={RouterLink} icon={<NotesIcon boxSize={6} />} aria-label="Home" flexGrow="1" size="md" to="/" />
|
||||
<IconButton
|
||||
as={RouterLink}
|
||||
icon={<SearchIcon boxSize={6} />}
|
||||
aria-label="Search"
|
||||
flexGrow="1"
|
||||
size="md"
|
||||
to="/search"
|
||||
/>
|
||||
<IconButton
|
||||
as={RouterLink}
|
||||
icon={<PlusCircleIcon boxSize={6} />}
|
||||
aria-label="Create new"
|
||||
title="Create new"
|
||||
variant="solid"
|
||||
colorScheme="primary"
|
||||
to="/new"
|
||||
/>
|
||||
<IconButton
|
||||
as={RouterLink}
|
||||
icon={<DirectMessagesIcon boxSize={6} />}
|
||||
aria-label="Messages"
|
||||
flexGrow="1"
|
||||
size="md"
|
||||
to="/dm"
|
||||
/>
|
||||
<IconButton
|
||||
as={RouterLink}
|
||||
icon={<NotificationsIcon boxSize={6} />}
|
||||
aria-label="Notifications"
|
||||
flexGrow="1"
|
||||
size="md"
|
||||
to="/notifications"
|
||||
/>
|
||||
<IconButton as={RouterLink} icon={<Rocket02 boxSize={6} />} aria-label="Launchpad" to="/launchpad" />
|
||||
</Flex>
|
||||
<MobileSideDrawer isOpen={isOpen} onClose={onClose} />
|
||||
</>
|
||||
);
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
import { useContext } from "react";
|
||||
import { Button, Flex, FlexProps, IconButton } from "@chakra-ui/react";
|
||||
import { Button, Flex, FlexProps } from "@chakra-ui/react";
|
||||
|
||||
import { PublishContext } from "../../providers/global/publish-provider";
|
||||
import { useTaskManagerContext } from "../../views/task-manager/provider";
|
||||
|
@ -8,6 +8,7 @@ import NsecAccount from "../classes/accounts/nsec-account";
|
||||
import PasswordAccount from "../classes/accounts/password-account";
|
||||
import PubkeyAccount from "../classes/accounts/pubkey-account";
|
||||
import SerialPortAccount from "../classes/accounts/serial-port-account";
|
||||
import AndroidSignerAccount from "../classes/accounts/android-signer-account";
|
||||
import { logger } from "../helpers/debug";
|
||||
import db from "./db";
|
||||
import { AppSettings } from "../helpers/app-settings";
|
||||
@ -71,6 +72,8 @@ class AccountService {
|
||||
return new SerialPortAccount(data.pubkey).fromJSON(data);
|
||||
case "nostr-connect":
|
||||
return new NostrConnectAccount(data.pubkey).fromJSON(data);
|
||||
case "android-signer":
|
||||
return new AndroidSignerAccount(data.pubkey).fromJSON(data);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ import ExtensionAccount from "../../classes/accounts/extension-account";
|
||||
import SerialPortAccount from "../../classes/accounts/serial-port-account";
|
||||
import AmberAccount from "../../classes/accounts/amber-account";
|
||||
import { AndroidNativeSigners } from "./native";
|
||||
import { CAP_IS_ANDROID } from "../../env";
|
||||
import { CAP_IS_ANDROID, CAP_IS_WEB } from "../../env";
|
||||
|
||||
export default function LoginStartView() {
|
||||
const location = useLocation();
|
||||
@ -98,7 +98,7 @@ export default function LoginStartView() {
|
||||
/>
|
||||
</ButtonGroup>
|
||||
)}
|
||||
{AmberClipboardSigner.SUPPORTED && (
|
||||
{CAP_IS_WEB && AmberClipboardSigner.SUPPORTED && (
|
||||
<ButtonGroup colorScheme="orange" w="full">
|
||||
<Button onClick={signinWithAmber} leftIcon={<Diamond01 boxSize={6} />} flex={1}>
|
||||
Use Amber
|
||||
|
Loading…
x
Reference in New Issue
Block a user