fix some bugs

This commit is contained in:
Ren Amamiya
2023-09-08 15:29:41 +07:00
parent 10036500cb
commit 177e4c1ff7
14 changed files with 142 additions and 119 deletions

View File

@@ -11,10 +11,15 @@ import { ComposerModal } from '@shared/composer';
import { Frame } from '@shared/frame';
import { BellIcon, NavArrowDownIcon, SpaceIcon } from '@shared/icons';
import { useActivities } from '@stores/activities';
import { useSidebar } from '@stores/sidebar';
import { compactNumber } from '@utils/number';
export function Navigation() {
const { db } = useStorage();
const [totalNewActivities] = useActivities((state) => [state.totalNewActivities]);
const [chats, toggleChats] = useSidebar((state) => [state.chats, state.toggleChats]);
return (
@@ -47,17 +52,26 @@ export function Navigation() {
preventScrollReset={true}
className={({ isActive }) =>
twMerge(
'flex h-10 items-center gap-2.5 rounded-r-lg border-l-2 pl-4 pr-2',
'flex h-10 items-center justify-between rounded-r-lg border-l-2 pl-4 pr-2',
isActive
? 'border-fuchsia-500 bg-white/5 text-white'
: 'border-transparent text-white/80'
)
}
>
<span className="inline-flex h-7 w-7 shrink-0 items-center justify-center rounded bg-white/10 backdrop-blur-xl">
<BellIcon className="h-4 w-4 text-white" />
</span>
Notifications
<div className="flex items-center gap-2.5">
<span className="inline-flex h-7 w-7 shrink-0 items-center justify-center rounded bg-white/10 backdrop-blur-xl">
<BellIcon className="h-4 w-4 text-white" />
</span>
Notifications
</div>
{totalNewActivities > 0 ? (
<div className="inline-flex h-5 w-8 items-center justify-center rounded bg-fuchsia-500">
<span className="text-xs font-medium text-white">
{compactNumber.format(totalNewActivities)}
</span>
</div>
) : null}
</NavLink>
</div>
<Collapsible.Root open={chats} onOpenChange={toggleChats}>

View File

@@ -19,7 +19,7 @@ import { useEvent } from '@utils/hooks/useEvent';
export function Repost({ event }: { event: NDKEvent }) {
// @ts-expect-error, root_id isn't exist on NDKEvent
const { status, data } = useEvent(event.root_id, event.content);
const { status, data } = useEvent(event.root_id ?? event.id, event.content);
const renderKind = useCallback(
(repostEvent: NDKEvent) => {

View File

@@ -42,7 +42,7 @@ export function TextNote({ content }: { content: string }) {
const cleanURL = new URL(href);
cleanURL.search = '';
return (
<Link to={href} target="_blank">
<Link to={href} target="_blank" className="line-clamp-1">
{cleanURL.hostname + cleanURL.pathname}
</Link>
);

View File

@@ -17,9 +17,9 @@ import {
import { NoteSkeleton } from '@shared/notes/skeleton';
import { TitleBar } from '@shared/titleBar';
import { DBEvent } from '@utils/types';
import { DBEvent, Widget } from '@utils/types';
export function LocalFollowsWidget() {
export function LocalFollowsWidget({ params }: { params: Widget }) {
const { db } = useStorage();
const { status, data, hasNextPage, isFetchingNextPage, fetchNextPage } =
useInfiniteQuery({
@@ -116,7 +116,7 @@ export function LocalFollowsWidget() {
return (
<div className="relative shrink-0 grow-0 basis-[400px] bg-white/10 backdrop-blur-xl">
<TitleBar title="👋 Network" />
<TitleBar id={params.id} title="Follows" />
<div ref={parentRef} className="scrollbar-hide h-full overflow-y-auto pb-20">
{status === 'loading' ? (
<div className="px-3 py-1.5">