Fixup webpack config
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import { useUserProfile } from "@snort/system-react";
|
||||
import { NostrEvent, parseZap, EventKind } from "@snort/system";
|
||||
import { useRef, useState, useMemo } from "react";
|
||||
import React, { useRef, useState, useMemo } from "react";
|
||||
import {
|
||||
useMediaQuery,
|
||||
useHover,
|
||||
@ -46,7 +46,7 @@ export function ChatMessage({
|
||||
reactions: readonly NostrEvent[];
|
||||
emojiPacks: EmojiPack[];
|
||||
}) {
|
||||
const ref = useRef(null);
|
||||
const ref = useRef<HTMLDivElement | null>(null);
|
||||
const inView = useIntersectionObserver(ref, {
|
||||
freezeOnceVisible: true,
|
||||
});
|
||||
@ -119,15 +119,15 @@ export function ChatMessage({
|
||||
console.debug(reply);
|
||||
System.BroadcastEvent(reply);
|
||||
}
|
||||
} catch (error) { }
|
||||
} catch {
|
||||
//ignore
|
||||
}
|
||||
}
|
||||
|
||||
// @ts-expect-error
|
||||
const topOffset = ref.current?.getBoundingClientRect().top;
|
||||
// @ts-expect-error
|
||||
const leftOffset = ref.current?.getBoundingClientRect().left;
|
||||
|
||||
function pickEmoji(ev: any) {
|
||||
function pickEmoji(ev: React.MouseEvent) {
|
||||
ev.stopPropagation();
|
||||
setShowEmojiPicker(!showEmojiPicker);
|
||||
}
|
||||
@ -182,8 +182,8 @@ export function ChatMessage({
|
||||
}
|
||||
: {
|
||||
position: "fixed",
|
||||
top: topOffset - 12,
|
||||
left: leftOffset - 32,
|
||||
top: topOffset ? topOffset - 12 : 0,
|
||||
left: leftOffset ? leftOffset - 32 : 0,
|
||||
opacity: showZapDialog || isHovering ? 1 : 0,
|
||||
pointerEvents:
|
||||
showZapDialog || isHovering ? "auto" : "none",
|
||||
@ -211,8 +211,8 @@ export function ChatMessage({
|
||||
</div>
|
||||
{showEmojiPicker && (
|
||||
<EmojiPicker
|
||||
topOffset={topOffset}
|
||||
leftOffset={leftOffset}
|
||||
topOffset={topOffset ?? 0}
|
||||
leftOffset={leftOffset ?? 0}
|
||||
emojiPacks={emojiPacks}
|
||||
onEmojiSelect={onEmojiSelect}
|
||||
onClickOutside={() => setShowEmojiPicker(false)}
|
||||
|
@ -2,18 +2,16 @@ import "./goal.css";
|
||||
import { useMemo } from "react";
|
||||
import * as Progress from "@radix-ui/react-progress";
|
||||
import Confetti from "react-confetti";
|
||||
import { NostrLink, ParsedZap, NostrEvent } from "@snort/system";
|
||||
import { ParsedZap, NostrEvent } from "@snort/system";
|
||||
import { Icon } from "./icon";
|
||||
import { findTag } from "utils";
|
||||
import { formatSats } from "number";
|
||||
import usePreviousValue from "hooks/usePreviousValue";
|
||||
|
||||
export function Goal({
|
||||
link,
|
||||
ev,
|
||||
zaps,
|
||||
}: {
|
||||
link: NostrLink;
|
||||
ev: NostrEvent;
|
||||
zaps: ParsedZap[];
|
||||
}) {
|
||||
|
@ -37,7 +37,7 @@ function TopZappers({ zaps }: { zaps: ParsedZap[] }) {
|
||||
|
||||
return (
|
||||
<>
|
||||
{zappers.map(({ pubkey, total }, idx) => {
|
||||
{zappers.map(({ pubkey, total }) => {
|
||||
return (
|
||||
<div className="top-zapper" key={pubkey}>
|
||||
{pubkey === "anon" ? (
|
||||
@ -79,7 +79,6 @@ export function LiveChat({
|
||||
}, [feed.zaps]);
|
||||
|
||||
const userEmojiPacks = useEmoji(login?.pubkey);
|
||||
const userEmojis = userEmojiPacks.map((pack) => pack.emojis).flat();
|
||||
const channelEmojiPacks = useEmoji(host);
|
||||
const allEmojiPacks = useMemo(() => {
|
||||
return uniqBy(channelEmojiPacks.concat(userEmojiPacks), packId);
|
||||
|
@ -1,5 +1,5 @@
|
||||
import Hls from "hls.js";
|
||||
import { HTMLProps, useEffect, useMemo, useRef, useState } from "react";
|
||||
import { useEffect, useMemo, useRef, useState } from "react";
|
||||
import { WISH } from "wish";
|
||||
|
||||
export enum VideoStatus {
|
||||
@ -71,7 +71,7 @@ export function LiveVideoPlayer(
|
||||
export function WebRTCPlayer(props: VideoPlayerProps) {
|
||||
const video = useRef<HTMLVideoElement>(null);
|
||||
const streamCached = useMemo(() => "https://customer-uu10flpvos4pfhgu.cloudflarestream.com/7634aee1af35a2de4ac13ca3d1718a8b/webRTC/play", [props.stream]);
|
||||
const [status, setStatus] = useState<VideoStatus>();
|
||||
const [status] = useState<VideoStatus>();
|
||||
//https://customer-uu10flpvos4pfhgu.cloudflarestream.com/7634aee1af35a2de4ac13ca3d1718a8b/webRTC/play
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -10,7 +10,6 @@ import { Icon } from "./icon";
|
||||
import Copy from "./copy";
|
||||
import { hexToBech32, openFile } from "utils";
|
||||
import { VoidApi } from "@void-cat/api";
|
||||
import { upload } from "@testing-library/user-event/dist/upload";
|
||||
import { LoginType } from "login";
|
||||
|
||||
enum Stage {
|
||||
|
@ -8,7 +8,7 @@ interface MentionProps {
|
||||
relays?: string[];
|
||||
}
|
||||
|
||||
export function Mention({ pubkey, relays }: MentionProps) {
|
||||
export function Mention({ pubkey }: MentionProps) {
|
||||
const user = useUserProfile(System, pubkey);
|
||||
const npub = hexToBech32("npub", pubkey);
|
||||
return <Link to={`/p/${npub}`}>{user?.name || pubkey}</Link>;
|
||||
|
@ -3,7 +3,7 @@ import * as Dialog from "@radix-ui/react-dialog";
|
||||
|
||||
import { Icon } from "element/icon";
|
||||
import { useStreamProvider } from "hooks/stream-provider";
|
||||
import { StreamProvider, StreamProviderInfo, StreamProviders } from "providers";
|
||||
import { StreamProvider, StreamProviders } from "providers";
|
||||
import { useEffect, useState } from "react";
|
||||
import { StreamEditor, StreamEditorProps } from "./stream-editor";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
|
@ -1,10 +1,10 @@
|
||||
import "./textarea.css";
|
||||
import type { KeyboardEvent, ChangeEvent } from "react";
|
||||
import ReactTextareaAutocomplete from "@webscopeio/react-textarea-autocomplete";
|
||||
import ReactTextareaAutocomplete, { TriggerType } from "@webscopeio/react-textarea-autocomplete";
|
||||
import "@webscopeio/react-textarea-autocomplete/style.css";
|
||||
import uniqWith from "lodash/uniqWith";
|
||||
import isEqual from "lodash/isEqual";
|
||||
import { MetadataCache, NostrPrefix } from "@snort/system";
|
||||
import { MetadataCache, NostrPrefix, UserProfileCache } from "@snort/system";
|
||||
import { System } from "index";
|
||||
import { Emoji, type EmojiTag } from "./emoji";
|
||||
import { Avatar } from "element/avatar";
|
||||
@ -27,7 +27,7 @@ const EmojiItem = ({ entity: { name, url } }: { entity: EmojiItemProps }) => {
|
||||
};
|
||||
|
||||
const UserItem = (metadata: MetadataCache) => {
|
||||
const { pubkey, display_name, nip05, ...rest } = metadata;
|
||||
const { pubkey, display_name, ...rest } = metadata;
|
||||
return (
|
||||
<div key={pubkey} className="user-item">
|
||||
<Avatar avatarClassname="user-image" user={metadata} />
|
||||
@ -39,14 +39,16 @@ const UserItem = (metadata: MetadataCache) => {
|
||||
interface TextareaProps {
|
||||
emojis: EmojiTag[];
|
||||
value: string;
|
||||
onChange: (e: ChangeEvent<Element>) => void;
|
||||
onChange: (e: ChangeEvent<HTMLTextAreaElement>) => void;
|
||||
onKeyDown: (e: KeyboardEvent<Element>) => void;
|
||||
}
|
||||
|
||||
export function Textarea({ emojis, ...props }: TextareaProps) {
|
||||
const userDataProvider = async (token: string) => {
|
||||
// @ts-expect-error: Property 'search'
|
||||
return System.ProfileLoader.Cache.search(token);
|
||||
const cache = System.ProfileLoader.Cache;
|
||||
if (cache instanceof UserProfileCache) {
|
||||
return cache.search(token);
|
||||
}
|
||||
};
|
||||
|
||||
const emojiDataProvider = async (token: string) => {
|
||||
@ -76,7 +78,7 @@ export function Textarea({ emojis, ...props }: TextareaProps) {
|
||||
output: (item: { pubkey: string }) =>
|
||||
`@${hexToBech32(NostrPrefix.PublicKey, item.pubkey)}`,
|
||||
},
|
||||
};
|
||||
} as TriggerType<string | object>;
|
||||
|
||||
return (
|
||||
<ReactTextareaAutocomplete
|
||||
@ -84,7 +86,6 @@ export function Textarea({ emojis, ...props }: TextareaProps) {
|
||||
loadingComponent={() => <span>Loading...</span>}
|
||||
placeholder="Message"
|
||||
autoFocus={false}
|
||||
// @ts-expect-error
|
||||
trigger={trigger}
|
||||
{...props}
|
||||
/>
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { NostrLink, EventKind } from "@snort/system";
|
||||
import { useRef, useState, ChangeEvent } from "react";
|
||||
import React, { useRef, useState } from "react";
|
||||
|
||||
import { LIVE_STREAM_CHAT } from "../const";
|
||||
import { useLogin } from "../hooks/login";
|
||||
@ -17,7 +17,7 @@ export function WriteMessage({
|
||||
link: NostrLink;
|
||||
emojiPacks: EmojiPack[];
|
||||
}) {
|
||||
const ref = useRef(null);
|
||||
const ref = useRef<HTMLDivElement | null>(null);
|
||||
const emojiRef = useRef(null);
|
||||
const [chat, setChat] = useState("");
|
||||
const [showEmojiPicker, setShowEmojiPicker] = useState(false);
|
||||
@ -25,15 +25,13 @@ export function WriteMessage({
|
||||
const emojis = emojiPacks.map((pack) => pack.emojis).flat();
|
||||
const names = emojis.map((t) => t.at(1));
|
||||
|
||||
// @ts-expect-error
|
||||
const topOffset = ref.current?.getBoundingClientRect().top;
|
||||
// @ts-expect-error
|
||||
const leftOffset = ref.current?.getBoundingClientRect().left;
|
||||
|
||||
async function sendChatMessage() {
|
||||
const pub = login?.publisher();
|
||||
if (chat.length > 1) {
|
||||
let emojiNames = new Set();
|
||||
const emojiNames = new Set();
|
||||
|
||||
for (const name of names) {
|
||||
if (chat.includes(`:${name}:`)) {
|
||||
@ -80,12 +78,7 @@ export function WriteMessage({
|
||||
}
|
||||
}
|
||||
|
||||
async function onChange(e: ChangeEvent) {
|
||||
// @ts-expect-error
|
||||
setChat(e.target.value);
|
||||
}
|
||||
|
||||
function pickEmoji(ev: any) {
|
||||
function pickEmoji(ev: React.MouseEvent) {
|
||||
ev.stopPropagation();
|
||||
setShowEmojiPicker(!showEmojiPicker);
|
||||
}
|
||||
@ -97,15 +90,15 @@ export function WriteMessage({
|
||||
emojis={emojis}
|
||||
value={chat}
|
||||
onKeyDown={onKeyDown}
|
||||
onChange={onChange}
|
||||
onChange={e => setChat(e.target.value)}
|
||||
/>
|
||||
<div onClick={pickEmoji}>
|
||||
<Icon name="face" className="write-emoji-button" />
|
||||
</div>
|
||||
{showEmojiPicker && (
|
||||
<EmojiPicker
|
||||
topOffset={topOffset}
|
||||
leftOffset={leftOffset}
|
||||
topOffset={topOffset ?? 0}
|
||||
leftOffset={leftOffset ?? 0}
|
||||
emojiPacks={emojiPacks}
|
||||
onEmojiSelect={onEmojiSelect}
|
||||
onClickOutside={() => setShowEmojiPicker(false)}
|
||||
|
@ -2,14 +2,11 @@ import { useMemo } from "react";
|
||||
import {
|
||||
RequestBuilder,
|
||||
ReplaceableNoteStore,
|
||||
NostrEvent,
|
||||
EventKind,
|
||||
NostrLink,
|
||||
} from "@snort/system";
|
||||
import { useRequestBuilder } from "@snort/system-react";
|
||||
import { GOAL } from "const";
|
||||
import { System } from "index";
|
||||
import { findTag } from "utils";
|
||||
|
||||
export function useZapGoal(host: string, link: NostrLink, leaveOpen = false) {
|
||||
const sub = useMemo(() => {
|
||||
|
@ -18,7 +18,7 @@ export interface StreamProvider {
|
||||
/**
|
||||
* Create a config object to save in localStorage
|
||||
*/
|
||||
createConfig(): any & { type: StreamProviders }
|
||||
createConfig(): unknown & { type: StreamProviders }
|
||||
|
||||
/**
|
||||
* Update stream info event
|
||||
@ -59,7 +59,7 @@ export class ProviderStore extends ExternalStore<Array<StreamProvider>> {
|
||||
super();
|
||||
const cache = window.localStorage.getItem("providers");
|
||||
if (cache) {
|
||||
const cached: Array<{ type: StreamProviders } & any> = JSON.parse(cache);
|
||||
const cached: Array<{ type: StreamProviders } & Record<string, unknown>> = JSON.parse(cache);
|
||||
for (const c of cached) {
|
||||
switch (c.type) {
|
||||
case StreamProviders.Manual: {
|
||||
@ -67,11 +67,11 @@ export class ProviderStore extends ExternalStore<Array<StreamProvider>> {
|
||||
break;
|
||||
}
|
||||
case StreamProviders.NostrType: {
|
||||
this.#providers.push(new Nip103StreamProvider(c.url));
|
||||
this.#providers.push(new Nip103StreamProvider(c.url as string));
|
||||
break;
|
||||
}
|
||||
case StreamProviders.Owncast: {
|
||||
this.#providers.push(new OwncastProvider(c.url, c.token));
|
||||
this.#providers.push(new OwncastProvider(c.url as string, c.token as string));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ export class ManualProvider implements StreamProvider {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
topup(amount: number): Promise<string> {
|
||||
topup(): Promise<string> {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
}
|
@ -1,4 +1,3 @@
|
||||
import { NostrEvent } from "@snort/system";
|
||||
import { StreamState } from "index";
|
||||
import { StreamProvider, StreamProviderInfo, StreamProviders } from "providers";
|
||||
|
||||
@ -19,7 +18,7 @@ export class OwncastProvider implements StreamProvider {
|
||||
return StreamProviders.Owncast
|
||||
}
|
||||
|
||||
createConfig(): any & { type: StreamProviders; } {
|
||||
createConfig() {
|
||||
return {
|
||||
type: StreamProviders.Owncast,
|
||||
url: this.#url,
|
||||
@ -27,7 +26,7 @@ export class OwncastProvider implements StreamProvider {
|
||||
}
|
||||
}
|
||||
|
||||
updateStreamInfo(ev: NostrEvent): Promise<void> {
|
||||
updateStreamInfo(): Promise<void> {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
@ -44,7 +43,7 @@ export class OwncastProvider implements StreamProvider {
|
||||
} as StreamProviderInfo
|
||||
}
|
||||
|
||||
topup(amount: number): Promise<string> {
|
||||
topup(): Promise<string> {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ export class WISH extends TypedEventTarget {
|
||||
private connecting: boolean = false;
|
||||
private connectedPromise!: Promise<void>;
|
||||
private connectedResolver!: (any: void) => void;
|
||||
private connectedRejector!: (reason?: any) => void;
|
||||
private connectedRejector!: (reason?: unknown) => void;
|
||||
private gatherPromise!: Promise<void>;
|
||||
private gatherResolver!: (any: void) => void;
|
||||
|
||||
@ -282,7 +282,7 @@ export class WISH extends TypedEventTarget {
|
||||
relAddr: candidate.relatedAddress || undefined,
|
||||
relPort:
|
||||
typeof candidate.relatedPort !== "undefined" &&
|
||||
candidate.relatedPort !== null
|
||||
candidate.relatedPort !== null
|
||||
? candidate.relatedPort.toString()
|
||||
: undefined,
|
||||
});
|
||||
@ -323,7 +323,7 @@ export class WISH extends TypedEventTarget {
|
||||
case "checking":
|
||||
this.iceStartTime = performance.now();
|
||||
break;
|
||||
case "connected":
|
||||
case "connected": {
|
||||
const connected = performance.now();
|
||||
if (this.connectStartTime) {
|
||||
const delta = connected - this.connectStartTime;
|
||||
@ -352,6 +352,7 @@ export class WISH extends TypedEventTarget {
|
||||
this.connectedResolver();
|
||||
this.stopTrickleBatching();
|
||||
break;
|
||||
}
|
||||
case "failed":
|
||||
if (this.connecting) {
|
||||
this.connectedRejector("ICE failed while trying to connect");
|
||||
|
Reference in New Issue
Block a user