mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-03-29 11:12:12 +01:00
add open in app link to list view
This commit is contained in:
parent
4812eb82ef
commit
02b93843b2
@ -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...
|
||||
|
3
src/helpers/nostr-apps.ts
Normal file
3
src/helpers/nostr-apps.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export function buildAppSelectUrl(identifier: string) {
|
||||
return `https://nostrapp.link/#${identifier}?select=true`;
|
||||
}
|
@ -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 }) => (
|
||||
|
@ -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 />}>
|
||||
|
Loading…
x
Reference in New Issue
Block a user