mirror of
https://github.com/aljazceru/rabbit.git
synced 2025-12-18 14:34:25 +01:00
update
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import { Show, type JSX, type Component } from 'solid-js';
|
||||
|
||||
import ArrowLeft from 'heroicons/24/outline/arrow-left.svg';
|
||||
|
||||
import { useHandleCommand } from '@/hooks/useCommandBus';
|
||||
import { TimelineContext, useTimelineState } from '@/components/TimelineContext';
|
||||
import TimelineContentDisplay from '@/components/TimelineContentDisplay';
|
||||
import { TimelineContext, useTimelineState } from '@/components/TimelineContext';
|
||||
import { useHandleCommand } from '@/hooks/useCommandBus';
|
||||
|
||||
export type ColumnProps = {
|
||||
name: string;
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import useConfig, { type Config } from '@/nostr/useConfig';
|
||||
import { createSignal, For, type JSX } from 'solid-js';
|
||||
|
||||
import XMark from 'heroicons/24/outline/x-mark.svg';
|
||||
|
||||
import Modal from '@/components/Modal';
|
||||
import useConfig, { type Config } from '@/nostr/useConfig';
|
||||
|
||||
import UserNameDisplay from './UserDisplayName';
|
||||
|
||||
type ConfigProps = {
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
// NIP-18 (DEPRECATED)
|
||||
import { type Component, createMemo } from 'solid-js';
|
||||
import { Event as NostrEvent } from 'nostr-tools';
|
||||
|
||||
import ArrowPathRoundedSquare from 'heroicons/24/outline/arrow-path-rounded-square.svg';
|
||||
import { Event as NostrEvent } from 'nostr-tools';
|
||||
|
||||
import ColumnItem from '@/components/ColumnItem';
|
||||
import UserDisplayName from '@/components/UserDisplayName';
|
||||
import eventWrapper from '@/core/event';
|
||||
import useFormatDate from '@/hooks/useFormatDate';
|
||||
import useModalState from '@/hooks/useModalState';
|
||||
|
||||
import TextNoteDisplayById from './textNote/TextNoteDisplayById';
|
||||
|
||||
export type DeprecatedRepostProps = {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Component } from 'solid-js';
|
||||
|
||||
import { nip19 } from 'nostr-tools';
|
||||
|
||||
const { noteEncode } = nip19;
|
||||
|
||||
@@ -15,6 +15,7 @@ const Modal: Component<ModalProps> = (props) => {
|
||||
};
|
||||
|
||||
return (
|
||||
/* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */
|
||||
<div
|
||||
ref={containerRef}
|
||||
class="absolute top-0 left-0 z-10 flex h-screen w-screen cursor-default place-content-center place-items-center bg-black/30"
|
||||
|
||||
@@ -8,25 +8,22 @@ import {
|
||||
type JSX,
|
||||
type Accessor,
|
||||
} from 'solid-js';
|
||||
import { createMutation } from '@tanstack/solid-query';
|
||||
import { Event as NostrEvent } from 'nostr-tools';
|
||||
import uniq from 'lodash/uniq';
|
||||
|
||||
import PaperAirplane from 'heroicons/24/solid/paper-airplane.svg';
|
||||
import { createMutation } from '@tanstack/solid-query';
|
||||
import Photo from 'heroicons/24/outline/photo.svg';
|
||||
import XMark from 'heroicons/24/outline/x-mark.svg';
|
||||
import PaperAirplane from 'heroicons/24/solid/paper-airplane.svg';
|
||||
import uniq from 'lodash/uniq';
|
||||
import { Event as NostrEvent } from 'nostr-tools';
|
||||
|
||||
import UserNameDisplay from '@/components/UserDisplayName';
|
||||
|
||||
import eventWrapper from '@/core/event';
|
||||
|
||||
import useConfig from '@/nostr/useConfig';
|
||||
import useCommands, { PublishTextNoteParams } from '@/nostr/useCommands';
|
||||
import usePubkey from '@/nostr/usePubkey';
|
||||
import { useHandleCommand } from '@/hooks/useCommandBus';
|
||||
|
||||
import { uploadNostrBuild, uploadFiles } from '@/utils/imageUpload';
|
||||
import parseTextNote from '@/core/parseTextNote';
|
||||
import { useHandleCommand } from '@/hooks/useCommandBus';
|
||||
import useCommands, { PublishTextNoteParams } from '@/nostr/useCommands';
|
||||
import useConfig from '@/nostr/useConfig';
|
||||
import usePubkey from '@/nostr/usePubkey';
|
||||
import { uploadNostrBuild, uploadFiles } from '@/utils/imageUpload';
|
||||
|
||||
type NotePostFormProps = {
|
||||
replyTo?: NostrEvent;
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { For, Switch, Match, type Component } from 'solid-js';
|
||||
|
||||
import { Kind, type Event as NostrEvent } from 'nostr-tools';
|
||||
|
||||
import TextNote from '@/components/TextNote';
|
||||
import Reaction from '@/components/notification/Reaction';
|
||||
import DeprecatedRepost from '@/components/DeprecatedRepost';
|
||||
import Reaction from '@/components/notification/Reaction';
|
||||
import TextNote from '@/components/TextNote';
|
||||
|
||||
export type NotificationProps = {
|
||||
events: NostrEvent[];
|
||||
|
||||
@@ -1,31 +1,30 @@
|
||||
import { Component, createSignal, createMemo, Show, Switch, Match, createEffect } from 'solid-js';
|
||||
import { createMutation } from '@tanstack/solid-query';
|
||||
|
||||
import { createMutation } from '@tanstack/solid-query';
|
||||
import ArrowPath from 'heroicons/24/outline/arrow-path.svg';
|
||||
import EllipsisHorizontal from 'heroicons/24/outline/ellipsis-horizontal.svg';
|
||||
import GlobeAlt from 'heroicons/24/outline/globe-alt.svg';
|
||||
import XMark from 'heroicons/24/outline/x-mark.svg';
|
||||
import CheckCircle from 'heroicons/24/solid/check-circle.svg';
|
||||
import ExclamationCircle from 'heroicons/24/solid/exclamation-circle.svg';
|
||||
import ArrowPath from 'heroicons/24/outline/arrow-path.svg';
|
||||
import EllipsisHorizontal from 'heroicons/24/outline/ellipsis-horizontal.svg';
|
||||
|
||||
import Modal from '@/components/Modal';
|
||||
import Timeline from '@/components/Timeline';
|
||||
import Copy from '@/components/utils/Copy';
|
||||
import SafeLink from '@/components/utils/SafeLink';
|
||||
|
||||
import usePubkey from '@/nostr/usePubkey';
|
||||
import useProfile from '@/nostr/useProfile';
|
||||
import useVerification from '@/nostr/useVerification';
|
||||
import useFollowings from '@/nostr/useFollowings';
|
||||
import useFollowers from '@/nostr/useFollowers';
|
||||
import useConfig from '@/nostr/useConfig';
|
||||
import useCommands from '@/nostr/useCommands';
|
||||
import useConfig from '@/nostr/useConfig';
|
||||
import useFollowers from '@/nostr/useFollowers';
|
||||
import useFollowings from '@/nostr/useFollowings';
|
||||
import useProfile from '@/nostr/useProfile';
|
||||
import usePubkey from '@/nostr/usePubkey';
|
||||
import useSubscription from '@/nostr/useSubscription';
|
||||
|
||||
import npubEncodeFallback from '@/utils/npubEncodeFallback';
|
||||
import useVerification from '@/nostr/useVerification';
|
||||
import ensureNonNull from '@/utils/ensureNonNull';
|
||||
import epoch from '@/utils/epoch';
|
||||
import npubEncodeFallback from '@/utils/npubEncodeFallback';
|
||||
import timeout from '@/utils/timeout';
|
||||
|
||||
import ContextMenu, { MenuItem } from './ContextMenu';
|
||||
|
||||
export type ProfileDisplayProps = {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { createSignal, Show, type JSX, Component } from 'solid-js';
|
||||
|
||||
import Cog6Tooth from 'heroicons/24/outline/cog-6-tooth.svg';
|
||||
import MagnifyingGlass from 'heroicons/24/solid/magnifying-glass.svg';
|
||||
import PencilSquare from 'heroicons/24/solid/pencil-square.svg';
|
||||
import Cog6Tooth from 'heroicons/24/outline/cog-6-tooth.svg';
|
||||
|
||||
import NotePostForm from '@/components/NotePostForm';
|
||||
import Config from '@/components/Config';
|
||||
|
||||
import NotePostForm from '@/components/NotePostForm';
|
||||
import { useHandleCommand } from '@/hooks/useCommandBus';
|
||||
import useConfig from '@/nostr/useConfig';
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import { Show, type Component } from 'solid-js';
|
||||
|
||||
import ColumnItem from '@/components/ColumnItem';
|
||||
import useConfig from '@/nostr/useConfig';
|
||||
|
||||
import TextNoteDisplay, { TextNoteDisplayProps } from './textNote/TextNoteDisplay';
|
||||
|
||||
export type TextNoteProps = TextNoteDisplayProps;
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { For, Switch, Match, type Component } from 'solid-js';
|
||||
|
||||
import { Kind, type Event as NostrEvent } from 'nostr-tools';
|
||||
|
||||
import TextNote from '@/components/TextNote';
|
||||
import DeprecatedRepost from '@/components/DeprecatedRepost';
|
||||
import TextNote from '@/components/TextNote';
|
||||
|
||||
export type TimelineProps = {
|
||||
events: NostrEvent[];
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { Switch, Match, type Component } from 'solid-js';
|
||||
import { Filter, Event as NostrEvent } from 'nostr-tools';
|
||||
|
||||
import uniq from 'lodash/uniq';
|
||||
import { Filter, Event as NostrEvent } from 'nostr-tools';
|
||||
|
||||
import useConfig from '@/nostr/useConfig';
|
||||
|
||||
import { type TimelineContent } from '@/components/TimelineContext';
|
||||
import Timeline from '@/components/Timeline';
|
||||
import useSubscription from '@/nostr/useSubscription';
|
||||
import { type TimelineContent } from '@/components/TimelineContext';
|
||||
import eventWrapper from '@/core/event';
|
||||
import useConfig from '@/nostr/useConfig';
|
||||
import useSubscription from '@/nostr/useSubscription';
|
||||
|
||||
const relatedEvents = (rawEvent: NostrEvent) => {
|
||||
const event = () => eventWrapper(rawEvent);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { createContext, useContext } from 'solid-js';
|
||||
import { createStore } from 'solid-js/store';
|
||||
|
||||
import { Event as NostrEvent } from 'nostr-tools';
|
||||
import { createStore } from 'solid-js/store';
|
||||
|
||||
export type TimelineContent = {
|
||||
type: 'Replies';
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import { Switch, Match, type Component, Show } from 'solid-js';
|
||||
import { type Event as NostrEvent } from 'nostr-tools';
|
||||
|
||||
import HeartSolid from 'heroicons/24/solid/heart.svg';
|
||||
import { type Event as NostrEvent } from 'nostr-tools';
|
||||
|
||||
import ColumnItem from '@/components/ColumnItem';
|
||||
import TextNoteDisplay from '@/components/textNote/TextNoteDisplay';
|
||||
import UserDisplayName from '@/components/UserDisplayName';
|
||||
|
||||
import useProfile from '@/nostr/useProfile';
|
||||
import useEvent from '@/nostr/useEvent';
|
||||
import eventWrapper from '@/core/event';
|
||||
import useModalState from '@/hooks/useModalState';
|
||||
import useEvent from '@/nostr/useEvent';
|
||||
import useProfile from '@/nostr/useProfile';
|
||||
|
||||
type ReactionProps = {
|
||||
event: NostrEvent;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { createSignal, type Component, type JSX, Show } from 'solid-js';
|
||||
|
||||
import { ContentWarning } from '@/core/event';
|
||||
|
||||
export type ContentWarningDisplayProps = {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { Component, createEffect, createSignal, onMount, Show, JSX } from 'solid-js';
|
||||
import { Component, createSignal, Show } from 'solid-js';
|
||||
|
||||
import { fixUrl } from '@/utils/imageUrl';
|
||||
|
||||
import SafeLink from '../utils/SafeLink';
|
||||
|
||||
type ImageDisplayProps = {
|
||||
@@ -14,12 +16,13 @@ const ImageDisplay: Component<ImageDisplayProps> = (props) => {
|
||||
const [hidden, setHidden] = createSignal(props.initialHidden);
|
||||
const [playing, setPlaying] = createSignal(true);
|
||||
|
||||
const isGIF = () => props.url.match(/\.gif/i);
|
||||
// const isGIF = () => props.url.match(/\.gif/i);
|
||||
|
||||
const play = () => {
|
||||
setPlaying(true);
|
||||
};
|
||||
|
||||
/*
|
||||
const stop = () => {
|
||||
if (canvasRef == null || imageRef == null) return;
|
||||
canvasRef.width = imageRef.width;
|
||||
@@ -39,6 +42,7 @@ const ImageDisplay: Component<ImageDisplayProps> = (props) => {
|
||||
);
|
||||
setPlaying(false);
|
||||
};
|
||||
*/
|
||||
|
||||
return (
|
||||
<Show
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import { Show } from 'solid-js';
|
||||
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
import TextNoteDisplayById from '@/components/textNote/TextNoteDisplayById';
|
||||
import { type MentionedEvent } from '@/core/parseTextNote';
|
||||
|
||||
import EventLink from '../EventLink';
|
||||
|
||||
export type MentionedEventDisplayProps = {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import type { MentionedUser } from '@/core/parseTextNote';
|
||||
import GeneralUserMentionDisplay from '@/components/textNote/GeneralUserMentionDisplay';
|
||||
import useModalState from '@/hooks/useModalState';
|
||||
|
||||
import type { MentionedUser } from '@/core/parseTextNote';
|
||||
|
||||
export type MentionedUserDisplayProps = {
|
||||
pubkey: string;
|
||||
};
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
import { For } from 'solid-js';
|
||||
import parseTextNote, { resolveTagReference, type ParsedTextNoteNode } from '@/core/parseTextNote';
|
||||
import type { Event as NostrEvent } from 'nostr-tools';
|
||||
import PlainTextDisplay from '@/components/textNote/PlainTextDisplay';
|
||||
import MentionedUserDisplay from '@/components/textNote/MentionedUserDisplay';
|
||||
|
||||
import EventLink from '@/components/EventLink';
|
||||
import ImageDisplay from '@/components/textNote/ImageDisplay';
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
import MentionedEventDisplay from '@/components/textNote/MentionedEventDisplay';
|
||||
import ImageDisplay from '@/components/textNote/ImageDisplay';
|
||||
import MentionedUserDisplay from '@/components/textNote/MentionedUserDisplay';
|
||||
import PlainTextDisplay from '@/components/textNote/PlainTextDisplay';
|
||||
import TextNoteDisplayById from '@/components/textNote/TextNoteDisplayById';
|
||||
import SafeLink from '@/components/utils/SafeLink';
|
||||
import eventWrapper from '@/core/event';
|
||||
import { isImageUrl } from '@/utils/imageUrl';
|
||||
import parseTextNote, { resolveTagReference, type ParsedTextNoteNode } from '@/core/parseTextNote';
|
||||
|
||||
import type { Event as NostrEvent } from 'nostr-tools';
|
||||
|
||||
import useConfig from '@/nostr/useConfig';
|
||||
import EventLink from '../EventLink';
|
||||
import TextNoteDisplayById from './TextNoteDisplayById';
|
||||
import { isImageUrl } from '@/utils/imageUrl';
|
||||
|
||||
export type TextNoteContentDisplayProps = {
|
||||
event: NostrEvent;
|
||||
|
||||
@@ -1,36 +1,33 @@
|
||||
import { Show, For, createSignal, createMemo, onMount, type JSX, type Component } from 'solid-js';
|
||||
import { nip19, type Event as NostrEvent } from 'nostr-tools';
|
||||
import { createMutation } from '@tanstack/solid-query';
|
||||
|
||||
import HeartOutlined from 'heroicons/24/outline/heart.svg';
|
||||
import HeartSolid from 'heroicons/24/solid/heart.svg';
|
||||
import { createMutation } from '@tanstack/solid-query';
|
||||
import ArrowPathRoundedSquare from 'heroicons/24/outline/arrow-path-rounded-square.svg';
|
||||
import ChatBubbleLeft from 'heroicons/24/outline/chat-bubble-left.svg';
|
||||
import EllipsisHorizontal from 'heroicons/24/outline/ellipsis-horizontal.svg';
|
||||
import HeartOutlined from 'heroicons/24/outline/heart.svg';
|
||||
import HeartSolid from 'heroicons/24/solid/heart.svg';
|
||||
import { nip19, type Event as NostrEvent } from 'nostr-tools';
|
||||
|
||||
import eventWrapper from '@/core/event';
|
||||
|
||||
import useProfile from '@/nostr/useProfile';
|
||||
import useConfig from '@/nostr/useConfig';
|
||||
import usePubkey from '@/nostr/usePubkey';
|
||||
import useCommands from '@/nostr/useCommands';
|
||||
import useReactions from '@/nostr/useReactions';
|
||||
import useDeprecatedReposts from '@/nostr/useDeprecatedReposts';
|
||||
|
||||
import useFormatDate from '@/hooks/useFormatDate';
|
||||
import useModalState from '@/hooks/useModalState';
|
||||
|
||||
import UserNameDisplay from '@/components/UserDisplayName';
|
||||
import NotePostForm from '@/components/NotePostForm';
|
||||
import ContentWarningDisplay from '@/components/textNote/ContentWarningDisplay';
|
||||
import GeneralUserMentionDisplay from '@/components/textNote/GeneralUserMentionDisplay';
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
import TextNoteContentDisplay from '@/components/textNote/TextNoteContentDisplay';
|
||||
import TextNoteDisplayById from '@/components/textNote/TextNoteDisplayById';
|
||||
import { useTimelineContext } from '@/components/TimelineContext';
|
||||
import GeneralUserMentionDisplay from '@/components/textNote/GeneralUserMentionDisplay';
|
||||
import ContentWarningDisplay from '@/components/textNote/ContentWarningDisplay';
|
||||
import TextNoteContentDisplay from '@/components/textNote/TextNoteContentDisplay';
|
||||
import NotePostForm from '@/components/NotePostForm';
|
||||
|
||||
import eventWrapper from '@/core/event';
|
||||
import useFormatDate from '@/hooks/useFormatDate';
|
||||
import useModalState from '@/hooks/useModalState';
|
||||
import useCommands from '@/nostr/useCommands';
|
||||
import useConfig from '@/nostr/useConfig';
|
||||
import useProfile from '@/nostr/useProfile';
|
||||
import usePubkey from '@/nostr/usePubkey';
|
||||
import useReactions from '@/nostr/useReactions';
|
||||
import useReposts from '@/nostr/useReposts';
|
||||
import useSubscription from '@/nostr/useSubscription';
|
||||
import ensureNonNull from '@/utils/ensureNonNull';
|
||||
import npubEncodeFallback from '@/utils/npubEncodeFallback';
|
||||
import useSubscription from '@/nostr/useSubscription';
|
||||
|
||||
import ContextMenu, { MenuItem } from '../ContextMenu';
|
||||
|
||||
export type TextNoteDisplayProps = {
|
||||
@@ -85,7 +82,7 @@ const TextNoteDisplay: Component<TextNoteDisplayProps> = (props) => {
|
||||
eventId: props.event.id,
|
||||
}));
|
||||
|
||||
const { reposts, isRepostedBy, invalidateDeprecatedReposts } = useDeprecatedReposts(() => ({
|
||||
const { reposts, isRepostedBy, invalidateReposts } = useReposts(() => ({
|
||||
eventId: props.event.id,
|
||||
}));
|
||||
|
||||
@@ -105,9 +102,9 @@ const TextNoteDisplay: Component<TextNoteDisplayProps> = (props) => {
|
||||
},
|
||||
});
|
||||
|
||||
const publishDeprecatedRepostMutation = createMutation({
|
||||
mutationKey: ['publishDeprecatedRepost', event().id],
|
||||
mutationFn: commands.publishDeprecatedRepost.bind(commands),
|
||||
const publishRepostMutation = createMutation({
|
||||
mutationKey: ['publishRepost', event().id],
|
||||
mutationFn: commands.publishRepost.bind(commands),
|
||||
onSuccess: () => {
|
||||
console.log('succeeded to publish reposts');
|
||||
},
|
||||
@@ -115,7 +112,7 @@ const TextNoteDisplay: Component<TextNoteDisplayProps> = (props) => {
|
||||
console.error('failed to publish repost: ', err);
|
||||
},
|
||||
onSettled: () => {
|
||||
invalidateDeprecatedReposts().catch((err) => console.error('failed to refetch reposts', err));
|
||||
invalidateReposts().catch((err) => console.error('failed to refetch reposts', err));
|
||||
},
|
||||
});
|
||||
|
||||
@@ -151,7 +148,7 @@ const TextNoteDisplay: Component<TextNoteDisplayProps> = (props) => {
|
||||
}
|
||||
|
||||
ensureNonNull([pubkey(), props.event.id] as const)(([pubkeyNonNull, eventIdNonNull]) => {
|
||||
publishDeprecatedRepostMutation.mutate({
|
||||
publishRepostMutation.mutate({
|
||||
relayUrls: config().relayUrls,
|
||||
pubkey: pubkeyNonNull,
|
||||
eventId: eventIdNonNull,
|
||||
@@ -306,13 +303,13 @@ const TextNoteDisplay: Component<TextNoteDisplayProps> = (props) => {
|
||||
class="flex shrink-0 items-center gap-1"
|
||||
classList={{
|
||||
'text-zinc-400': !isRepostedByMe(),
|
||||
'text-green-400': isRepostedByMe() || publishDeprecatedRepostMutation.isLoading,
|
||||
'text-green-400': isRepostedByMe() || publishRepostMutation.isLoading,
|
||||
}}
|
||||
>
|
||||
<button
|
||||
class="h-4 w-4"
|
||||
onClick={handleRepost}
|
||||
disabled={publishDeprecatedRepostMutation.isLoading}
|
||||
disabled={publishRepostMutation.isLoading}
|
||||
>
|
||||
<ArrowPathRoundedSquare />
|
||||
</button>
|
||||
|
||||
@@ -2,11 +2,10 @@ import { Switch, Match, type Component } from 'solid-js';
|
||||
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
import TextNoteDisplay, { type TextNoteDisplayProps } from '@/components/textNote/TextNoteDisplay';
|
||||
|
||||
import useConfig from '@/nostr/useConfig';
|
||||
import useEvent from '@/nostr/useEvent';
|
||||
|
||||
import ensureNonNull from '@/utils/ensureNonNull';
|
||||
|
||||
import EventLink from '../EventLink';
|
||||
|
||||
type TextNoteDisplayByIdProps = Omit<TextNoteDisplayProps, 'event'> & {
|
||||
|
||||
Reference in New Issue
Block a user