mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-08-08 09:12:26 +02:00
add open in app link to list view
This commit is contained in:
@@ -28,6 +28,7 @@ import { buildDeleteEvent } from "../../helpers/nostr-event";
|
|||||||
import signingService from "../../services/signing";
|
import signingService from "../../services/signing";
|
||||||
import { nostrPostAction } from "../../classes/nostr-post-action";
|
import { nostrPostAction } from "../../classes/nostr-post-action";
|
||||||
import clientRelaysService from "../../services/client-relays";
|
import clientRelaysService from "../../services/client-relays";
|
||||||
|
import { buildAppSelectUrl } from "../../helpers/nostr-apps";
|
||||||
|
|
||||||
export const NoteMenu = ({ event, ...props }: { event: NostrEvent } & Omit<MenuIconButtonProps, "children">) => {
|
export const NoteMenu = ({ event, ...props }: { event: NostrEvent } & Omit<MenuIconButtonProps, "children">) => {
|
||||||
const account = useCurrentAccount();
|
const account = useCurrentAccount();
|
||||||
@@ -69,7 +70,7 @@ export const NoteMenu = ({ event, ...props }: { event: NostrEvent } & Omit<MenuI
|
|||||||
Zaps/Reactions
|
Zaps/Reactions
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
onClick={() => window.open(`https://nostrapp.link/#${getSharableNoteId(event.id)}?select=true`, "_blank")}
|
onClick={() => window.open(buildAppSelectUrl(getSharableNoteId(event.id)), "_blank")}
|
||||||
icon={<ExternalLinkIcon />}
|
icon={<ExternalLinkIcon />}
|
||||||
>
|
>
|
||||||
View in app...
|
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 { UserCard } from "../user/components/user-card";
|
||||||
import { ArrowLeftSIcon, ExternalLinkIcon } from "../../components/icons";
|
import { ArrowLeftSIcon, ExternalLinkIcon } from "../../components/icons";
|
||||||
import { useCurrentAccount } from "../../hooks/use-current-account";
|
import { useCurrentAccount } from "../../hooks/use-current-account";
|
||||||
|
import { buildAppSelectUrl } from "../../helpers/nostr-apps";
|
||||||
|
|
||||||
function useListPointer() {
|
function useListPointer() {
|
||||||
const { addr } = useParams() as { addr: string };
|
const { addr } = useParams() as { addr: string };
|
||||||
@@ -53,13 +54,8 @@ export default function ListView() {
|
|||||||
</Heading>
|
</Heading>
|
||||||
|
|
||||||
{isAuthor && <Button colorScheme="red">Delete</Button>}
|
{isAuthor && <Button colorScheme="red">Delete</Button>}
|
||||||
<Button
|
<Button as={Link} href={buildAppSelectUrl(list.getAddress())} target="_blank" leftIcon={<ExternalLinkIcon />}>
|
||||||
as={Link}
|
Open in app
|
||||||
href={`https://listr.lol/a/${list.getAddress()}`}
|
|
||||||
target="_blank"
|
|
||||||
leftIcon={<ExternalLinkIcon />}
|
|
||||||
>
|
|
||||||
Edit
|
|
||||||
</Button>
|
</Button>
|
||||||
</Flex>
|
</Flex>
|
||||||
{people.map(({ pubkey, relay }) => (
|
{people.map(({ pubkey, relay }) => (
|
||||||
|
@@ -11,6 +11,7 @@ import UserDebugModal from "../../../components/debug-modals/user-debug-modal";
|
|||||||
import { useCopyToClipboard } from "react-use";
|
import { useCopyToClipboard } from "react-use";
|
||||||
import { useSharableProfileId } from "../../../hooks/use-shareable-profile-id";
|
import { useSharableProfileId } from "../../../hooks/use-shareable-profile-id";
|
||||||
import { truncatedId } from "../../../helpers/nostr-event";
|
import { truncatedId } from "../../../helpers/nostr-event";
|
||||||
|
import { buildAppSelectUrl } from "../../../helpers/nostr-apps";
|
||||||
|
|
||||||
export const UserProfileMenu = ({
|
export const UserProfileMenu = ({
|
||||||
pubkey,
|
pubkey,
|
||||||
@@ -42,10 +43,7 @@ export const UserProfileMenu = ({
|
|||||||
<MenuItem icon={<SpyIcon fontSize="1.5em" />} onClick={() => loginAsUser()}>
|
<MenuItem icon={<SpyIcon fontSize="1.5em" />} onClick={() => loginAsUser()}>
|
||||||
Login as {truncatedId(getUserDisplayName(metadata, pubkey))}
|
Login as {truncatedId(getUserDisplayName(metadata, pubkey))}
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem
|
<MenuItem onClick={() => window.open(buildAppSelectUrl(sharableId), "_blank")} icon={<ExternalLinkIcon />}>
|
||||||
onClick={() => window.open(`https://nostrapp.link/#${sharableId}?select=true`, "_blank")}
|
|
||||||
icon={<ExternalLinkIcon />}
|
|
||||||
>
|
|
||||||
View in app...
|
View in app...
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem onClick={() => copyToClipboard("nostr:" + sharableId)} icon={<ClipboardIcon />}>
|
<MenuItem onClick={() => copyToClipboard("nostr:" + sharableId)} icon={<ClipboardIcon />}>
|
||||||
|
Reference in New Issue
Block a user