Browse Source

fix: 🐛

imwald
codytseng 1 year ago
parent
commit
1e3c74a28f
  1. 4
      src/renderer/src/components/AboutInfoDialog/index.tsx
  2. 2
      src/renderer/src/components/AccountButton/ProfileButton.tsx
  3. 1
      src/renderer/src/components/NoteCard/ShortTextNoteCard.tsx
  4. 14
      src/renderer/src/components/NoteStats/NoteOptions/index.tsx
  5. 13
      src/renderer/src/components/Sidebar/index.tsx
  6. 7
      src/renderer/src/components/ui/dialog.tsx
  7. 6
      src/renderer/src/layouts/PrimaryPageLayout/index.tsx
  8. 6
      src/renderer/src/layouts/SecondaryPageLayout/index.tsx
  9. 10
      src/renderer/src/pages/primary/NoteListPage/index.tsx

4
src/renderer/src/components/AboutInfoDialog/index.tsx

@ -15,7 +15,9 @@ export default function AboutInfoDialog({ children }: { children: React.ReactNod @@ -15,7 +15,9 @@ export default function AboutInfoDialog({ children }: { children: React.ReactNod
<DialogContent>
<DialogHeader>
<DialogTitle>Jumble</DialogTitle>
<DialogDescription>yet another nostr client</DialogDescription>
<DialogDescription>
A beautiful nostr client focused on browsing relay feeds
</DialogDescription>
</DialogHeader>
<div>
Made by{' '}

2
src/renderer/src/components/AccountButton/ProfileButton.tsx

@ -32,7 +32,7 @@ export default function ProfileButton({ @@ -32,7 +32,7 @@ export default function ProfileButton({
if (variant === 'titlebar') {
triggerComponent = (
<button>
<Avatar className="ml-2 w-7 h-7 hover:opacity-90">
<Avatar className="w-7 h-7 hover:opacity-90">
<AvatarImage src={avatar} />
<AvatarFallback>
<img src={defaultAvatar} />

1
src/renderer/src/components/NoteCard/ShortTextNoteCard.tsx

@ -35,6 +35,7 @@ export default function ShortTextNoteCard({ @@ -35,6 +35,7 @@ export default function ShortTextNoteCard({
<RepostDescription reposter={reposter} className="max-sm:hidden pl-4" />
<div
className={`hover:bg-muted/50 text-left cursor-pointer ${embedded ? 'p-2 sm:p-3 border rounded-lg' : 'px-4 py-3 sm:py-4 sm:border sm:rounded-lg max-sm:border-b'}`}
onClick={(e) => e.stopPropagation()}
>
<RepostDescription reposter={reposter} className="sm:hidden" />
<Note

14
src/renderer/src/components/NoteStats/NoteOptions/index.tsx

@ -8,8 +8,8 @@ import { getSharableEventId } from '@renderer/lib/event' @@ -8,8 +8,8 @@ import { getSharableEventId } from '@renderer/lib/event'
import { Code, Copy, Ellipsis } from 'lucide-react'
import { Event } from 'nostr-tools'
import { useState } from 'react'
import RawEventDialog from './RawEventDialog'
import { useTranslation } from 'react-i18next'
import RawEventDialog from './RawEventDialog'
export default function NoteOptions({ event }: { event: Event }) {
const { t } = useTranslation()
@ -26,20 +26,12 @@ export default function NoteOptions({ event }: { event: Event }) { @@ -26,20 +26,12 @@ export default function NoteOptions({ event }: { event: Event }) {
</DropdownMenuTrigger>
<DropdownMenuContent collisionPadding={8}>
<DropdownMenuItem
onClick={(e) => {
e.stopPropagation()
navigator.clipboard.writeText('nostr:' + getSharableEventId(event))
}}
onClick={() => navigator.clipboard.writeText('nostr:' + getSharableEventId(event))}
>
<Copy />
{t('copy embedded code')}
</DropdownMenuItem>
<DropdownMenuItem
onClick={(e) => {
e.stopPropagation()
setIsRawEventDialogOpen(true)
}}
>
<DropdownMenuItem onClick={() => setIsRawEventDialogOpen(true)}>
<Code />
{t('raw event')}
</DropdownMenuItem>

13
src/renderer/src/components/Sidebar/index.tsx

@ -1,8 +1,6 @@ @@ -1,8 +1,6 @@
import Logo from '@renderer/assets/Logo'
import { Button } from '@renderer/components/ui/button'
import { IS_ELECTRON } from '@renderer/lib/env'
import { toHome } from '@renderer/lib/link'
import { SecondaryPageLink } from '@renderer/PageManager'
import { Info } from 'lucide-react'
import { useTranslation } from 'react-i18next'
import AboutInfoDialog from '../AboutInfoDialog'
@ -16,18 +14,17 @@ import SearchButton from '../SearchButton' @@ -16,18 +14,17 @@ import SearchButton from '../SearchButton'
export default function PrimaryPageSidebar() {
const { t } = useTranslation()
return (
<div className="draggable w-52 h-full shrink-0 hidden xl:flex flex-col pb-8 pt-10 pl-4 justify-between">
<div className="w-52 h-full shrink-0 hidden xl:flex flex-col pb-8 pt-10 pl-4 justify-between relative">
<div className="draggable absolute top-0 left-0 h-11 w-full" />
<div className="space-y-2">
<div className="ml-4 mb-8 w-40">
<SecondaryPageLink to={toHome()}>
<Logo />
</SecondaryPageLink>
<div className="draggable ml-4 mb-8 w-40">
<Logo />
</div>
<PostButton variant="sidebar" />
<RelaySettingsButton variant="sidebar" />
<NotificationButton variant="sidebar" />
<SearchButton variant="sidebar" />
<RefreshButton variant="sidebar" />
{IS_ELECTRON && <RefreshButton variant="sidebar" />}
{!IS_ELECTRON && (
<AboutInfoDialog>
<Button variant="sidebar" size="sidebar">

7
src/renderer/src/components/ui/dialog.tsx

@ -22,7 +22,6 @@ const DialogOverlay = React.forwardRef< @@ -22,7 +22,6 @@ const DialogOverlay = React.forwardRef<
'fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
className
)}
onClick={(e) => e.stopPropagation()}
{...props}
/>
))
@ -40,15 +39,11 @@ const DialogContent = React.forwardRef< @@ -40,15 +39,11 @@ const DialogContent = React.forwardRef<
'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 sm:border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg',
className
)}
onClick={(e) => e.stopPropagation()}
{...props}
>
{children}
{!withoutClose && (
<DialogPrimitive.Close
className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground"
onClick={(e) => e.stopPropagation()}
>
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
<X className="h-4 w-4" />
<span className="sr-only">Close</span>
</DialogPrimitive.Close>

6
src/renderer/src/layouts/PrimaryPageLayout/index.tsx

@ -9,7 +9,7 @@ import SearchButton from '@renderer/components/SearchButton' @@ -9,7 +9,7 @@ import SearchButton from '@renderer/components/SearchButton'
import ThemeToggle from '@renderer/components/ThemeToggle'
import { Titlebar } from '@renderer/components/Titlebar'
import { ScrollArea } from '@renderer/components/ui/scroll-area'
import { isMacOS } from '@renderer/lib/env'
import { IS_ELECTRON, isMacOS } from '@renderer/lib/env'
import { cn } from '@renderer/lib/utils'
import { useScreenSize } from '@renderer/providers/ScreenSizeProvider'
import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react'
@ -60,7 +60,7 @@ const PrimaryPageLayout = forwardRef(({ children }: { children?: React.ReactNode @@ -60,7 +60,7 @@ const PrimaryPageLayout = forwardRef(({ children }: { children?: React.ReactNode
<ScrollArea
ref={scrollAreaRef}
className="h-full w-full"
scrollBarClassName="pt-9 max-sm:pt-0 xl:pt-0"
scrollBarClassName={`pt-9 xl:pt-0 ${isMacOS() ? 'max-sm:pt-20' : 'max-sm:pt-11'}`}
>
<PrimaryPageTitlebar visible={visible} />
<div className={cn('sm:px-4 pb-4 pt-11 xl:pt-4', isMacOS() ? 'max-sm:pt-20' : '')}>
@ -111,7 +111,7 @@ function PrimaryPageTitlebar({ visible = true }: { visible?: boolean }) { @@ -111,7 +111,7 @@ function PrimaryPageTitlebar({ visible = true }: { visible?: boolean }) {
<SearchButton />
</div>
<div className="flex gap-2 items-center">
<RefreshButton />
{IS_ELECTRON && <RefreshButton />}
<RelaySettingsButton />
<NotificationButton />
</div>

6
src/renderer/src/layouts/SecondaryPageLayout/index.tsx

@ -51,7 +51,11 @@ export default function SecondaryPageLayout({ @@ -51,7 +51,11 @@ export default function SecondaryPageLayout({
}, [lastScrollTop])
return (
<ScrollArea ref={scrollAreaRef} className="h-full" scrollBarClassName="pt-9">
<ScrollArea
ref={scrollAreaRef}
className="h-full"
scrollBarClassName={`sm:pt-9 ${isMacOS() ? 'pt-20' : 'pt-11'}`}
>
<SecondaryPageTitlebar
content={titlebarContent}
hideBackButton={hideBackButton}

10
src/renderer/src/pages/primary/NoteListPage/index.tsx

@ -5,10 +5,18 @@ import { Popover, PopoverContent, PopoverTrigger } from '@renderer/components/ui @@ -5,10 +5,18 @@ import { Popover, PopoverContent, PopoverTrigger } from '@renderer/components/ui
import { ScrollArea } from '@renderer/components/ui/scroll-area'
import PrimaryPageLayout from '@renderer/layouts/PrimaryPageLayout'
import { useRelaySettings } from '@renderer/providers/RelaySettingsProvider'
import { useEffect, useRef } from 'react'
export default function NoteListPage() {
const layoutRef = useRef<{ scrollToTop: () => void }>(null)
const { relayUrls } = useRelaySettings()
useEffect(() => {
if (layoutRef.current) {
layoutRef.current.scrollToTop()
}
}, [JSON.stringify(relayUrls)])
if (!relayUrls.length) {
return (
<PrimaryPageLayout>
@ -33,7 +41,7 @@ export default function NoteListPage() { @@ -33,7 +41,7 @@ export default function NoteListPage() {
}
return (
<PrimaryPageLayout>
<PrimaryPageLayout ref={layoutRef}>
<NoteList relayUrls={relayUrls} />
</PrimaryPageLayout>
)

Loading…
Cancel
Save