mirror of
https://github.com/lumehq/lume.git
synced 2025-09-27 20:46:22 +02:00
fixed build error
This commit is contained in:
@@ -13,7 +13,7 @@ export const CreateChannelModal = () => {
|
|||||||
const [pool, relays]: any = useContext(RelayContext);
|
const [pool, relays]: any = useContext(RelayContext);
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
|
|
||||||
const [activeAccount]: any = useLocalStorage('activeAccount');
|
const [activeAccount]: any = useLocalStorage('activeAccount', {});
|
||||||
|
|
||||||
const {
|
const {
|
||||||
register,
|
register,
|
||||||
|
@@ -12,8 +12,8 @@ export default function ChatList() {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const [list, setList] = useState([]);
|
const [list, setList] = useState([]);
|
||||||
const [activeAccount]: any = useLocalStorage('activeAccount');
|
const [activeAccount]: any = useLocalStorage('activeAccount', {});
|
||||||
const accountProfile = JSON.parse(activeAccount.metadata);
|
const profile = activeAccount.metadata ? JSON.parse(activeAccount.metadata) : null;
|
||||||
|
|
||||||
const openSelfChat = () => {
|
const openSelfChat = () => {
|
||||||
router.push({
|
router.push({
|
||||||
@@ -41,7 +41,7 @@ export default function ChatList() {
|
|||||||
>
|
>
|
||||||
<div className="relative h-5 w-5 shrink overflow-hidden rounded bg-white">
|
<div className="relative h-5 w-5 shrink overflow-hidden rounded bg-white">
|
||||||
<ImageWithFallback
|
<ImageWithFallback
|
||||||
src={accountProfile.picture || DEFAULT_AVATAR}
|
src={profile?.picture || DEFAULT_AVATAR}
|
||||||
alt={activeAccount.pubkey}
|
alt={activeAccount.pubkey}
|
||||||
fill={true}
|
fill={true}
|
||||||
className="rounded object-cover"
|
className="rounded object-cover"
|
||||||
@@ -49,7 +49,7 @@ export default function ChatList() {
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<h5 className="text-sm font-medium text-zinc-400">
|
<h5 className="text-sm font-medium text-zinc-400">
|
||||||
{accountProfile.display_name || accountProfile.name} <span className="text-zinc-500">(you)</span>
|
{profile?.display_name || profile?.name} <span className="text-zinc-500">(you)</span>
|
||||||
</h5>
|
</h5>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -7,7 +7,7 @@ import { useCallback, useEffect, useState } from 'react';
|
|||||||
|
|
||||||
export const ChatModal = () => {
|
export const ChatModal = () => {
|
||||||
const [plebs, setPlebs] = useState([]);
|
const [plebs, setPlebs] = useState([]);
|
||||||
const [activeAccount]: any = useLocalStorage('activeAccount');
|
const [activeAccount]: any = useLocalStorage('activeAccount', {});
|
||||||
|
|
||||||
const fetchPlebsByAccount = useCallback(async (id) => {
|
const fetchPlebsByAccount = useCallback(async (id) => {
|
||||||
const { getPlebs } = await import('@utils/bindings');
|
const { getPlebs } = await import('@utils/bindings');
|
||||||
|
@@ -5,7 +5,7 @@ import { useCallback, useRef } from 'react';
|
|||||||
import { Virtuoso } from 'react-virtuoso';
|
import { Virtuoso } from 'react-virtuoso';
|
||||||
|
|
||||||
export const MessageList = ({ data }: { data: any }) => {
|
export const MessageList = ({ data }: { data: any }) => {
|
||||||
const [activeAccount]: any = useLocalStorage('activeAccount');
|
const [activeAccount]: any = useLocalStorage('activeAccount', {});
|
||||||
const virtuosoRef = useRef(null);
|
const virtuosoRef = useRef(null);
|
||||||
|
|
||||||
const itemContent: any = useCallback(
|
const itemContent: any = useCallback(
|
||||||
|
@@ -17,8 +17,8 @@ export default function EventCollector() {
|
|||||||
const [isOnline] = useState(true);
|
const [isOnline] = useState(true);
|
||||||
const setHasNewerNote = useSetAtom(hasNewerNoteAtom);
|
const setHasNewerNote = useSetAtom(hasNewerNoteAtom);
|
||||||
|
|
||||||
const [activeAccount]: any = useLocalStorage('activeAccount');
|
const [activeAccount]: any = useLocalStorage('activeAccount', {});
|
||||||
const [follows] = useLocalStorage('activeAccountFollows');
|
const [follows] = useLocalStorage('activeAccountFollows', []);
|
||||||
|
|
||||||
const now = useRef(new Date());
|
const now = useRef(new Date());
|
||||||
const unsubscribe = useRef(null);
|
const unsubscribe = useRef(null);
|
||||||
|
@@ -18,7 +18,7 @@ export default function FormBase() {
|
|||||||
const [value, setValue] = useAtom(noteContentAtom);
|
const [value, setValue] = useAtom(noteContentAtom);
|
||||||
const resetValue = useResetAtom(noteContentAtom);
|
const resetValue = useResetAtom(noteContentAtom);
|
||||||
|
|
||||||
const [activeAccount]: any = useLocalStorage('activeAccount');
|
const [activeAccount]: any = useLocalStorage('activeAccount', {});
|
||||||
|
|
||||||
const submitEvent = () => {
|
const submitEvent = () => {
|
||||||
const event: any = {
|
const event: any = {
|
||||||
|
@@ -11,7 +11,7 @@ export default function FormChannelMessage({ eventId }: { eventId: string | stri
|
|||||||
const [pool, relays]: any = useContext(RelayContext);
|
const [pool, relays]: any = useContext(RelayContext);
|
||||||
|
|
||||||
const [value, setValue] = useState('');
|
const [value, setValue] = useState('');
|
||||||
const [activeAccount]: any = useLocalStorage('activeAccount');
|
const [activeAccount]: any = useLocalStorage('activeAccount', {});
|
||||||
|
|
||||||
const submitEvent = useCallback(() => {
|
const submitEvent = useCallback(() => {
|
||||||
const event: any = {
|
const event: any = {
|
||||||
|
@@ -9,8 +9,9 @@ import { useCallback, useContext, useState } from 'react';
|
|||||||
|
|
||||||
export default function FormChat({ receiverPubkey }: { receiverPubkey: string }) {
|
export default function FormChat({ receiverPubkey }: { receiverPubkey: string }) {
|
||||||
const [pool, relays]: any = useContext(RelayContext);
|
const [pool, relays]: any = useContext(RelayContext);
|
||||||
|
|
||||||
const [value, setValue] = useState('');
|
const [value, setValue] = useState('');
|
||||||
const [activeAccount]: any = useLocalStorage('activeAccount');
|
const [activeAccount]: any = useLocalStorage('activeAccount', {});
|
||||||
|
|
||||||
const encryptMessage = useCallback(
|
const encryptMessage = useCallback(
|
||||||
async (privkey: string) => {
|
async (privkey: string) => {
|
||||||
|
@@ -10,7 +10,7 @@ import { useContext, useState } from 'react';
|
|||||||
export default function FormComment({ eventID }: { eventID: any }) {
|
export default function FormComment({ eventID }: { eventID: any }) {
|
||||||
const [pool, relays]: any = useContext(RelayContext);
|
const [pool, relays]: any = useContext(RelayContext);
|
||||||
|
|
||||||
const [activeAccount]: any = useLocalStorage('activeAccount');
|
const [activeAccount]: any = useLocalStorage('activeAccount', {});
|
||||||
const [value, setValue] = useState('');
|
const [value, setValue] = useState('');
|
||||||
|
|
||||||
const profile = JSON.parse(activeAccount.metadata);
|
const profile = JSON.parse(activeAccount.metadata);
|
||||||
|
@@ -12,15 +12,18 @@ import { useCallback, useEffect, useState } from 'react';
|
|||||||
|
|
||||||
export default function MultiAccounts() {
|
export default function MultiAccounts() {
|
||||||
const [users, setUsers] = useState([]);
|
const [users, setUsers] = useState([]);
|
||||||
const [activeAccount]: any = useLocalStorage('activeAccount');
|
const [activeAccount]: any = useLocalStorage('activeAccount', {});
|
||||||
|
|
||||||
const renderAccount = useCallback((user: { pubkey: string }) => {
|
const renderAccount = useCallback(
|
||||||
|
(user: { pubkey: string }) => {
|
||||||
if (user.pubkey === activeAccount.pubkey) {
|
if (user.pubkey === activeAccount.pubkey) {
|
||||||
return <ActiveAccount key={user.pubkey} user={user} />;
|
return <ActiveAccount key={user.pubkey} user={user} />;
|
||||||
} else {
|
} else {
|
||||||
return <InactiveAccount key={user.pubkey} user={user} />;
|
return <InactiveAccount key={user.pubkey} user={user} />;
|
||||||
}
|
}
|
||||||
}, []);
|
},
|
||||||
|
[activeAccount.pubkey]
|
||||||
|
);
|
||||||
|
|
||||||
const fetchAccounts = useCallback(async () => {
|
const fetchAccounts = useCallback(async () => {
|
||||||
const { getAccounts } = await import('@utils/bindings');
|
const { getAccounts } = await import('@utils/bindings');
|
||||||
|
@@ -32,8 +32,8 @@ export const NoteComment = memo(function NoteComment({
|
|||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
const [value, setValue] = useState('');
|
const [value, setValue] = useState('');
|
||||||
|
|
||||||
const [activeAccount]: any = useLocalStorage('activeAccount');
|
const [activeAccount]: any = useLocalStorage('activeAccount', {});
|
||||||
const profile = JSON.parse(activeAccount.metadata);
|
const profile = activeAccount.metadata ? JSON.parse(activeAccount.metadata) : null;
|
||||||
|
|
||||||
const openThread = () => {
|
const openThread = () => {
|
||||||
router.push(`/newsfeed/${eventID}`);
|
router.push(`/newsfeed/${eventID}`);
|
||||||
@@ -87,7 +87,7 @@ export const NoteComment = memo(function NoteComment({
|
|||||||
<div>
|
<div>
|
||||||
<div className="relative h-11 w-11 shrink-0 overflow-hidden rounded-md border border-white/10">
|
<div className="relative h-11 w-11 shrink-0 overflow-hidden rounded-md border border-white/10">
|
||||||
<ImageWithFallback
|
<ImageWithFallback
|
||||||
src={profile.picture}
|
src={profile?.picture}
|
||||||
alt="user's avatar"
|
alt="user's avatar"
|
||||||
fill={true}
|
fill={true}
|
||||||
className="rounded-md object-cover"
|
className="rounded-md object-cover"
|
||||||
|
@@ -20,7 +20,7 @@ export const NoteReaction = memo(function NoteReaction({
|
|||||||
}) {
|
}) {
|
||||||
const [pool, relays]: any = useContext(RelayContext);
|
const [pool, relays]: any = useContext(RelayContext);
|
||||||
|
|
||||||
const [activeAccount]: any = useLocalStorage('activeAccount');
|
const [activeAccount]: any = useLocalStorage('activeAccount', {});
|
||||||
const [isReact, setIsReact] = useState(false);
|
const [isReact, setIsReact] = useState(false);
|
||||||
const [like, setLike] = useState(0);
|
const [like, setLike] = useState(0);
|
||||||
|
|
||||||
|
@@ -16,7 +16,7 @@ import reactStringReplace from 'react-string-replace';
|
|||||||
export const NoteParent = memo(function NoteParent({ id }: { id: string }) {
|
export const NoteParent = memo(function NoteParent({ id }: { id: string }) {
|
||||||
const [pool, relays]: any = useContext(RelayContext);
|
const [pool, relays]: any = useContext(RelayContext);
|
||||||
|
|
||||||
const [activeAccount]: any = useLocalStorage('activeAccount');
|
const [activeAccount]: any = useLocalStorage('activeAccount', {});
|
||||||
const [event, setEvent] = useState(null);
|
const [event, setEvent] = useState(null);
|
||||||
|
|
||||||
const unsubscribe = useRef(null);
|
const unsubscribe = useRef(null);
|
||||||
|
@@ -12,7 +12,7 @@ import reactStringReplace from 'react-string-replace';
|
|||||||
export const NoteRepost = memo(function NoteRepost({ id }: { id: string }) {
|
export const NoteRepost = memo(function NoteRepost({ id }: { id: string }) {
|
||||||
const [pool, relays]: any = useContext(RelayContext);
|
const [pool, relays]: any = useContext(RelayContext);
|
||||||
|
|
||||||
const [activeAccount]: any = useLocalStorage('activeAccount');
|
const [activeAccount]: any = useLocalStorage('activeAccount', {});
|
||||||
const [event, setEvent] = useState(null);
|
const [event, setEvent] = useState(null);
|
||||||
|
|
||||||
const unsubscribe = useRef(null);
|
const unsubscribe = useRef(null);
|
||||||
|
@@ -1,51 +0,0 @@
|
|||||||
import ActiveLink from '@components/activeLink';
|
|
||||||
import AccountColumn from '@components/columns/account';
|
|
||||||
|
|
||||||
import { useLocalStorage } from '@rehooks/local-storage';
|
|
||||||
|
|
||||||
export default function UserLayout({ children }: { children: React.ReactNode }) {
|
|
||||||
const [currentUser]: any = useLocalStorage('current-user');
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="flex h-full w-full flex-row">
|
|
||||||
<div className="relative h-full w-[70px] shrink-0 border-r border-zinc-900">
|
|
||||||
<div data-tauri-drag-region className="absolute top-0 left-0 h-12 w-full" />
|
|
||||||
<AccountColumn />
|
|
||||||
</div>
|
|
||||||
<div className="grid grow grid-cols-4">
|
|
||||||
<div className="col-span-1">
|
|
||||||
<div className="flex h-full flex-col flex-wrap justify-between overflow-hidden px-2 pt-3 pb-4">
|
|
||||||
{/* main */}
|
|
||||||
<div className="flex flex-col gap-4">
|
|
||||||
{/* menu */}
|
|
||||||
<div className="flex flex-col gap-2">
|
|
||||||
<div className="flex items-center justify-between px-2">
|
|
||||||
<h3 className="text-sm font-bold text-zinc-400">Menu</h3>
|
|
||||||
</div>
|
|
||||||
<div className="flex flex-col gap-1 text-zinc-500">
|
|
||||||
<ActiveLink
|
|
||||||
href={`/profile/${currentUser.id}`}
|
|
||||||
activeClassName="ring-1 ring-white/10 dark:bg-zinc-900 dark:text-white"
|
|
||||||
className="flex h-10 items-center gap-1 rounded-lg px-2.5 text-sm font-medium hover:bg-zinc-900"
|
|
||||||
>
|
|
||||||
<span>Personal Page</span>
|
|
||||||
</ActiveLink>
|
|
||||||
<ActiveLink
|
|
||||||
href={`/profile/update?pubkey=${currentUser.id}`}
|
|
||||||
activeClassName="ring-1 ring-white/10 dark:bg-zinc-900 dark:text-white"
|
|
||||||
className="flex h-10 items-center gap-1 rounded-lg px-2.5 text-sm font-medium hover:bg-zinc-900"
|
|
||||||
>
|
|
||||||
<span>Update Profile</span>
|
|
||||||
</ActiveLink>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="col-span-3 m-3 ml-0 overflow-hidden rounded-lg border border-zinc-800 bg-zinc-900 shadow-input shadow-black/20">
|
|
||||||
<div className="h-full w-full rounded-lg">{children}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
@@ -23,7 +23,7 @@ export default function Page() {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const pubkey: any = router.query.pubkey || null;
|
const pubkey: any = router.query.pubkey || null;
|
||||||
|
|
||||||
const [activeAccount]: any = useLocalStorage('activeAccount');
|
const [activeAccount]: any = useLocalStorage('activeAccount', {});
|
||||||
const [messages, setMessages] = useState([]);
|
const [messages, setMessages] = useState([]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@@ -31,9 +31,9 @@ export default function Page() {
|
|||||||
|
|
||||||
const [eose, setEose] = useState(false);
|
const [eose, setEose] = useState(false);
|
||||||
|
|
||||||
const [lastLogin] = useLocalStorage('lastLogin');
|
const [lastLogin] = useLocalStorage('lastLogin', '');
|
||||||
const [activeAccount]: any = useLocalStorage('activeAccount');
|
const [activeAccount]: any = useLocalStorage('activeAccount', {});
|
||||||
const [follows] = useLocalStorage('activeAccountFollows');
|
const [follows] = useLocalStorage('activeAccountFollows', []);
|
||||||
|
|
||||||
const fetchData = useCallback(
|
const fetchData = useCallback(
|
||||||
async (since: Date) => {
|
async (since: Date) => {
|
||||||
|
@@ -1,53 +1,10 @@
|
|||||||
import BaseLayout from '@layouts/base';
|
import BaseLayout from '@layouts/base';
|
||||||
import WithSidebarLayout from '@layouts/withSidebar';
|
import WithSidebarLayout from '@layouts/withSidebar';
|
||||||
|
|
||||||
import FormComment from '@components/form/comment';
|
import { JSXElementConstructor, ReactElement, ReactFragment, ReactPortal } from 'react';
|
||||||
import { NoteComment } from '@components/note/comment';
|
|
||||||
import { NoteExtend } from '@components/note/extend';
|
|
||||||
import { RelayContext } from '@components/relaysProvider';
|
|
||||||
|
|
||||||
import { useRouter } from 'next/router';
|
|
||||||
import {
|
|
||||||
JSXElementConstructor,
|
|
||||||
ReactElement,
|
|
||||||
ReactFragment,
|
|
||||||
ReactPortal,
|
|
||||||
useContext,
|
|
||||||
useEffect,
|
|
||||||
useState,
|
|
||||||
} from 'react';
|
|
||||||
|
|
||||||
export default function Page() {
|
export default function Page() {
|
||||||
const [pool, relays]: any = useContext(RelayContext);
|
return <div className="scrollbar-hide flex h-full flex-col gap-2 overflow-y-auto py-3"></div>;
|
||||||
|
|
||||||
const router = useRouter();
|
|
||||||
const id = router.query.id || null;
|
|
||||||
|
|
||||||
const [rootEvent, setRootEvent] = useState(null);
|
|
||||||
const [comments, setComments] = useState([]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
/*getNoteByID(id)
|
|
||||||
.then((res) => {
|
|
||||||
setRootEvent(res);
|
|
||||||
getAllCommentNotes(id).then((res: any) => setComments(res));
|
|
||||||
})
|
|
||||||
.catch(console.error);*/
|
|
||||||
}, [id, pool, relays]);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="scrollbar-hide flex h-full flex-col gap-2 overflow-y-auto py-3">
|
|
||||||
<div className="flex h-min min-h-min w-full select-text flex-col px-3">
|
|
||||||
{rootEvent && <NoteExtend event={rootEvent} />}
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<FormComment eventID={id} />
|
|
||||||
</div>
|
|
||||||
<div className="flex flex-col">
|
|
||||||
{comments.length > 0 && comments.map((comment) => <NoteComment key={comment.id} event={comment} />)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Page.getLayout = function getLayout(
|
Page.getLayout = function getLayout(
|
||||||
|
Reference in New Issue
Block a user