add open in app link to list view

This commit is contained in:
hzrd149 2023-06-07 09:58:06 -04:00
parent 4812eb82ef
commit 02b93843b2
4 changed files with 10 additions and 12 deletions

View File

@ -28,6 +28,7 @@ import { buildDeleteEvent } from "../../helpers/nostr-event";
import signingService from "../../services/signing";
import { nostrPostAction } from "../../classes/nostr-post-action";
import clientRelaysService from "../../services/client-relays";
import { buildAppSelectUrl } from "../../helpers/nostr-apps";
export const NoteMenu = ({ event, ...props }: { event: NostrEvent } & Omit<MenuIconButtonProps, "children">) => {
const account = useCurrentAccount();
@ -69,7 +70,7 @@ export const NoteMenu = ({ event, ...props }: { event: NostrEvent } & Omit<MenuI
Zaps/Reactions
</MenuItem>
<MenuItem
onClick={() => window.open(`https://nostrapp.link/#${getSharableNoteId(event.id)}?select=true`, "_blank")}
onClick={() => window.open(buildAppSelectUrl(getSharableNoteId(event.id)), "_blank")}
icon={<ExternalLinkIcon />}
>
View in app...

View File

@ -0,0 +1,3 @@
export function buildAppSelectUrl(identifier: string) {
return `https://nostrapp.link/#${identifier}?select=true`;
}

View File

@ -8,6 +8,7 @@ import { Button, Flex, Heading, Link } from "@chakra-ui/react";
import { UserCard } from "../user/components/user-card";
import { ArrowLeftSIcon, ExternalLinkIcon } from "../../components/icons";
import { useCurrentAccount } from "../../hooks/use-current-account";
import { buildAppSelectUrl } from "../../helpers/nostr-apps";
function useListPointer() {
const { addr } = useParams() as { addr: string };
@ -53,13 +54,8 @@ export default function ListView() {
</Heading>
{isAuthor && <Button colorScheme="red">Delete</Button>}
<Button
as={Link}
href={`https://listr.lol/a/${list.getAddress()}`}
target="_blank"
leftIcon={<ExternalLinkIcon />}
>
Edit
<Button as={Link} href={buildAppSelectUrl(list.getAddress())} target="_blank" leftIcon={<ExternalLinkIcon />}>
Open in app
</Button>
</Flex>
{people.map(({ pubkey, relay }) => (

View File

@ -11,6 +11,7 @@ import UserDebugModal from "../../../components/debug-modals/user-debug-modal";
import { useCopyToClipboard } from "react-use";
import { useSharableProfileId } from "../../../hooks/use-shareable-profile-id";
import { truncatedId } from "../../../helpers/nostr-event";
import { buildAppSelectUrl } from "../../../helpers/nostr-apps";
export const UserProfileMenu = ({
pubkey,
@ -42,10 +43,7 @@ export const UserProfileMenu = ({
<MenuItem icon={<SpyIcon fontSize="1.5em" />} onClick={() => loginAsUser()}>
Login as {truncatedId(getUserDisplayName(metadata, pubkey))}
</MenuItem>
<MenuItem
onClick={() => window.open(`https://nostrapp.link/#${sharableId}?select=true`, "_blank")}
icon={<ExternalLinkIcon />}
>
<MenuItem onClick={() => window.open(buildAppSelectUrl(sharableId), "_blank")} icon={<ExternalLinkIcon />}>
View in app...
</MenuItem>
<MenuItem onClick={() => copyToClipboard("nostr:" + sharableId)} icon={<ClipboardIcon />}>